From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 00:34:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F09B1065672; Sun, 8 Jan 2012 00:34:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DBF28FC0A; Sun, 8 Jan 2012 00:34:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q080YePk063047; Sun, 8 Jan 2012 00:34:40 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q080YeQn063045; Sun, 8 Jan 2012 00:34:40 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201201080034.q080YeQn063045@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 8 Jan 2012 00:34: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: r229798 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 00:34:40 -0000 Author: gonzo Date: Sun Jan 8 00:34:39 2012 New Revision: 229798 URL: http://svn.freebsd.org/changeset/base/229798 Log: Fix DDB x/i addr[,count] command for count > 1 case Modified: head/sys/mips/mips/db_disasm.c Modified: head/sys/mips/mips/db_disasm.c ============================================================================== --- head/sys/mips/mips/db_disasm.c Sun Jan 8 00:14:45 2012 (r229797) +++ head/sys/mips/mips/db_disasm.c Sun Jan 8 00:34:39 2012 (r229798) @@ -388,5 +388,6 @@ md_printins(int ins, int mdbdot) reg_name[i.IType.rt], reg_name[i.IType.rs], (short)i.IType.imm); } + db_printf("\n"); return (delay); } From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 00:55:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC4C7106566B; Sun, 8 Jan 2012 00:55:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB30D8FC08; Sun, 8 Jan 2012 00:55:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q080tM3p063810; Sun, 8 Jan 2012 00:55:22 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q080tMlJ063808; Sun, 8 Jan 2012 00:55:22 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201080055.q080tMlJ063808@svn.freebsd.org> From: Adrian Chadd Date: Sun, 8 Jan 2012 00:55: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: r229800 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 00:55:23 -0000 Author: adrian Date: Sun Jan 8 00:55:22 2012 New Revision: 229800 URL: http://svn.freebsd.org/changeset/base/229800 Log: Make these two files conditionally build on UFS_ACL, as it doesn't seem to be used elsewhere. Since UFS_ACL is enabled by default for GENERIC kernels, this shouldn't break anything - but please beat me to fix things if it does. This reduces the footprint of the kernel on small embedded systems (think <1MB flash for the compressed kernel image) just enough to actually fit. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Jan 8 00:42:07 2012 (r229799) +++ head/sys/conf/files Sun Jan 8 00:55:22 2012 (r229800) @@ -2409,8 +2409,9 @@ kern/sched_ule.c optional sched_ule kern/serdev_if.m standard kern/stack_protector.c standard \ compile-with "${NORMAL_C:N-fstack-protector*}" -kern/subr_acl_nfs4.c standard -kern/subr_acl_posix1e.c standard +# XXX subr_acl_nfs4.c is also used by ZFS +kern/subr_acl_nfs4.c optional ufs_acl +kern/subr_acl_posix1e.c optional ufs_acl kern/subr_autoconf.c standard kern/subr_blist.c standard kern/subr_bus.c standard From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 01:54:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BC1E106566B; Sun, 8 Jan 2012 01:54:47 +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 E41FB8FC08; Sun, 8 Jan 2012 01:54:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q081sk2c065630; Sun, 8 Jan 2012 01:54:46 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q081sk8V065624; Sun, 8 Jan 2012 01:54:46 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201080154.q081sk8V065624@svn.freebsd.org> From: Rick Macklem Date: Sun, 8 Jan 2012 01:54: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: r229802 - in head/sys/fs: nfs nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 01:54:47 -0000 Author: rmacklem Date: Sun Jan 8 01:54:46 2012 New Revision: 229802 URL: http://svn.freebsd.org/changeset/base/229802 Log: opt_inet6.h was missing from some files in the new NFS subsystem. The effect of this was, for clients mounted via inet6 addresses, that the DRC cache would never have a hit in the server. It also broke NFSv4 callbacks when an inet6 address was the only one available in the client. This patch fixes the above, plus deletes opt_inet6.h from a couple of files it is not needed for. MFC after: 2 weeks Modified: head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfsclient/nfs_clkrpc.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Sun Jan 8 01:09:00 2012 (r229801) +++ head/sys/fs/nfs/nfs_commonkrpc.c Sun Jan 8 01:54:46 2012 (r229802) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); * Socket operations for use by nfs */ -#include "opt_inet6.h" #include "opt_kdtrace.h" #include "opt_kgssapi.h" #include "opt_nfs.h" Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Sun Jan 8 01:09:00 2012 (r229801) +++ head/sys/fs/nfs/nfs_commonsubs.c Sun Jan 8 01:54:46 2012 (r229802) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); * copy data between mbuf chains and uio lists. */ #ifndef APPLEKEXT +#include "opt_inet6.h" + #include /* Modified: head/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clkrpc.c Sun Jan 8 01:09:00 2012 (r229801) +++ head/sys/fs/nfsclient/nfs_clkrpc.c Sun Jan 8 01:54:46 2012 (r229802) @@ -34,7 +34,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_inet6.h" #include "opt_kgssapi.h" #include Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Sun Jan 8 01:09:00 2012 (r229801) +++ head/sys/fs/nfsclient/nfs_clport.c Sun Jan 8 01:54:46 2012 (r229802) @@ -34,6 +34,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet6.h" #include "opt_kdtrace.h" #include Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Sun Jan 8 01:09:00 2012 (r229801) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sun Jan 8 01:54:46 2012 (r229802) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); */ #ifndef APPLEKEXT +#include "opt_inet6.h" + #include /* From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 05:44:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22F95106566B; Sun, 8 Jan 2012 05:44:20 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11F538FC0A; Sun, 8 Jan 2012 05:44:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q085iJBU072874; Sun, 8 Jan 2012 05:44:19 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q085iJUZ072872; Sun, 8 Jan 2012 05:44:19 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201201080544.q085iJUZ072872@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 8 Jan 2012 05:44: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: r229803 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 05:44:20 -0000 Author: gonzo Date: Sun Jan 8 05:44:19 2012 New Revision: 229803 URL: http://svn.freebsd.org/changeset/base/229803 Log: Fix relocations for MIPS64: - Use Elf32_Addr as default, the only field that is 64 bitw wide is R_MIPS_64 - Add R_MIPS_HIGHER and R_MIPS_HGHEST handlers - Handle R_MIPS_HI16 and R_MIPS_LO16 for both .rel and .rela sections Modified: head/sys/mips/mips/elf_machdep.c Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Sun Jan 8 01:54:46 2012 (r229802) +++ head/sys/mips/mips/elf_machdep.c Sun Jan 8 05:44:19 2012 (r229803) @@ -168,25 +168,41 @@ static int elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, int type, int local, elf_lookup_fn lookup) { - Elf_Addr *where = (Elf_Addr *)NULL; + Elf32_Addr *where = (Elf32_Addr *)NULL; Elf_Addr addr; Elf_Addr addend = (Elf_Addr)0; Elf_Word rtype = (Elf_Word)0, symidx; - const Elf_Rel *rel; + const Elf_Rel *rel = NULL; + const Elf_Rela *rela = NULL; /* * Stash R_MIPS_HI16 info so we can use it when processing R_MIPS_LO16 */ static Elf_Addr ahl; - static Elf_Addr *where_hi16; + static Elf32_Addr *where_hi16; switch (type) { case ELF_RELOC_REL: rel = (const Elf_Rel *)data; - where = (Elf_Addr *) (relocbase + rel->r_offset); - addend = *where; + where = (Elf32_Addr *) (relocbase + rel->r_offset); rtype = ELF_R_TYPE(rel->r_info); symidx = ELF_R_SYM(rel->r_info); + switch (rtype) { + case R_MIPS_64: + addend = *(Elf64_Addr *)where; + break; + default: + addend = *where; + break; + } + + break; + case ELF_RELOC_RELA: + rela = (const Elf_Rela *)data; + where = (Elf32_Addr *) (relocbase + rela->r_offset); + addend = rela->r_addend; + rtype = ELF_R_TYPE(rela->r_info); + symidx = ELF_R_SYM(rela->r_info); break; default: panic("unknown reloc type %d\n", type); @@ -202,7 +218,7 @@ elf_reloc_internal(linker_file_t lf, Elf return (-1); addr += addend; if (*where != addr) - *where = addr; + *where = (Elf32_Addr)addr; break; case R_MIPS_26: /* ((A << 2) | (P & 0xf0000000) + S) >> 2 */ @@ -220,25 +236,73 @@ elf_reloc_internal(linker_file_t lf, Elf *where |= addr & 0x03ffffff; break; + case R_MIPS_64: /* S + A */ + addr = lookup(lf, symidx, 1); + if (addr == 0) + return (-1); + addr += addend; + if (*(Elf64_Addr*)where != addr) + *(Elf64_Addr*)where = addr; + break; + case R_MIPS_HI16: /* ((AHL + S) - ((short)(AHL + S)) >> 16 */ - ahl = addend << 16; - where_hi16 = where; + if (rela != NULL) { + addr = lookup(lf, symidx, 1); + if (addr == 0) + return (-1); + addr += addend; + *where &= 0xffff0000; + *where |= ((((long long) addr + 0x8000LL) >> 16) & 0xffff); + } + else { + ahl = addend << 16; + where_hi16 = where; + } break; case R_MIPS_LO16: /* AHL + S */ - ahl += (int16_t)addend; + if (rela != NULL) { + addr = lookup(lf, symidx, 1); + if (addr == 0) + return (-1); + addr += addend; + *where &= 0xffff0000; + *where |= addr & 0xffff; + } + else { + ahl += (int16_t)addend; + addr = lookup(lf, symidx, 1); + if (addr == 0) + return (-1); + + addend &= 0xffff0000; + addend |= (uint16_t)(ahl + addr); + *where = addend; + + addend = *where_hi16; + addend &= 0xffff0000; + addend |= ((ahl + addr) - (int16_t)(ahl + addr)) >> 16; + *where_hi16 = addend; + } + + break; + + case R_MIPS_HIGHER: /* %higher(A+S) */ addr = lookup(lf, symidx, 1); if (addr == 0) return (-1); + addr += addend; + *where &= 0xffff0000; + *where |= (((long long)addr + 0x80008000LL) >> 32) & 0xffff; + break; - addend &= 0xffff0000; - addend |= (uint16_t)(ahl + addr); - *where = addend; - - addend = *where_hi16; - addend &= 0xffff0000; - addend |= ((ahl + addr) - (int16_t)(ahl + addr)) >> 16; - *where_hi16 = addend; + case R_MIPS_HIGHEST: /* %highest(A+S) */ + addr = lookup(lf, symidx, 1); + if (addr == 0) + return (-1); + addr += addend; + *where &= 0xffff0000; + *where |= (((long long)addr + 0x800080008000LL) >> 48) & 0xffff; break; default: @@ -246,6 +310,7 @@ elf_reloc_internal(linker_file_t lf, Elf rtype); return (-1); } + return(0); } From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 08:04:40 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EC7E106564A; Sun, 8 Jan 2012 08:04:40 +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 C6B428FC12; Sun, 8 Jan 2012 08:04:38 +0000 (UTC) Received: from porto.starpoint.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 KAA14950; Sun, 08 Jan 2012 10:04:36 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Rjnk4-0001Fm-4e; Sun, 08 Jan 2012 10:04:36 +0200 Message-ID: <4F094E11.4010007@FreeBSD.org> Date: Sun, 08 Jan 2012 10:04:33 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Xin LI References: <201201032017.q03KHZ0Z040723@svn.freebsd.org> In-Reply-To: <201201032017.q03KHZ0Z040723@svn.freebsd.org> X-Enigmail-Version: undefined 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: r229416 - head/sys/dev/tws X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 08:04:40 -0000 on 03/01/2012 22:17 Xin LI said the following: > Author: delphij > Date: Tue Jan 3 20:17:35 2012 > New Revision: 229416 > URL: http://svn.freebsd.org/changeset/base/229416 > > Log: > Don't forget to release queue lock when allocation of memory failed. > > Submitted by: Sascha Wildner > Obtained from: DragonFly > MFC after: 2 weeks > > Modified: > head/sys/dev/tws/tws.c > > Modified: head/sys/dev/tws/tws.c > ============================================================================== > --- head/sys/dev/tws/tws.c Tue Jan 3 19:47:32 2012 (r229415) > +++ head/sys/dev/tws/tws.c Tue Jan 3 20:17:35 2012 (r229416) > @@ -685,6 +685,7 @@ tws_init_reqs(struct tws_softc *sc, u_in > { > if (bus_dmamap_create(sc->data_tag, 0, &sc->reqs[i].dma_map)) { > /* log a ENOMEM failure msg here */ > + mtx_unlock(&sc->q_lock); At least here it looks like the new line has inconsistent whitespace indentation. > return(FAILURE); > } > sc->reqs[i].cmd_pkt = &cmd_buf[i]; -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 09:56:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 904F91065670; Sun, 8 Jan 2012 09:56:25 +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 7E17A8FC12; Sun, 8 Jan 2012 09:56:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q089uP62080610; Sun, 8 Jan 2012 09:56:25 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q089uP5u080604; Sun, 8 Jan 2012 09:56:25 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201201080956.q089uP5u080604@svn.freebsd.org> From: Michael Tuexen Date: Sun, 8 Jan 2012 09:56: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: r229805 - in head/sys: netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 09:56:25 -0000 Author: tuexen Date: Sun Jan 8 09:56:24 2012 New Revision: 229805 URL: http://svn.freebsd.org/changeset/base/229805 Log: Add an SCTP sysctl "blackhole", similar to the one for TCP. If set to 1, no ABORT is sent back in response to an incoming INIT. If set to 2, no ABORT is sent back in response to an out of the blue packet. If set to 0 (the default), ABORTs are sent. Discussed with rrs@. MFC after: 1 month. Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctputil.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun Jan 8 07:51:40 2012 (r229804) +++ head/sys/netinet/sctp_input.c Sun Jan 8 09:56:24 2012 (r229805) @@ -170,8 +170,9 @@ sctp_handle_init(struct mbuf *m, int iph * accepts(). The App just looses and should NOT be in this * state :-) */ - sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, - vrf_id, port); + if (SCTP_BASE_SYSCTL(sctp_blackhole) == 0) { + sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + } goto outnow; } if ((stcb != NULL) && @@ -5927,8 +5928,13 @@ sctp_skip_csum_4: if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) { goto bad; } - if (ch->chunk_type != SCTP_ABORT_ASSOCIATION) - sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + if (ch->chunk_type != SCTP_ABORT_ASSOCIATION) { + if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || + ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && + (ch->chunk_type != SCTP_INIT))) { + sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + } + } goto bad; } else if (stcb == NULL) { refcount_up = 1; Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Sun Jan 8 07:51:40 2012 (r229804) +++ head/sys/netinet/sctp_sysctl.c Sun Jan 8 09:56:24 2012 (r229805) @@ -117,6 +117,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_rttvar_eqret) = SCTPCTL_RTTVAR_EQRET_DEFAULT; SCTP_BASE_SYSCTL(sctp_steady_step) = SCTPCTL_RTTVAR_STEADYS_DEFAULT; SCTP_BASE_SYSCTL(sctp_use_dccc_ecn) = SCTPCTL_RTTVAR_DCCCECN_DEFAULT; + SCTP_BASE_SYSCTL(sctp_blackhole) = SCTPCTL_BLACKHOLE_DEFAULT; #if defined(SCTP_LOCAL_TRACE_BUF) memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); @@ -665,6 +666,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN, SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), SCTPCTL_NAT_FRIENDLY_INITS_MIN, SCTPCTL_NAT_FRIENDLY_INITS_MAX); + RANGECHK(SCTP_BASE_SYSCTL(sctp_blackhole), SCTPCTL_BLACKHOLE_MIN, SCTPCTL_BLACKHOLE_MAX); #ifdef SCTP_DEBUG RANGECHK(SCTP_BASE_SYSCTL(sctp_debug_on), SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX); @@ -1123,6 +1125,10 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUT &SCTP_BASE_SYSCTL(sctp_use_dccc_ecn), 0, sysctl_sctp_check, "IU", SCTPCTL_RTTVAR_DCCCECN_DESC); +SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, blackhole, CTLTYPE_UINT | CTLFLAG_RW, + &SCTP_BASE_SYSCTL(sctp_blackhole), 0, sysctl_sctp_check, "IU", + SCTPCTL_BLACKHOLE_DESC); + #ifdef SCTP_DEBUG SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_UINT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU", Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Sun Jan 8 07:51:40 2012 (r229804) +++ head/sys/netinet/sctp_sysctl.h Sun Jan 8 09:56:24 2012 (r229805) @@ -114,6 +114,7 @@ struct sctp_sysctl { uint32_t sctp_vtag_time_wait; uint32_t sctp_buffer_splitting; uint32_t sctp_initial_cwnd; + uint32_t sctp_blackhole; #if defined(SCTP_DEBUG) uint32_t sctp_debug_on; #endif @@ -519,6 +520,11 @@ struct sctp_sysctl { #define SCTPCTL_RTTVAR_DCCCECN_MAX 1 #define SCTPCTL_RTTVAR_DCCCECN_DEFAULT 1 /* 0 means disable feature */ +#define SCTPCTL_BLACKHOLE_DESC "Enable SCTP blackholing" +#define SCTPCTL_BLACKHOLE_MIN 0 +#define SCTPCTL_BLACKHOLE_MAX 2 +#define SCTPCTL_BLACKHOLE_DEFAULT SCTPCTL_BLACKHOLE_MIN + #if defined(SCTP_DEBUG) /* debug: Configure debug output */ #define SCTPCTL_DEBUG_DESC "Configure debug output" Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun Jan 8 07:51:40 2012 (r229804) +++ head/sys/netinet/sctputil.c Sun Jan 8 09:56:24 2012 (r229805) @@ -3801,6 +3801,7 @@ sctp_handle_ootb(struct mbuf *m, int iph { struct sctp_chunkhdr *ch, chunk_buf; unsigned int chk_length; + int contains_init_chunk; SCTP_STAT_INCR_COUNTER32(sctps_outoftheblue); /* Generate a TO address for future reference */ @@ -3810,6 +3811,7 @@ sctp_handle_ootb(struct mbuf *m, int iph SCTP_CALLED_DIRECTLY_NOCMPSET); } } + contains_init_chunk = 0; ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, sizeof(*ch), (uint8_t *) & chunk_buf); while (ch != NULL) { @@ -3819,6 +3821,9 @@ sctp_handle_ootb(struct mbuf *m, int iph break; } switch (ch->chunk_type) { + case SCTP_INIT: + contains_init_chunk = 1; + break; case SCTP_COOKIE_ECHO: /* We hit here only if the assoc is being freed */ return; @@ -3844,7 +3849,11 @@ sctp_handle_ootb(struct mbuf *m, int iph ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, sizeof(*ch), (uint8_t *) & chunk_buf); } - sctp_send_abort(m, iphlen, sh, 0, op_err, vrf_id, port); + if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || + ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && + (contains_init_chunk == 0))) { + sctp_send_abort(m, iphlen, sh, 0, op_err, vrf_id, port); + } } /* Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Sun Jan 8 07:51:40 2012 (r229804) +++ head/sys/netinet6/sctp6_usrreq.c Sun Jan 8 09:56:24 2012 (r229805) @@ -236,8 +236,13 @@ sctp_skip_csum: if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) { goto bad; } - if (ch->chunk_type != SCTP_ABORT_ASSOCIATION) - sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + if (ch->chunk_type != SCTP_ABORT_ASSOCIATION) { + if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || + ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && + (ch->chunk_type != SCTP_INIT))) { + sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + } + } goto bad; } else if (stcb == NULL) { refcount_up = 1; From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 10:07:25 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF88F1065673; Sun, 8 Jan 2012 10:07:24 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 62FDD8FC12; Sun, 8 Jan 2012 10:07:23 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q08A6wCq015758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 Jan 2012 21:07:21 +1100 Date: Sun, 8 Jan 2012 21:06:58 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eitan Adler In-Reply-To: <201201072315.q07NFM3v060477@svn.freebsd.org> Message-ID: <20120108203419.S14348@besplex.bde.org> References: <201201072315.q07NFM3v060477@svn.freebsd.org> 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: r229794 - head/usr.bin/hexdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 10:07:25 -0000 > Log: > - Fix how hexdump parses escape strings > From the NetBSD bug: > The way how hexdump(1) parses escape sequences has some bugs. > It shows up when an escape sequence is used as the non-last character > of a format string. > > PR: bin/144722 > Submitted by: gcooper > Approved by: rpaulo > Obtained from: NetBSD > MFC after: 1 week This has lots of style bugs. > Modified: head/usr.bin/hexdump/parse.c > ============================================================================== > --- head/usr.bin/hexdump/parse.c Sat Jan 7 22:29:46 2012 (r229793) > +++ head/usr.bin/hexdump/parse.c Sat Jan 7 23:15:21 2012 (r229794) > @@ -255,7 +255,9 @@ rewrite(FS *fs) > sokay = NOTOKAY; > } > > - p2 = p1 + 1; /* Set end pointer. */ > + p2 = *p1 ? p1 + 1 : p1; /* Set end pointer -- make sure > + * that it's non-NUL/-NULL first > + * though. */ > cs[0] = *p1; /* Set conversion string. */ > cs[1] = '\0'; > Comments to the right of code should be used less than was already done here. Large comments should never be to the right of code. They cause formatting problems, as the above shows. The "it" in the comment doesn't match its subject. Its subject is the end pointer, but "it" is meant to refer to the first byte of the string. Perhaps contractions like "it's" should be avoided in comments for the same reason as in man pages (they are harder to parse for non-native speakers). And parsing this one shows that the "it" is wrong. The comment doesn't match the code. The code doesn't have any NULL pointer check. And a null pointer check makes no sense, since the old code derefences p1 without checking for that, and the new code adds another dereference. The test of *p1 is a boolean test in non-boolean context. But nearby code has the same style bug, in the much more non-idiomatic form `!*p'. Fixing these style bugs gives something like: %%% /* * Set end pointer. First make sure that p1 is not * the empty string.. */ p2 = *p1 == '\0' ? p1 + p1 + 1; /* Set conversion string. */ cs[0] = *p1; cs[1] = '\0'; %%% Possible furthe improvements: - some programmers can't would add unnecessary parentheses for the ?: operator. Even I might add them. - it might be clearer to set the conversion string first and then use cs[0] instead of *p1 twice. > @@ -449,13 +451,21 @@ escape(char *p1) > char *p2; > > /* alphabetic escape sequences have to be done in place */ > - for (p2 = p1;; ++p1, ++p2) { > - if (!*p1) { > - *p2 = *p1; > - break; > - } > - if (*p1 == '\\') > - switch(*++p1) { > + for (p2 = p1; *p1; p1++, p2++) { > + /* > + * Let's take a peak at the next item and see whether or not > + * we need to escape the value... > + */ This comment is very verbose, starting with the noise words "Let's". This comment mispells "peek". "Peek" is another chatty word. The keyboard has excessive repeat on its "." key. There is no reason to use an ellipsis here. > + if (*p1 == '\\') { > + > + p1++; > + The keyboard also dribbles newlines. 2 instances here. > + switch(*p1) { > + /* A standalone `\' */ > + case '\0': Previous comment is misplaced and misindented. It should be here. It should be terminated by a ".". Perhaps the backslash in it should be quoted. > + *p2 = '\\'; > + *++p2 = '\0'; It's not clear why this doesn't give a buffer overrun. It writes past the end of a string. This is only safe if the caller allocated space beyond the end of the string. cs[] is allocated locally, and it is clear that it has space for just 1 byte of expansion. > + break; > case 'a': > /* *p2 = '\a'; */ > *p2 = '\007'; > @@ -482,7 +492,12 @@ escape(char *p1) > *p2 = *p1; > break; > } > + > + } else > + *p2 = *p1; > + 2 more extra newline. > } > + 1 more extra newline. > } > > void > Bruce From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 10:15:21 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E774B106564A; Sun, 8 Jan 2012 10:15:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 034BE8FC0C; Sun, 8 Jan 2012 10:15:20 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q08AFGRp030552 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 Jan 2012 21:15:17 +1100 Date: Sun, 8 Jan 2012 21:15:16 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans In-Reply-To: <20120108203419.S14348@besplex.bde.org> Message-ID: <20120108210842.U14348@besplex.bde.org> References: <201201072315.q07NFM3v060477@svn.freebsd.org> <20120108203419.S14348@besplex.bde.org> 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, Eitan Adler Subject: Re: svn commit: r229794 - head/usr.bin/hexdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 10:15:22 -0000 On Sun, 8 Jan 2012, Bruce Evans wrote: > ... > Fixing these style bugs gives something like: > > %%% > /* > * Set end pointer. First make sure that p1 is not > * the empty string.. > */ > p2 = *p1 == '\0' ? p1 + p1 + 1; Grr, typo. One of the `+'s should be `:'. I hope I inverted the logic of this expression correctly. > > /* Set conversion string. */ > cs[0] = *p1; > cs[1] = '\0'; > > %%% > Possible furthe improvements: > - some programmers can't would add unnecessary parentheses for the ?: > operator. Even I might add them. Since I changed `*p1' to `*p1 == `\0'' and inverted the logic, it has an extra operator so it needs the parentheses more than before: p2 = (*p1 == '\0' ? p1 : p1 + 1); Not: p2 = (*p1 == '\0') ? p1 : p1 + 1; (since this adds parentheses where they are least needed), or p2 = ((*p1 == '\0') ? p1 : p1 + 1); (since this adds layers of parentheses which must be parsed to see where they actually are). Bruce From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 10:44:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FFCD106564A; Sun, 8 Jan 2012 10:44:51 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 11A118FC08; Sun, 8 Jan 2012 10:44:50 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id C089C45B; Sun, 8 Jan 2012 11:44:46 +0100 (CET) Date: Sun, 8 Jan 2012 11:43:30 +0100 From: Pawel Jakub Dawidek To: Adrian Chadd Message-ID: <20120108104330.GC1674@garage.freebsd.pl> References: <201201080055.q080tMlJ063808@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Bu8it7iiRSEf40bY" Content-Disposition: inline In-Reply-To: <201201080055.q080tMlJ063808@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229800 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 10:44:51 -0000 --Bu8it7iiRSEf40bY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 08, 2012 at 12:55:22AM +0000, Adrian Chadd wrote: > Author: adrian > Date: Sun Jan 8 00:55:22 2012 > New Revision: 229800 > URL: http://svn.freebsd.org/changeset/base/229800 >=20 > Log: > Make these two files conditionally build on UFS_ACL, as it doesn't > seem to be used elsewhere. > =20 > Since UFS_ACL is enabled by default for GENERIC kernels, this shouldn't > break anything - but please beat me to fix things if it does. If someone is actually using GENERIC kernel. This change will break all my system next time I upgrade. Adding UFS_ACL option to the kernel config to make ZFS kernel module to work doesn't sound very intuitive. I understand what you are trying to accomplish, but we really need to find better way to do this. Until then, could you back it out? > This reduces the footprint of the kernel on small embedded systems > (think <1MB flash for the compressed kernel image) just enough to > actually fit. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --Bu8it7iiRSEf40bY Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8Jc1IACgkQForvXbEpPzTuPACfXr7wGC97cXng26Wt90xC86wd +54An25uHD8dIvD0Vx36bLwIviyCFfWG =uZSj -----END PGP SIGNATURE----- --Bu8it7iiRSEf40bY-- From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 11:57:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FDEC1065670; Sun, 8 Jan 2012 11:57:39 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E5528FC14; Sun, 8 Jan 2012 11:57:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08Bvd4u089260; Sun, 8 Jan 2012 11:57:39 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08Bvd6j089257; Sun, 8 Jan 2012 11:57:39 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201201081157.q08Bvd6j089257@svn.freebsd.org> From: Andreas Tobler Date: Sun, 8 Jan 2012 11:57:39 +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: r229806 - in head/lib/libc: powerpc/gen powerpc64/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 11:57:39 -0000 Author: andreast Date: Sun Jan 8 11:57:38 2012 New Revision: 229806 URL: http://svn.freebsd.org/changeset/base/229806 Log: Two other places where we can use WEAK_ALIAS. Modified: head/lib/libc/powerpc/gen/setjmp.S head/lib/libc/powerpc64/gen/setjmp.S Modified: head/lib/libc/powerpc/gen/setjmp.S ============================================================================== --- head/lib/libc/powerpc/gen/setjmp.S Sun Jan 8 09:56:24 2012 (r229805) +++ head/lib/libc/powerpc/gen/setjmp.S Sun Jan 8 11:57:38 2012 (r229806) @@ -69,8 +69,7 @@ ENTRY(setjmp) li %r3,0 /* return (0) */ blr - .weak CNAME(longjmp) - .set CNAME(longjmp),CNAME(__longjmp) + WEAK_ALIAS(longjmp, __longjmp) ENTRY(__longjmp) lmw %r9,20(%r3) /* restore regs */ mr %r6,%r4 /* save val param */ Modified: head/lib/libc/powerpc64/gen/setjmp.S ============================================================================== --- head/lib/libc/powerpc64/gen/setjmp.S Sun Jan 8 09:56:24 2012 (r229805) +++ head/lib/libc/powerpc64/gen/setjmp.S Sun Jan 8 11:57:38 2012 (r229806) @@ -93,10 +93,7 @@ ENTRY(setjmp) li %r3,0 /* return (0) */ blr - .weak CNAME(longjmp) - .set CNAME(longjmp),CNAME(__longjmp) - .weak CNAME(.longjmp) - .set CNAME(.longjmp),CNAME(.__longjmp) + WEAK_ALIAS(longjmp, __longjmp) ENTRY(__longjmp) ld %r9,40 + 0*8(%r3) ld %r10,40 + 1*8(%r3) From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 12:03:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D44E9106566B; Sun, 8 Jan 2012 12:03: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 C3ABA8FC0C; Sun, 8 Jan 2012 12:03:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08C3kwD089512; Sun, 8 Jan 2012 12:03:46 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08C3kk6089510; Sun, 8 Jan 2012 12:03:46 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201081203.q08C3kk6089510@svn.freebsd.org> From: Ed Schouten Date: Sun, 8 Jan 2012 12:03: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: r229807 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 12:03:46 -0000 Author: ed Date: Sun Jan 8 12:03:46 2012 New Revision: 229807 URL: http://svn.freebsd.org/changeset/base/229807 Log: Fix spelling of C11 and sort functions by name. Modified: head/include/stdlib.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Sun Jan 8 11:57:38 2012 (r229806) +++ head/include/stdlib.h Sun Jan 8 12:03:46 2012 (r229807) @@ -149,12 +149,12 @@ _Noreturn void _Exit(int); #endif /* __ISO_C_VISIBLE >= 1999 */ /* - * If we're in a mode greater than C99, expose C1x functions. + * If we're in a mode greater than C99, expose C11 functions. */ #if __ISO_C_VISIBLE >= 2011 +int at_quick_exit(void (*)(void)); _Noreturn void quick_exit(int); -int at_quick_exit(void (*)(void)); #endif /* __ISO_C_VISIBLE >= 2011 */ /* * Extensions made by POSIX relative to C. We don't know yet which edition From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 12:04:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5D59106566B; Sun, 8 Jan 2012 12:04: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 953578FC17; Sun, 8 Jan 2012 12:04:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08C4Mbd089569; Sun, 8 Jan 2012 12:04:22 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08C4Meg089567; Sun, 8 Jan 2012 12:04:22 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201081204.q08C4Meg089567@svn.freebsd.org> From: Ed Schouten Date: Sun, 8 Jan 2012 12:04: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: r229808 - head/lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 12:04:22 -0000 Author: ed Date: Sun Jan 8 12:04:22 2012 New Revision: 229808 URL: http://svn.freebsd.org/changeset/base/229808 Log: Properly sort functions by name. Modified: head/lib/libc/stdlib/Symbol.map Modified: head/lib/libc/stdlib/Symbol.map ============================================================================== --- head/lib/libc/stdlib/Symbol.map Sun Jan 8 12:03:46 2012 (r229807) +++ head/lib/libc/stdlib/Symbol.map Sun Jan 8 12:04:22 2012 (r229808) @@ -93,18 +93,18 @@ FBSD_1.0 { }; FBSD_1.3 { + at_quick_exit; atof_l; atoi_l; atol_l; atoll_l; - at_quick_exit; quick_exit; strtod_l; - strtol_l; - strtoll_l; strtof_l; strtoimax_l; + strtol_l; strtold_l; + strtoll_l; strtoq_l; strtoul_l; strtoull_l; From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 12:38:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DA3B106564A; Sun, 8 Jan 2012 12:38:42 +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 5C9AB8FC0C; Sun, 8 Jan 2012 12:38:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08CcgjI090737; Sun, 8 Jan 2012 12:38:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08CcgdU090735; Sun, 8 Jan 2012 12:38:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201081238.q08CcgdU090735@svn.freebsd.org> From: Ed Schouten Date: Sun, 8 Jan 2012 12:38: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: r229809 - head/gnu/usr.bin/cvs/lib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 12:38:42 -0000 Author: ed Date: Sun Jan 8 12:38:41 2012 New Revision: 229809 URL: http://svn.freebsd.org/changeset/base/229809 Log: Don't include . Including this header file causes a compilation warning. The code builds perfectly fine without this header file. Modified: head/gnu/usr.bin/cvs/lib/config.h.proto Modified: head/gnu/usr.bin/cvs/lib/config.h.proto ============================================================================== --- head/gnu/usr.bin/cvs/lib/config.h.proto Sun Jan 8 12:04:22 2012 (r229808) +++ head/gnu/usr.bin/cvs/lib/config.h.proto Sun Jan 8 12:38:41 2012 (r229809) @@ -324,7 +324,7 @@ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIMEB_H 1 +/* #undef HAVE_SYS_TIMEB_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 13:34:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96331106566B; Sun, 8 Jan 2012 13:34:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AE7D8FC0A; Sun, 8 Jan 2012 13:34:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08DY1SL092435; Sun, 8 Jan 2012 13:34:01 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08DY1fC092430; Sun, 8 Jan 2012 13:34:01 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201081334.q08DY1fC092430@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 8 Jan 2012 13:34: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: r229810 - in head/sys: net netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 13:34:01 -0000 Author: glebius Date: Sun Jan 8 13:34:00 2012 New Revision: 229810 URL: http://svn.freebsd.org/changeset/base/229810 Log: Move arprequest() declaration to if_ether.h. Modified: head/sys/net/if_llatbl.c head/sys/netinet/if_ether.c head/sys/netinet/if_ether.h Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sun Jan 8 12:38:41 2012 (r229809) +++ head/sys/net/if_llatbl.c Sun Jan 8 13:34:00 2012 (r229810) @@ -65,9 +65,6 @@ MALLOC_DEFINE(M_LLTABLE, "lltable", "lin static VNET_DEFINE(SLIST_HEAD(, lltable), lltables); #define V_lltables VNET(lltables) -extern void arprequest(struct ifnet *, struct in_addr *, struct in_addr *, - u_char *); - static void vnet_lltable_init(void); struct rwlock lltable_rwlock; Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Sun Jan 8 12:38:41 2012 (r229809) +++ head/sys/netinet/if_ether.c Sun Jan 8 13:34:00 2012 (r229810) @@ -123,8 +123,6 @@ SYSCTL_VNET_INT(_net_link_ether_inet, OI "Number of packets to hold per ARP entry"); static void arp_init(void); -void arprequest(struct ifnet *, - struct in_addr *, struct in_addr *, u_char *); static void arpintr(struct mbuf *); static void arptimer(void *); #ifdef INET Modified: head/sys/netinet/if_ether.h ============================================================================== --- head/sys/netinet/if_ether.h Sun Jan 8 12:38:41 2012 (r229809) +++ head/sys/netinet/if_ether.h Sun Jan 8 13:34:00 2012 (r229810) @@ -115,6 +115,8 @@ struct ifaddr; int arpresolve(struct ifnet *ifp, struct rtentry *rt, struct mbuf *m, struct sockaddr *dst, u_char *desten, struct llentry **lle); +void arprequest(struct ifnet *, struct in_addr *, struct in_addr *, + u_char *); void arp_ifinit(struct ifnet *, struct ifaddr *); void arp_ifinit2(struct ifnet *, struct ifaddr *, u_char *); void arp_ifscrub(struct ifnet *, uint32_t); From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 17:11:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42FC1106566B; Sun, 8 Jan 2012 17:11:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D9378FC08; Sun, 8 Jan 2012 17:11:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08HBsYQ099299; Sun, 8 Jan 2012 17:11:54 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08HBrsB099297; Sun, 8 Jan 2012 17:11:53 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201081711.q08HBrsB099297@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 8 Jan 2012 17:11: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: r229814 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 17:11:54 -0000 Author: glebius Date: Sun Jan 8 17:11:53 2012 New Revision: 229814 URL: http://svn.freebsd.org/changeset/base/229814 Log: Copy ifa->if_data to ifam->ifam_data. This was forgotten in r228571. Submitted by: bz Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sun Jan 8 16:47:37 2012 (r229813) +++ head/sys/net/rtsock.c Sun Jan 8 17:11:53 2012 (r229814) @@ -1606,6 +1606,7 @@ sysctl_iflist(int af, struct walkarg *w) ifam->ifam_flags = ifa->ifa_flags; ifam->ifam_metric = ifa->ifa_metric; ifam->ifam_addrs = info.rti_addrs; + ifam->ifam_data = ifa->if_data; if (carp_get_vhid_p != NULL) ifam->ifam_data.ifi_vhid = (*carp_get_vhid_p)(ifa); From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 17:20:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 776C7106566C; Sun, 8 Jan 2012 17:20:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6343C8FC1A; Sun, 8 Jan 2012 17:20:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08HKULA099581; Sun, 8 Jan 2012 17:20:30 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08HKU4l099579; Sun, 8 Jan 2012 17:20:30 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201081720.q08HKU4l099579@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 8 Jan 2012 17:20:30 +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: r229815 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 17:20:30 -0000 Author: glebius Date: Sun Jan 8 17:20:29 2012 New Revision: 229815 URL: http://svn.freebsd.org/changeset/base/229815 Log: Provide IA_MASKSIN() macro similar to IA_SIN() and IA_DSTSIN(). Modified: head/sys/netinet/in_var.h Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Sun Jan 8 17:11:53 2012 (r229814) +++ head/sys/netinet/in_var.h Sun Jan 8 17:20:29 2012 (r229815) @@ -85,6 +85,7 @@ struct in_aliasreq { */ #define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) #define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr)) +#define IA_MASKSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_sockmask)) #define IN_LNAOF(in, ifa) \ ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 17:25:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67C681065676; Sun, 8 Jan 2012 17:25:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 388E08FC0C; Sun, 8 Jan 2012 17:25:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08HPGgA099767; Sun, 8 Jan 2012 17:25:16 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08HPG3m099765; Sun, 8 Jan 2012 17:25:16 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201081725.q08HPG3m099765@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 8 Jan 2012 17:25: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: r229816 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 17:25:16 -0000 Author: glebius Date: Sun Jan 8 17:25:15 2012 New Revision: 229816 URL: http://svn.freebsd.org/changeset/base/229816 Log: Make it possible to use alternative source hardware address in the ARP datagram generated by arprequest(). If caller doesn't supply the address, then it is either picked from CARP or hardware address of the interface is taken. While here, make several minor fixes: - Hold IF_ADDR_RLOCK(ifp) while traversing address list. - Remove not true comment. - Access internet address and mask via in_ifaddr fields, rather than ifaddr. Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Sun Jan 8 17:20:29 2012 (r229815) +++ head/sys/netinet/if_ether.c Sun Jan 8 17:25:15 2012 (r229816) @@ -211,29 +211,41 @@ arprequest(struct ifnet *ifp, struct in_ struct mbuf *m; struct arphdr *ah; struct sockaddr sa; + u_char *carpaddr = NULL; if (sip == NULL) { - /* XXX don't believe this can happen (or explain why) */ /* * The caller did not supply a source address, try to find * a compatible one among those assigned to this interface. */ struct ifaddr *ifa; + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (!ifa->ifa_addr || - ifa->ifa_addr->sa_family != AF_INET) + if (ifa->ifa_addr->sa_family != AF_INET) continue; - sip = &SIN(ifa->ifa_addr)->sin_addr; + + if (ifa->ifa_carp) { + if ((*carp_iamatch_p)(ifa, &carpaddr) == 0) + continue; + sip = &IA_SIN(ifa)->sin_addr; + } else { + carpaddr = NULL; + sip = &IA_SIN(ifa)->sin_addr; + } + if (0 == ((sip->s_addr ^ tip->s_addr) & - SIN(ifa->ifa_netmask)->sin_addr.s_addr) ) + IA_MASKSIN(ifa)->sin_addr.s_addr)) break; /* found it. */ } + IF_ADDR_RUNLOCK(ifp); if (sip == NULL) { printf("%s: cannot find matching address\n", __func__); return; } } + if (enaddr == NULL) + enaddr = carpaddr ? carpaddr : (u_char *)IF_LLADDR(ifp); if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) return; @@ -328,9 +340,7 @@ retry: */ if (!(la->la_flags & LLE_STATIC) && time_uptime + la->la_preempt > la->la_expire) { - arprequest(ifp, NULL, - &SIN(dst)->sin_addr, IF_LLADDR(ifp)); - + arprequest(ifp, NULL, &SIN(dst)->sin_addr, NULL); la->la_preempt--; } @@ -406,8 +416,7 @@ retry: LLE_REMREF(la); la->la_asked++; LLE_WUNLOCK(la); - arprequest(ifp, NULL, &SIN(dst)->sin_addr, - IF_LLADDR(ifp)); + arprequest(ifp, NULL, &SIN(dst)->sin_addr, NULL); return (error); } done: From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 18:48:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98E46106564A; Sun, 8 Jan 2012 18:48: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 847FC8FC08; Sun, 8 Jan 2012 18:48:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08ImaFc002541; Sun, 8 Jan 2012 18:48:36 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08ImakZ002539; Sun, 8 Jan 2012 18:48:36 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201081848.q08ImakZ002539@svn.freebsd.org> From: Hiroki Sato Date: Sun, 8 Jan 2012 18:48: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: r229818 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 18:48:36 -0000 Author: hrs Date: Sun Jan 8 18:48:36 2012 New Revision: 229818 URL: http://svn.freebsd.org/changeset/base/229818 Log: Fix a typo. (s/nessesary/necessary/) Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Sun Jan 8 17:40:10 2012 (r229817) +++ head/sys/kern/kern_prot.c Sun Jan 8 18:48:36 2012 (r229818) @@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$"); #ifdef REGRESSION FEATURE(regression, - "Kernel support for interfaces nessesary for regression testing (SECURITY RISK!)"); + "Kernel support for interfaces necessary for regression testing (SECURITY RISK!)"); #endif #if defined(INET) || defined(INET6) From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 20:09:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D263106564A; Sun, 8 Jan 2012 20:09:27 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 478408FC08; Sun, 8 Jan 2012 20:09:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08K9R2c005286; Sun, 8 Jan 2012 20:09:27 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08K9RoC005283; Sun, 8 Jan 2012 20:09:27 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201201082009.q08K9RoC005283@svn.freebsd.org> From: Alan Cox Date: Sun, 8 Jan 2012 20:09: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: r229821 - in head/sys: fs/tmpfs kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 20:09:27 -0000 Author: alc Date: Sun Jan 8 20:09:26 2012 New Revision: 229821 URL: http://svn.freebsd.org/changeset/base/229821 Log: Correct an error of omission in the implementation of the truncation operation on POSIX shared memory objects and tmpfs. Previously, neither of these modules correctly handled the case in which the new size of the object or file was not a multiple of the page size. Specifically, they did not handle partial page truncation of data stored on swap. As a result, stale data might later be returned to an application. Interestingly, a data inconsistency was less likely to occur under tmpfs than POSIX shared memory objects. The reason being that a different mistake by the tmpfs truncation operation helped avoid a data inconsistency. If the data was still resident in memory in a PG_CACHED page, then the tmpfs truncation operation would reactivate that page, zero the truncated portion, and leave the page pinned in memory. More precisely, the benevolent error was that the truncation operation didn't add the reactivated page to any of the paging queues, effectively pinning the page. This page would remain pinned until the file was destroyed or the page was read or written. With this change, the page is now added to the inactive queue. Discussed with: jhb Reviewed by: kib (an earlier version) MFC after: 3 weeks Modified: head/sys/fs/tmpfs/tmpfs_subr.c head/sys/kern/uipc_shm.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Sun Jan 8 19:52:56 2012 (r229820) +++ head/sys/fs/tmpfs/tmpfs_subr.c Sun Jan 8 20:09:26 2012 (r229821) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -886,10 +887,10 @@ tmpfs_reg_resize(struct vnode *vp, off_t struct tmpfs_mount *tmp; struct tmpfs_node *node; vm_object_t uobj; - vm_page_t m; - vm_pindex_t newpages, oldpages; + vm_page_t m, ma[1]; + vm_pindex_t idx, newpages, oldpages; off_t oldsize; - size_t zerolen; + int base, rv; MPASS(vp->v_type == VREG); MPASS(newsize >= 0); @@ -912,15 +913,57 @@ tmpfs_reg_resize(struct vnode *vp, off_t newpages - oldpages > TMPFS_PAGES_AVAIL(tmp)) return (ENOSPC); - TMPFS_LOCK(tmp); - tmp->tm_pages_used += (newpages - oldpages); - TMPFS_UNLOCK(tmp); - - node->tn_size = newsize; - vnode_pager_setsize(vp, newsize); VM_OBJECT_LOCK(uobj); if (newsize < oldsize) { /* + * Zero the truncated part of the last page. + */ + base = newsize & PAGE_MASK; + if (base != 0) { + idx = OFF_TO_IDX(newsize); +retry: + m = vm_page_lookup(uobj, idx); + if (m != NULL) { + if ((m->oflags & VPO_BUSY) != 0 || + m->busy != 0) { + vm_page_sleep(m, "tmfssz"); + goto retry; + } + } else if (vm_pager_has_page(uobj, idx, NULL, NULL)) { + m = vm_page_alloc(uobj, idx, VM_ALLOC_NORMAL); + if (m == NULL) { + VM_OBJECT_UNLOCK(uobj); + VM_WAIT; + VM_OBJECT_LOCK(uobj); + goto retry; + } else if (m->valid != VM_PAGE_BITS_ALL) { + ma[0] = m; + rv = vm_pager_get_pages(uobj, ma, 1, 0); + m = vm_page_lookup(uobj, idx); + } else + /* A cached page was reactivated. */ + rv = VM_PAGER_OK; + vm_page_lock(m); + if (rv == VM_PAGER_OK) { + vm_page_deactivate(m); + vm_page_unlock(m); + vm_page_wakeup(m); + } else { + vm_page_free(m); + vm_page_unlock(m); + VM_OBJECT_UNLOCK(uobj); + return (EIO); + } + } + if (m != NULL) { + pmap_zero_page_area(m, base, PAGE_SIZE - base); + MPASS(m->valid == VM_PAGE_BITS_ALL); + vm_page_dirty(m); + vm_pager_page_unswapped(m); + } + } + + /* * Release any swap space and free any whole pages. */ if (newpages < oldpages) { @@ -928,19 +971,16 @@ tmpfs_reg_resize(struct vnode *vp, off_t newpages); vm_object_page_remove(uobj, newpages, 0, 0); } - - /* - * Zero the truncated part of the last page. - */ - zerolen = round_page(newsize) - newsize; - if (zerolen > 0) { - m = vm_page_grab(uobj, OFF_TO_IDX(newsize), - VM_ALLOC_NOBUSY | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - pmap_zero_page_area(m, PAGE_SIZE - zerolen, zerolen); - } } uobj->size = newpages; VM_OBJECT_UNLOCK(uobj); + + TMPFS_LOCK(tmp); + tmp->tm_pages_used += (newpages - oldpages); + TMPFS_UNLOCK(tmp); + + node->tn_size = newsize; + vnode_pager_setsize(vp, newsize); return (0); } Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Sun Jan 8 19:52:56 2012 (r229820) +++ head/sys/kern/uipc_shm.c Sun Jan 8 20:09:26 2012 (r229821) @@ -39,13 +39,6 @@ * * (3) Resource limits? Does this need its own resource limits or are the * existing limits in mmap(2) sufficient? - * - * (4) Partial page truncation. vnode_pager_setsize() will zero any parts - * of a partially mapped page as a result of ftruncate(2)/truncate(2). - * We can do the same (with the same pmap evil), but do we need to - * worry about the bits on disk if the page is swapped out or will the - * swapper zero the parts of a page that are invalid if the page is - * swapped back in for us? */ #include @@ -86,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -253,9 +247,10 @@ static int shm_dotruncate(struct shmfd *shmfd, off_t length) { vm_object_t object; - vm_page_t m; - vm_pindex_t nobjsize; + vm_page_t m, ma[1]; + vm_pindex_t idx, nobjsize; vm_ooffset_t delta; + int base, rv; object = shmfd->shm_object; VM_OBJECT_LOCK(object); @@ -275,6 +270,56 @@ shm_dotruncate(struct shmfd *shmfd, off_ VM_OBJECT_UNLOCK(object); return (EBUSY); } + + /* + * Zero the truncated part of the last page. + */ + base = length & PAGE_MASK; + if (base != 0) { + idx = OFF_TO_IDX(length); +retry: + m = vm_page_lookup(object, idx); + if (m != NULL) { + if ((m->oflags & VPO_BUSY) != 0 || + m->busy != 0) { + vm_page_sleep(m, "shmtrc"); + goto retry; + } + } else if (vm_pager_has_page(object, idx, NULL, NULL)) { + m = vm_page_alloc(object, idx, VM_ALLOC_NORMAL); + if (m == NULL) { + VM_OBJECT_UNLOCK(object); + VM_WAIT; + VM_OBJECT_LOCK(object); + goto retry; + } else if (m->valid != VM_PAGE_BITS_ALL) { + ma[0] = m; + rv = vm_pager_get_pages(object, ma, 1, + 0); + m = vm_page_lookup(object, idx); + } else + /* A cached page was reactivated. */ + rv = VM_PAGER_OK; + vm_page_lock(m); + if (rv == VM_PAGER_OK) { + vm_page_deactivate(m); + vm_page_unlock(m); + vm_page_wakeup(m); + } else { + vm_page_free(m); + vm_page_unlock(m); + VM_OBJECT_UNLOCK(object); + return (EIO); + } + } + if (m != NULL) { + pmap_zero_page_area(m, base, PAGE_SIZE - base); + KASSERT(m->valid == VM_PAGE_BITS_ALL, + ("shm_dotruncate: page %p is invalid", m)); + vm_page_dirty(m); + vm_pager_page_unswapped(m); + } + } delta = ptoa(object->size - nobjsize); /* Toss in memory pages. */ @@ -289,45 +334,7 @@ shm_dotruncate(struct shmfd *shmfd, off_ /* Free the swap accounted for shm */ swap_release_by_cred(delta, object->cred); object->charge -= delta; - - /* - * If the last page is partially mapped, then zero out - * the garbage at the end of the page. See comments - * in vnode_pager_setsize() for more details. - * - * XXXJHB: This handles in memory pages, but what about - * a page swapped out to disk? - */ - if ((length & PAGE_MASK) && - (m = vm_page_lookup(object, OFF_TO_IDX(length))) != NULL && - m->valid != 0) { - int base = (int)length & PAGE_MASK; - int size = PAGE_SIZE - base; - - pmap_zero_page_area(m, base, size); - - /* - * Update the valid bits to reflect the blocks that - * have been zeroed. Some of these valid bits may - * have already been set. - */ - vm_page_set_valid_range(m, base, size); - - /* - * Round "base" to the next block boundary so that the - * dirty bit for a partially zeroed block is not - * cleared. - */ - base = roundup2(base, DEV_BSIZE); - - vm_page_clear_dirty(m, base, PAGE_SIZE - base); - } else if ((length & PAGE_MASK) && - __predict_false(object->cache != NULL)) { - vm_page_cache_free(object, OFF_TO_IDX(length), - nobjsize); - } } else { - /* Attempt to reserve the swap */ delta = ptoa(nobjsize - object->size); if (!swap_reserve_by_cred(delta, object->cred)) { From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 20:25:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B40521065670; Sun, 8 Jan 2012 20:25:29 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F1138FC13; Sun, 8 Jan 2012 20:25:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08KPT7l005969; Sun, 8 Jan 2012 20:25:29 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08KPTd1005965; Sun, 8 Jan 2012 20:25:29 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201082025.q08KPTd1005965@svn.freebsd.org> From: Doug Barton Date: Sun, 8 Jan 2012 20:25: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: r229822 - in head/etc: . rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 20:25:29 -0000 Author: dougb Date: Sun Jan 8 20:25:29 2012 New Revision: 229822 URL: http://svn.freebsd.org/changeset/base/229822 Log: There is no longer a need to abstract ${rcvar_manpage} as we are not attempting to maintain compatibility with NetBSD for some years now. Modified: head/etc/rc.d/hostname head/etc/rc.subr Modified: head/etc/rc.d/hostname ============================================================================== --- head/etc/rc.d/hostname Sun Jan 8 20:09:26 2012 (r229821) +++ head/etc/rc.d/hostname Sun Jan 8 20:25:29 2012 (r229822) @@ -65,7 +65,7 @@ hostname_start() # Null hostname is probably OK if DHCP is in use. # if [ -z "`list_net_interfaces dhcp`" ]; then - warn "\$hostname is not set -- see ${rcvar_manpage}." + warn "\$hostname is not set -- see rc.conf(5)." fi return fi Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sun Jan 8 20:09:26 2012 (r229821) +++ head/etc/rc.subr Sun Jan 8 20:25:29 2012 (r229822) @@ -32,7 +32,6 @@ # functions used by various rc scripts # -: ${rcvar_manpage:='rc.conf(5)'} : ${RC_PID:=$$}; export RC_PID # @@ -152,7 +151,7 @@ checkyesno() return 1 ;; *) - warn "\$${1} is not set properly - see ${rcvar_manpage}." + warn "\$${1} is not set properly - see rc.conf(5)." return 1 ;; esac From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 20:35:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30CA21065670; Sun, 8 Jan 2012 20:35:54 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id CBBB98FC0C; Sun, 8 Jan 2012 20:35:53 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so4777601obb.13 for ; Sun, 08 Jan 2012 12:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=UgH8tlPkSeU2MXA1zAzRsFQ6+euBUu1QKBmFGf1Wi+Y=; b=WtT7NEcQIafvG3k+LFBWylY1wXTQ0rzTjtOreB2kBAkI9nG2xRlYxBhLk/5aVLSA9m A1mEjWpHJRM2fz+cff3OryCwialqVC+aJEJiOOutNrDL6zXSllozpvj3w7CNrFUN28Xp WAnN9KYTfDAXQ7PGX+NUTVRcN4PE13O2ztL9A= MIME-Version: 1.0 Received: by 10.182.117.97 with SMTP id kd1mr12128675obb.50.1326054953162; Sun, 08 Jan 2012 12:35:53 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Sun, 8 Jan 2012 12:35:53 -0800 (PST) In-Reply-To: <4F08A518.8090207@FreeBSD.org> References: <201112300624.pBU6OxO9098906@svn.freebsd.org> <4F08A518.8090207@FreeBSD.org> Date: Sun, 8 Jan 2012 23:35:53 +0300 X-Google-Sender-Auth: DmKntepnk0xmNnWaWNM6jcEEsX4 Message-ID: From: Sergey Kandaurov To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Devin Teske Subject: Re: svn commit: r228985 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 20:35:54 -0000 On 8 January 2012 00:03, Dimitry Andric wrote: > On 2011-12-30 07:24, Sergey Kandaurov wrote: >> >> Author: pluknet >> Date: Fri Dec 30 06:24:59 2011 >> New Revision: 228985 >> URL: http://svn.freebsd.org/changeset/base/228985 >> >> Log: >> =A0 Unset the environment variables associated with individual menu item= s >> =A0 before invoking the kernel. > > > When I did a single-user mode boot to install a new world, I saw the > following warning on the (serial) console during boot: > > =A0/boot.config: -D -S115200 > =A0Consoles: internal video/keyboard =A0serial port > =A0BIOS drive A: is disk0 > =A0BIOS drive C: is disk1 > =A0BIOS 638kB/3143616kB available memory > > =A0FreeBSD/x86 bootstrap loader, Revision 1.1 > =A0(dim@vm-freebsd10-amd64.home.andric.com, Sat Jan =A07 01:05:07 CET 201= 2) > =A0Loading /boot/defaults/loader.conf > =A0/boot/kernel/kernel data=3D0xb73530 data=3D0x11dbe0+0x2b4db8 > syms=3D[0x8+0xfd620+0x8+0xec6b6] > =A0- > =A0Hit [Enter] to boot immediately, or any other key for command prompt. > > > =A0Type '?' for a list of commands, 'help' for more detailed help. > =A0OK boot -s > =A0menu-unset not found =A0 =A0 =A0 =A0 =A0 <<-- what's this? > =A0GDB: no debug ports present > =A0KDB: debugger backends: ddb > =A0KDB: current backend: ddb > =A0[...kernel boots...] > > E.g, it always gives a 'menu-unset not found' warning (or maybe it's an > error, it's not clear). =A0This was not the case before r228985. > > I have almost no knowledge about forth, but it looks like this might be > caused by the new try-menu-unset subroutine. > > My loader.conf is just this: > > =A0beastie_disable=3D"YES" > =A0comconsole_speed=3D"115200" > =A0console=3D"comconsole vidconsole" > =A0kern.hz=3D"100" So, the problem arise when beastie_disable is set. In this case menu.rc is not evaluated and consequently menu-unset does not have a body yet. This results in the ficl warning "not found" when try-menu-unset calls menu-unset. The warning cannot be handled with catch as seen with the code in head. Otherwise, when beastie is enabled, all works as it should. To "fix" the problem I replaced 'catch' with 'sfind', so that we can conditionally call menu-unset only when the definition is present. Please try the following patch. I tested it with enabled/disabled beastie and loader_color over serial console. I would also like to get a review from Devin Teske to see if this change is acceptable. %%% Index: sys/boot/forth/loader.4th =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 --- sys/boot/forth/loader.4th (revision 229670) +++ sys/boot/forth/loader.4th (working copy) @@ -45,8 +45,10 @@ : try-menu-unset s" menu-unset" - ['] evaluate catch if - 2drop + sfind if + execute + else + drop then ; %%% [ It could be simplified with one-liner: s" menu-unset" sfind drop execute but ficl doesn't like this in a freestanding environment.] --=20 wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 22:58:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4264A106566C; Sun, 8 Jan 2012 22:58:57 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id C1E438FC0C; Sun, 8 Jan 2012 22:58:56 +0000 (UTC) Received: by iadj38 with SMTP id j38so8122654iad.13 for ; Sun, 08 Jan 2012 14:58:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=mtfRRB6QcW9ZHExqisZqZGBLTyJAdyG3HY4I6xndYl8=; b=f8JCaaNBmZW6I7WKZvFqZcZU/kk/2R8QhCQPuc4hO9TbfY90gFfcNe3LxdwdDZeKsa 2ItTAGfYcvEKop4y5vJUVYgH1vsOgUgsXC3FbwQIHDVHaAu29EAs0RgT6Gl5mScrpS2R 5I0K6lJyI91MhJRks+6DDfxy7Xu7d8RXUHsE8= MIME-Version: 1.0 Received: by 10.50.190.196 with SMTP id gs4mr16712731igc.14.1326063536504; Sun, 08 Jan 2012 14:58:56 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.42.243.65 with HTTP; Sun, 8 Jan 2012 14:58:56 -0800 (PST) In-Reply-To: <20120108104330.GC1674@garage.freebsd.pl> References: <201201080055.q080tMlJ063808@svn.freebsd.org> <20120108104330.GC1674@garage.freebsd.pl> Date: Sun, 8 Jan 2012 14:58:56 -0800 X-Google-Sender-Auth: wqJVW4mIpusncQ7KDB5RuY8vzRg Message-ID: From: Adrian Chadd To: Pawel Jakub Dawidek Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229800 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 22:58:57 -0000 On 8 January 2012 02:43, Pawel Jakub Dawidek wrote: > If someone is actually using GENERIC kernel. This change will break all > my system next time I upgrade. Adding UFS_ACL option to the kernel > config to make ZFS kernel module to work doesn't sound very intuitive. > > I understand what you are trying to accomplish, but we really need to > find better way to do this. Until then, could you back it out? I'd rather find a cleaner solution - it's pulling in code which just isn't being used if you aren't using UFS_ACL or ZFS. How about wrapping those two up in a module which zfs can register a dependency on? Adrian From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 23:06:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E934106566B; Sun, 8 Jan 2012 23:06:53 +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 696228FC13; Sun, 8 Jan 2012 23:06:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q08N6r2u011771; Sun, 8 Jan 2012 23:06:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q08N6rDQ011768; Sun, 8 Jan 2012 23:06:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201082306.q08N6rDQ011768@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 8 Jan 2012 23:06: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: r229828 - in head/sys: kern ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 23:06:53 -0000 Author: kib Date: Sun Jan 8 23:06:53 2012 New Revision: 229828 URL: http://svn.freebsd.org/changeset/base/229828 Log: Avoid LOR between vfs_busy() lock and covered vnode lock on quotaon(). The vfs_busy() is after covered vnode lock in the global lock order, but since quotaon() does recursive VFS call to open quota file, we usually end up locking covered vnode after mp is busied in sys_quotactl(). Change the interface of VFS_QUOTACTL(), requiring that mp was unbusied by fs code, and do not try to pick up vfs_busy() reference in ufs quotaon, esp. if vfs_busy cannot succeed due to unmount being performed. Reported and tested by: pho MFC after: 1 week Modified: head/sys/kern/vfs_syscalls.c head/sys/ufs/ufs/ufs_quota.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sun Jan 8 23:05:36 2012 (r229827) +++ head/sys/kern/vfs_syscalls.c Sun Jan 8 23:06:53 2012 (r229828) @@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + static MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); SDT_PROVIDER_DEFINE(vfs); @@ -212,7 +214,20 @@ sys_quotactl(td, uap) return (error); } error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg); - vfs_unbusy(mp); + + /* + * Since quota on operation typically needs to open quota + * file, the Q_QUOTAON handler needs to unbusy the mount point + * before calling into namei. Otherwise, unmount might be + * started between two vfs_busy() invocations (first is our, + * second is from mount point cross-walk code in lookup()), + * causing deadlock. + * + * Require that Q_QUOTAON handles the vfs_busy() reference on + * its own, always returning with ubusied mount point. + */ + if ((uap->cmd >> SUBCMDSHIFT) != Q_QUOTAON) + vfs_unbusy(mp); VFS_UNLOCK_GIANT(vfslocked); return (error); } Modified: head/sys/ufs/ufs/ufs_quota.c ============================================================================== --- head/sys/ufs/ufs/ufs_quota.c Sun Jan 8 23:05:36 2012 (r229827) +++ head/sys/ufs/ufs/ufs_quota.c Sun Jan 8 23:06:53 2012 (r229828) @@ -512,17 +512,29 @@ quotaon(struct thread *td, struct mount NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_USERSPACE, fname, td); flags = FREAD | FWRITE; + vfs_ref(mp); + vfs_unbusy(mp); error = vn_open(&nd, &flags, 0, NULL); - if (error) + if (error != 0) { + vfs_rel(mp); return (error); + } vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; - if (vp->v_type != VREG) { + error = vfs_busy(mp, MBF_NOWAIT); + vfs_rel(mp); + if (error == 0) { + if (vp->v_type != VREG) { + error = EACCES; + vfs_unbusy(mp); + } + } + if (error != 0) { VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); - return (EACCES); + return (error); } UFS_LOCK(ump); @@ -531,6 +543,7 @@ quotaon(struct thread *td, struct mount VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); + vfs_unbusy(mp); return (EALREADY); } ump->um_qflags[type] |= QTF_OPENING|QTF_CLOSING; @@ -542,6 +555,7 @@ quotaon(struct thread *td, struct mount UFS_UNLOCK(ump); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); + vfs_unbusy(mp); return (error); } VOP_UNLOCK(vp, 0); @@ -619,6 +633,7 @@ again: ("quotaon: leaking flags")); UFS_UNLOCK(ump); + vfs_unbusy(mp); return (error); } From owner-svn-src-head@FreeBSD.ORG Sun Jan 8 23:20:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9ED6106564A; Sun, 8 Jan 2012 23:20:02 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 566698FC08; Sun, 8 Jan 2012 23:20:02 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 73783635; Mon, 9 Jan 2012 00:20:00 +0100 (CET) Date: Mon, 9 Jan 2012 00:18:53 +0100 From: Pawel Jakub Dawidek To: Adrian Chadd Message-ID: <20120108231852.GB1654@garage.freebsd.pl> References: <201201080055.q080tMlJ063808@svn.freebsd.org> <20120108104330.GC1674@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wq9mPyueHGvFACwf" Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229800 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2012 23:20:02 -0000 --wq9mPyueHGvFACwf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 08, 2012 at 02:58:56PM -0800, Adrian Chadd wrote: > On 8 January 2012 02:43, Pawel Jakub Dawidek wrote: > > If someone is actually using GENERIC kernel. This change will break all > > my system next time I upgrade. Adding UFS_ACL option to the kernel > > config to make ZFS kernel module to work doesn't sound very intuitive. > > > > I understand what you are trying to accomplish, but we really need to > > find better way to do this. Until then, could you back it out? >=20 > I'd rather find a cleaner solution - it's pulling in code which just > isn't being used if you aren't using UFS_ACL or ZFS. >=20 > How about wrapping those two up in a module which zfs can register a > dependency on? This would be one weird module, but let's see:) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --wq9mPyueHGvFACwf Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8KJFwACgkQForvXbEpPzTGRQCfWyUjj9PpumAdjSrTGYOUyrmr 2kkAoOJYDqB4/bSArLOBfweUbxGW94VA =OSLa -----END PGP SIGNATURE----- --wq9mPyueHGvFACwf-- From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 00:48:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69126106564A; Mon, 9 Jan 2012 00:48:20 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 50C358FC08; Mon, 9 Jan 2012 00:48:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q090mKiH015081; Mon, 9 Jan 2012 00:48:20 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q090mKB6015074; Mon, 9 Jan 2012 00:48:20 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201090048.q090mKB6015074@svn.freebsd.org> From: Eitan Adler Date: Mon, 9 Jan 2012 00:48: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: r229831 - in head: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 00:48:20 -0000 Author: eadler (ports committer) Date: Mon Jan 9 00:48:19 2012 New Revision: 229831 URL: http://svn.freebsd.org/changeset/base/229831 Log: X11BASE has been deprecated for a long time and will die soon Approved by: x11 (eadler) Approved by: brucec MFC after: 1 week Modified: head/lib/libopie/config.h head/share/examples/diskless/README.TEMPLATING head/share/examples/ppp/ppp.linkdown.sample head/share/examples/printing/hpvf head/tools/tools/nanobsd/pcengines/Files/root/.cshrc head/usr.sbin/pkg_install/add/main.c Modified: head/lib/libopie/config.h ============================================================================== --- head/lib/libopie/config.h Sun Jan 8 23:30:23 2012 (r229830) +++ head/lib/libopie/config.h Mon Jan 9 00:48:19 2012 (r229831) @@ -54,7 +54,7 @@ /* #undef DOANONYMOUS */ /* The default value of the PATH environment variable */ -#define DEFAULT_PATH "/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin" +#define DEFAULT_PATH "/usr/bin:/bin:/usr/sbin:/sbin" /* Defined if the file /etc/default/login exists (and, presumably, should be looked at by login) */ Modified: head/share/examples/diskless/README.TEMPLATING ============================================================================== --- head/share/examples/diskless/README.TEMPLATING Sun Jan 8 23:30:23 2012 (r229830) +++ head/share/examples/diskless/README.TEMPLATING Mon Jan 9 00:48:19 2012 (r229831) @@ -94,8 +94,8 @@ be useful to set up clients and server f /usr/ports ( note 5 ) /usr/src ( note 5 ) /usr/local/crack ( note 5 ) - /usr/X11R6/lib/X11/xdm/xdm-errors ( note 6 ) - /usr/X11R6/lib/X11/xdm/xdm-pid ( note 6 ) + /usr/local/lib/X11/xdm/xdm-errors ( note 6 ) + /usr/local/lib/X11/xdm/xdm-pid ( note 6 ) /usr/local/etc/ssh_host_key ( note 6 ) /usr/local/etc/ssh_host_key.pub ( note 6 ) /usr/local/etc/ssh_random_seed ( note 6 ) @@ -120,7 +120,7 @@ be useful to set up clients and server f do not want to template such directories. note 6: Note that you can solve the problem of xdm and sshd creating - files in /usr. With xdm, edit /usr/X11R6/lib/xdm/xdm-config + files in /usr. With xdm, edit /usr/local/lib/xdm/xdm-config and change the errorLogFile and pidFile config lines. With sshd, add 'HostKey' and 'RandomSeed' directives to specify Modified: head/share/examples/ppp/ppp.linkdown.sample ============================================================================== --- head/share/examples/ppp/ppp.linkdown.sample Sun Jan 8 23:30:23 2012 (r229830) +++ head/share/examples/ppp/ppp.linkdown.sample Mon Jan 9 00:48:19 2012 (r229831) @@ -23,7 +23,7 @@ # ``auplay'' (assuming NAS is installed and configured). # MYADDR: - !bg /usr/X11R6/bin/auplay /etc/ppp/linkdown.au + !bg /usr/local/bin/auplay /etc/ppp/linkdown.au # If you're running ``ppp -auto -nat dynamic-nat-auto'', and are # assigned a dynamic IP number by the peer, this may be worth while Modified: head/share/examples/printing/hpvf ============================================================================== --- head/share/examples/printing/hpvf Sun Jan 8 23:30:23 2012 (r229830) +++ head/share/examples/printing/hpvf Mon Jan 9 00:48:19 2012 (r229831) @@ -1,10 +1,10 @@ #!/bin/sh # +# $FreeBSD$ +# # hpvf - Convert GIF files into HP/PCL, then print # Installed in /usr/local/libexec/hpvf -PATH=/usr/X11R6/bin:$PATH; export PATH - giftopnm | ppmtopgm | pgmtopbm | pbmtolj -resolution 300 \ && exit 0 \ || exit 2 Modified: head/tools/tools/nanobsd/pcengines/Files/root/.cshrc ============================================================================== --- head/tools/tools/nanobsd/pcengines/Files/root/.cshrc Sun Jan 8 23:30:23 2012 (r229830) +++ head/tools/tools/nanobsd/pcengines/Files/root/.cshrc Mon Jan 9 00:48:19 2012 (r229831) @@ -14,7 +14,7 @@ alias ll ls -lA # A righteous umask umask 22 -set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin $HOME/bin) +set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin) setenv EDITOR vi setenv PAGER more Modified: head/usr.sbin/pkg_install/add/main.c ============================================================================== --- head/usr.sbin/pkg_install/add/main.c Sun Jan 8 23:30:23 2012 (r229830) +++ head/usr.sbin/pkg_install/add/main.c Mon Jan 9 00:48:19 2012 (r229831) @@ -285,7 +285,7 @@ main(int argc, char **argv) } /* Make sure the sub-execs we invoke get found */ setenv("PATH", - "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin", + "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin", 1); /* Set a reasonable umask */ From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 02:22:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E53F106566B; Mon, 9 Jan 2012 02:22:27 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 1DEAB8FC12; Mon, 9 Jan 2012 02:22:26 +0000 (UTC) Received: from pps.filterd (ltcfislmsgpa05 [127.0.0.1]) by ltcfislmsgpa05.fnfis.com (8.14.4/8.14.4) with SMTP id q091QqDY028283; Sun, 8 Jan 2012 19:46:31 -0600 Received: from smtp.fisglobal.com ([10.132.206.17]) by ltcfislmsgpa05.fnfis.com with ESMTP id 127erq19hx-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Sun, 08 Jan 2012 19:46:31 -0600 Received: from [10.0.0.104] (10.14.152.28) by smtp.fisglobal.com (10.132.206.17) with Microsoft SMTP Server (TLS) id 14.1.323.3; Sun, 8 Jan 2012 19:46:29 -0600 MIME-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset="us-ascii" From: Devin Teske In-Reply-To: Date: Sun, 8 Jan 2012 17:46:27 -0800 Content-Transfer-Encoding: quoted-printable Message-ID: <2C0D66FB-4056-45FB-998C-4234C3E13B6F@fisglobal.com> References: <201112300624.pBU6OxO9098906@svn.freebsd.org> <4F08A518.8090207@FreeBSD.org> To: Sergey Kandaurov X-Mailer: Apple Mail (2.1084) X-Originating-IP: [10.14.152.28] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110, 1.0.211, 0.0.0000 definitions=2012-01-09_01:2012-01-06, 2012-01-09, 1970-01-01 signatures=0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric Subject: Re: svn commit: r228985 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 02:22:27 -0000 On Jan 8, 2012, at 12:35 PM, Sergey Kandaurov wrote: > On 8 January 2012 00:03, Dimitry Andric wrote: >> On 2011-12-30 07:24, Sergey Kandaurov wrote: >>>=20 >>> Author: pluknet >>> Date: Fri Dec 30 06:24:59 2011 >>> New Revision: 228985 >>> URL: http://svn.freebsd.org/changeset/base/228985 >>>=20 >>> Log: >>> Unset the environment variables associated with individual menu items >>> before invoking the kernel. >>=20 >>=20 >> When I did a single-user mode boot to install a new world, I saw the >> following warning on the (serial) console during boot: >>=20 >> /boot.config: -D -S115200 >> Consoles: internal video/keyboard serial port >> BIOS drive A: is disk0 >> BIOS drive C: is disk1 >> BIOS 638kB/3143616kB available memory >>=20 >> FreeBSD/x86 bootstrap loader, Revision 1.1 >> (dim@vm-freebsd10-amd64.home.andric.com, Sat Jan 7 01:05:07 CET 2012) >> Loading /boot/defaults/loader.conf >> /boot/kernel/kernel data=3D0xb73530 data=3D0x11dbe0+0x2b4db8 >> syms=3D[0x8+0xfd620+0x8+0xec6b6] >> - >> Hit [Enter] to boot immediately, or any other key for command prompt. >>=20 >>=20 >> Type '?' for a list of commands, 'help' for more detailed help. >> OK boot -s >> menu-unset not found <<-- what's this? >> GDB: no debug ports present >> KDB: debugger backends: ddb >> KDB: current backend: ddb >> [...kernel boots...] >>=20 >> E.g, it always gives a 'menu-unset not found' warning (or maybe it's an >> error, it's not clear). This was not the case before r228985. >>=20 >> I have almost no knowledge about forth, but it looks like this might be >> caused by the new try-menu-unset subroutine. >>=20 >> My loader.conf is just this: >>=20 >> beastie_disable=3D"YES" >> comconsole_speed=3D"115200" >> console=3D"comconsole vidconsole" >> kern.hz=3D"100" >=20 > So, the problem arise when beastie_disable is set. >=20 > In this case menu.rc is not evaluated and consequently menu-unset does > not have a body yet. This results in the ficl warning "not found" when > try-menu-unset calls menu-unset. The warning cannot be handled with catch > as seen with the code in head. > Otherwise, when beastie is enabled, all works as it should. >=20 > To "fix" the problem I replaced 'catch' with 'sfind', so that we can > conditionally call menu-unset only when the definition is present. >=20 > Please try the following patch. I tested it with enabled/disabled beastie > and loader_color over serial console. I would also like to get a review > from Devin Teske to see if this change is acceptable. >=20 > %%% > Index: sys/boot/forth/loader.4th > =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 > --- sys/boot/forth/loader.4th (revision 229670) > +++ sys/boot/forth/loader.4th (working copy) > @@ -45,8 +45,10 @@ >=20 > : try-menu-unset > s" menu-unset" > - ['] evaluate catch if > - 2drop > + sfind if > + execute > + else > + drop > then > ; >=20 > %%% >=20 I've reviewed the patch, but also submitted my solution as PR amd64/163938. However, I love your use of sfind -- it's perfect. Nice job! I'm incorporating your patch into my patch for PR amd64/163938 for posterit= y measures and historical archiving. Please review in a few moments after submission of my followup. > [ It could be simplified with one-liner: > s" menu-unset" sfind drop execute > but ficl doesn't like this in a freestanding environment.] >=20 Nah, multi-line is perfectly fine. --=20 Devin _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you. From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 04:27:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AA49106566B; Mon, 9 Jan 2012 04:27:33 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0961A8FC0C; Mon, 9 Jan 2012 04:27:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q094RWcB022315; Mon, 9 Jan 2012 04:27:32 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q094RWBc022313; Mon, 9 Jan 2012 04:27:32 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201201090427.q094RWBc022313@svn.freebsd.org> From: Warren Block Date: Mon, 9 Jan 2012 04:27: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: r229838 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 04:27:33 -0000 Author: wblock (doc committer) Date: Mon Jan 9 04:27:32 2012 New Revision: 229838 URL: http://svn.freebsd.org/changeset/base/229838 Log: Clarity improvements. Approved by: gjb (mentor) MFC after: 3 days Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Mon Jan 9 03:03:43 2012 (r229837) +++ head/sbin/geom/class/part/gpart.8 Mon Jan 9 04:27:32 2012 (r229838) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 21, 2011 +.Dd January 8, 2012 .Dt GPART 8 .Os .Sh NAME @@ -33,7 +33,7 @@ .Sh SYNOPSIS To add support for the disk partitioning GEOM class, place one or more of the following -lines in your kernel configuration file: +lines in the kernel configuration file: .Bd -ragged -offset indent .Cd "options GEOM_PART_APM" .Cd "options GEOM_PART_BSD" @@ -410,13 +410,13 @@ about its use. .El .\" ==== RESTORE ==== .It Cm restore -Restore the partition table from backup previously created by +Restore the partition table from a backup previously created by the .Cm backup -action and given from standard input. -Only partition table may be restored. -This action does not affect content of partitions. -This mean that you should copy your data from backup after restoring -partition table and write bootcode again if it is needed. +action and read from standard input. +Only the partition table is restored. +This action does not affect the content of partitions. +After restoring the partition table and writing bootcode if needed, +user data must be restored from backup. .Pp Additional options include: .Bl -tag -width 10n From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 05:51:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 818C4106564A; Mon, 9 Jan 2012 05:51:34 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7053E8FC14; Mon, 9 Jan 2012 05:51:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q095pYw6025350; Mon, 9 Jan 2012 05:51:34 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q095pYbN025348; Mon, 9 Jan 2012 05:51:34 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201201090551.q095pYbN025348@svn.freebsd.org> From: Warren Block Date: Mon, 9 Jan 2012 05:51: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: r229847 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 05:51:34 -0000 Author: wblock (doc committer) Date: Mon Jan 9 05:51:33 2012 New Revision: 229847 URL: http://svn.freebsd.org/changeset/base/229847 Log: Whitespace-only fix. Translators, please feel free to ignore. Approved by: gjb (mentor) MFC after: 3 days X-MFC-with: r227774, r227777, r227800 Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Mon Jan 9 04:59:47 2012 (r229846) +++ head/sbin/geom/class/part/gpart.8 Mon Jan 9 05:51:33 2012 (r229847) @@ -48,7 +48,8 @@ lines in the kernel configuration file: These options provide support for the various types of partitioning schemes supported by the .Ns Nm -utility. See +utility. +See .Sx "PARTITIONING SCHEMES" below for more details. .Pp @@ -502,8 +503,8 @@ Traditional BSD disklabel, usually used .Po This scheme can also be used as the sole partitioning method, without an MBR. -Partition editing tools from other operating systems often do not -understand the bare disklabel partition layout, so this is sometimes +Partition editing tools from other operating systems often do not +understand the bare disklabel partition layout, so this is sometimes called .Dq dangerously dedicated . .Pc From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 06:36:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FC01106566C; Mon, 9 Jan 2012 06:36:29 +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 0DF628FC15; Mon, 9 Jan 2012 06:36:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q096aSHN026737; Mon, 9 Jan 2012 06:36:28 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q096aSiu026731; Mon, 9 Jan 2012 06:36:28 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201090636.q096aSiu026731@svn.freebsd.org> From: Ed Schouten Date: Mon, 9 Jan 2012 06:36: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: r229848 - in head: include lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 06:36:29 -0000 Author: ed Date: Mon Jan 9 06:36:28 2012 New Revision: 229848 URL: http://svn.freebsd.org/changeset/base/229848 Log: Add aligned_alloc(3). The C11 folks reinvented the wheel by introducing an aligned version of malloc(3) called aligned_alloc(3), instead of posix_memalign(3). Instead of returning the allocation by reference, it returns the address, just like malloc(3). Reviewed by: jasone@ Added: head/lib/libc/stdlib/aligned_alloc.3 - copied, changed from r229786, head/lib/libc/stdlib/posix_memalign.3 Deleted: head/lib/libc/stdlib/posix_memalign.3 Modified: head/include/stdlib.h head/lib/libc/stdlib/Makefile.inc head/lib/libc/stdlib/Symbol.map head/lib/libc/stdlib/malloc.c Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Mon Jan 9 05:51:33 2012 (r229847) +++ head/include/stdlib.h Mon Jan 9 06:36:28 2012 (r229848) @@ -152,6 +152,7 @@ _Noreturn void _Exit(int); * If we're in a mode greater than C99, expose C11 functions. */ #if __ISO_C_VISIBLE >= 2011 +void * aligned_alloc(size_t, size_t); int at_quick_exit(void (*)(void)); _Noreturn void quick_exit(int); Modified: head/lib/libc/stdlib/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/Makefile.inc Mon Jan 9 05:51:33 2012 (r229847) +++ head/lib/libc/stdlib/Makefile.inc Mon Jan 9 06:36:28 2012 (r229848) @@ -18,17 +18,18 @@ SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map # machine-dependent stdlib sources .sinclude "${.CURDIR}/${LIBC_ARCH}/stdlib/Makefile.inc" -MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 \ - at_quick_exit.3 bsearch.3 \ +MAN+= a64l.3 abort.3 abs.3 aligned_alloc.3 alloca.3 atexit.3 atof.3 \ + atoi.3 atol.3 at_quick_exit.3 bsearch.3 \ div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \ hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \ - lsearch.3 malloc.3 memory.3 posix_memalign.3 ptsname.3 qsort.3 \ + lsearch.3 malloc.3 memory.3 ptsname.3 qsort.3 \ quick_exit.3 \ radixsort.3 rand.3 random.3 \ realpath.3 strfmon.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 \ tsearch.3 MLINKS+=a64l.3 l64a.3 a64l.3 l64a_r.3 +MLINKS+=aligned_alloc.3 posix_memalign.3 MLINKS+=atol.3 atoll.3 MLINKS+=exit.3 _Exit.3 MLINKS+=getenv.3 putenv.3 getenv.3 setenv.3 getenv.3 unsetenv.3 Modified: head/lib/libc/stdlib/Symbol.map ============================================================================== --- head/lib/libc/stdlib/Symbol.map Mon Jan 9 05:51:33 2012 (r229847) +++ head/lib/libc/stdlib/Symbol.map Mon Jan 9 06:36:28 2012 (r229848) @@ -93,6 +93,7 @@ FBSD_1.0 { }; FBSD_1.3 { + aligned_alloc; at_quick_exit; atof_l; atoi_l; Copied and modified: head/lib/libc/stdlib/aligned_alloc.3 (from r229786, head/lib/libc/stdlib/posix_memalign.3) ============================================================================== --- head/lib/libc/stdlib/posix_memalign.3 Sat Jan 7 16:16:13 2012 (r229786, copy source) +++ head/lib/libc/stdlib/aligned_alloc.3 Mon Jan 9 06:36:28 2012 (r229848) @@ -27,26 +27,35 @@ .\" .\" $FreeBSD$ .\" -.Dd January 11, 2006 -.Dt POSIX_MEMALIGN 3 +.Dd January 7, 2011 +.Dt ALIGNED_ALLOC 3 .Os .Sh NAME +.Nm aligned_alloc , .Nm posix_memalign .Nd aligned memory allocation .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In stdlib.h +.Ft void * +.Fn aligned_alloc "size_t alignment" "size_t size" .Ft int .Fn posix_memalign "void **ptr" "size_t alignment" "size_t size" .Sh DESCRIPTION The +.Fn aligned_alloc +and .Fn posix_memalign -function allocates +functions allocate .Fa size bytes of memory such that the allocation's base address is an even multiple of -.Fa alignment , -and returns the allocation in the value pointed to by +.Fa alignment . +The +.Fn aligned_alloc +function returns the allocation, while the +.Fn posix_memalign +function stores the allocation in the value pointed to by .Fa ptr . .Pp The requested @@ -55,6 +64,8 @@ must be a power of 2 at least as large a .Fn sizeof "void *" . .Pp Memory that is allocated via +.Fn aligned_alloc +and .Fn posix_memalign can be used as an argument in subsequent calls to .Xr realloc 3 , @@ -63,12 +74,21 @@ and .Xr free 3 . .Sh RETURN VALUES The +.Fn aligned_alloc +function returns a pointer to the allocation if successful; otherwise a +NULL pointer is returned and +.Va errno +is set to an error value. +.Pp +The .Fn posix_memalign function returns the value 0 if successful; otherwise it returns an error value. .Sh ERRORS The +.Fn aligned_alloc +and .Fn posix_memalign -function will fail if: +functions will fail if: .Bl -tag -width Er .It Bq Er EINVAL The @@ -86,6 +106,11 @@ Memory allocation error. .Xr valloc 3 .Sh STANDARDS The +.Fn aligned_alloc +function conforms to +.St -isoC-2011 . +.Pp +The .Fn posix_memalign function conforms to .St -p1003.1-2001 . @@ -94,3 +119,8 @@ The .Fn posix_memalign function first appeared in .Fx 7.0 . +.Pp +The +.Fn aligned_alloc +function first appeared in +.Fx 10.0 . Modified: head/lib/libc/stdlib/malloc.c ============================================================================== --- head/lib/libc/stdlib/malloc.c Mon Jan 9 05:51:33 2012 (r229847) +++ head/lib/libc/stdlib/malloc.c Mon Jan 9 06:36:28 2012 (r229848) @@ -6043,6 +6043,20 @@ RETURN: } void * +aligned_alloc(size_t alignment, size_t size) +{ + void *memptr; + int ret; + + ret = posix_memalign(&memptr, alignment, size); + if (ret != 0) { + errno = ret; + return (NULL); + } + return (memptr); +} + +void * calloc(size_t num, size_t size) { void *ret; From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 08:36:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7AC5106564A; Mon, 9 Jan 2012 08:36:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A63EE8FC08; Mon, 9 Jan 2012 08:36:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q098aC0h030610; Mon, 9 Jan 2012 08:36:12 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q098aCTI030608; Mon, 9 Jan 2012 08:36:12 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201090836.q098aCTI030608@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 9 Jan 2012 08:36: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: r229849 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 08:36:12 -0000 Author: glebius Date: Mon Jan 9 08:36:12 2012 New Revision: 229849 URL: http://svn.freebsd.org/changeset/base/229849 Log: o Fix panic on module unload, that happened due to mutex being destroyed prior to pfsync_uninit(). To do this, move all the initialization to the module_t method, instead of SYSINIT(9). o Fix another panic after module unload, due to not clearing the m_addr_chg_pf_p pointer. o Refuse to unload module, unless being unloaded forcibly. o Revert the sub argument to MODULE_DECLARE, to the stable/8 value. This change probably isn't correct from viewpoint of VIMAGE, but the module wasn't VIMAGE-correct before the change, as well. Glanced at by: bz Modified: head/sys/contrib/pf/net/pf_ioctl.c Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Mon Jan 9 06:36:28 2012 (r229848) +++ head/sys/contrib/pf/net/pf_ioctl.c Mon Jan 9 08:36:12 2012 (r229849) @@ -4328,57 +4328,25 @@ dehook_pf(void) return (0); } -/* Vnet accessors */ -static int -vnet_pf_init(const void *unused) -{ - - V_pf_pfil_hooked = 0; - V_pf_end_threads = 0; - - V_debug_pfugidhack = 0; - - TAILQ_INIT(&V_pf_tags); - TAILQ_INIT(&V_pf_qids); - - pf_load(); - - return (0); -} - -static int -vnet_pf_uninit(const void *unused) -{ - - pf_unload(); - - return (0); -} - -/* Define startup order. */ -#define PF_SYSINIT_ORDER SI_SUB_PROTO_BEGIN -#define PF_MODEVENT_ORDER (SI_ORDER_FIRST) /* On boot slot in here. */ -#define PF_VNET_ORDER (PF_MODEVENT_ORDER + 2) /* Later still. */ - -/* - * Starting up. - * VNET_SYSINIT is called for each existing vnet and each new vnet. - */ -VNET_SYSINIT(vnet_pf_init, PF_SYSINIT_ORDER, PF_VNET_ORDER, - vnet_pf_init, NULL); - -/* - * Closing up shop. These are done in REVERSE ORDER, - * Not called on reboot. - * VNET_SYSUNINIT is called for each exiting vnet as it exits. - */ -VNET_SYSUNINIT(vnet_pf_uninit, PF_SYSINIT_ORDER, PF_VNET_ORDER, - vnet_pf_uninit, NULL); - static int pf_load(void) { + VNET_ITERATOR_DECL(vnet_iter); + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + V_pf_pfil_hooked = 0; + V_pf_end_threads = 0; + V_debug_pfugidhack = 0; + TAILQ_INIT(&V_pf_tags); + TAILQ_INIT(&V_pf_qids); + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK(); + + init_pf_mutex(); + pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); init_zone_var(); sx_init(&V_pf_consistency_lock, "pf_statetbl_lock"); if (pfattach() < 0) @@ -4395,6 +4363,7 @@ pf_unload(void) PF_LOCK(); V_pf_status.running = 0; PF_UNLOCK(); + m_addr_chg_pf_p = NULL; error = dehook_pf(); if (error) { /* @@ -4417,6 +4386,8 @@ pf_unload(void) pf_osfp_cleanup(); cleanup_pf_zone(); PF_UNLOCK(); + destroy_dev(pf_dev); + destroy_pf_mutex(); sx_destroy(&V_pf_consistency_lock); return error; } @@ -4428,12 +4399,16 @@ pf_modevent(module_t mod, int type, void switch(type) { case MOD_LOAD: - init_pf_mutex(); - pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); + error = pf_load(); + break; + case MOD_QUIESCE: + /* + * Module should not be unloaded due to race conditions. + */ + error = EPERM; break; case MOD_UNLOAD: - destroy_dev(pf_dev); - destroy_pf_mutex(); + error = pf_unload(); break; default: error = EINVAL; @@ -4448,6 +4423,6 @@ static moduledata_t pf_mod = { 0 }; -DECLARE_MODULE(pf, pf_mod, SI_SUB_PSEUDO, SI_ORDER_FIRST); +DECLARE_MODULE(pf, pf_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST); MODULE_VERSION(pf, PF_MODVER); #endif /* __FreeBSD__ */ From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 08:50:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 582EA106567A; Mon, 9 Jan 2012 08:50:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 459238FC1A; Mon, 9 Jan 2012 08:50:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q098oNka031483; Mon, 9 Jan 2012 08:50:23 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q098oNme031479; Mon, 9 Jan 2012 08:50:23 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201090850.q098oNme031479@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 9 Jan 2012 08:50: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: r229850 - in head: etc/rc.d sys/contrib/pf/net sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 08:50:23 -0000 Author: glebius Date: Mon Jan 9 08:50:22 2012 New Revision: 229850 URL: http://svn.freebsd.org/changeset/base/229850 Log: Bunch of fixes to pfsync(4) module load/unload: o Make the pfsync.ko actually usable. Before this change loading it didn't register protosw, so was a nop. However, a module /boot/kernel did confused users. o Rewrite the way we are joining multicast group: - Move multicast initialization/destruction to separate functions. - Don't allocate memory if we aren't going to join a multicast group. - Use modern API for joining/leaving multicast group. - Now the utterly wrong pfsync_ifdetach() isn't needed. o Move module initialization from SYSINIT(9) to moduledata_t method. o Refuse to unload module, unless asked forcibly. o Improve a bit some FreeBSD porting code: - Use separate malloc type. - Simplify swi sheduling. This change is probably wrong from VIMAGE viewpoint, however pfsync wasn't VIMAGE-correct before this change, too. Glanced at by: bz Modified: head/etc/rc.d/pfsync head/sys/contrib/pf/net/if_pfsync.c head/sys/netinet/in_proto.c Modified: head/etc/rc.d/pfsync ============================================================================== --- head/etc/rc.d/pfsync Mon Jan 9 08:36:12 2012 (r229849) +++ head/etc/rc.d/pfsync Mon Jan 9 08:50:22 2012 (r229850) @@ -18,13 +18,6 @@ required_modules="pf" pfsync_prestart() { - # XXX Currently pfsync cannot be a module as it must register - # a network protocol in a static kernel table. - if ! kldstat -q -m pfsync; then - warn "pfsync(4) must be statically compiled in the kernel." - return 1 - fi - case "$pfsync_syncdev" in '') warn "pfsync_syncdev is not set." Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 08:36:12 2012 (r229849) +++ head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 08:50:22 2012 (r229850) @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #else #include #include @@ -295,21 +296,25 @@ struct pfsync_softc { #else struct timeout sc_tmo; #endif -#ifdef __FreeBSD__ - eventhandler_tag sc_detachtag; -#endif - }; #ifdef __FreeBSD__ +static MALLOC_DEFINE(M_PFSYNC, "pfsync", "pfsync data"); static VNET_DEFINE(struct pfsync_softc *, pfsyncif) = NULL; #define V_pfsyncif VNET(pfsyncif) - +static VNET_DEFINE(void *, pfsync_swi_cookie) = NULL; +#define V_pfsync_swi_cookie VNET(pfsync_swi_cookie) static VNET_DEFINE(struct pfsyncstats, pfsyncstats); #define V_pfsyncstats VNET(pfsyncstats) static VNET_DEFINE(int, pfsync_carp_adj) = CARP_MAXSKEW; #define V_pfsync_carp_adj VNET(pfsync_carp_adj) +static void pfsyncintr(void *); +static int pfsync_multicast_setup(struct pfsync_softc *); +static void pfsync_multicast_cleanup(struct pfsync_softc *); +static int pfsync_init(void); +static void pfsync_uninit(void); + SYSCTL_NODE(_net, OID_AUTO, pfsync, CTLFLAG_RW, 0, "PFSYNC"); SYSCTL_VNET_STRUCT(_net_pfsync, OID_AUTO, stats, CTLFLAG_RW, &VNET_NAME(pfsyncstats), pfsyncstats, @@ -322,16 +327,6 @@ struct pfsyncstats pfsyncstats; #define V_pfsyncstats pfsyncstats #endif -#ifdef __FreeBSD__ -static void pfsyncintr(void *); -struct pfsync_swi { - void * pfsync_swi_cookie; -}; -static struct pfsync_swi pfsync_swi; -#define schednetisr(p) swi_sched(pfsync_swi.pfsync_swi_cookie, 0) -#define NETISR_PFSYNC -#endif - void pfsyncattach(int); #ifdef __FreeBSD__ int pfsync_clone_create(struct if_clone *, int, caddr_t); @@ -377,8 +372,6 @@ void pfsync_bulk_update(void *); void pfsync_bulk_fail(void *); #ifdef __FreeBSD__ -void pfsync_ifdetach(void *, struct ifnet *); - /* XXX: ugly */ #define betoh64 (unsigned long long)be64toh #define timeout_del callout_stop @@ -390,6 +383,10 @@ int pfsync_sync_ok; #endif #ifdef __FreeBSD__ +VNET_DEFINE(struct ifc_simple_data, pfsync_cloner_data); +VNET_DEFINE(struct if_clone, pfsync_cloner); +#define V_pfsync_cloner_data VNET(pfsync_cloner_data) +#define V_pfsync_cloner VNET(pfsync_cloner) IFC_SIMPLE_DECLARE(pfsync, 1); #else struct if_clone pfsync_cloner = @@ -415,25 +412,20 @@ pfsync_clone_create(struct if_clone *ifc if (unit != 0) return (EINVAL); -#ifndef __FreeBSD__ +#ifdef __FreeBSD__ + sc = malloc(sizeof(struct pfsync_softc), M_PFSYNC, M_WAITOK | M_ZERO); + sc->pfsync_sync_ok = 1; +#else pfsync_sync_ok = 1; + sc = malloc(sizeof(*pfsyncif), M_DEVBUF, M_NOWAIT | M_ZERO); #endif - sc = malloc(sizeof(struct pfsync_softc), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc == NULL) - return (ENOMEM); - for (q = 0; q < PFSYNC_S_COUNT; q++) TAILQ_INIT(&sc->sc_qs[q]); #ifdef __FreeBSD__ - sc->pfsync_sync_ok = 1; - sc->sc_pool = uma_zcreate("pfsync", PFSYNC_PLSIZE, - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - if (sc->sc_pool == NULL) { - free(sc, M_DEVBUF); - return (ENOMEM); - } + sc->sc_pool = uma_zcreate("pfsync", PFSYNC_PLSIZE, NULL, NULL, NULL, + NULL, UMA_ALIGN_PTR, 0); #else pool_init(&sc->sc_pool, PFSYNC_PLSIZE, 0, 0, 0, "pfsync", NULL); #endif @@ -446,13 +438,7 @@ pfsync_clone_create(struct if_clone *ifc sc->sc_len = PFSYNC_MINPKT; sc->sc_maxupdates = 128; -#ifdef __FreeBSD__ - sc->sc_imo.imo_membership = (struct in_multi **)malloc( - (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_DEVBUF, - M_NOWAIT | M_ZERO); - sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS; - sc->sc_imo.imo_multicast_vif = -1; -#else +#ifndef __FreeBSD__ sc->sc_imo.imo_membership = (struct in_multi **)malloc( (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS, M_WAITOK | M_ZERO); @@ -462,26 +448,11 @@ pfsync_clone_create(struct if_clone *ifc #ifdef __FreeBSD__ ifp = sc->sc_ifp = if_alloc(IFT_PFSYNC); if (ifp == NULL) { - free(sc->sc_imo.imo_membership, M_DEVBUF); uma_zdestroy(sc->sc_pool); - free(sc, M_DEVBUF); + free(sc, M_PFSYNC); return (ENOSPC); } if_initname(ifp, ifc->ifc_name, unit); - - sc->sc_detachtag = EVENTHANDLER_REGISTER(ifnet_departure_event, -#ifdef __FreeBSD__ - pfsync_ifdetach, V_pfsyncif, EVENTHANDLER_PRI_ANY); -#else - pfsync_ifdetach, pfsyncif, EVENTHANDLER_PRI_ANY); -#endif - if (sc->sc_detachtag == NULL) { - if_free(ifp); - free(sc->sc_imo.imo_membership, M_DEVBUF); - uma_zdestroy(sc->sc_pool); - free(sc, M_DEVBUF); - return (ENOSPC); - } #else ifp = &sc->sc_if; snprintf(ifp->if_xname, sizeof ifp->if_xname, "pfsync%d", unit); @@ -540,7 +511,6 @@ pfsync_clone_destroy(struct ifnet *ifp) struct pfsync_softc *sc = ifp->if_softc; #ifdef __FreeBSD__ - EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->sc_detachtag); PF_LOCK(); #endif timeout_del(&sc->sc_bulkfail_tmo); @@ -573,11 +543,13 @@ pfsync_clone_destroy(struct ifnet *ifp) #endif #ifdef __FreeBSD__ if_free(ifp); - free(sc->sc_imo.imo_membership, M_DEVBUF); + if (sc->sc_imo.imo_membership) + pfsync_multicast_cleanup(sc); + free(sc, M_PFSYNC); #else free(sc->sc_imo.imo_membership, M_IPMOPTS); -#endif free(sc, M_DEVBUF); +#endif #ifdef __FreeBSD__ V_pfsyncif = NULL; @@ -1886,12 +1858,15 @@ pfsyncioctl(struct ifnet *ifp, u_long cm sc->sc_sync_if = NULL; #ifdef __FreeBSD__ PF_UNLOCK(); -#endif + if (imo->imo_membership) + pfsync_multicast_cleanup(sc); +#else if (imo->imo_num_memberships > 0) { in_delmulti(imo->imo_membership[ --imo->imo_num_memberships]); imo->imo_multicast_ifp = NULL; } +#endif break; } @@ -1916,57 +1891,53 @@ pfsyncioctl(struct ifnet *ifp, u_long cm pfsync_sendout(); sc->sc_sync_if = sifp; - if (imo->imo_num_memberships > 0) { #ifdef __FreeBSD__ + if (imo->imo_membership) { PF_UNLOCK(); -#endif - in_delmulti(imo->imo_membership[--imo->imo_num_memberships]); -#ifdef __FreeBSD__ + pfsync_multicast_cleanup(sc); PF_LOCK(); -#endif + } +#else + if (imo->imo_num_memberships > 0) { + in_delmulti(imo->imo_membership[--imo->imo_num_memberships]); imo->imo_multicast_ifp = NULL; } +#endif - if (sc->sc_sync_if && #ifdef __FreeBSD__ + if (sc->sc_sync_if && sc->sc_sync_peer.s_addr == htonl(INADDR_PFSYNC_GROUP)) { + PF_UNLOCK(); + error = pfsync_multicast_setup(sc); + if (error) + return (error); + PF_LOCK(); + } #else + if (sc->sc_sync_if && sc->sc_sync_peer.s_addr == INADDR_PFSYNC_GROUP) { -#endif struct in_addr addr; if (!(sc->sc_sync_if->if_flags & IFF_MULTICAST)) { sc->sc_sync_if = NULL; -#ifdef __FreeBSD__ - PF_UNLOCK(); -#endif splx(s); return (EADDRNOTAVAIL); } -#ifdef __FreeBSD__ - addr.s_addr = htonl(INADDR_PFSYNC_GROUP); -#else addr.s_addr = INADDR_PFSYNC_GROUP; -#endif -#ifdef __FreeBSD__ - PF_UNLOCK(); -#endif if ((imo->imo_membership[0] = in_addmulti(&addr, sc->sc_sync_if)) == NULL) { sc->sc_sync_if = NULL; splx(s); return (ENOBUFS); } -#ifdef __FreeBSD__ - PF_LOCK(); -#endif imo->imo_num_memberships++; imo->imo_multicast_ifp = sc->sc_sync_if; imo->imo_multicast_ttl = PFSYNC_DFLTTL; imo->imo_multicast_loop = 0; } +#endif /* !__FreeBSD__ */ ip = &sc->sc_template; bzero(ip, sizeof(*ip)); @@ -2365,7 +2336,7 @@ pfsync_sendout(void) sc->sc_len = PFSYNC_MINPKT; IFQ_ENQUEUE(&sc->sc_ifp->if_snd, m, dummy_error); - schednetisr(NETISR_PFSYNC); + swi_sched(V_pfsync_swi_cookie, 0); #else sc->sc_if.if_opackets++; sc->sc_if.if_obytes += m->m_pkthdr.len; @@ -3342,54 +3313,91 @@ pfsync_sysctl(int *name, u_int namelen, } #ifdef __FreeBSD__ -void -pfsync_ifdetach(void *arg, struct ifnet *ifp) +static int +pfsync_multicast_setup(struct pfsync_softc *sc) { - struct pfsync_softc *sc = (struct pfsync_softc *)arg; - struct ip_moptions *imo; - - if (sc == NULL || sc->sc_sync_if != ifp) - return; /* not for us; unlocked read */ + struct ip_moptions *imo = &sc->sc_imo; + int error; - CURVNET_SET(sc->sc_ifp->if_vnet); + if (!(sc->sc_sync_if->if_flags & IFF_MULTICAST)) { + sc->sc_sync_if = NULL; + return (EADDRNOTAVAIL); + } - PF_LOCK(); + imo->imo_membership = (struct in_multi **)malloc( + (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_PFSYNC, + M_WAITOK | M_ZERO); + imo->imo_max_memberships = IP_MIN_MEMBERSHIPS; + imo->imo_multicast_vif = -1; - /* Deal with a member interface going away from under us. */ - sc->sc_sync_if = NULL; - imo = &sc->sc_imo; - if (imo->imo_num_memberships > 0) { - KASSERT(imo->imo_num_memberships == 1, - ("%s: imo_num_memberships != 1", __func__)); - /* - * Our event handler is always called after protocol - * domains have been detached from the underlying ifnet. - * Do not call in_delmulti(); we held a single reference - * which the protocol domain has purged in in_purgemaddrs(). - */ - PF_UNLOCK(); - imo->imo_membership[--imo->imo_num_memberships] = NULL; - PF_LOCK(); - imo->imo_multicast_ifp = NULL; - } + if ((error = in_joingroup(sc->sc_sync_if, &sc->sc_sync_peer, NULL, + &imo->imo_membership[0])) != 0) { + free(imo->imo_membership, M_PFSYNC); + return (error); + } + imo->imo_num_memberships++; + imo->imo_multicast_ifp = sc->sc_sync_if; + imo->imo_multicast_ttl = PFSYNC_DFLTTL; + imo->imo_multicast_loop = 0; - PF_UNLOCK(); - - CURVNET_RESTORE(); + return (0); } +static void +pfsync_multicast_cleanup(struct pfsync_softc *sc) +{ + struct ip_moptions *imo = &sc->sc_imo; + + in_leavegroup(imo->imo_membership[0], NULL); + free(imo->imo_membership, M_PFSYNC); + imo->imo_membership = NULL; + imo->imo_multicast_ifp = NULL; +} + +#ifdef INET +extern struct domain inetdomain; +static struct protosw in_pfsync_protosw = { + .pr_type = SOCK_RAW, + .pr_domain = &inetdomain, + .pr_protocol = IPPROTO_PFSYNC, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_input = pfsync_input, + .pr_output = (pr_output_t *)rip_output, + .pr_ctloutput = rip_ctloutput, + .pr_usrreqs = &rip_usrreqs +}; +#endif + static int -vnet_pfsync_init(const void *unused) +pfsync_init() { + VNET_ITERATOR_DECL(vnet_iter); int error = 0; - pfsyncattach(0); - - error = swi_add(NULL, "pfsync", pfsyncintr, V_pfsyncif, - SWI_NET, INTR_MPSAFE, &pfsync_swi.pfsync_swi_cookie); + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + V_pfsync_cloner = pfsync_cloner; + V_pfsync_cloner_data = pfsync_cloner_data; + V_pfsync_cloner.ifc_data = &V_pfsync_cloner_data; + if_clone_attach(&V_pfsync_cloner); + error = swi_add(NULL, "pfsync", pfsyncintr, V_pfsyncif, + SWI_NET, INTR_MPSAFE, &V_pfsync_swi_cookie); + CURVNET_RESTORE(); + if (error) + goto fail_locked; + } + VNET_LIST_RUNLOCK(); +#ifdef INET + error = pf_proto_register(PF_INET, &in_pfsync_protosw); if (error) - panic("%s: swi_add %d", __func__, error); - + goto fail; + error = ipproto_register(IPPROTO_PFSYNC); + if (error) { + pf_proto_unregister(PF_INET, IPPROTO_PFSYNC, SOCK_RAW); + goto fail; + } +#endif PF_LOCK(); pfsync_state_import_ptr = pfsync_state_import; pfsync_up_ptr = pfsync_up; @@ -3402,13 +3410,27 @@ vnet_pfsync_init(const void *unused) PF_UNLOCK(); return (0); + +fail: + VNET_LIST_RLOCK(); +fail_locked: + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + if (V_pfsync_swi_cookie) { + swi_remove(V_pfsync_swi_cookie); + if_clone_detach(&V_pfsync_cloner); + } + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK(); + + return (error); } -static int -vnet_pfsync_uninit(const void *unused) +static void +pfsync_uninit() { - - swi_remove(pfsync_swi.pfsync_swi_cookie); + VNET_ITERATOR_DECL(vnet_iter); PF_LOCK(); pfsync_state_import_ptr = NULL; @@ -3421,30 +3443,18 @@ vnet_pfsync_uninit(const void *unused) pfsync_defer_ptr = NULL; PF_UNLOCK(); - if_clone_detach(&pfsync_cloner); - - return (0); + ipproto_unregister(IPPROTO_PFSYNC); + pf_proto_unregister(PF_INET, IPPROTO_PFSYNC, SOCK_RAW); + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + swi_remove(V_pfsync_swi_cookie); + if_clone_detach(&V_pfsync_cloner); + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK(); } -/* Define startup order. */ -#define PFSYNC_SYSINIT_ORDER SI_SUB_PROTO_IF -#define PFSYNC_MODEVENT_ORDER (SI_ORDER_FIRST) /* On boot slot in here. */ -#define PFSYNC_VNET_ORDER (PFSYNC_MODEVENT_ORDER + 2) /* Later still. */ - -/* - * Starting up. - * VNET_SYSINIT is called for each existing vnet and each new vnet. - */ -VNET_SYSINIT(vnet_pfsync_init, PFSYNC_SYSINIT_ORDER, PFSYNC_VNET_ORDER, - vnet_pfsync_init, NULL); - -/* - * Closing up shop. These are done in REVERSE ORDER, - * Not called on reboot. - * VNET_SYSUNINIT is called for each exiting vnet as it exits. - */ -VNET_SYSUNINIT(vnet_pfsync_uninit, PFSYNC_SYSINIT_ORDER, PFSYNC_VNET_ORDER, - vnet_pfsync_uninit, NULL); static int pfsync_modevent(module_t mod, int type, void *data) { @@ -3452,21 +3462,23 @@ pfsync_modevent(module_t mod, int type, switch (type) { case MOD_LOAD: -#ifndef __FreeBSD__ - pfsyncattach(0); -#endif + error = pfsync_init(); + break; + case MOD_QUIESCE: + /* + * Module should not be unloaded due to race conditions. + */ + error = EPERM; break; case MOD_UNLOAD: -#ifndef __FreeBSD__ - if_clone_detach(&pfsync_cloner); -#endif + pfsync_uninit(); break; default: error = EINVAL; break; } - return error; + return (error); } static moduledata_t pfsync_mod = { @@ -3477,7 +3489,7 @@ static moduledata_t pfsync_mod = { #define PFSYNC_MODVER 1 -DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); MODULE_VERSION(pfsync, PFSYNC_MODVER); MODULE_DEPEND(pfsync, pf, PF_MODVER, PF_MODVER, PF_MODVER); #endif /* __FreeBSD__ */ Modified: head/sys/netinet/in_proto.c ============================================================================== --- head/sys/netinet/in_proto.c Mon Jan 9 08:36:12 2012 (r229849) +++ head/sys/netinet/in_proto.c Mon Jan 9 08:50:22 2012 (r229850) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ipsec.h" #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_pf.h" #include "opt_sctp.h" #include "opt_mpath.h" @@ -101,11 +100,6 @@ static struct pr_usrreqs nousrreqs; #include #endif /* SCTP */ -#ifdef DEV_PFSYNC -#include -#include -#endif - FEATURE(inet, "Internet Protocol version 4"); extern struct domain inetdomain; @@ -317,17 +311,6 @@ struct protosw inetsw[] = { .pr_ctloutput = rip_ctloutput, .pr_usrreqs = &rip_usrreqs }, -#ifdef DEV_PFSYNC -{ - .pr_type = SOCK_RAW, - .pr_domain = &inetdomain, - .pr_protocol = IPPROTO_PFSYNC, - .pr_flags = PR_ATOMIC|PR_ADDR, - .pr_input = pfsync_input, - .pr_ctloutput = rip_ctloutput, - .pr_usrreqs = &rip_usrreqs -}, -#endif /* DEV_PFSYNC */ /* Spacer n-times for loadable protocols. */ IPPROTOSPACER, IPPROTOSPACER, @@ -397,6 +380,3 @@ SYSCTL_NODE(_net_inet, IPPROTO_IPCOMP, i SYSCTL_NODE(_net_inet, IPPROTO_IPIP, ipip, CTLFLAG_RW, 0, "IPIP"); #endif /* IPSEC */ SYSCTL_NODE(_net_inet, IPPROTO_RAW, raw, CTLFLAG_RW, 0, "RAW"); -#ifdef DEV_PFSYNC -SYSCTL_NODE(_net_inet, IPPROTO_PFSYNC, pfsync, CTLFLAG_RW, 0, "PFSYNC"); -#endif From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 08:55:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 6C1E01065670; Mon, 9 Jan 2012 08:55:08 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 67AB614ED6F; Mon, 9 Jan 2012 08:55:07 +0000 (UTC) Message-ID: <4F0AAB6A.7090606@FreeBSD.org> Date: Mon, 09 Jan 2012 00:55:06 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Konstantin Belousov References: <201201082306.q08N6rDQ011768@svn.freebsd.org> In-Reply-To: <201201082306.q08N6rDQ011768@svn.freebsd.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229828 - in head/sys: kern ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 08:55:08 -0000 On 01/08/2012 15:06, Konstantin Belousov wrote: > Author: kib > Date: Sun Jan 8 23:06:53 2012 > New Revision: 229828 > URL: http://svn.freebsd.org/changeset/base/229828 > > Log: > Avoid LOR between vfs_busy() lock and covered vnode lock on quotaon(). Does this mean that if we turn witness back on the ever-present VFS LORs will no longer be there, or does this only affect calls to quotaon()? Doug -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 08:55:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A2C11065678; Mon, 9 Jan 2012 08:55:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F39F8FC1E; Mon, 9 Jan 2012 08:55:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q098tNPB031685; Mon, 9 Jan 2012 08:55:23 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q098tNhk031681; Mon, 9 Jan 2012 08:55:23 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201090855.q098tNhk031681@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 9 Jan 2012 08:55: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: r229851 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 08:55:24 -0000 Author: glebius Date: Mon Jan 9 08:55:23 2012 New Revision: 229851 URL: http://svn.freebsd.org/changeset/base/229851 Log: In FreeBSD we determine presence of pfsync(4) at run-time, not at compile time, so define NPFSYNC to 1 always. While here, remove unused defines. Modified: head/sys/contrib/pf/net/if_pfsync.c head/sys/contrib/pf/net/pf.c head/sys/contrib/pf/net/pf_ioctl.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 08:50:22 2012 (r229850) +++ head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 08:55:23 2012 (r229851) @@ -59,12 +59,6 @@ __FBSDID("$FreeBSD$"); #define NBPFILTER 1 - -#ifdef DEV_PFSYNC -#define NPFSYNC DEV_PFSYNC -#else -#define NPFSYNC 0 -#endif #endif /* __FreeBSD__ */ #include Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Mon Jan 9 08:50:22 2012 (r229850) +++ head/sys/contrib/pf/net/pf.c Mon Jan 9 08:55:23 2012 (r229851) @@ -47,23 +47,7 @@ __FBSDID("$FreeBSD$"); #include "opt_bpf.h" #include "opt_pf.h" -#ifdef DEV_BPF -#define NBPFILTER DEV_BPF -#else -#define NBPFILTER 0 -#endif - -#ifdef DEV_PFLOG -#define NPFLOG DEV_PFLOG -#else -#define NPFLOG 0 -#endif - -#ifdef DEV_PFSYNC -#define NPFSYNC DEV_PFSYNC -#else -#define NPFSYNC 0 -#endif +#define NPFSYNC 1 #ifdef DEV_PFLOW #define NPFLOW DEV_PFLOW Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Mon Jan 9 08:50:22 2012 (r229850) +++ head/sys/contrib/pf/net/pf_ioctl.c Mon Jan 9 08:55:23 2012 (r229851) @@ -44,11 +44,7 @@ __FBSDID("$FreeBSD$"); #include "opt_bpf.h" #include "opt_pf.h" -#ifdef DEV_BPF -#define NBPFILTER DEV_BPF -#else -#define NBPFILTER 0 -#endif +#define NPFSYNC 1 #ifdef DEV_PFLOG #define NPFLOG DEV_PFLOG @@ -56,16 +52,10 @@ __FBSDID("$FreeBSD$"); #define NPFLOG 0 #endif -#ifdef DEV_PFSYNC -#define NPFSYNC DEV_PFSYNC -#else -#define NPFSYNC 0 -#endif - -#else +#else /* !__FreeBSD__ */ #include "pfsync.h" #include "pflog.h" -#endif +#endif /* __FreeBSD__ */ #include #include From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 09:19:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C7C1106564A; Mon, 9 Jan 2012 09:19:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B68D8FC17; Mon, 9 Jan 2012 09:19:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q099J1hG032432; Mon, 9 Jan 2012 09:19:01 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q099J119032429; Mon, 9 Jan 2012 09:19:01 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201090919.q099J119032429@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 9 Jan 2012 09:19: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: r229852 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 09:19:01 -0000 Author: glebius Date: Mon Jan 9 09:19:00 2012 New Revision: 229852 URL: http://svn.freebsd.org/changeset/base/229852 Log: Revert sub argument of MODULE_DECLARE back to r226532. Noticed by: bz Modified: head/sys/contrib/pf/net/if_pfsync.c head/sys/contrib/pf/net/pf_ioctl.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 08:55:23 2012 (r229851) +++ head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 09:19:00 2012 (r229852) @@ -3483,7 +3483,7 @@ static moduledata_t pfsync_mod = { #define PFSYNC_MODVER 1 -DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); +DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(pfsync, PFSYNC_MODVER); MODULE_DEPEND(pfsync, pf, PF_MODVER, PF_MODVER, PF_MODVER); #endif /* __FreeBSD__ */ Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Mon Jan 9 08:55:23 2012 (r229851) +++ head/sys/contrib/pf/net/pf_ioctl.c Mon Jan 9 09:19:00 2012 (r229852) @@ -4413,6 +4413,6 @@ static moduledata_t pf_mod = { 0 }; -DECLARE_MODULE(pf, pf_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST); +DECLARE_MODULE(pf, pf_mod, SI_SUB_PSEUDO, SI_ORDER_FIRST); MODULE_VERSION(pf, PF_MODVER); #endif /* __FreeBSD__ */ From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 12:06:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2189C106566C; Mon, 9 Jan 2012 12:06:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 104C08FC22; Mon, 9 Jan 2012 12:06:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q09C62OF040201; Mon, 9 Jan 2012 12:06:02 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q09C626P040199; Mon, 9 Jan 2012 12:06:02 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201091206.q09C626P040199@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 9 Jan 2012 12:06: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: r229853 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 12:06:03 -0000 Author: glebius Date: Mon Jan 9 12:06:02 2012 New Revision: 229853 URL: http://svn.freebsd.org/changeset/base/229853 Log: Backout of backout: we need SI_SUB_PROTO_DOMAIN for pfsync, since it needs existing inetdomain on startup. Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 09:19:00 2012 (r229852) +++ head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 12:06:02 2012 (r229853) @@ -3483,7 +3483,7 @@ static moduledata_t pfsync_mod = { #define PFSYNC_MODVER 1 -DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); MODULE_VERSION(pfsync, PFSYNC_MODVER); MODULE_DEPEND(pfsync, pf, PF_MODVER, PF_MODVER, PF_MODVER); #endif /* __FreeBSD__ */ From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 12:06:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2543E1065672; Mon, 9 Jan 2012 12:06:10 +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 11F548FC19; Mon, 9 Jan 2012 12:06:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q09C69bR040242; Mon, 9 Jan 2012 12:06:09 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q09C694n040239; Mon, 9 Jan 2012 12:06:09 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201201091206.q09C694n040239@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 Jan 2012 12:06: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: r229854 - in head: . sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 12:06:11 -0000 Author: avg Date: Mon Jan 9 12:06:09 2012 New Revision: 229854 URL: http://svn.freebsd.org/changeset/base/229854 Log: enable stop_scheduler_on_panic by default My plan is to make this behavior unconditional before 10.0 release. X-MFC after: r228424 (if ever) Modified: head/UPDATING head/sys/kern/kern_shutdown.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Jan 9 12:06:02 2012 (r229853) +++ head/UPDATING Mon Jan 9 12:06:09 2012 (r229854) @@ -22,6 +22,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20120109: + panic(9) now stops other CPUs in the SMP systems, disables interrupts + on the current CPU and prevents other threads from running. + This behavior can be reverted using the kern.stop_scheduler_on_panic + tunable/sysctl. + The new behavior can be incompatible with kern.sync_on_panic. + 20111215: The carp(4) facility has been changed significantly. Configuration of the CARP protocol via ifconfig(8) has changed, as well as format Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Mon Jan 9 12:06:02 2012 (r229853) +++ head/sys/kern/kern_shutdown.c Mon Jan 9 12:06:09 2012 (r229854) @@ -123,7 +123,7 @@ SYSCTL_INT(_kern, OID_AUTO, sync_on_pani &sync_on_panic, 0, "Do a sync before rebooting from a panic"); TUNABLE_INT("kern.sync_on_panic", &sync_on_panic); -static int stop_scheduler_on_panic = 0; +static int stop_scheduler_on_panic = 1; SYSCTL_INT(_kern, OID_AUTO, stop_scheduler_on_panic, CTLFLAG_RW | CTLFLAG_TUN, &stop_scheduler_on_panic, 0, "stop scheduler upon entering panic"); TUNABLE_INT("kern.stop_scheduler_on_panic", &stop_scheduler_on_panic); From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 12:38:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 704BB106564A; Mon, 9 Jan 2012 12:38:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id DCF638FC0C; Mon, 9 Jan 2012 12:38:49 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q09Cckxu099987 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 Jan 2012 14:38:46 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q09CckrS052422; Mon, 9 Jan 2012 14:38:46 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q09Ccksp052421; Mon, 9 Jan 2012 14:38:46 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 9 Jan 2012 14:38:46 +0200 From: Kostik Belousov To: Doug Barton Message-ID: <20120109123846.GT31224@deviant.kiev.zoral.com.ua> References: <201201082306.q08N6rDQ011768@svn.freebsd.org> <4F0AAB6A.7090606@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gSsRJZU0nGhQbl8n" Content-Disposition: inline In-Reply-To: <4F0AAB6A.7090606@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229828 - in head/sys: kern ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 12:38:50 -0000 --gSsRJZU0nGhQbl8n Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 09, 2012 at 12:55:06AM -0800, Doug Barton wrote: > On 01/08/2012 15:06, Konstantin Belousov wrote: > > Author: kib > > Date: Sun Jan 8 23:06:53 2012 > > New Revision: 229828 > > URL: http://svn.freebsd.org/changeset/base/229828 > >=20 > > Log: > > Avoid LOR between vfs_busy() lock and covered vnode lock on quotaon(). >=20 > Does this mean that if we turn witness back on the ever-present VFS LORs > will no longer be there, or does this only affect calls to quotaon()? vfs_busy() lock is not accounted for by witness, so there shall be no changes in the witness reports. The scenario affected only fired when somebody did quotaon and unmount proceeded in parallel. --gSsRJZU0nGhQbl8n Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk8K39UACgkQC3+MBN1Mb4ij5QCgiG3wzONl8f8nHSJx2LSqxNY5 J/UAnjbomgJFbyIjepMso9xOzo1qpm1h =4q9E -----END PGP SIGNATURE----- --gSsRJZU0nGhQbl8n-- From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 12:49:58 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 763E8106566C; Mon, 9 Jan 2012 12:49:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 339B28FC0C; Mon, 9 Jan 2012 12:49:58 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:d01c:cec7:e367:727] (unknown [IPv6:2001:7b8:3a7:0:d01c:cec7:e367:727]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 1756A5C37; Mon, 9 Jan 2012 13:49:57 +0100 (CET) Message-ID: <4F0AE274.8010907@FreeBSD.org> Date: Mon, 09 Jan 2012 13:49:56 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120106 Thunderbird/10.0 MIME-Version: 1.0 To: Sergey Kandaurov References: <201112300624.pBU6OxO9098906@svn.freebsd.org> <4F08A518.8090207@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Devin Teske Subject: Re: svn commit: r228985 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 12:49:58 -0000 On 2012-01-08 21:35, Sergey Kandaurov wrote: ... > So, the problem arise when beastie_disable is set. > > In this case menu.rc is not evaluated and consequently menu-unset does > not have a body yet. This results in the ficl warning "not found" when > try-menu-unset calls menu-unset. The warning cannot be handled with catch > as seen with the code in head. > Otherwise, when beastie is enabled, all works as it should. > > To "fix" the problem I replaced 'catch' with 'sfind', so that we can > conditionally call menu-unset only when the definition is present. > > Please try the following patch. I tested it with enabled/disabled beastie > and loader_color over serial console. I would also like to get a review > from Devin Teske to see if this change is acceptable. Yes, this patch makes the warning disappear. Thanks! From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 13:48:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCE061065672; Mon, 9 Jan 2012 13:48:28 +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 A25378FC18; Mon, 9 Jan 2012 13:48:28 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 5B42846B5C; Mon, 9 Jan 2012 08:48:28 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C526FB99B; Mon, 9 Jan 2012 08:48:27 -0500 (EST) From: John Baldwin To: Pawel Jakub Dawidek Date: Mon, 9 Jan 2012 08:15:44 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201201080055.q080tMlJ063808@svn.freebsd.org> <20120108104330.GC1674@garage.freebsd.pl> In-Reply-To: <20120108104330.GC1674@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201201090815.44495.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 09 Jan 2012 08:48:27 -0500 (EST) Cc: svn-src-head@freebsd.org, Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r229800 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 13:48:28 -0000 On Sunday, January 08, 2012 5:43:30 am Pawel Jakub Dawidek wrote: > On Sun, Jan 08, 2012 at 12:55:22AM +0000, Adrian Chadd wrote: > > Author: adrian > > Date: Sun Jan 8 00:55:22 2012 > > New Revision: 229800 > > URL: http://svn.freebsd.org/changeset/base/229800 > > > > Log: > > Make these two files conditionally build on UFS_ACL, as it doesn't > > seem to be used elsewhere. > > > > Since UFS_ACL is enabled by default for GENERIC kernels, this shouldn't > > break anything - but please beat me to fix things if it does. > > If someone is actually using GENERIC kernel. This change will break all > my system next time I upgrade. Adding UFS_ACL option to the kernel > config to make ZFS kernel module to work doesn't sound very intuitive. > > I understand what you are trying to accomplish, but we really need to > find better way to do this. Until then, could you back it out? Why not make 'options ZFS' work? Then you can have subr_acl_nfs.c depend on ZFS as well. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 13:58:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17A8C106566B; Mon, 9 Jan 2012 13:58:17 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id A49A98FC08; Mon, 9 Jan 2012 13:58:16 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 1D54586D; Mon, 9 Jan 2012 14:58:15 +0100 (CET) Date: Mon, 9 Jan 2012 14:57:06 +0100 From: Pawel Jakub Dawidek To: John Baldwin Message-ID: <20120109135706.GE4117@garage.freebsd.pl> References: <201201080055.q080tMlJ063808@svn.freebsd.org> <20120108104330.GC1674@garage.freebsd.pl> <201201090815.44495.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DqhR8hV3EnoxUkKN" Content-Disposition: inline In-Reply-To: <201201090815.44495.jhb@freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Adrian Chadd , src-committers@freebsd.org, kmacy@FreeBSD.org Subject: Re: svn commit: r229800 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 13:58:17 -0000 --DqhR8hV3EnoxUkKN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 09, 2012 at 08:15:44AM -0500, John Baldwin wrote: > On Sunday, January 08, 2012 5:43:30 am Pawel Jakub Dawidek wrote: > > On Sun, Jan 08, 2012 at 12:55:22AM +0000, Adrian Chadd wrote: > > > Author: adrian > > > Date: Sun Jan 8 00:55:22 2012 > > > New Revision: 229800 > > > URL: http://svn.freebsd.org/changeset/base/229800 > > >=20 > > > Log: > > > Make these two files conditionally build on UFS_ACL, as it doesn't > > > seem to be used elsewhere. > > > =20 > > > Since UFS_ACL is enabled by default for GENERIC kernels, this shoul= dn't > > > break anything - but please beat me to fix things if it does. > >=20 > > If someone is actually using GENERIC kernel. This change will break all > > my system next time I upgrade. Adding UFS_ACL option to the kernel > > config to make ZFS kernel module to work doesn't sound very intuitive. > >=20 > > I understand what you are trying to accomplish, but we really need to > > find better way to do this. Until then, could you back it out? >=20 > Why not make 'options ZFS' work? Then you can have subr_acl_nfs.c depend= on > ZFS as well. At the time I looked at it, it was very hard (at least for me) to make it work. Note that initial import of ZFS was delayed, because of this very reason. Then des@ convinced me to go ahead with module-only solution. The problem with having ZFS compiled into the kernel is that OpenSolaris compatiblity layer needs its headers to be included before system headers, which is/was impossible or hard to express for kernel compilation. AFAIR Kip Macy was working on it and my understanding was that he finished it or almost finished it (CCed). I'm all for making ZFS be compilable as part of the kernel itself, but it is really very low on my list, because ZFS simply works now and also because as I said, it was far from trivial for me to do it. If someone who is more familiar with the bits responsible for kernel compilation wants to work on including ZFS there, I'll gladly provide help from the ZFS side. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --DqhR8hV3EnoxUkKN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8K8jIACgkQForvXbEpPzS+xQCdHONluQeEW7xhqhyUC3oE4+C9 pgcAoKmoV5lYXLTdjk51BApPCp8GkldE =e9Y2 -----END PGP SIGNATURE----- --DqhR8hV3EnoxUkKN-- From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 14:35:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FE6D1065673; Mon, 9 Jan 2012 14:35:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 089198FC14; Mon, 9 Jan 2012 14:35:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q09EZ5uP044898; Mon, 9 Jan 2012 14:35:05 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q09EZ54v044897; Mon, 9 Jan 2012 14:35:05 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201091435.q09EZ54v044897@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 9 Jan 2012 14:35: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: r229857 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 14:35:06 -0000 Author: glebius Date: Mon Jan 9 14:35:05 2012 New Revision: 229857 URL: http://svn.freebsd.org/changeset/base/229857 Log: Can't pass MSIZE to m_cljget(), an mbuf can't be attached as external storage to another mbuf. Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 14:23:18 2012 (r229856) +++ head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 14:35:05 2012 (r229857) @@ -2163,8 +2163,7 @@ pfsync_sendout(void) if (pktlen > MHLEN) { /* Find the right pool to allocate from. */ /* XXX: This is ugly. */ - m_cljget(m, M_DONTWAIT, pktlen <= MSIZE ? MSIZE : - pktlen <= MCLBYTES ? MCLBYTES : + m_cljget(m, M_DONTWAIT, pktlen <= MCLBYTES ? MCLBYTES : #if MJUMPAGESIZE != MCLBYTES pktlen <= MJUMPAGESIZE ? MJUMPAGESIZE : #endif From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 14:43:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CB02106566B; Mon, 9 Jan 2012 14:43:45 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 57ACA8FC0A; Mon, 9 Jan 2012 14:43:44 +0000 (UTC) Received: by pbcc3 with SMTP id c3so2993322pbc.13 for ; Mon, 09 Jan 2012 06:43:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=kTAEh6/G1nKvv5U2XfKkR57zwaILevHH5ifksM+6Aqs=; b=hQdfiLErp3VIsfa5QbxbrY5h3/0RX0VCPXkf6zdKTh0o/RSmc6BI1IfxFt6Lbp82xE gF73Mn+5Ntf+W8+gkQst1Hzu28OO9mDghl7uVgT/NbedYAKE7fUmhSRHzYlGd3UB5KnG 6WDrT7adkuqgxWVa+RKj12YuaLXzyBfroTvpM= MIME-Version: 1.0 Received: by 10.68.73.69 with SMTP id j5mr42822354pbv.11.1326118561140; Mon, 09 Jan 2012 06:16:01 -0800 (PST) Sender: kmacybsd@gmail.com Received: by 10.68.42.73 with HTTP; Mon, 9 Jan 2012 06:16:01 -0800 (PST) In-Reply-To: <20120109135706.GE4117@garage.freebsd.pl> References: <201201080055.q080tMlJ063808@svn.freebsd.org> <20120108104330.GC1674@garage.freebsd.pl> <201201090815.44495.jhb@freebsd.org> <20120109135706.GE4117@garage.freebsd.pl> Date: Mon, 9 Jan 2012 15:16:01 +0100 X-Google-Sender-Auth: 0-uvFW236a5k5smlN5PLLd21_RA Message-ID: From: "K. Macy" To: Pawel Jakub Dawidek Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, John Baldwin Subject: Re: svn commit: r229800 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 14:43:45 -0000 > > The problem with having ZFS compiled into the kernel is that OpenSolaris > compatiblity layer needs its headers to be included before system > headers, which is/was impossible or hard to express for kernel > compilation. AFAIR Kip Macy was working on it and my understanding was > that he finished it or almost finished it (CCed). I did indeed make it work. The (only) reason I didn't check it in was because there were some collisions between freebsd's older zlib which ppp depends on and the one in the solaris layer. Both bz and I were kind of busy at the time. > I'm all for making ZFS be compilable as part of the kernel itself, but > it is really very low on my list, because ZFS simply works now and also > because as I said, it was far from trivial for me to do it. > If someone who is more familiar with the bits responsible for kernel > compilation wants to work on including ZFS there, I'll gladly provide > help from the ZFS side. I think this can be done without much work, (re)work out the dependencies. Cheers From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 15:38:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 132B1106566B; Mon, 9 Jan 2012 15:38:55 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id C7A0E8FC14; Mon, 9 Jan 2012 15:38:54 +0000 (UTC) Received: from pps.filterd (ltcfislmsgpa03 [127.0.0.1]) by ltcfislmsgpa03.fnfis.com (8.14.4/8.14.4) with SMTP id q09FQerV027481; Mon, 9 Jan 2012 09:38:53 -0600 Received: from smtp.fisglobal.com ([10.132.206.16]) by ltcfislmsgpa03.fnfis.com with ESMTP id 1282hgr562-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Mon, 09 Jan 2012 09:38:53 -0600 Received: from [10.0.0.105] (10.14.152.28) by smtp.fisglobal.com (10.132.206.16) with Microsoft SMTP Server (TLS) id 14.1.323.3; Mon, 9 Jan 2012 09:38:50 -0600 References: <201112300624.pBU6OxO9098906@svn.freebsd.org> <4F08A518.8090207@FreeBSD.org> <4F0AE274.8010907@FreeBSD.org> In-Reply-To: <4F0AE274.8010907@FreeBSD.org> MIME-Version: 1.0 (iPhone Mail 8C148) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" Message-ID: X-Mailer: iPhone Mail (8C148) From: Devin Teske Date: Mon, 9 Jan 2012 07:38:39 -0800 To: Dimitry Andric X-Originating-IP: [10.14.152.28] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110, 1.0.211, 0.0.0000 definitions=2012-01-09_03:2012-01-09, 2012-01-09, 1970-01-01 signatures=0 Cc: "" , "" , Sergey Kandaurov , "" Subject: * Re: svn commit: r228985 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 15:38:55 -0000 On Jan 9, 2012, at 4:49 AM, Dimitry Andric wrote: > On 2012-01-08 21:35, Sergey Kandaurov wrote: > ... >> So, the problem arise when beastie_disable is set. >>=20 >> In this case menu.rc is not evaluated and consequently menu-unset does >> not have a body yet. This results in the ficl warning "not found" when >> try-menu-unset calls menu-unset. The warning cannot be handled with catch >> as seen with the code in head. >> Otherwise, when beastie is enabled, all works as it should. >>=20 >> To "fix" the problem I replaced 'catch' with 'sfind', so that we can >> conditionally call menu-unset only when the definition is present. >>=20 >> Please try the following patch. I tested it with enabled/disabled beastie >> and loader_color over serial console. I would also like to get a review >> from Devin Teske to see if this change is acceptable. >=20 > Yes, this patch makes the warning disappear. Thanks! Please also see additional notes in PR kern/163938 (additional patching to = same file for same problem). --=20 Devin _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you. From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 18:58:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E82B106566C; Mon, 9 Jan 2012 18:58:13 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 86D5B8FC0C; Mon, 9 Jan 2012 18:58:12 +0000 (UTC) Received: by wgbdr11 with SMTP id dr11so2046270wgb.31 for ; Mon, 09 Jan 2012 10:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=A92afF1esTtOusS7PfbGvi4J2wSHFtKgdsiRL0w1RGA=; b=arDdSeGztB68SJVIbCjBpzld6hyJhP6XpMqvjtBCEp9Gj8sruKqua2I5PdBMgHsED+ 9WMdUDe4gvqKRl92boR76edWemrWZ2IyPIlVySprPWGiwxxol0H3PDDoi4OTiNnOTzS4 DCJzhH2csWCuA+VLcovO14wrnH8vyaAqQ/PkQ= Received: by 10.180.79.10 with SMTP id f10mr6783300wix.0.1326135491532; Mon, 09 Jan 2012 10:58:11 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id o41sm41154022wba.19.2012.01.09.10.58.09 (version=SSLv3 cipher=OTHER); Mon, 09 Jan 2012 10:58:10 -0800 (PST) Sender: Alexander Motin Message-ID: <4F0B38B9.1020302@FreeBSD.org> Date: Mon, 09 Jan 2012 20:58:01 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111112 Thunderbird/8.0 MIME-Version: 1.0 To: Maksim Yevmenkin References: <201112282249.pBSMnTZu028304@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228939 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 18:58:13 -0000 On 09.01.2012 20:54, Maksim Yevmenkin wrote: > On Wed, Dec 28, 2011 at 2:49 PM, Alexander Motin wrote: >> Author: mav >> Date: Wed Dec 28 22:49:28 2011 >> New Revision: 228939 >> URL: http://svn.freebsd.org/changeset/base/228939 >> >> Log: >> Set maximum I/O size for mps(4) to MAXPHYS. Looking into the code, I see >> no reason why it should be limited to 64K of DFLTPHYS. DMA data tag is any >> way set to allow MAXPHYS, S/G lists (chain elements) are sufficient and >> overflows are also handled. On my tests even 1MB I/Os are working fine. >> >> Reviewed by: ken@ >> >> Modified: >> head/sys/dev/mps/mps_sas.c >> >> Modified: head/sys/dev/mps/mps_sas.c >> ============================================================================== >> --- head/sys/dev/mps/mps_sas.c Wed Dec 28 22:18:53 2011 (r228938) >> +++ head/sys/dev/mps/mps_sas.c Wed Dec 28 22:49:28 2011 (r228939) >> @@ -937,6 +937,7 @@ mpssas_action(struct cam_sim *sim, union >> cpi->transport_version = 0; >> cpi->protocol = PROTO_SCSI; >> cpi->protocol_version = SCSI_REV_SPC; >> + cpi->maxio = MAXPHYS; >> cpi->ccb_h.status = CAM_REQ_CMP; >> break; >> } > > sorry for the late reply, but can we make in into tunable please? i > have in local tree > > --- mps_sas.c.orig 2011-11-17 02:05:04.000000000 -0800 > +++ mps_sas.c 2011-12-28 16:05:10.000000000 -0800 > @@ -121,6 +121,11 @@ > > MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); > > +int mps_maxio = MAXPHYS; > +TUNABLE_INT("hw.mps.maxio",&mps_maxio); > +SYSCTL_INT(_hw_mps, OID_AUTO, maxio, CTLFLAG_RD,&mps_maxio, 0, > + "CAM maxio override\n"); > + > static __inline int mpssas_set_lun(uint8_t *lun, u_int ccblun); > static struct mpssas_target * mpssas_alloc_target(struct mpssas_softc *, > struct mpssas_target *); > @@ -938,6 +943,7 @@ > cpi->protocol = PROTO_SCSI; > cpi->protocol_version = SCSI_REV_SPC; > cpi->ccb_h.status = CAM_REQ_CMP; > + cpi->maxio = mps_maxio; > break; > } > case XPT_GET_TRAN_SETTINGS: We can. but could you explain why? Have you found any problems this change? -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 19:04:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DF29106564A; Mon, 9 Jan 2012 19:04:25 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C0E3C8FC16; Mon, 9 Jan 2012 19:04:24 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so6152729obb.13 for ; Mon, 09 Jan 2012 11:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=rhuG35GXg8ZoF8llZeBuxjLpqlaIT8yqLdRCV1qODUY=; b=QqP2mAIsw8PnSO/HmvPKi6EHSUUnNrnfuT3gaeAtUCelEkqKrPyg026M7yShrzprxR H9EXJ2/s2BQGSDrTY2laah7c1cyMsmEgPqCcFOltQt8fGg2lxEY6vL2blNQAxpPC31SR JjhVE1rZsLoNs7uKbcBxGybApV/0qVCaDJBu4= MIME-Version: 1.0 Received: by 10.182.39.70 with SMTP id n6mr8871850obk.41.1326135863972; Mon, 09 Jan 2012 11:04:23 -0800 (PST) Received: by 10.182.152.6 with HTTP; Mon, 9 Jan 2012 11:04:23 -0800 (PST) In-Reply-To: <4F0B38B9.1020302@FreeBSD.org> References: <201112282249.pBSMnTZu028304@svn.freebsd.org> <4F0B38B9.1020302@FreeBSD.org> Date: Mon, 9 Jan 2012 11:04:23 -0800 Message-ID: From: Garrett Cooper To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Maksim Yevmenkin Subject: Re: svn commit: r228939 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 19:04:25 -0000 2012/1/9 Alexander Motin : > On 09.01.2012 20:54, Maksim Yevmenkin wrote: >> >> On Wed, Dec 28, 2011 at 2:49 PM, Alexander Motin =A0wro= te: >> >>> Author: mav >>> Date: Wed Dec 28 22:49:28 2011 >>> New Revision: 228939 >>> URL: http://svn.freebsd.org/changeset/base/228939 >>> >>> Log: >>> =A0Set maximum I/O size for mps(4) to MAXPHYS. Looking into the code, I= see >>> =A0no reason why it should be limited to 64K of DFLTPHYS. DMA data tag = is >>> any >>> =A0way set to allow MAXPHYS, S/G lists (chain elements) are sufficient = and >>> =A0overflows are also handled. On my tests even 1MB I/Os are working fi= ne. >>> >>> =A0Reviewed by: =A0ken@ >>> >>> Modified: >>> =A0head/sys/dev/mps/mps_sas.c >>> >>> Modified: head/sys/dev/mps/mps_sas.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/sys/dev/mps/mps_sas.c =A0Wed Dec 28 22:18:53 2011 =A0 =A0 =A0 = =A0(r228938) >>> +++ head/sys/dev/mps/mps_sas.c =A0Wed Dec 28 22:49:28 2011 =A0 =A0 =A0 = =A0(r228939) >>> @@ -937,6 +937,7 @@ mpssas_action(struct cam_sim *sim, union >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->transport_version =3D 0; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol =3D PROTO_SCSI; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol_version =3D SCSI_REV_SPC; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cpi->maxio =3D MAXPHYS; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->ccb_h.status =3D CAM_REQ_CMP; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>> =A0 =A0 =A0 =A0} >> >> >> sorry for the late reply, but can we make in into tunable please? i >> have in local tree >> >> --- mps_sas.c.orig =A0 =A0 =A02011-11-17 02:05:04.000000000 -0800 >> +++ mps_sas.c =A0 2011-12-28 16:05:10.000000000 -0800 >> @@ -121,6 +121,11 @@ >> >> =A0MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); >> >> +int mps_maxio =3D MAXPHYS; >> +TUNABLE_INT("hw.mps.maxio",&mps_maxio); >> +SYSCTL_INT(_hw_mps, OID_AUTO, maxio, CTLFLAG_RD,&mps_maxio, 0, >> + =A0 =A0 =A0 "CAM maxio override\n"); >> + >> =A0static __inline int mpssas_set_lun(uint8_t *lun, u_int ccblun); >> =A0static struct mpssas_target * mpssas_alloc_target(struct mpssas_softc= *, >> =A0 =A0 =A0struct mpssas_target *); >> @@ -938,6 +943,7 @@ >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol =3D PROTO_SCSI; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol_version =3D SCSI_REV_SPC; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->ccb_h.status =3D CAM_REQ_CMP; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cpi->maxio =3D mps_maxio; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >> =A0 =A0 =A0 =A0} >> =A0 =A0 =A0 =A0case XPT_GET_TRAN_SETTINGS: > > > We can. but could you explain why? Have you found any problems this chang= e? It would make it nice when dealing with different controllers -- a similar example is that mfi(4) has a tunable called hw.mfi.max_cmds which controls the I/O command queue size as not all MegaRAID cards have the same I/O queue size capabilities. Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 19:07:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CB421065672; Mon, 9 Jan 2012 19:07:46 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id E654C8FC13; Mon, 9 Jan 2012 19:07:45 +0000 (UTC) Received: by ggnp1 with SMTP id p1so2042768ggn.13 for ; Mon, 09 Jan 2012 11:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=u2828H5TTO2gQUXQaiLaq1wHr5c2XvNHaw0jovyIZSg=; b=RJIz22v0Y/9P4tNsPalvkvWS3+BPmG+Mv0aFfNDomfzVYGE7KShkM08nLbE44Ul9Jw JfRngUfbLf28595yDUu1xJ9ZMSUF5qRqdwO4WE/gKaNQExYSmE5x4s3F8q53wH9iZ2Sl aGwFGrcuVvNFhrms1DH+heKi1gxfMdJlgaBFU= MIME-Version: 1.0 Received: by 10.101.82.2 with SMTP id j2mr7167111anl.77.1326135714181; Mon, 09 Jan 2012 11:01:54 -0800 (PST) Sender: maksim.yevmenkin@gmail.com Received: by 10.101.41.18 with HTTP; Mon, 9 Jan 2012 11:01:54 -0800 (PST) In-Reply-To: <4F0B38B9.1020302@FreeBSD.org> References: <201112282249.pBSMnTZu028304@svn.freebsd.org> <4F0B38B9.1020302@FreeBSD.org> Date: Mon, 9 Jan 2012 11:01:54 -0800 X-Google-Sender-Auth: f97CuNOxthJQbKHOWSIzhd6_hfY Message-ID: From: Maksim Yevmenkin To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228939 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 19:07:46 -0000 2012/1/9 Alexander Motin : > On 09.01.2012 20:54, Maksim Yevmenkin wrote: >> >> On Wed, Dec 28, 2011 at 2:49 PM, Alexander Motin =A0wro= te: >>> >>> Author: mav >>> Date: Wed Dec 28 22:49:28 2011 >>> New Revision: 228939 >>> URL: http://svn.freebsd.org/changeset/base/228939 >>> >>> Log: >>> =A0Set maximum I/O size for mps(4) to MAXPHYS. Looking into the code, I= see >>> =A0no reason why it should be limited to 64K of DFLTPHYS. DMA data tag = is >>> any >>> =A0way set to allow MAXPHYS, S/G lists (chain elements) are sufficient = and >>> =A0overflows are also handled. On my tests even 1MB I/Os are working fi= ne. >>> >>> =A0Reviewed by: =A0ken@ >>> >>> Modified: >>> =A0head/sys/dev/mps/mps_sas.c >>> >>> Modified: head/sys/dev/mps/mps_sas.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/sys/dev/mps/mps_sas.c =A0Wed Dec 28 22:18:53 2011 =A0 =A0 =A0 = =A0(r228938) >>> +++ head/sys/dev/mps/mps_sas.c =A0Wed Dec 28 22:49:28 2011 =A0 =A0 =A0 = =A0(r228939) >>> @@ -937,6 +937,7 @@ mpssas_action(struct cam_sim *sim, union >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->transport_version =3D 0; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol =3D PROTO_SCSI; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol_version =3D SCSI_REV_SPC; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cpi->maxio =3D MAXPHYS; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->ccb_h.status =3D CAM_REQ_CMP; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>> =A0 =A0 =A0 =A0} >> >> >> sorry for the late reply, but can we make in into tunable please? i >> have in local tree >> >> --- mps_sas.c.orig =A0 =A0 =A02011-11-17 02:05:04.000000000 -0800 >> +++ mps_sas.c =A0 2011-12-28 16:05:10.000000000 -0800 >> @@ -121,6 +121,11 @@ >> >> =A0MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); >> >> +int mps_maxio =3D MAXPHYS; >> +TUNABLE_INT("hw.mps.maxio",&mps_maxio); >> +SYSCTL_INT(_hw_mps, OID_AUTO, maxio, CTLFLAG_RD,&mps_maxio, 0, >> >> + =A0 =A0 =A0 "CAM maxio override\n"); >> + >> =A0static __inline int mpssas_set_lun(uint8_t *lun, u_int ccblun); >> =A0static struct mpssas_target * mpssas_alloc_target(struct mpssas_softc= *, >> =A0 =A0 =A0struct mpssas_target *); >> @@ -938,6 +943,7 @@ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol =3D PROTO_SCSI; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol_version =3D SCSI_REV_SPC; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->ccb_h.status =3D CAM_REQ_CMP; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cpi->maxio =3D mps_maxio; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >> =A0 =A0 =A0 =A0} >> =A0 =A0 =A0 =A0case XPT_GET_TRAN_SETTINGS: > > > We can. but could you explain why? Have you found any problems this chang= e? not really. i've had this patch in the local tree for a while now. we are experimenting with various MAXPHYS/maxio settings and having this tunable is very handy. basically, we can set MAXPHYS to some larger value and tweak maxio (for testing purposes) without recompiling/installing new kernel. thanks, max From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 19:13:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0658E1065677; Mon, 9 Jan 2012 19:13:54 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 144D78FC13; Mon, 9 Jan 2012 19:13:52 +0000 (UTC) Received: by wibhr1 with SMTP id hr1so4420306wib.13 for ; Mon, 09 Jan 2012 11:13:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Vh+6PAA88msTN5306MLyq91AVq3T61rqDVFdGE1lk5s=; b=dmSgwI1u3kLqhK2B1CMZXZ+3pW9QwR/8e9z+KGRZU6GuxI7Hjk8CaudkBl1Aa29TGq krIAghZeAzg2X0H4zbTshROGHAdR3h6YFCg/tH5hUVPRwdjfpiNoYvtnpDqCS65QbNUY 8VGEIHfScsMaEvsLZMJNLxlCDXq/ur+Ya5xCI= Received: by 10.180.83.69 with SMTP id o5mr30579362wiy.1.1326136432113; Mon, 09 Jan 2012 11:13:52 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id 28sm80358017wby.3.2012.01.09.11.13.50 (version=SSLv3 cipher=OTHER); Mon, 09 Jan 2012 11:13:51 -0800 (PST) Sender: Alexander Motin Message-ID: <4F0B3C66.6020701@FreeBSD.org> Date: Mon, 09 Jan 2012 21:13:42 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111112 Thunderbird/8.0 MIME-Version: 1.0 To: Maksim Yevmenkin References: <201112282249.pBSMnTZu028304@svn.freebsd.org> <4F0B38B9.1020302@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228939 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 19:13:54 -0000 On 09.01.2012 21:01, Maksim Yevmenkin wrote: > 2012/1/9 Alexander Motin: >> On 09.01.2012 20:54, Maksim Yevmenkin wrote: >>> >>> On Wed, Dec 28, 2011 at 2:49 PM, Alexander Motin wrote: >>>> >>>> Author: mav >>>> Date: Wed Dec 28 22:49:28 2011 >>>> New Revision: 228939 >>>> URL: http://svn.freebsd.org/changeset/base/228939 >>>> >>>> Log: >>>> Set maximum I/O size for mps(4) to MAXPHYS. Looking into the code, I see >>>> no reason why it should be limited to 64K of DFLTPHYS. DMA data tag is >>>> any >>>> way set to allow MAXPHYS, S/G lists (chain elements) are sufficient and >>>> overflows are also handled. On my tests even 1MB I/Os are working fine. >>>> >>>> Reviewed by: ken@ >>>> >>>> Modified: >>>> head/sys/dev/mps/mps_sas.c >>>> >>>> Modified: head/sys/dev/mps/mps_sas.c >>>> >>>> ============================================================================== >>>> --- head/sys/dev/mps/mps_sas.c Wed Dec 28 22:18:53 2011 (r228938) >>>> +++ head/sys/dev/mps/mps_sas.c Wed Dec 28 22:49:28 2011 (r228939) >>>> @@ -937,6 +937,7 @@ mpssas_action(struct cam_sim *sim, union >>>> cpi->transport_version = 0; >>>> cpi->protocol = PROTO_SCSI; >>>> cpi->protocol_version = SCSI_REV_SPC; >>>> + cpi->maxio = MAXPHYS; >>>> cpi->ccb_h.status = CAM_REQ_CMP; >>>> break; >>>> } >>> >>> >>> sorry for the late reply, but can we make in into tunable please? i >>> have in local tree >>> >>> --- mps_sas.c.orig 2011-11-17 02:05:04.000000000 -0800 >>> +++ mps_sas.c 2011-12-28 16:05:10.000000000 -0800 >>> @@ -121,6 +121,11 @@ >>> >>> MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); >>> >>> +int mps_maxio = MAXPHYS; >>> +TUNABLE_INT("hw.mps.maxio",&mps_maxio); >>> +SYSCTL_INT(_hw_mps, OID_AUTO, maxio, CTLFLAG_RD,&mps_maxio, 0, >>> >>> + "CAM maxio override\n"); >>> + >>> static __inline int mpssas_set_lun(uint8_t *lun, u_int ccblun); >>> static struct mpssas_target * mpssas_alloc_target(struct mpssas_softc *, >>> struct mpssas_target *); >>> @@ -938,6 +943,7 @@ >>> cpi->protocol = PROTO_SCSI; >>> cpi->protocol_version = SCSI_REV_SPC; >>> cpi->ccb_h.status = CAM_REQ_CMP; >>> + cpi->maxio = mps_maxio; >>> break; >>> } >>> case XPT_GET_TRAN_SETTINGS: >> >> >> We can. but could you explain why? Have you found any problems this change? > > not really. i've had this patch in the local tree for a while now. we > are experimenting with various MAXPHYS/maxio settings and having this > tunable is very handy. basically, we can set MAXPHYS to some larger > value and tweak maxio (for testing purposes) without > recompiling/installing new kernel. I don't really think that it is perfect place for such tunable. It is a bit strange IMHO to have different maxio for different types of HBAs except physical limitations. I would prefer it to be configurable on above layers, for example, file systems, if needed. But if you need it here for something, I won't object against adding it. Have you found any benefits of having maxio below MAXPHYS while experimenting? May be those results could be used to improve FS behavior somehow to make tuning not needed? -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 19:20:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B881B106564A; Mon, 9 Jan 2012 19:20:31 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 50A198FC15; Mon, 9 Jan 2012 19:20:31 +0000 (UTC) Received: by yenl9 with SMTP id l9so1923856yen.13 for ; Mon, 09 Jan 2012 11:20:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=efZe7/+Q+dFtKXTlYkIbWLLJtF2RkhC1Rh9/cigduVo=; b=x4DI1a54Xy9C4yWjti4+KIlsWyEGktJbUIDpzHyuUEczzHCBRIGYh95VpPcUxSul1V V4Db2+Dgd/rRnWsb1IEXGOfwUNl9vf6iKtoHnI8bY7+Qjvy0JrsbKqnG2BZUI1Y6AgEP r+ILA82OlRkQCWgBmThNXumcmmSVD8jpD5eXs= MIME-Version: 1.0 Received: by 10.236.122.237 with SMTP id t73mr10734310yhh.124.1326135243889; Mon, 09 Jan 2012 10:54:03 -0800 (PST) Sender: maksim.yevmenkin@gmail.com Received: by 10.101.41.18 with HTTP; Mon, 9 Jan 2012 10:54:03 -0800 (PST) In-Reply-To: <201112282249.pBSMnTZu028304@svn.freebsd.org> References: <201112282249.pBSMnTZu028304@svn.freebsd.org> Date: Mon, 9 Jan 2012 10:54:03 -0800 X-Google-Sender-Auth: j4CMW2yzOjwGjnFZTJxqLL9zM9g Message-ID: From: Maksim Yevmenkin To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228939 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 19:20:31 -0000 On Wed, Dec 28, 2011 at 2:49 PM, Alexander Motin wrote: > Author: mav > Date: Wed Dec 28 22:49:28 2011 > New Revision: 228939 > URL: http://svn.freebsd.org/changeset/base/228939 > > Log: > =A0Set maximum I/O size for mps(4) to MAXPHYS. Looking into the code, I s= ee > =A0no reason why it should be limited to 64K of DFLTPHYS. DMA data tag is= any > =A0way set to allow MAXPHYS, S/G lists (chain elements) are sufficient an= d > =A0overflows are also handled. On my tests even 1MB I/Os are working fine= . > > =A0Reviewed by: =A0ken@ > > Modified: > =A0head/sys/dev/mps/mps_sas.c > > Modified: head/sys/dev/mps/mps_sas.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/sys/dev/mps/mps_sas.c =A0Wed Dec 28 22:18:53 2011 =A0 =A0 =A0 = =A0(r228938) > +++ head/sys/dev/mps/mps_sas.c =A0Wed Dec 28 22:49:28 2011 =A0 =A0 =A0 = =A0(r228939) > @@ -937,6 +937,7 @@ mpssas_action(struct cam_sim *sim, union > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->transport_version =3D 0; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol =3D PROTO_SCSI; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol_version =3D SCSI_REV_SPC; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cpi->maxio =3D MAXPHYS; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->ccb_h.status =3D CAM_REQ_CMP; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0} sorry for the late reply, but can we make in into tunable please? i have in local tree --- mps_sas.c.orig 2011-11-17 02:05:04.000000000 -0800 +++ mps_sas.c 2011-12-28 16:05:10.000000000 -0800 @@ -121,6 +121,11 @@ MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); +int mps_maxio =3D MAXPHYS; +TUNABLE_INT("hw.mps.maxio", &mps_maxio); +SYSCTL_INT(_hw_mps, OID_AUTO, maxio, CTLFLAG_RD, &mps_maxio, 0, + "CAM maxio override\n"); + static __inline int mpssas_set_lun(uint8_t *lun, u_int ccblun); static struct mpssas_target * mpssas_alloc_target(struct mpssas_softc *, struct mpssas_target *); @@ -938,6 +943,7 @@ cpi->protocol =3D PROTO_SCSI; cpi->protocol_version =3D SCSI_REV_SPC; cpi->ccb_h.status =3D CAM_REQ_CMP; + cpi->maxio =3D mps_maxio; break; } case XPT_GET_TRAN_SETTINGS: thanks, max From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 19:21:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5061E1065677; Mon, 9 Jan 2012 19:21:32 +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 104678FC1E; Mon, 9 Jan 2012 19:21:32 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id A159846B09; Mon, 9 Jan 2012 14:21:31 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 33593B922; Mon, 9 Jan 2012 14:21:31 -0500 (EST) From: John Baldwin To: Garrett Cooper Date: Mon, 9 Jan 2012 14:21:30 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201112282249.pBSMnTZu028304@svn.freebsd.org> <4F0B38B9.1020302@FreeBSD.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201201091421.30596.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 09 Jan 2012 14:21:31 -0500 (EST) Cc: svn-src-head@freebsd.org, Alexander Motin , src-committers@freebsd.org, Maksim Yevmenkin , svn-src-all@freebsd.org Subject: Re: svn commit: r228939 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 19:21:32 -0000 On Monday, January 09, 2012 2:04:23 pm Garrett Cooper wrote: > 2012/1/9 Alexander Motin : > > On 09.01.2012 20:54, Maksim Yevmenkin wrote: > >> > >> On Wed, Dec 28, 2011 at 2:49 PM, Alexander Motin wrote: > >> > >>> Author: mav > >>> Date: Wed Dec 28 22:49:28 2011 > >>> New Revision: 228939 > >>> URL: http://svn.freebsd.org/changeset/base/228939 > >>> > >>> Log: > >>> Set maximum I/O size for mps(4) to MAXPHYS. Looking into the code, I see > >>> no reason why it should be limited to 64K of DFLTPHYS. DMA data tag is > >>> any > >>> way set to allow MAXPHYS, S/G lists (chain elements) are sufficient and > >>> overflows are also handled. On my tests even 1MB I/Os are working fine. > >>> > >>> Reviewed by: ken@ > >>> > >>> Modified: > >>> head/sys/dev/mps/mps_sas.c > >>> > >>> Modified: head/sys/dev/mps/mps_sas.c > >>> > >>> ============================================================================== > >>> --- head/sys/dev/mps/mps_sas.c Wed Dec 28 22:18:53 2011 (r228938) > >>> +++ head/sys/dev/mps/mps_sas.c Wed Dec 28 22:49:28 2011 (r228939) > >>> @@ -937,6 +937,7 @@ mpssas_action(struct cam_sim *sim, union > >>> cpi->transport_version = 0; > >>> cpi->protocol = PROTO_SCSI; > >>> cpi->protocol_version = SCSI_REV_SPC; > >>> + cpi->maxio = MAXPHYS; > >>> cpi->ccb_h.status = CAM_REQ_CMP; > >>> break; > >>> } > >> > >> > >> sorry for the late reply, but can we make in into tunable please? i > >> have in local tree > >> > >> --- mps_sas.c.orig 2011-11-17 02:05:04.000000000 -0800 > >> +++ mps_sas.c 2011-12-28 16:05:10.000000000 -0800 > >> @@ -121,6 +121,11 @@ > >> > >> MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); > >> > >> +int mps_maxio = MAXPHYS; > >> +TUNABLE_INT("hw.mps.maxio",&mps_maxio); > >> +SYSCTL_INT(_hw_mps, OID_AUTO, maxio, CTLFLAG_RD,&mps_maxio, 0, > >> + "CAM maxio override\n"); > >> + > >> static __inline int mpssas_set_lun(uint8_t *lun, u_int ccblun); > >> static struct mpssas_target * mpssas_alloc_target(struct mpssas_softc *, > >> struct mpssas_target *); > >> @@ -938,6 +943,7 @@ > >> > >> cpi->protocol = PROTO_SCSI; > >> cpi->protocol_version = SCSI_REV_SPC; > >> cpi->ccb_h.status = CAM_REQ_CMP; > >> + cpi->maxio = mps_maxio; > >> break; > >> } > >> case XPT_GET_TRAN_SETTINGS: > > > > > > We can. but could you explain why? Have you found any problems this change? > > It would make it nice when dealing with different controllers -- a > similar example is that mfi(4) has a tunable called hw.mfi.max_cmds > which controls the I/O command queue size as not all MegaRAID cards > have the same I/O queue size capabilities. Yeah, but that's more a debugging aid. mfi(4) has a firmware interface that tells you how many command slots it supports dynamically. mfi also uses a better way to compute maxio: sc->ld_disk->d_maxsize = min(sc->ld_controller->mfi_max_io * secsize, (sc->ld_controller->mfi_max_sge - 1) * PAGE_SIZE); It would be nice if mps could use a similar formula that was actually limited by the device's capabilities. The upper layers will cap transfers to MAXPHYS elsewhere. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 19:22:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 274021065670; Mon, 9 Jan 2012 19:22:03 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2A3BE8FC1D; Mon, 9 Jan 2012 19:22:01 +0000 (UTC) Received: by eekc50 with SMTP id c50so2859204eek.13 for ; Mon, 09 Jan 2012 11:22:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=SNqAaCgqvh7igVrf3wav1Ovl11lSe7SOLdn8OxplDf8=; b=Sldlfe4MDAKc4gmu99vwAfFRDb5ZGvBEZt1KGySBVPPbF0+pEDABKMGxVMUPDQhV8T gBfVcYgBi+GnTilLoyQQYKowxnK7uFNWG+JoaUcaEbteUkrvuXMmKS1OmhoCAjrqtQbA gfjeD4kFkrN3EtQtiibERNE6YYVxNEeBzoEgY= Received: by 10.14.99.197 with SMTP id x45mr6640262eef.114.1326136920424; Mon, 09 Jan 2012 11:22:00 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id 76sm294295005eeh.0.2012.01.09.11.21.58 (version=SSLv3 cipher=OTHER); Mon, 09 Jan 2012 11:21:59 -0800 (PST) Sender: Alexander Motin Message-ID: <4F0B3E4E.20807@FreeBSD.org> Date: Mon, 09 Jan 2012 21:21:50 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111112 Thunderbird/8.0 MIME-Version: 1.0 To: Garrett Cooper References: <201112282249.pBSMnTZu028304@svn.freebsd.org> <4F0B38B9.1020302@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Maksim Yevmenkin Subject: Re: svn commit: r228939 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 19:22:03 -0000 On 09.01.2012 21:04, Garrett Cooper wrote: > 2012/1/9 Alexander Motin: >> On 09.01.2012 20:54, Maksim Yevmenkin wrote: >>> >>> On Wed, Dec 28, 2011 at 2:49 PM, Alexander Motin wrote: >>> >>>> Author: mav >>>> Date: Wed Dec 28 22:49:28 2011 >>>> New Revision: 228939 >>>> URL: http://svn.freebsd.org/changeset/base/228939 >>>> >>>> Log: >>>> Set maximum I/O size for mps(4) to MAXPHYS. Looking into the code, I see >>>> no reason why it should be limited to 64K of DFLTPHYS. DMA data tag is >>>> any >>>> way set to allow MAXPHYS, S/G lists (chain elements) are sufficient and >>>> overflows are also handled. On my tests even 1MB I/Os are working fine. >>>> >>>> Reviewed by: ken@ >>>> >>>> Modified: >>>> head/sys/dev/mps/mps_sas.c >>>> >>>> Modified: head/sys/dev/mps/mps_sas.c >>>> >>>> ============================================================================== >>>> --- head/sys/dev/mps/mps_sas.c Wed Dec 28 22:18:53 2011 (r228938) >>>> +++ head/sys/dev/mps/mps_sas.c Wed Dec 28 22:49:28 2011 (r228939) >>>> @@ -937,6 +937,7 @@ mpssas_action(struct cam_sim *sim, union >>>> cpi->transport_version = 0; >>>> cpi->protocol = PROTO_SCSI; >>>> cpi->protocol_version = SCSI_REV_SPC; >>>> + cpi->maxio = MAXPHYS; >>>> cpi->ccb_h.status = CAM_REQ_CMP; >>>> break; >>>> } >>> >>> >>> sorry for the late reply, but can we make in into tunable please? i >>> have in local tree >>> >>> --- mps_sas.c.orig 2011-11-17 02:05:04.000000000 -0800 >>> +++ mps_sas.c 2011-12-28 16:05:10.000000000 -0800 >>> @@ -121,6 +121,11 @@ >>> >>> MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); >>> >>> +int mps_maxio = MAXPHYS; >>> +TUNABLE_INT("hw.mps.maxio",&mps_maxio); >>> +SYSCTL_INT(_hw_mps, OID_AUTO, maxio, CTLFLAG_RD,&mps_maxio, 0, >>> + "CAM maxio override\n"); >>> + >>> static __inline int mpssas_set_lun(uint8_t *lun, u_int ccblun); >>> static struct mpssas_target * mpssas_alloc_target(struct mpssas_softc *, >>> struct mpssas_target *); >>> @@ -938,6 +943,7 @@ >>> >>> cpi->protocol = PROTO_SCSI; >>> cpi->protocol_version = SCSI_REV_SPC; >>> cpi->ccb_h.status = CAM_REQ_CMP; >>> + cpi->maxio = mps_maxio; >>> break; >>> } >>> case XPT_GET_TRAN_SETTINGS: >> >> >> We can. but could you explain why? Have you found any problems this change? > > It would make it nice when dealing with different controllers -- a > similar example is that mfi(4) has a tunable called hw.mfi.max_cmds > which controls the I/O command queue size as not all MegaRAID cards > have the same I/O queue size capabilities. Not many people care able to configure such low-level things. It means that if such configuration is needed, then either most of others will be in trouble or at least get suboptimal performance. If there are any way to avoid such tunables, I believe we should avoid them. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 19:34:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B5711065675; Mon, 9 Jan 2012 19:34: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 7F1488FC1B; Mon, 9 Jan 2012 19:34:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q09JYCTu055193; Mon, 9 Jan 2012 19:34:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q09JYCjI055190; Mon, 9 Jan 2012 19:34:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201091934.q09JYCjI055190@svn.freebsd.org> From: John Baldwin Date: Mon, 9 Jan 2012 19:34: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: r229873 - in head/sys: kern net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 19:34:12 -0000 Author: jhb Date: Mon Jan 9 19:34:12 2012 New Revision: 229873 URL: http://svn.freebsd.org/changeset/base/229873 Log: Convert the per-interface address list lock from a mutex to a reader/writer lock. Reviewed by: bz Modified: head/sys/kern/subr_witness.c head/sys/net/if_var.h Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Mon Jan 9 19:31:35 2012 (r229872) +++ head/sys/kern/subr_witness.c Mon Jan 9 19:34:12 2012 (r229873) @@ -520,7 +520,7 @@ static struct witness_order_list_entry o { "udpinp", &lock_class_rw }, { "in_multi_mtx", &lock_class_mtx_sleep }, { "igmp_mtx", &lock_class_mtx_sleep }, - { "if_addr_mtx", &lock_class_mtx_sleep }, + { "if_addr_lock", &lock_class_rw }, { NULL, NULL }, /* * IPv6 multicast: @@ -529,7 +529,7 @@ static struct witness_order_list_entry o { "udpinp", &lock_class_rw }, { "in6_multi_mtx", &lock_class_mtx_sleep }, { "mld_mtx", &lock_class_mtx_sleep }, - { "if_addr_mtx", &lock_class_mtx_sleep }, + { "if_addr_lock", &lock_class_rw }, { NULL, NULL }, /* * UNIX Domain Sockets Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Mon Jan 9 19:31:35 2012 (r229872) +++ head/sys/net/if_var.h Mon Jan 9 19:34:12 2012 (r229873) @@ -189,11 +189,11 @@ struct ifnet { int if_afdata_initialized; struct rwlock if_afdata_lock; struct task if_linktask; /* task for link change events */ - struct mtx if_addr_mtx; /* mutex to protect address lists */ + struct rwlock if_addr_lock; /* lock to protect address lists */ LIST_ENTRY(ifnet) if_clones; /* interfaces of a cloner */ TAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */ - /* protected by if_addr_mtx */ + /* protected by if_addr_lock */ void *if_pf_kif; void *if_lagg; /* lagg glue */ char *if_description; /* interface description */ @@ -246,15 +246,14 @@ typedef void if_init_f_t(void *); /* * Locks for address lists on the network interface. */ -#define IF_ADDR_LOCK_INIT(if) mtx_init(&(if)->if_addr_mtx, \ - "if_addr_mtx", NULL, MTX_DEF) -#define IF_ADDR_LOCK_DESTROY(if) mtx_destroy(&(if)->if_addr_mtx) -#define IF_ADDR_WLOCK(if) mtx_lock(&(if)->if_addr_mtx) -#define IF_ADDR_WUNLOCK(if) mtx_unlock(&(if)->if_addr_mtx) -#define IF_ADDR_RLOCK(if) mtx_lock(&(if)->if_addr_mtx) -#define IF_ADDR_RUNLOCK(if) mtx_unlock(&(if)->if_addr_mtx) -#define IF_ADDR_LOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED) -#define IF_ADDR_WLOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED) +#define IF_ADDR_LOCK_INIT(if) rw_init(&(if)->if_addr_lock, "if_addr_lock") +#define IF_ADDR_LOCK_DESTROY(if) rw_destroy(&(if)->if_addr_lock) +#define IF_ADDR_WLOCK(if) rw_wlock(&(if)->if_addr_lock) +#define IF_ADDR_WUNLOCK(if) rw_wunlock(&(if)->if_addr_lock) +#define IF_ADDR_RLOCK(if) rw_rlock(&(if)->if_addr_lock) +#define IF_ADDR_RUNLOCK(if) rw_runlock(&(if)->if_addr_lock) +#define IF_ADDR_LOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_LOCKED) +#define IF_ADDR_WLOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_WLOCKED) /* XXX: Compat. */ #define IF_ADDR_LOCK(if) IF_ADDR_WLOCK(if) #define IF_ADDR_UNLOCK(if) IF_ADDR_WUNLOCK(if) From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 20:25:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4F10106566B; Mon, 9 Jan 2012 20:25:14 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B41028FC0C; Mon, 9 Jan 2012 20:25:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q09KPE2N057380; Mon, 9 Jan 2012 20:25:14 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q09KPEG6057378; Mon, 9 Jan 2012 20:25:14 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201092025.q09KPEG6057378@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 9 Jan 2012 20:25:14 +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: r229881 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 20:25:14 -0000 Author: pluknet Date: Mon Jan 9 20:25:14 2012 New Revision: 229881 URL: http://svn.freebsd.org/changeset/base/229881 Log: Get rid of a spurious warning on the console when booting the kernel from the interactive loader(8) prompt and beastie_disable="YES" is set in loader.conf(5). In this case menu.rc is not evaluated and consequently menu-unset does not have a body yet. This results in the ficl warning "menu-unset not found" when try-menu-unset invokes menu-unset. Check for beastie_disable="YES" explicitly, so that the try-menu-unset word will not attempt to invoke menu-unset because the menu will have never been configured. [1] Use the sfind primitive as a last resort as an additional safer approach conjuring a foreign word safely. [2] PR: kern/163938 Submitted by: Devin Teske [1] Reviewed by: Devin Teske [2] Reported and tested by: dim MFC after: 1 week X-MFC with: r228985 Modified: head/sys/boot/forth/loader.4th Modified: head/sys/boot/forth/loader.4th ============================================================================== --- head/sys/boot/forth/loader.4th Mon Jan 9 20:16:06 2012 (r229880) +++ head/sys/boot/forth/loader.4th Mon Jan 9 20:25:14 2012 (r229881) @@ -44,9 +44,20 @@ include /boot/support.4th only forth also support-functions also builtins definitions : try-menu-unset + \ menu-unset may not be present + s" beastie_disable" getenv + dup -1 <> if + s" YES" compare-insensitive 0= if + exit + then + else + drop + then s" menu-unset" - ['] evaluate catch if - 2drop + sfind if + execute + else + drop then ; From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 20:31:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA202106568D; Mon, 9 Jan 2012 20:31:12 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 65CD38FC12; Mon, 9 Jan 2012 20:31:12 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so6274649obb.13 for ; Mon, 09 Jan 2012 12:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=uST1lWGfC0pq1DlLmN0bcBd9dgCHjIwF+c93A3SyQiw=; b=DArQ1C842jV1YERbW9TQwvUvHgo5HU9hCW0yvCYBUDHsf23cNwRL0OmqUX9653mnTR A4n3eARiBtn6xU75Ro23IDX9yr1f52KFU8ZfkGkz8JACBjekf7R0l8Q4o2eVXiSj80Qf //9P5VSn3Rx7X8JbVSYvQoIqFd6Wd6ixKImes= MIME-Version: 1.0 Received: by 10.182.226.6 with SMTP id ro6mr15812838obc.3.1326141071761; Mon, 09 Jan 2012 12:31:11 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Mon, 9 Jan 2012 12:31:11 -0800 (PST) In-Reply-To: <4F0AE274.8010907@FreeBSD.org> References: <201112300624.pBU6OxO9098906@svn.freebsd.org> <4F08A518.8090207@FreeBSD.org> <4F0AE274.8010907@FreeBSD.org> Date: Mon, 9 Jan 2012 23:31:11 +0300 X-Google-Sender-Auth: snnJsg6LcoVZ1QvtlO9hn-agXeI Message-ID: From: Sergey Kandaurov To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Devin Teske Subject: Re: svn commit: r228985 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 20:31:12 -0000 On 9 January 2012 16:49, Dimitry Andric wrote: > On 2012-01-08 21:35, Sergey Kandaurov wrote: > ... > >> So, the problem arise when beastie_disable is set. >> >> In this case menu.rc is not evaluated and consequently menu-unset does >> not have a body yet. This results in the ficl warning "not found" when >> try-menu-unset calls menu-unset. The warning cannot be handled with catc= h >> as seen with the code in head. >> Otherwise, when beastie is enabled, all works as it should. >> >> To "fix" the problem I replaced 'catch' with 'sfind', so that we can >> conditionally call menu-unset only when the definition is present. >> >> Please try the following patch. I tested it with enabled/disabled beasti= e >> and loader_color over serial console. I would also like to get a review >> from Devin Teske to see if this change is acceptable. > > > Yes, this patch makes the warning disappear. =A0Thanks! FYI, committed in r229881. Thanks for the help. --=20 wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 22:15:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07DB61065679; Mon, 9 Jan 2012 22:15:59 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 78C3D8FC14; Mon, 9 Jan 2012 22:15:58 +0000 (UTC) Received: by ghrr16 with SMTP id r16so2060674ghr.13 for ; Mon, 09 Jan 2012 14:15:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ZT7FUe3IDs6U2DHnjd6jrcSrnttm42g5DesP9hVcmeM=; b=qQ09OkpbdX02XA7Vl8SBy7uMeUtlew5gjLXvSBceFOUYW1jmgsyyf++Ne3itToa8p/ QrqQVn+Vrb8HmOwFsD4HuPnZzrdA7cfcZzFbPV2M4J83PQUTn6Ynop1MuW/3OmOswMWC 7Tn4S5xq3frafdAGIGgdDqtCHYxcTBmnludFk= MIME-Version: 1.0 Received: by 10.236.91.84 with SMTP id g60mr23607849yhf.90.1326147357696; Mon, 09 Jan 2012 14:15:57 -0800 (PST) Sender: maksim.yevmenkin@gmail.com Received: by 10.101.41.18 with HTTP; Mon, 9 Jan 2012 14:15:57 -0800 (PST) In-Reply-To: <4F0B3C66.6020701@FreeBSD.org> References: <201112282249.pBSMnTZu028304@svn.freebsd.org> <4F0B38B9.1020302@FreeBSD.org> <4F0B3C66.6020701@FreeBSD.org> Date: Mon, 9 Jan 2012 14:15:57 -0800 X-Google-Sender-Auth: -ngbzUl8qu04FNji6cnQyp5Qs-w Message-ID: From: Maksim Yevmenkin To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228939 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 22:15:59 -0000 2012/1/9 Alexander Motin : > On 09.01.2012 21:01, Maksim Yevmenkin wrote: >> >> 2012/1/9 Alexander Motin: >>> >>> On 09.01.2012 20:54, Maksim Yevmenkin wrote: >>>> >>>> >>>> On Wed, Dec 28, 2011 at 2:49 PM, Alexander Motin >>>> =A0wrote: >>>>> >>>>> >>>>> Author: mav >>>>> Date: Wed Dec 28 22:49:28 2011 >>>>> New Revision: 228939 >>>>> URL: http://svn.freebsd.org/changeset/base/228939 >>>>> >>>>> Log: >>>>> =A0Set maximum I/O size for mps(4) to MAXPHYS. Looking into the code,= I >>>>> see >>>>> =A0no reason why it should be limited to 64K of DFLTPHYS. DMA data ta= g is >>>>> any >>>>> =A0way set to allow MAXPHYS, S/G lists (chain elements) are sufficien= t >>>>> and >>>>> =A0overflows are also handled. On my tests even 1MB I/Os are working >>>>> fine. >>>>> >>>>> =A0Reviewed by: =A0ken@ >>>>> >>>>> Modified: >>>>> =A0head/sys/dev/mps/mps_sas.c >>>>> >>>>> Modified: head/sys/dev/mps/mps_sas.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/sys/dev/mps/mps_sas.c =A0Wed Dec 28 22:18:53 2011 >>>>> =A0(r228938) >>>>> +++ head/sys/dev/mps/mps_sas.c =A0Wed Dec 28 22:49:28 2011 >>>>> =A0(r228939) >>>>> @@ -937,6 +937,7 @@ mpssas_action(struct cam_sim *sim, union >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->transport_version =3D 0; >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol =3D PROTO_SCSI; >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol_version =3D SCSI_REV_SPC= ; >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cpi->maxio =3D MAXPHYS; >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->ccb_h.status =3D CAM_REQ_CMP; >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>>>> =A0 =A0 =A0 =A0} >>>> >>>> >>>> >>>> sorry for the late reply, but can we make in into tunable please? i >>>> have in local tree >>>> >>>> --- mps_sas.c.orig =A0 =A0 =A02011-11-17 02:05:04.000000000 -0800 >>>> +++ mps_sas.c =A0 2011-12-28 16:05:10.000000000 -0800 >>>> @@ -121,6 +121,11 @@ >>>> >>>> =A0MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); >>>> >>>> +int mps_maxio =3D MAXPHYS; >>>> +TUNABLE_INT("hw.mps.maxio",&mps_maxio); >>>> +SYSCTL_INT(_hw_mps, OID_AUTO, maxio, CTLFLAG_RD,&mps_maxio, 0, >>>> >>>> + =A0 =A0 =A0 "CAM maxio override\n"); >>>> + >>>> =A0static __inline int mpssas_set_lun(uint8_t *lun, u_int ccblun); >>>> =A0static struct mpssas_target * mpssas_alloc_target(struct mpssas_sof= tc >>>> *, >>>> =A0 =A0 =A0struct mpssas_target *); >>>> @@ -938,6 +943,7 @@ >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol =3D PROTO_SCSI; >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->protocol_version =3D SCSI_REV_SPC; >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpi->ccb_h.status =3D CAM_REQ_CMP; >>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cpi->maxio =3D mps_maxio; >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>>> =A0 =A0 =A0 =A0} >>>> =A0 =A0 =A0 =A0case XPT_GET_TRAN_SETTINGS: >>> >>> >>> >>> We can. but could you explain why? Have you found any problems this >>> change? >> >> >> not really. i've had this patch in the local tree for a while now. we >> are experimenting with various MAXPHYS/maxio settings and having this >> tunable is very handy. basically, we can set MAXPHYS to some larger >> value and tweak maxio (for testing purposes) without >> recompiling/installing new kernel. > > > I don't really think that it is perfect place for such tunable. It is a b= it > strange IMHO to have different maxio for different types of HBAs except > physical limitations. I would prefer it to be configurable on above layer= s, > for example, file systems, if needed. But if you need it here for somethi= ng, > I won't object against adding it. i'm not sure i understand your point. there certainly drivers that set maxio to value smaller then MAXPHYS. sometimes comments in the code clearly state that this is because of hardware limitation. in case of mps(4) it was not clear at all which values are acceptable for maxio. hence the tunable. > Have you found any benefits of having maxio below MAXPHYS while > experimenting? May be those results could be used to improve FS behavior > somehow to make tuning not needed? we believe so. fs tuning is under investigation as well. thanks max From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 23:01:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B34EA106566C; Mon, 9 Jan 2012 23:01:42 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9CAF38FC15; Mon, 9 Jan 2012 23:01:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q09N1gsG064210; Mon, 9 Jan 2012 23:01:42 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q09N1gKe064207; Mon, 9 Jan 2012 23:01:42 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201201092301.q09N1gKe064207@svn.freebsd.org> From: Jim Harris Date: Mon, 9 Jan 2012 23:01: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: r229886 - in head: sbin/geom/class/raid sys/geom/raid X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 23:01:42 -0000 Author: jimharris Date: Mon Jan 9 23:01:42 2012 New Revision: 229886 URL: http://svn.freebsd.org/changeset/base/229886 Log: Add support for >2TB disks in GEOM RAID for Intel metadata format. Reviewed by: mav Approved by: scottl MFC after: 1 week Modified: head/sbin/geom/class/raid/graid.8 head/sys/geom/raid/md_intel.c Modified: head/sbin/geom/class/raid/graid.8 ============================================================================== --- head/sbin/geom/class/raid/graid.8 Mon Jan 9 21:52:55 2012 (r229885) +++ head/sbin/geom/class/raid/graid.8 Mon Jan 9 23:01:42 2012 (r229886) @@ -251,7 +251,7 @@ complete it there. Do not run GEOM RAID class on migrating volumes under pain of possible data corruption! .Sh 2TiB BARRIERS -Intel and Promise metadata formats do not support disks above 2TiB. +Promise metadata format does not support disks above 2TiB. NVIDIA metadata format does not support volumes above 2TiB. .Sh EXIT STATUS Exit status is 0 on success, and non-zero if the command fails. Modified: head/sys/geom/raid/md_intel.c ============================================================================== --- head/sys/geom/raid/md_intel.c Mon Jan 9 21:52:55 2012 (r229885) +++ head/sys/geom/raid/md_intel.c Mon Jan 9 23:01:42 2012 (r229886) @@ -64,7 +64,10 @@ struct intel_raid_map { uint8_t total_domains; uint8_t failed_disk_num; uint8_t ddf; - uint32_t filler_2[7]; + uint32_t offset_hi; + uint32_t disk_sectors_hi; + uint32_t stripe_count_hi; + uint32_t filler_2[4]; uint32_t disk_idx[1]; /* total_disks entries. */ #define INTEL_DI_IDX 0x00ffffff #define INTEL_DI_RBLD 0x01000000 @@ -111,7 +114,8 @@ struct intel_raid_vol { uint8_t fs_state; uint16_t verify_errors; uint16_t bad_blocks; - uint32_t filler_1[4]; + uint32_t curr_migr_unit_hi; + uint32_t filler_1[3]; struct intel_raid_map map[1]; /* 2 entries if migr_state != 0. */ } __packed; @@ -125,8 +129,9 @@ struct intel_raid_disk { #define INTEL_F_ASSIGNED 0x02 #define INTEL_F_FAILED 0x04 #define INTEL_F_ONLINE 0x08 - - uint32_t filler[5]; + uint32_t owner_cfg_num; + uint32_t sectors_hi; + uint32_t filler[3]; } __packed; struct intel_raid_conf { @@ -254,6 +259,82 @@ intel_get_volume(struct intel_raid_conf return (mvol); } +static off_t +intel_get_map_offset(struct intel_raid_map *mmap) +{ + off_t offset = (off_t)mmap->offset_hi << 32; + + offset += mmap->offset; + return (offset); +} + +static void +intel_set_map_offset(struct intel_raid_map *mmap, off_t offset) +{ + + mmap->offset = offset & 0xffffffff; + mmap->offset_hi = offset >> 32; +} + +static off_t +intel_get_map_disk_sectors(struct intel_raid_map *mmap) +{ + off_t disk_sectors = (off_t)mmap->disk_sectors_hi << 32; + + disk_sectors += mmap->disk_sectors; + return (disk_sectors); +} + +static void +intel_set_map_disk_sectors(struct intel_raid_map *mmap, off_t disk_sectors) +{ + + mmap->disk_sectors = disk_sectors & 0xffffffff; + mmap->disk_sectors_hi = disk_sectors >> 32; +} + +static void +intel_set_map_stripe_count(struct intel_raid_map *mmap, off_t stripe_count) +{ + + mmap->stripe_count = stripe_count & 0xffffffff; + mmap->stripe_count_hi = stripe_count >> 32; +} + +static off_t +intel_get_disk_sectors(struct intel_raid_disk *disk) +{ + off_t sectors = (off_t)disk->sectors_hi << 32; + + sectors += disk->sectors; + return (sectors); +} + +static void +intel_set_disk_sectors(struct intel_raid_disk *disk, off_t sectors) +{ + + disk->sectors = sectors & 0xffffffff; + disk->sectors_hi = sectors >> 32; +} + +static off_t +intel_get_vol_curr_migr_unit(struct intel_raid_vol *vol) +{ + off_t curr_migr_unit = (off_t)vol->curr_migr_unit_hi << 32; + + curr_migr_unit += vol->curr_migr_unit; + return (curr_migr_unit); +} + +static void +intel_set_vol_curr_migr_unit(struct intel_raid_vol *vol, off_t curr_migr_unit) +{ + + vol->curr_migr_unit = curr_migr_unit & 0xffffffff; + vol->curr_migr_unit_hi = curr_migr_unit >> 32; +} + static void g_raid_md_intel_print(struct intel_raid_conf *meta) { @@ -274,10 +355,11 @@ g_raid_md_intel_print(struct intel_raid_ printf("attributes 0x%08x\n", meta->attributes); printf("total_disks %u\n", meta->total_disks); printf("total_volumes %u\n", meta->total_volumes); - printf("DISK# serial disk_sectors disk_id flags\n"); + printf("DISK# serial disk_sectors disk_sectors_hi disk_id flags\n"); for (i = 0; i < meta->total_disks; i++ ) { - printf(" %d <%.16s> %u 0x%08x 0x%08x\n", i, + printf(" %d <%.16s> %u %u 0x%08x 0x%08x\n", i, meta->disk[i].serial, meta->disk[i].sectors, + meta->disk[i].sectors_hi, meta->disk[i].id, meta->disk[i].flags); } for (i = 0; i < meta->total_volumes; i++) { @@ -288,6 +370,7 @@ g_raid_md_intel_print(struct intel_raid_ printf(" state %u\n", mvol->state); printf(" reserved %u\n", mvol->reserved); printf(" curr_migr_unit %u\n", mvol->curr_migr_unit); + printf(" curr_migr_unit_hi %u\n", mvol->curr_migr_unit_hi); printf(" checkpoint_id %u\n", mvol->checkpoint_id); printf(" migr_state %u\n", mvol->migr_state); printf(" migr_type %u\n", mvol->migr_type); @@ -297,8 +380,11 @@ g_raid_md_intel_print(struct intel_raid_ printf(" *** Map %d ***\n", j); mmap = intel_get_map(mvol, j); printf(" offset %u\n", mmap->offset); + printf(" offset_hi %u\n", mmap->offset_hi); printf(" disk_sectors %u\n", mmap->disk_sectors); + printf(" disk_sectors_hi %u\n", mmap->disk_sectors_hi); printf(" stripe_count %u\n", mmap->stripe_count); + printf(" stripe_count_hi %u\n", mmap->stripe_count_hi); printf(" strip_sectors %u\n", mmap->strip_sectors); printf(" status %u\n", mmap->status); printf(" type %u\n", mmap->type); @@ -660,12 +746,15 @@ g_raid_md_intel_start_disk(struct g_raid continue; /* Make sure this disk is big enough. */ TAILQ_FOREACH(sd, &tmpdisk->d_subdisks, sd_next) { + off_t disk_sectors = + intel_get_disk_sectors(&pd->pd_disk_meta); + if (sd->sd_offset + sd->sd_size + 4096 > - (off_t)pd->pd_disk_meta.sectors * 512) { + disk_sectors * 512) { G_RAID_DEBUG1(1, sc, "Disk too small (%llu < %llu)", - ((unsigned long long) - pd->pd_disk_meta.sectors) * 512, + (unsigned long long) + disk_sectors * 512, (unsigned long long) sd->sd_offset + sd->sd_size + 4096); break; @@ -788,7 +877,7 @@ nofit: sd->sd_rebuild_pos = 0; } else { sd->sd_rebuild_pos = - (off_t)mvol->curr_migr_unit * + intel_get_vol_curr_migr_unit(mvol) * sd->sd_volume->v_strip_size * mmap0->total_domains; } @@ -815,7 +904,7 @@ nofit: sd->sd_rebuild_pos = 0; } else { sd->sd_rebuild_pos = - (off_t)mvol->curr_migr_unit * + intel_get_vol_curr_migr_unit(mvol) * sd->sd_volume->v_strip_size * mmap0->total_domains; } @@ -967,8 +1056,8 @@ g_raid_md_intel_start(struct g_raid_soft vol->v_sectorsize = 512; //ZZZ for (j = 0; j < vol->v_disks_count; j++) { sd = &vol->v_subdisks[j]; - sd->sd_offset = (off_t)mmap->offset * 512; //ZZZ - sd->sd_size = (off_t)mmap->disk_sectors * 512; //ZZZ + sd->sd_offset = intel_get_map_offset(mmap) * 512; //ZZZ + sd->sd_size = intel_get_map_disk_sectors(mmap) * 512; //ZZZ } g_raid_start_volume(vol); } @@ -1176,9 +1265,6 @@ g_raid_md_taste_intel(struct g_raid_md_o G_RAID_DEBUG(1, "Intel vendor mismatch 0x%04x != 0x8086", vendor); - } else if (pp->mediasize / pp->sectorsize > UINT32_MAX) { - G_RAID_DEBUG(1, - "Intel disk '%s' is too big.", pp->name); } else { G_RAID_DEBUG(1, "No Intel metadata, forcing spare."); @@ -1195,10 +1281,10 @@ g_raid_md_taste_intel(struct g_raid_md_o G_RAID_DEBUG(1, "Intel serial '%s' not found", serial); goto fail1; } - if (meta->disk[disk_pos].sectors != + if (intel_get_disk_sectors(&meta->disk[disk_pos]) != (pp->mediasize / pp->sectorsize)) { G_RAID_DEBUG(1, "Intel size mismatch %ju != %ju", - (off_t)meta->disk[disk_pos].sectors, + intel_get_disk_sectors(&meta->disk[disk_pos]), (off_t)(pp->mediasize / pp->sectorsize)); goto fail1; } @@ -1266,7 +1352,8 @@ search: pd->pd_disk_pos = -1; if (spare == 2) { memcpy(&pd->pd_disk_meta.serial[0], serial, INTEL_SERIAL_LEN); - pd->pd_disk_meta.sectors = pp->mediasize / pp->sectorsize; + intel_set_disk_sectors(&pd->pd_disk_meta, + pp->mediasize / pp->sectorsize); pd->pd_disk_meta.id = 0; pd->pd_disk_meta.flags = INTEL_F_SPARE; } else { @@ -1372,7 +1459,7 @@ g_raid_md_ctl_intel(struct g_raid_md_obj const char *verb, *volname, *levelname, *diskname; char *tmp; int *nargs, *force; - off_t off, size, sectorsize, strip; + off_t off, size, sectorsize, strip, disk_sectors; intmax_t *sizearg, *striparg; int numdisks, i, len, level, qual, update; int error; @@ -1452,13 +1539,6 @@ g_raid_md_ctl_intel(struct g_raid_md_obj cp->private = disk; g_topology_unlock(); - if (pp->mediasize / pp->sectorsize > UINT32_MAX) { - gctl_error(req, - "Disk '%s' is too big.", diskname); - error = -8; - break; - } - error = g_raid_md_get_label(cp, &pd->pd_disk_meta.serial[0], INTEL_SERIAL_LEN); if (error != 0) { @@ -1479,7 +1559,8 @@ g_raid_md_ctl_intel(struct g_raid_md_obj "Dumping not supported by %s.", cp->provider->name); - pd->pd_disk_meta.sectors = pp->mediasize / pp->sectorsize; + intel_set_disk_sectors(&pd->pd_disk_meta, + pp->mediasize / pp->sectorsize); if (size > pp->mediasize) size = pp->mediasize; if (sectorsize < pp->sectorsize) @@ -1544,10 +1625,6 @@ g_raid_md_ctl_intel(struct g_raid_md_obj gctl_error(req, "Size too small."); return (-13); } - if (size > 0xffffffffllu * sectorsize) { - gctl_error(req, "Size too big."); - return (-14); - } /* We have all we need, create things: volume, ... */ mdi->mdio_started = 1; @@ -1655,8 +1732,11 @@ g_raid_md_ctl_intel(struct g_raid_md_obj disk = vol1->v_subdisks[i].sd_disk; pd = (struct g_raid_md_intel_perdisk *) disk->d_md_data; - if ((off_t)pd->pd_disk_meta.sectors * 512 < size) - size = (off_t)pd->pd_disk_meta.sectors * 512; + disk_sectors = + intel_get_disk_sectors(&pd->pd_disk_meta); + + if (disk_sectors * 512 < size) + size = disk_sectors * 512; if (disk->d_consumer != NULL && disk->d_consumer->provider != NULL && disk->d_consumer->provider->sectorsize > @@ -1950,14 +2030,6 @@ g_raid_md_ctl_intel(struct g_raid_md_obj pp = cp->provider; g_topology_unlock(); - if (pp->mediasize / pp->sectorsize > UINT32_MAX) { - gctl_error(req, - "Disk '%s' is too big.", diskname); - g_raid_kill_consumer(sc, cp); - error = -8; - break; - } - /* Read disk serial. */ error = g_raid_md_get_label(cp, &serial[0], INTEL_SERIAL_LEN); @@ -1990,7 +2062,8 @@ g_raid_md_ctl_intel(struct g_raid_md_obj memcpy(&pd->pd_disk_meta.serial[0], &serial[0], INTEL_SERIAL_LEN); - pd->pd_disk_meta.sectors = pp->mediasize / pp->sectorsize; + intel_set_disk_sectors(&pd->pd_disk_meta, + pp->mediasize / pp->sectorsize); pd->pd_disk_meta.id = 0; pd->pd_disk_meta.flags = INTEL_F_SPARE; @@ -2165,8 +2238,8 @@ g_raid_md_write_intel(struct g_raid_md_o mmap0 = intel_get_map(mvol, 0); /* Write map / common part of two maps. */ - mmap0->offset = sd->sd_offset / sectorsize; - mmap0->disk_sectors = sd->sd_size / sectorsize; + intel_set_map_offset(mmap0, sd->sd_offset / sectorsize); + intel_set_map_disk_sectors(mmap0, sd->sd_size / sectorsize); mmap0->strip_sectors = vol->v_strip_size / sectorsize; if (vol->v_state == G_RAID_VOLUME_S_BROKEN) mmap0->status = INTEL_S_FAILURE; @@ -2188,15 +2261,15 @@ g_raid_md_write_intel(struct g_raid_md_o mmap0->total_domains = 2; else mmap0->total_domains = 1; - mmap0->stripe_count = sd->sd_size / vol->v_strip_size / - mmap0->total_domains; + intel_set_map_stripe_count(mmap0, + sd->sd_size / vol->v_strip_size / mmap0->total_domains); mmap0->failed_disk_num = 0xff; mmap0->ddf = 1; /* If there are two maps - copy common and update. */ if (mvol->migr_state) { - mvol->curr_migr_unit = pos / - vol->v_strip_size / mmap0->total_domains; + intel_set_vol_curr_migr_unit(mvol, + pos / vol->v_strip_size / mmap0->total_domains); mmap1 = intel_get_map(mvol, 1); memcpy(mmap1, mmap0, sizeof(struct intel_raid_map)); mmap0->status = INTEL_S_READY; From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 23:20:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD96F106566C; Mon, 9 Jan 2012 23:20:30 +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 7DB158FC22; Mon, 9 Jan 2012 23:20:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q09NKUPY065385; Mon, 9 Jan 2012 23:20:30 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q09NKUhv065381; Mon, 9 Jan 2012 23:20:30 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201201092320.q09NKUhv065381@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 9 Jan 2012 23:20:30 +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: r229887 - in head/sys: conf dev/random modules/random X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 23:20:30 -0000 Author: jkim Date: Mon Jan 9 23:20:30 2012 New Revision: 229887 URL: http://svn.freebsd.org/changeset/base/229887 Log: Enable hardware RNG for VIA Nano processors. PR: kern/163974 Modified: head/sys/conf/files.amd64 head/sys/dev/random/probe.c head/sys/modules/random/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Mon Jan 9 23:01:42 2012 (r229886) +++ head/sys/conf/files.amd64 Mon Jan 9 23:20:30 2012 (r229887) @@ -215,6 +215,7 @@ dev/lindev/lindev.c optional lindev dev/nfe/if_nfe.c optional nfe pci dev/nve/if_nve.c optional nve pci dev/nvram/nvram.c optional nvram isa +dev/random/nehemiah.c optional random dev/qlxgb/qla_dbg.c optional qlxgb pci dev/qlxgb/qla_hw.c optional qlxgb pci dev/qlxgb/qla_ioctl.c optional qlxgb pci Modified: head/sys/dev/random/probe.c ============================================================================== --- head/sys/dev/random/probe.c Mon Jan 9 23:01:42 2012 (r229886) +++ head/sys/dev/random/probe.c Mon Jan 9 23:20:30 2012 (r229887) @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__i386__) && !defined(PC98) +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) #include #include #include @@ -55,7 +55,7 @@ random_ident_hardware(struct random_syst *systat = random_yarrow; /* Then go looking for hardware */ -#if defined(__i386__) && !defined(PC98) +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) if (via_feature_rng & VIA_HAS_RNG) { *systat = random_nehemiah; } Modified: head/sys/modules/random/Makefile ============================================================================== --- head/sys/modules/random/Makefile Mon Jan 9 23:01:42 2012 (r229886) +++ head/sys/modules/random/Makefile Mon Jan 9 23:20:30 2012 (r229887) @@ -6,7 +6,7 @@ KMOD= random SRCS= randomdev.c probe.c -.if ${MACHINE} == "i386" +.if ${MACHINE} == "amd64" || ${MACHINE} == "i386" SRCS+= nehemiah.c .endif SRCS+= randomdev_soft.c yarrow.c hash.c From owner-svn-src-head@FreeBSD.ORG Mon Jan 9 23:43:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E62B01065675; Mon, 9 Jan 2012 23:43:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5D12E8FC16; Mon, 9 Jan 2012 23:43:42 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q09Nhdbq086388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Jan 2012 01:43:39 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q09Nhdoh055683; Tue, 10 Jan 2012 01:43:39 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q09NhdFV055682; Tue, 10 Jan 2012 01:43:39 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 10 Jan 2012 01:43:39 +0200 From: Kostik Belousov To: Jung-uk Kim Message-ID: <20120109234339.GD31224@deviant.kiev.zoral.com.ua> References: <201201092320.q09NKUhv065381@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sR4wgT97u2q5hWcW" Content-Disposition: inline In-Reply-To: <201201092320.q09NKUhv065381@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229887 - in head/sys: conf dev/random modules/random X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 23:43:44 -0000 --sR4wgT97u2q5hWcW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 09, 2012 at 11:20:30PM +0000, Jung-uk Kim wrote: > Author: jkim > Date: Mon Jan 9 23:20:30 2012 > New Revision: 229887 > URL: http://svn.freebsd.org/changeset/base/229887 >=20 > Log: > Enable hardware RNG for VIA Nano processors. > =20 > PR: kern/163974 Can we, please, have VIA RNG enabled under some option ? It is currently eating 512 bytes on 99.9% of machines for FPU save area. Shortly it will take even more on AVX-capable machines. --sR4wgT97u2q5hWcW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk8Le6sACgkQC3+MBN1Mb4jdWQCePjezcIEJbumtsekAo28v/W7F gOwAoJ5trw99Mgaule5+SV1TKk1oTBtf =NtT7 -----END PGP SIGNATURE----- --sR4wgT97u2q5hWcW-- From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 00:48:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54BA31065677; Tue, 10 Jan 2012 00:48:30 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2563D8FC13; Tue, 10 Jan 2012 00:48:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A0mUEV071591; Tue, 10 Jan 2012 00:48:30 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A0mUmu071589; Tue, 10 Jan 2012 00:48:30 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201201100048.q0A0mUmu071589@svn.freebsd.org> From: Lawrence Stewart Date: Tue, 10 Jan 2012 00:48:30 +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: r229898 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 00:48:30 -0000 Author: lstewart Date: Tue Jan 10 00:48:29 2012 New Revision: 229898 URL: http://svn.freebsd.org/changeset/base/229898 Log: Consumers of bpfdetach() expect it to remove all bpf_if structs from the bpf_iflist list which reference the specified ifnet. The existing implementation only removes the first matching bpf_if found in the list, effectively leaking list entries if an ifnet has been bpfattach()ed multiple times with different DLTs. Fix the leak by performing the detach logic in a loop, stopping when all bpf_if structs referencing the specified ifnet have been detached and removed from the bpf_iflist list. Whilst here, also: - Remove the unnecessary "bp->bif_ifp == NULL" check, as a bpf_if should never exist in the list with a NULL ifnet pointer. - Except when INVARIANTS is in the kernel config, silently ignore the case where no bpf_if referencing the specified ifnet is found, as it is harmless and does not require user attention. Reviewed by: csjp MFC after: 1 week Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Tue Jan 10 00:35:25 2012 (r229897) +++ head/sys/net/bpf.c Tue Jan 10 00:48:29 2012 (r229898) @@ -2253,33 +2253,42 @@ bpfdetach(struct ifnet *ifp) { struct bpf_if *bp; struct bpf_d *d; +#ifdef INVARIANTS + int ndetached; - /* Locate BPF interface information */ - mtx_lock(&bpf_mtx); - LIST_FOREACH(bp, &bpf_iflist, bif_next) { - if (ifp == bp->bif_ifp) - break; - } + ndetached = 0; +#endif - /* Interface wasn't attached */ - if ((bp == NULL) || (bp->bif_ifp == NULL)) { + /* Find all bpf_if struct's which reference ifp and detach them. */ + do { + mtx_lock(&bpf_mtx); + LIST_FOREACH(bp, &bpf_iflist, bif_next) { + if (ifp == bp->bif_ifp) + break; + } + if (bp != NULL) + LIST_REMOVE(bp, bif_next); mtx_unlock(&bpf_mtx); - printf("bpfdetach: %s was not attached\n", ifp->if_xname); - return; - } - - LIST_REMOVE(bp, bif_next); - mtx_unlock(&bpf_mtx); - while ((d = LIST_FIRST(&bp->bif_dlist)) != NULL) { - bpf_detachd(d); - BPFD_LOCK(d); - bpf_wakeup(d); - BPFD_UNLOCK(d); - } + if (bp != NULL) { +#ifdef INVARIANTS + ndetached++; +#endif + while ((d = LIST_FIRST(&bp->bif_dlist)) != NULL) { + bpf_detachd(d); + BPFD_LOCK(d); + bpf_wakeup(d); + BPFD_UNLOCK(d); + } + mtx_destroy(&bp->bif_mtx); + free(bp, M_BPF); + } + } while (bp != NULL); - mtx_destroy(&bp->bif_mtx); - free(bp, M_BPF); +#ifdef INVARIANTS + if (ndetached == 0) + printf("bpfdetach: %s was not attached\n", ifp->if_xname); +#endif } /* From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:55:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2E47106566B; Tue, 10 Jan 2012 02:55:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A62A8FC18; Tue, 10 Jan 2012 02:55:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2tZRJ079422; Tue, 10 Jan 2012 02:55:35 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2tZRY079419; Tue, 10 Jan 2012 02:55:35 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100255.q0A2tZRY079419@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:55: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: r229904 - head/libexec/tftpd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:55:35 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:55:35 2012 New Revision: 229904 URL: http://svn.freebsd.org/changeset/base/229904 Log: Fix warning when compiling with gcc46: error: variable 'bp' set but not use Approved by: dim MFC After: 3 days Modified: head/libexec/tftpd/tftp-io.c Modified: head/libexec/tftpd/tftp-io.c ============================================================================== --- head/libexec/tftpd/tftp-io.c Tue Jan 10 02:21:48 2012 (r229903) +++ head/libexec/tftpd/tftp-io.c Tue Jan 10 02:55:35 2012 (r229904) @@ -323,7 +323,6 @@ send_ack(int fp, uint16_t block) { struct tftphdr *tp; int size; - char *bp; char buf[MAXPKTSIZE]; if (debug&DEBUG_PACKETS) @@ -332,7 +331,6 @@ send_ack(int fp, uint16_t block) DROPPACKETn("send_ack", 0); tp = (struct tftphdr *)buf; - bp = buf + 2; size = sizeof(buf) - 2; tp->th_opcode = htons((u_short)ACK); tp->th_block = htons((u_short)block); From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:55:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 783A3106567F; Tue, 10 Jan 2012 02:55:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 635E58FC0A; Tue, 10 Jan 2012 02:55:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2thSn079483; Tue, 10 Jan 2012 02:55:43 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2thmp079480; Tue, 10 Jan 2012 02:55:43 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100255.q0A2thmp079480@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:55: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: r229905 - head/usr.bin/split X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:55:43 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:55:43 2012 New Revision: 229905 URL: http://svn.freebsd.org/changeset/base/229905 Log: Fix warning when compiling with gcc46: error: variable 'defname' set but not use Approved by: dim MFC after: 3 day Modified: head/usr.bin/split/split.c Modified: head/usr.bin/split/split.c ============================================================================== --- head/usr.bin/split/split.c Tue Jan 10 02:55:35 2012 (r229904) +++ head/usr.bin/split/split.c Tue Jan 10 02:55:43 2012 (r229905) @@ -347,17 +347,14 @@ newfile(void) { long i, maxfiles, tfnum; static long fnum; - static int defname; static char *fpnt; if (ofd == -1) { if (fname[0] == '\0') { fname[0] = 'x'; fpnt = fname + 1; - defname = 1; } else { fpnt = fname + strlen(fname); - defname = 0; } ofd = fileno(stdout); } From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:58:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 484621065673; Tue, 10 Jan 2012 02:58:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3336E8FC1F; Tue, 10 Jan 2012 02:58:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2wLH9079703; Tue, 10 Jan 2012 02:58:21 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2wLkH079701; Tue, 10 Jan 2012 02:58:21 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100258.q0A2wLkH079701@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:58: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: r229907 - head/usr.bin/ncplist X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:58:21 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:58:20 2012 New Revision: 229907 URL: http://svn.freebsd.org/changeset/base/229907 Log: Fix warning when compiling with gcc46: error: variable 'wdone' set but not use Approved by: dim MFC after: 3 days Modified: head/usr.bin/ncplist/ncplist.c Modified: head/usr.bin/ncplist/ncplist.c ============================================================================== --- head/usr.bin/ncplist/ncplist.c Tue Jan 10 02:55:43 2012 (r229906) +++ head/usr.bin/ncplist/ncplist.c Tue Jan 10 02:58:20 2012 (r229907) @@ -375,7 +375,7 @@ enum listop { int main(int argc, char *argv[]) { - int opt, wdone = 0, nargs = 0, i; + int opt, nargs = 0, i; enum listop what; char *args[MAX_ARGS]; @@ -438,23 +438,18 @@ main(int argc, char *argv[]) switch(what) { case LO_SERVERS: show_serverlist(args[0]); - wdone = 1; break; case LO_USERS: show_userlist(args[0]); - wdone = 1; break; case LO_QUEUES: show_queuelist(args[0], args[1]); - wdone = 1; break; case LO_VOLUMES: list_volumes(args[0]); - wdone = 1; break; case LO_BINDERY: list_bindery(args[0], args[1], args[2]); - wdone = 1; break; default: help(); From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:58:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64F6B1065672; Tue, 10 Jan 2012 02:58:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 502DD8FC1D; Tue, 10 Jan 2012 02:58:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2wTWt079755; Tue, 10 Jan 2012 02:58:29 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2wT7E079753; Tue, 10 Jan 2012 02:58:29 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100258.q0A2wT7E079753@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:58: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: r229908 - head/usr.bin/brandelf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:58:29 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:58:29 2012 New Revision: 229908 URL: http://svn.freebsd.org/changeset/base/229908 Log: Fix warning when compiling with gcc46: error: variable 'verbose' set but not use Approved by: dim MFC after: 3 days Modified: head/usr.bin/brandelf/brandelf.c Modified: head/usr.bin/brandelf/brandelf.c ============================================================================== --- head/usr.bin/brandelf/brandelf.c Tue Jan 10 02:58:20 2012 (r229907) +++ head/usr.bin/brandelf/brandelf.c Tue Jan 10 02:58:29 2012 (r229908) @@ -64,7 +64,7 @@ main(int argc, char **argv) const char *strtype = "FreeBSD"; int type = ELFOSABI_FREEBSD; int retval = 0; - int ch, change = 0, verbose = 0, force = 0, listed = 0; + int ch, change = 0, force = 0, listed = 0; while ((ch = getopt(argc, argv, "f:lt:v")) != -1) switch (ch) { @@ -84,7 +84,7 @@ main(int argc, char **argv) listed = 1; break; case 'v': - verbose = 1; + /* does nothing */ break; case 't': if (force) From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:58:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A203E106585C; Tue, 10 Jan 2012 02:58:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D1958FC15; Tue, 10 Jan 2012 02:58:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2waEd079799; Tue, 10 Jan 2012 02:58:36 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2waaY079797; Tue, 10 Jan 2012 02:58:36 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100258.q0A2waaY079797@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:58: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: r229909 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:58:36 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:58:36 2012 New Revision: 229909 URL: http://svn.freebsd.org/changeset/base/229909 Log: Fix warning when compiling with gcc46: error: variable 'ifnetfound' set but not used Approved by: dim MFC after: 3 days Modified: head/usr.bin/netstat/if.c Modified: head/usr.bin/netstat/if.c ============================================================================== --- head/usr.bin/netstat/if.c Tue Jan 10 02:58:29 2012 (r229908) +++ head/usr.bin/netstat/if.c Tue Jan 10 02:58:36 2012 (r229909) @@ -188,7 +188,6 @@ intpr(int interval1, u_long ifnetaddr, v } ifaddr; u_long ifaddraddr; u_long ifaddrfound; - u_long ifnetfound; u_long opackets; u_long ipackets; u_long obytes; @@ -249,7 +248,6 @@ intpr(int interval1, u_long ifnetaddr, v link_layer = 0; if (ifaddraddr == 0) { - ifnetfound = ifnetaddr; if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet) != 0) return; strlcpy(name, ifnet.if_xname, sizeof(name)); From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:58:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C72871065670; Tue, 10 Jan 2012 02:58:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B22368FC13; Tue, 10 Jan 2012 02:58:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2wi7g079845; Tue, 10 Jan 2012 02:58:44 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2wiNu079843; Tue, 10 Jan 2012 02:58:44 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100258.q0A2wiNu079843@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:58: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: r229910 - head/usr.bin/bsdiff/bsdiff X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:58:44 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:58:44 2012 New Revision: 229910 URL: http://svn.freebsd.org/changeset/base/229910 Log: Silence bogus warning when compiling with gcc46: error: 'pos' may be used uninitialized in this function Reviewed by: cperciva Approved by: dim MFC after: 3 days Modified: head/usr.bin/bsdiff/bsdiff/bsdiff.c Modified: head/usr.bin/bsdiff/bsdiff/bsdiff.c ============================================================================== --- head/usr.bin/bsdiff/bsdiff/bsdiff.c Tue Jan 10 02:58:36 2012 (r229909) +++ head/usr.bin/bsdiff/bsdiff/bsdiff.c Tue Jan 10 02:58:44 2012 (r229910) @@ -272,7 +272,7 @@ int main(int argc,char *argv[]) /* Compute the differences, writing ctrl as we go */ if ((pfbz2 = BZ2_bzWriteOpen(&bz2err, pf, 9, 0, 0)) == NULL) errx(1, "BZ2_bzWriteOpen, bz2err = %d", bz2err); - scan=0;len=0; + scan=0;len=0;pos=0; lastscan=0;lastpos=0;lastoffset=0; while(scan Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 535BE106567F; Tue, 10 Jan 2012 02:58:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E9708FC13; Tue, 10 Jan 2012 02:58:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2wrNb079890; Tue, 10 Jan 2012 02:58:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2wrDQ079888; Tue, 10 Jan 2012 02:58:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100258.q0A2wrDQ079888@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:58: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: r229911 - head/sbin/tunefs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:58:53 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:58:52 2012 New Revision: 229911 URL: http://svn.freebsd.org/changeset/base/229911 Log: Fix warning when compiling with gcc46: error: variable 'Sflag' set but not used Approved by: dim MFC after: 3 days Modified: head/sbin/tunefs/tunefs.c Modified: head/sbin/tunefs/tunefs.c ============================================================================== --- head/sbin/tunefs/tunefs.c Tue Jan 10 02:58:44 2012 (r229910) +++ head/sbin/tunefs/tunefs.c Tue Jan 10 02:58:52 2012 (r229911) @@ -90,7 +90,7 @@ main(int argc, char *argv[]) int Aflag, aflag, eflag, evalue, fflag, fvalue, jflag, Jflag, Lflag; int lflag, mflag, mvalue, Nflag, nflag, oflag, ovalue, pflag, sflag; int tflag; - int svalue, Sflag, Svalue; + int svalue, Svalue; int ch, found_arg, i; const char *chg[2]; struct ufs_args args; @@ -269,7 +269,6 @@ main(int argc, char *argv[]) if (Svalue < SUJ_MIN) errx(10, "%s must be >= %d (was %s)", name, SUJ_MIN, optarg); - Sflag = 1; break; case 't': From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:59:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CF051065A43; Tue, 10 Jan 2012 02:59:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18D1D8FC18; Tue, 10 Jan 2012 02:59:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2x12t079941; Tue, 10 Jan 2012 02:59:01 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2x1Q9079938; Tue, 10 Jan 2012 02:59:01 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100259.q0A2x1Q9079938@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02: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: r229912 - head/sbin/ping6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:59:02 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:59:01 2012 New Revision: 229912 URL: http://svn.freebsd.org/changeset/base/229912 Log: Fix warning when compiling with gcc46: error: variable 'origextlen' set but not used Approved by: dim MFC after: 3 days Modified: head/sbin/ping6/ping6.c Modified: head/sbin/ping6/ping6.c ============================================================================== --- head/sbin/ping6/ping6.c Tue Jan 10 02:58:52 2012 (r229911) +++ head/sbin/ping6/ping6.c Tue Jan 10 02:59:01 2012 (r229912) @@ -1812,7 +1812,7 @@ pr_ip6opt(void *extbuf, size_t bufsize) struct ip6_hbh *ext; int currentlen; u_int8_t type; - socklen_t extlen, len, origextlen; + socklen_t extlen, len; void *databuf; size_t offset; u_int16_t value2; @@ -1828,7 +1828,6 @@ pr_ip6opt(void *extbuf, size_t bufsize) * subtract the size of a cmsg structure from the buffer size. */ if (bufsize < (extlen + CMSG_SPACE(0))) { - origextlen = extlen; extlen = bufsize - CMSG_SPACE(0); warnx("options truncated, showing only %u (total=%u)", (unsigned int)(extlen / 8 - 1), From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:59:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3C4010656D7; Tue, 10 Jan 2012 02:59:09 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C014B8FC25; Tue, 10 Jan 2012 02:59:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2x9DF079985; Tue, 10 Jan 2012 02:59:09 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2x9nq079983; Tue, 10 Jan 2012 02:59:09 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100259.q0A2x9nq079983@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:59: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: r229913 - head/sbin/newfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:59:09 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:59:09 2012 New Revision: 229913 URL: http://svn.freebsd.org/changeset/base/229913 Log: Fix warning when compiling with gcc46: error: variable 'c' set but not used Approved by: dim MFC after: 3 days Modified: head/sbin/newfs/mkfs.c Modified: head/sbin/newfs/mkfs.c ============================================================================== --- head/sbin/newfs/mkfs.c Tue Jan 10 02:59:01 2012 (r229912) +++ head/sbin/newfs/mkfs.c Tue Jan 10 02:59:09 2012 (r229913) @@ -989,9 +989,7 @@ void iput(union dinode *ip, ino_t ino) { ufs2_daddr_t d; - int c; - c = ino_to_cg(&sblock, ino); bread(&disk, part_ofs + fsbtodb(&sblock, cgtod(&sblock, 0)), (char *)&acg, sblock.fs_cgsize); if (acg.cg_magic != CG_MAGIC) { From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:59:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6621010656D7; Tue, 10 Jan 2012 02:59:18 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 50E458FC12; Tue, 10 Jan 2012 02:59:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2xImA080031; Tue, 10 Jan 2012 02:59:18 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2xI8Q080029; Tue, 10 Jan 2012 02:59:18 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100259.q0A2xI8Q080029@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:59: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: r229914 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:59:18 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:59:18 2012 New Revision: 229914 URL: http://svn.freebsd.org/changeset/base/229914 Log: Fix warning when compiling with gcc46: error: variable 'firstkey' set but not used Approved by: dim MFC after: 3 days Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Tue Jan 10 02:59:09 2012 (r229913) +++ head/sbin/ifconfig/ifieee80211.c Tue Jan 10 02:59:18 2012 (r229914) @@ -4383,7 +4383,6 @@ ieee80211_status(int s) if (get80211val(s, IEEE80211_IOC_WEP, &wepmode) != -1 && wepmode != IEEE80211_WEP_NOSUP) { - int firstkey; switch (wepmode) { case IEEE80211_WEP_OFF: @@ -4419,7 +4418,6 @@ ieee80211_status(int s) goto end; } - firstkey = 1; for (i = 0; i < num; i++) { struct ieee80211req_key ik; @@ -4433,7 +4431,6 @@ ieee80211_status(int s) if (verbose) LINE_BREAK(); printkey(&ik); - firstkey = 0; } } end: From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:59:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96DCC1065965; Tue, 10 Jan 2012 02:59:26 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81E998FC0C; Tue, 10 Jan 2012 02:59:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2xQFQ080075; Tue, 10 Jan 2012 02:59:26 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2xQwg080073; Tue, 10 Jan 2012 02:59:26 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100259.q0A2xQwg080073@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:59: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: r229915 - head/sbin/gvinum X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:59:26 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:59:26 2012 New Revision: 229915 URL: http://svn.freebsd.org/changeset/base/229915 Log: Fix warning when compiling with gcc46: error: variable 'op' set but not used error: variable 'cmd' set but not used Approved by: dim MFC after: 3 days Modified: head/sbin/gvinum/gvinum.c Modified: head/sbin/gvinum/gvinum.c ============================================================================== --- head/sbin/gvinum/gvinum.c Tue Jan 10 02:59:18 2012 (r229914) +++ head/sbin/gvinum/gvinum.c Tue Jan 10 02:59:26 2012 (r229915) @@ -937,14 +937,12 @@ gvinum_parityop(int argc, char **argv, i struct gctl_req *req; int flags, i; const char *errstr; - char *op, *msg; + char *op; if (rebuild) { op = "rebuildparity"; - msg = "Rebuilding"; } else { op = "checkparity"; - msg = "Checking"; } optreset = 1; @@ -1057,9 +1055,8 @@ gvinum_rm(int argc, char **argv) struct gctl_req *req; int flags, i, j; const char *errstr; - char buf[20], *cmd; + char buf[20]; - cmd = argv[0]; flags = 0; optreset = 1; optind = 1; From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:59:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF25E1065CC1; Tue, 10 Jan 2012 02:59:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AC1D8FC13; Tue, 10 Jan 2012 02:59:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2xZuF080123; Tue, 10 Jan 2012 02:59:35 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2xZju080121; Tue, 10 Jan 2012 02:59:35 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100259.q0A2xZju080121@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:59: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: r229916 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:59:35 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:59:35 2012 New Revision: 229916 URL: http://svn.freebsd.org/changeset/base/229916 Log: Fix warning when compiling with gcc46: error: variable 'secsz' set but not used Reviewed by: ae Approved by: dim MFC after: 3 days Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Tue Jan 10 02:59:26 2012 (r229915) +++ head/sbin/geom/class/part/geom_part.c Tue Jan 10 02:59:35 2012 (r229916) @@ -718,7 +718,7 @@ gpart_backup(struct gctl_req *req, unsig struct ggeom *gp; const char *s, *scheme; off_t sector, end; - off_t length, secsz; + off_t length; int error, i, windex, wblocks, wtype; if (gctl_get_int(req, "nargs") != 1) @@ -744,7 +744,6 @@ gpart_backup(struct gctl_req *req, unsig if (scheme == NULL) abort(); pp = LIST_FIRST(&gp->lg_consumer)->lg_provider; - secsz = pp->lg_sectorsize; s = find_geomcfg(gp, "last"); wblocks = strlen(s); wtype = 0; From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:59:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17CA410656AD; Tue, 10 Jan 2012 02:59:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03B508FC1E; Tue, 10 Jan 2012 02:59:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2xhSJ080172; Tue, 10 Jan 2012 02:59:43 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2xhpE080170; Tue, 10 Jan 2012 02:59:43 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100259.q0A2xhpE080170@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:59: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: r229917 - head/sbin/fsirand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:59:44 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:59:43 2012 New Revision: 229917 URL: http://svn.freebsd.org/changeset/base/229917 Log: Fix warning when compiling with gcc46: error: variable 'inumber' set but not used Approved by: dim MFC after: 3 days Modified: head/sbin/fsirand/fsirand.c Modified: head/sbin/fsirand/fsirand.c ============================================================================== --- head/sbin/fsirand/fsirand.c Tue Jan 10 02:59:35 2012 (r229916) +++ head/sbin/fsirand/fsirand.c Tue Jan 10 02:59:43 2012 (r229917) @@ -115,7 +115,7 @@ fsirand(char *device) caddr_t inodebuf; ssize_t ibufsize; struct fs *sblock; - ino_t inumber, maxino; + ino_t inumber; ufs2_daddr_t sblockloc, dblk; char sbuf[SBLOCKSIZE], sbuftmp[SBLOCKSIZE]; int i, devfd, n, cg; @@ -165,7 +165,6 @@ fsirand(char *device) fprintf(stderr, "Cannot find file system superblock\n"); return (1); } - maxino = sblock->fs_ncg * sblock->fs_ipg; if (sblock->fs_magic == FS_UFS1_MAGIC && sblock->fs_old_inodefmt < FS_44INODEFMT) { From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:59:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15C681065DCE; Tue, 10 Jan 2012 02:59:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 018818FC15; Tue, 10 Jan 2012 02:59:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2xof0080217; Tue, 10 Jan 2012 02:59:50 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2xoF4080215; Tue, 10 Jan 2012 02:59:50 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100259.q0A2xoF4080215@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:59: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: r229918 - head/sbin/fsck_ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:59:51 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:59:50 2012 New Revision: 229918 URL: http://svn.freebsd.org/changeset/base/229918 Log: Fix warning when compiling with gcc46: error: variable 'blksfree' set but not used Reviewed by: pjd Approved by: dim MFC after: 3 days Modified: head/sbin/fsck_ffs/gjournal.c Modified: head/sbin/fsck_ffs/gjournal.c ============================================================================== --- head/sbin/fsck_ffs/gjournal.c Tue Jan 10 02:59:43 2012 (r229917) +++ head/sbin/fsck_ffs/gjournal.c Tue Jan 10 02:59:50 2012 (r229918) @@ -399,7 +399,7 @@ gjournal_check(const char *filesys) void *p; struct cgchain *cgc; struct cg *cgp; - uint8_t *inosused, *blksfree; + uint8_t *inosused; ino_t cino, ino; int cg, mode; @@ -438,7 +438,6 @@ gjournal_check(const char *filesys) /* We don't want it to be freed in the meantime. */ busycg(cgc); inosused = cg_inosused(cgp); - blksfree = cg_blksfree(cgp); /* * Now go through the list of all inodes in this cylinder group * to find unreferenced ones. From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 02:59:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C4771065EE8; Tue, 10 Jan 2012 02:59:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D4788FC17; Tue, 10 Jan 2012 02:59:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0A2xxLW080265; Tue, 10 Jan 2012 02:59:59 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0A2xxat080261; Tue, 10 Jan 2012 02:59:59 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201100259.q0A2xxat080261@svn.freebsd.org> From: Eitan Adler Date: Tue, 10 Jan 2012 02:59: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: r229919 - head/sbin/camcontrol X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 02:59:59 -0000 Author: eadler (ports committer) Date: Tue Jan 10 02:59:58 2012 New Revision: 229919 URL: http://svn.freebsd.org/changeset/base/229919 Log: Fix warning when compiling with gcc46: error: variable 'freq' set but not used error: variable 'mode_pars' set but not used Reviewed by: mav Approved by: dim MFC after: 3 days Modified: head/sbin/camcontrol/camcontrol.c head/sbin/camcontrol/modeedit.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Tue Jan 10 02:59:50 2012 (r229918) +++ head/sbin/camcontrol/camcontrol.c Tue Jan 10 02:59:58 2012 (r229919) @@ -3412,7 +3412,6 @@ ratecontrol(struct cam_device *device, i } if (spi && syncrate != -1) { int prelim_sync_period; - u_int freq; if ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) { warnx("HBA is not capable of changing " @@ -3437,7 +3436,6 @@ ratecontrol(struct cam_device *device, i prelim_sync_period = 10000000 / syncrate; spi->sync_period = scsi_calc_syncparam(prelim_sync_period); - freq = scsi_calc_syncsrate(spi->sync_period); didsettings++; } if (sata && syncrate != -1) { @@ -4030,13 +4028,12 @@ retry: RPL_LUNDATA_LUN_LUN_MASK); break; case RPL_LUNDATA_ATYP_EXTLUN: { - int field_len, field_len_code, eam_code; + int field_len_code, eam_code; eam_code = lundata->luns[i].lundata[j] & RPL_LUNDATA_EXT_EAM_MASK; field_len_code = (lundata->luns[i].lundata[j] & RPL_LUNDATA_EXT_LEN_MASK) >> 4; - field_len = field_len_code * 2; if ((eam_code == RPL_LUNDATA_EXT_EAM_WK) && (field_len_code == 0x00)) { Modified: head/sbin/camcontrol/modeedit.c ============================================================================== --- head/sbin/camcontrol/modeedit.c Tue Jan 10 02:59:50 2012 (r229918) +++ head/sbin/camcontrol/modeedit.c Tue Jan 10 02:59:58 2012 (r229919) @@ -869,7 +869,6 @@ mode_list(struct cam_device *device, int int retry_count, int timeout) { u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ - u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct pagename *nameentry; @@ -895,7 +894,6 @@ mode_list(struct cam_device *device, int /* Locate the next mode page header. */ mph = (struct scsi_mode_page_header *) ((intptr_t)mh + sizeof(*mh) + len); - mode_pars = MODE_PAGE_DATA(mph); mph->page_code &= SMS_PAGE_CODE; nameentry = nameentry_lookup(mph->page_code); From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 04:33:43 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B050106564A; Tue, 10 Jan 2012 04:33:43 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) by mx1.freebsd.org (Postfix) with ESMTP id 426FB8FC12; Tue, 10 Jan 2012 04:33:43 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id q0A42J8F020270 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 Jan 2012 20:02:19 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id q0A42Jbo020269; Mon, 9 Jan 2012 20:02:19 -0800 (PST) (envelope-from jmg) Date: Mon, 9 Jan 2012 20:02:19 -0800 From: John-Mark Gurney To: "Pedro F. Giffuni" Message-ID: <20120110040219.GE52468@funkthat.com> References: <201201031947.q03JlXnx039684@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201031947.q03JlXnx039684@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Mon, 09 Jan 2012 20:02:19 -0800 (PST) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229415 - head/lib/libvgl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 04:33:43 -0000 Pedro F. Giffuni wrote this message on Tue, Jan 03, 2012 at 19:47 +0000: > +#define SL_SWAP(a,b) {a^=b; b^=a; a^=b;} Can we replace this w/ a normal swap function? Last time I did benchmarking on this ~10 years ago, it was slower to use xor instead of using assignments... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 04:46:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5AEA106566C for ; Tue, 10 Jan 2012 04:46:34 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm9-vm0.bullet.mail.sp2.yahoo.com (nm9-vm0.bullet.mail.sp2.yahoo.com [98.139.91.196]) by mx1.freebsd.org (Postfix) with SMTP id A84718FC1A for ; Tue, 10 Jan 2012 04:46:34 +0000 (UTC) Received: from [98.139.91.64] by nm9.bullet.mail.sp2.yahoo.com with NNFMP; 10 Jan 2012 04:46:34 -0000 Received: from [98.139.91.17] by tm4.bullet.mail.sp2.yahoo.com with NNFMP; 10 Jan 2012 04:46:34 -0000 Received: from [127.0.0.1] by omp1017.mail.sp2.yahoo.com with NNFMP; 10 Jan 2012 04:46:34 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 536122.75266.bm@omp1017.mail.sp2.yahoo.com Received: (qmail 60510 invoked by uid 60001); 10 Jan 2012 04:46:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1326170794; bh=gnLrH9jTQA5HPWme6K0y622AaZ9YWXxhCys6ojEYUTQ=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ONKQftWlLg4qB4Pd2vixGOrOxv725ne1Vu6eM/upl58tZtzdkWlWsKGPme5FpcsJHgaHuc7j/M7hHlLDyS/DDKIdnKLbw9nulFiB2dd3y4siphGPOJXuishYpN1/fkeelJTfwYtKxxQv6CAqSvAps2Y68BXINomLLhx1OlYcjo0= X-YMail-OSG: pknzSoIVM1lDSq4ATNRIVOlAnpAOUJbdQ9nrEReQWwxynzr 7gWNbKUTMcewkoC7Gde9eb_hyCcffgl0GLNkNWMU1lRKVhFaEtOoUinuOmNk g91YhS_s.Frv15KkYOlNhZxYZD4XcEkqTuJr4IS0Mi8TMz6Es8CKvJyoj4NI 08BCeR_oHU7tJ3gdfiXJMv_Xf5Mtxt2VY8xvx7YzMI3t9oa6GvhQzAgCw8NQ o29Y.5P7ZI82qWG4uE8l3.JXp7KpgtJXo1uv5.BrjF4h1GU2gRSjKrMwzVCJ Rvllq83TtWXDn8ro0bT6J3WEE0rKOVVtrUXQR_DEBXCbqYtrhl4GAAWW3Fcp wFN.Vn.qWAU1A.pNqyGehlRwNJtfHurmL1rG9TUFFEdn0Dm7CGHPbMKCF9_1 _BZii1XKhB1.MVP_Vj1FcQizoHW2yPG_V_NOYIHmuT4v26PmyQtx1wzpwrHe ROeSQn4AD6Dpr5PX8fsMBqEHDXQ-- Received: from [200.118.157.7] by web113503.mail.gq1.yahoo.com via HTTP; Mon, 09 Jan 2012 20:46:33 PST X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.115.331698 Message-ID: <1326170793.59968.YahooMailClassic@web113503.mail.gq1.yahoo.com> Date: Mon, 9 Jan 2012 20:46:33 -0800 (PST) From: Pedro Giffuni To: John-Mark Gurney In-Reply-To: <20120110040219.GE52468@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229415 - head/lib/libvgl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 04:46:34 -0000 Hi John;=0A=0A--- Lun 9/1/12, John-Mark Gurney ha scritt= o:=0A...=0A> Pedro F. Giffuni wrote this message=0A> on Tue, Jan 03, 2012 a= t 19:47 +0000:=0A> > +#define SL_SWAP(a,b)=A0 =A0 =A0 =A0=0A> =A0=A0=A0{a^= =3Db; b^=3Da; a^=3Db;}=0A> =0A> Can we replace this w/ a normal swap functi= on?=0A> =0A=0A> Last time I did benchmarking on this ~10 years ago, it was= =0A> slower to use xor instead of using assignments...=0A> =0A=0AI doubt it= 's worth it, the swapping is not critical here and=0Adoing a swap saves a t= emporary variable (not that they are=0Aexpensive either).=0A=0Acheers,=0A= =0APedro.=0A=0A=0A> -- =0A> =A0 John-Mark Gurney=A0=A0=A0=0A> =A0=A0=A0 =A0= =A0=A0 =A0=A0=A0=0A> Voice: +1 415 225 5579=0A> =0A> =A0 =A0=A0=A0"All that= I will do, has been=0A> done, All that I have, has not."=0A> From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 04:49:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3972106566B; Tue, 10 Jan 2012 04:49:22 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id C4A1A8FC13; Tue, 10 Jan 2012 04:49:21 +0000 (UTC) Received: by lahl5 with SMTP id l5so2405005lah.13 for ; Mon, 09 Jan 2012 20:49:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=Y7I7I9hXBV6JMDow/ewgJMYSLGbeMX2WaXSqr7ez+0k=; b=plMSGzHIunAI1g7qeFaLsPL7VnSBdvrSU6Oq/QLldPgCaytTsL6y3WYWmHhbdHh3H/ vIZTotMloe3XhZQMPPrU/VyodL2H/MASBPJYgEkEZXYbwkqfhhSoPjwJ3YRWFK29bWwH kuxwsKo4FhCJbe8PRg2YA5fPsAvSgK6hN49hE= Received: by 10.112.25.35 with SMTP id z3mr4090463lbf.52.1326170960439; Mon, 09 Jan 2012 20:49:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.129.8 with HTTP; Mon, 9 Jan 2012 20:48:49 -0800 (PST) In-Reply-To: <20120110040219.GE52468@funkthat.com> References: <201201031947.q03JlXnx039684@svn.freebsd.org> <20120110040219.GE52468@funkthat.com> From: Eitan Adler Date: Mon, 9 Jan 2012 23:48:49 -0500 Message-ID: To: John-Mark Gurney Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Pedro F. Giffuni" , src-committers@freebsd.org Subject: Re: svn commit: r229415 - head/lib/libvgl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 04:49:23 -0000 On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney wrote: > Last time I did benchmarking on this ~10 years ago, it was slower to > use xor instead of using assignments... I'd be shocked if the compiler didn't optimize this away to an XCHG. -- Eitan Adler From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 08:02:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0780B1065675; Tue, 10 Jan 2012 08:02:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id B4B9A8FC20; Tue, 10 Jan 2012 08:02:13 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:c412:ce36:3c98:43b8] (unknown [IPv6:2001:7b8:3a7:0:c412:ce36:3c98:43b8]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id CDFCC5C37; Tue, 10 Jan 2012 09:02:12 +0100 (CET) Message-ID: <4F0BF083.90003@FreeBSD.org> Date: Tue, 10 Jan 2012 09:02:11 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120106 Thunderbird/10.0 MIME-Version: 1.0 To: Eitan Adler References: <201201031947.q03JlXnx039684@svn.freebsd.org> <20120110040219.GE52468@funkthat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, John-Mark Gurney , "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r229415 - head/lib/libvgl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 08:02:14 -0000 On 2012-01-10 05:48, Eitan Adler wrote: > On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney wrote: >> Last time I did benchmarking on this ~10 years ago, it was slower to >> use xor instead of using assignments... > > I'd be shocked if the compiler didn't optimize this away to an XCHG. Even with our ancient gcc 4.2 (on i386): VGLLine: [...] movl 12(%ebp), %edx movl 16(%ebp), %eax movl $1, -56(%ebp) xchgl %eax, %edx movl %edx, 12(%ebp) movl 24(%ebp), %edx movl %eax, 16(%ebp) movl %ecx, %eax xchgl %edx, %esi movl %edx, 24(%ebp) movl -84(%ebp), %edx xchgl %eax, %edx movl %eax, -80(%ebp) movl %edx, -84(%ebp) With clang, the corresponding local variables seem to have been optimized away entirely (or rather, moved around). From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 08:07:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBD60106564A; Tue, 10 Jan 2012 08:07:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 98D258FC13; Tue, 10 Jan 2012 08:07:46 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:c412:ce36:3c98:43b8] (unknown [IPv6:2001:7b8:3a7:0:c412:ce36:3c98:43b8]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id DF7855C44; Tue, 10 Jan 2012 09:07:45 +0100 (CET) Message-ID: <4F0BF1D3.7090902@FreeBSD.org> Date: Tue, 10 Jan 2012 09:07:47 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120106 Thunderbird/10.0 MIME-Version: 1.0 To: "Pedro F. Giffuni" References: <201201031947.q03JlXnx039684@svn.freebsd.org> In-Reply-To: <201201031947.q03JlXnx039684@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229415 - head/lib/libvgl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 08:07:47 -0000 On 2012-01-03 20:47, Pedro F. Giffuni wrote: > Author: pfg > Date: Tue Jan 3 19:47:32 2012 > New Revision: 229415 > URL: http://svn.freebsd.org/changeset/base/229415 > > Log: > Integrate the line drawing algorithm from the book "Graphic Gems 1". > > http://www.graphicsgems.org/ > > At the time it claimed to be 3-4 times faster than the traditional > algorithm. Btw, why is this library in the base system at all? It seems totally unused, except for one picobsd Makefile? From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 08:22:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7F7D106566C; Tue, 10 Jan 2012 08:22:17 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 5B14C8FC0A; Tue, 10 Jan 2012 08:22:17 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 59C4AB51; Tue, 10 Jan 2012 09:22:15 +0100 (CET) Date: Tue, 10 Jan 2012 09:21:06 +0100 From: Pawel Jakub Dawidek To: Eitan Adler Message-ID: <20120110082106.GD1801@garage.freebsd.pl> References: <201201100258.q0A2wT7E079753@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fOHHtNG4YXGJ0yqR" Content-Disposition: inline In-Reply-To: <201201100258.q0A2wT7E079753@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229908 - head/usr.bin/brandelf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 08:22:18 -0000 --fOHHtNG4YXGJ0yqR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 10, 2012 at 02:58:29AM +0000, Eitan Adler wrote: > Author: eadler (ports committer) > Date: Tue Jan 10 02:58:29 2012 > New Revision: 229908 > URL: http://svn.freebsd.org/changeset/base/229908 >=20 > Log: > Fix warning when compiling with gcc46: > error: variable 'verbose' set but not use Maybe we should remove -v from the manual page as well or document as no-op? I'd still leave it in the code though, so there is no POLA violation. > Approved by: dim > MFC after: 3 days >=20 > Modified: > head/usr.bin/brandelf/brandelf.c >=20 > Modified: head/usr.bin/brandelf/brandelf.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/usr.bin/brandelf/brandelf.c Tue Jan 10 02:58:20 2012 (r229907) > +++ head/usr.bin/brandelf/brandelf.c Tue Jan 10 02:58:29 2012 (r229908) > @@ -64,7 +64,7 @@ main(int argc, char **argv) > const char *strtype =3D "FreeBSD"; > int type =3D ELFOSABI_FREEBSD; > int retval =3D 0; > - int ch, change =3D 0, verbose =3D 0, force =3D 0, listed =3D 0; > + int ch, change =3D 0, force =3D 0, listed =3D 0; > =20 > while ((ch =3D getopt(argc, argv, "f:lt:v")) !=3D -1) > switch (ch) { > @@ -84,7 +84,7 @@ main(int argc, char **argv) > listed =3D 1; > break; > case 'v': > - verbose =3D 1; > + /* does nothing */ > break; > case 't': > if (force) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --fOHHtNG4YXGJ0yqR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8L9PIACgkQForvXbEpPzQgrACg1chuGWsO0m6S443+3KqUrcDH GLsAoIxyTpkzISzRCATEaXrjfB7Fo6Zd =XXqs -----END PGP SIGNATURE----- --fOHHtNG4YXGJ0yqR-- From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 09:38:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65E141065673; Tue, 10 Jan 2012 09:38:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 240AE8FC16; Tue, 10 Jan 2012 09:38:31 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:c412:ce36:3c98:43b8] (unknown [IPv6:2001:7b8:3a7:0:c412:ce36:3c98:43b8]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 58FD05C37; Tue, 10 Jan 2012 10:38:30 +0100 (CET) Message-ID: <4F0C0714.6060501@FreeBSD.org> Date: Tue, 10 Jan 2012 10:38:28 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120106 Thunderbird/10.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201201100258.q0A2wT7E079753@svn.freebsd.org> <20120110082106.GD1801@garage.freebsd.pl> In-Reply-To: <20120110082106.GD1801@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler Subject: Re: svn commit: r229908 - head/usr.bin/brandelf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 09:38:31 -0000 On 2012-01-10 09:21, Pawel Jakub Dawidek wrote: > On Tue, Jan 10, 2012 at 02:58:29AM +0000, Eitan Adler wrote: >> Author: eadler (ports committer) >> Date: Tue Jan 10 02:58:29 2012 >> New Revision: 229908 >> URL: http://svn.freebsd.org/changeset/base/229908 >> >> Log: >> Fix warning when compiling with gcc46: >> error: variable 'verbose' set but not use > > Maybe we should remove -v from the manual page as well or document as no-op? > I'd still leave it in the code though, so there is no POLA violation. It has been a no-op since the beginning of brandelf, and I have really no idea what the original author intended the verbose output to be. :) It is probably best to document it as a no-op now, to reduce possible confusion. From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 12:45:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 197451065672; Tue, 10 Jan 2012 12:45:25 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07C9F8FC13; Tue, 10 Jan 2012 12:45:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ACjOtp010983; Tue, 10 Jan 2012 12:45:24 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ACjO6h010981; Tue, 10 Jan 2012 12:45:24 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201201101245.q0ACjO6h010981@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Tue, 10 Jan 2012 12:45: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: r229930 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 12:45:25 -0000 Author: melifaro Date: Tue Jan 10 12:45:24 2012 New Revision: 229930 URL: http://svn.freebsd.org/changeset/base/229930 Log: Add setsockopt(2) example to ng_ksocket(4). While here, fix formatting a bit Approved by: kib(mentor) MFC after: 2 weeks Modified: head/share/man/man4/ng_ksocket.4 Modified: head/share/man/man4/ng_ksocket.4 ============================================================================== --- head/share/man/man4/ng_ksocket.4 Tue Jan 10 11:41:02 2012 (r229929) +++ head/share/man/man4/ng_ksocket.4 Tue Jan 10 12:45:24 2012 (r229930) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2005 +.Dd January 09, 2012 .Dt NG_KSOCKET 4 .Os .Sh NAME @@ -199,7 +199,7 @@ For the address is the pathname as a doubly quoted string. .Pp Examples: -.Bl -tag -width XXXXXXXXXX +.Bl -tag -width "PF_LOCAL" .It Dv PF_LOCAL local/"/tmp/foo.socket" .It Dv PF_INET @@ -215,6 +215,12 @@ the normal form for that structure is used. In the future, more convenient encoding of the more common socket options may be supported. +.Pp +Setting socket options example: +.Bl -tag -width "PF_LOCAL" +.It Set FIB 2 for a socket (SOL_SOCKET, SO_SETFIB): +.Dv "setopt \&{ level=0xffff name=0x1014 data=[ 2 ] \&}" +.El .Sh SHUTDOWN This node shuts down upon receipt of a .Dv NGM_SHUTDOWN From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 15:29:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89BFD106564A; Tue, 10 Jan 2012 15:29:04 +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 76DC48FC15; Tue, 10 Jan 2012 15:29:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AFT4AX016512; Tue, 10 Jan 2012 15:29:04 GMT (envelope-from syrinx@svn.freebsd.org) Received: (from syrinx@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AFT4JL016507; Tue, 10 Jan 2012 15:29:04 GMT (envelope-from syrinx@svn.freebsd.org) Message-Id: <201201101529.q0AFT4JL016507@svn.freebsd.org> From: Shteryana Shopova Date: Tue, 10 Jan 2012 15:29: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: r229933 - in head/usr.sbin/bsnmpd/tools: bsnmptools libbsnmptools X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 15:29:04 -0000 Author: syrinx Date: Tue Jan 10 15:29:03 2012 New Revision: 229933 URL: http://svn.freebsd.org/changeset/base/229933 Log: Implement an option to execute SNMP walks using GETBULK requests in bsnmpwalk(1) retrieving multiple values with a Single PDU. Reviewed by: philip@ Tested by: tsanand129 (at) gmail (dot) com Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.h Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 ============================================================================== --- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 Tue Jan 10 13:41:14 2012 (r229932) +++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 Tue Jan 10 15:29:03 2012 (r229933) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2007 +.Dd January 10, 2012 .Dt BSNMPGET 1 .Os .Sh NAME @@ -112,7 +112,7 @@ objects whose values will be retrived, w received successfully. .Pp .Nm Bsnmpwalk -queries an agent with SMNP GetNextRequest packets, +queries an agent with ether SMNP GetNextRequest or GetBulkRequest packets, asking for values of OID instances that are a part of the object subtree rooted at the provided OIDs. .Pp @@ -220,7 +220,7 @@ The path of the posix local (unix domain transport is used. .It Fl M Ar max-repetitions The value for the max-repetitions field in a GetBulk PDU. -Default is 1. +Default is 10. .It Fl N Ar non-repeaters The value for the non-repeaters field in a GetBulk PDU. Default is 0. @@ -251,8 +251,17 @@ A binary localized privacy key to use wh By default plain text SNMPv3 PDUs are sent. .It Fl p Ar [get|getnext|getbulk] The PDU type to send by -.Nm bsmpget . -Default is get. +.Nm bsmpget +and +.Nm bsnmpwalk . +Default is get +for +.Nm bsmpget +and getnext for +.Nm bsnmpwalk . +Getbulk allows executing the so called SNMP "bulkwalks" allowing the values of +multiple columns to be retrived in a single PDU by +.Nm bsnmpwalk . .It Fl r Ar retries Number of resends of request packets before giving up if the agent does not respond after the first try. Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Tue Jan 10 13:41:14 2012 (r229932) +++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Tue Jan 10 15:29:03 2012 (r229933) @@ -76,8 +76,9 @@ usage(void) (program == BSNMPWALK) ? "[-dhnK]" : (program == BSNMPSET) ? "[-adehnK]" : "", - (program == BSNMPGET) ? " [-M max-repetitions] [-N non-repeaters]" : "", - (program == BSNMPGET) ? "[-p pdu] " : "", + (program == BSNMPGET || program == BSNMPWALK) ? + " [-M max-repetitions] [-N non-repeaters]" : "", + (program == BSNMPGET || program == BSNMPWALK) ? "[-p pdu] " : "", (program == BSNMPGET) ? " OID [OID ...]" : (program == BSNMPWALK || program == BSNMPSET) ? " [OID ...]" : "" @@ -150,7 +151,7 @@ snmptool_parse_options(struct snmp_tooli switch (program) { case BSNMPWALK: - opts = "dhnKA:b:C:I:i:l:o:P:r:s:t:U:v:"; + opts = "dhnKA:b:C:I:i:l:M:N:o:P:p:r:s:t:U:v:"; break; case BSNMPGET: opts = "aDdehnKA:b:C:I:i:l:M:N:o:P:p:r:s:t:U:v:"; @@ -398,7 +399,7 @@ snmptool_get(struct snmp_toolinfo *snmpt } if (snmp_parse_resp(&resp, &req) >= 0) { - snmp_output_resp(snmptoolctx, &resp); + snmp_output_resp(snmptoolctx, &resp, NULL); break; } @@ -460,8 +461,14 @@ snmptool_walk(struct snmp_toolinfo *snmp struct snmp_pdu req, resp; struct asn_oid root; /* Keep the initial oid. */ int32_t outputs, rc; + uint32_t op; - snmp_pdu_create(&req, SNMP_PDU_GETNEXT); + if (GET_PDUTYPE(snmptoolctx) == SNMP_PDU_GETBULK) + op = SNMP_PDU_GETBULK; + else + op = SNMP_PDU_GETNEXT; + + snmp_pdu_create(&req, op); while ((rc = snmp_pdu_add_bindings(snmptoolctx, NULL, snmptool_add_vbind, &req, 1)) > 0) { @@ -470,6 +477,10 @@ snmptool_walk(struct snmp_toolinfo *snmp memset(&root, 0, sizeof(struct asn_oid)); asn_append_oid(&root, &(req.bindings[0].var)); + if (op == SNMP_PDU_GETBULK) + snmpget_fix_getbulk(&req, GET_MAXREP(snmptoolctx), + GET_NONREP(snmptoolctx)); + outputs = 0; while (snmp_dialog(&req, &resp) >= 0) { if ((snmp_parse_resp(&resp, &req)) < 0) { @@ -479,21 +490,24 @@ snmptool_walk(struct snmp_toolinfo *snmp break; } - if (!(asn_is_suboid(&root, &(resp.bindings[0].var)))) { - snmp_pdu_free(&resp); - break; - } - - if (snmp_output_resp(snmptoolctx, &resp)!= 0) { + rc = snmp_output_resp(snmptoolctx, &resp, &root); + if (rc < 0) { snmp_pdu_free(&resp); outputs = -1; break; } - outputs++; + + outputs += rc; snmp_pdu_free(&resp); - snmpwalk_nextpdu_create(SNMP_PDU_GETNEXT, - &(resp.bindings[0].var), &req); + if (rc < resp.nbindings) + break; + + snmpwalk_nextpdu_create(op, + &(resp.bindings[resp.nbindings - 1].var), &req); + if (op == SNMP_PDU_GETBULK) + snmpget_fix_getbulk(&req, GET_MAXREP(snmptoolctx), + GET_NONREP(snmptoolctx)); } /* Just in case our root was a leaf. */ @@ -503,7 +517,7 @@ snmptool_walk(struct snmp_toolinfo *snmp if (snmp_parse_resp(&resp,&req) < 0) snmp_output_err_resp(snmptoolctx, &resp); else - snmp_output_resp(snmptoolctx, &(resp)); + snmp_output_resp(snmptoolctx, &(resp), NULL); snmp_pdu_free(&resp); } else @@ -515,7 +529,7 @@ snmptool_walk(struct snmp_toolinfo *snmp break; } - snmp_pdu_create(&req, SNMP_PDU_GETNEXT); + snmp_pdu_create(&req, op); } if (rc == 0) @@ -1076,7 +1090,7 @@ snmptool_set(struct snmp_toolinfo *snmpt if (snmp_pdu_check(&req, &resp) > 0) { if (GET_OUTPUT(snmptoolctx) != OUTPUT_QUIET) - snmp_output_resp(snmptoolctx, &resp); + snmp_output_resp(snmptoolctx, &resp, NULL); break; } Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Tue Jan 10 13:41:14 2012 (r229932) +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Tue Jan 10 15:29:03 2012 (r229933) @@ -132,6 +132,7 @@ snmptool_init(struct snmp_toolinfo *snmp snmptoolctx->flags = SNMP_PDU_GET; /* XXX */ SLIST_INIT(&snmptoolctx->filelist); snmp_client_init(&snmp_client); + SET_MAXREP(snmptoolctx, SNMP_MAX_REPETITIONS); if (add_filename(snmptoolctx, bsnmpd_defs, &IsoOrgDod_OID, 0) < 0) warnx("Error adding file %s to list", bsnmpd_defs); @@ -2039,14 +2040,20 @@ snmp_output_err_resp(struct snmp_toolinf } int32_t -snmp_output_resp(struct snmp_toolinfo *snmptoolctx, struct snmp_pdu *pdu) +snmp_output_resp(struct snmp_toolinfo *snmptoolctx, struct snmp_pdu *pdu, + struct asn_oid *root) { int32_t error; char p[ASN_OIDSTRLEN]; uint32_t i; struct snmp_object object; - for (i = 0, error = 0; i < pdu->nbindings; i++) { + i = error = 0; + while (i < pdu->nbindings) { + if (root != NULL && !(asn_is_suboid(root, + &(pdu->bindings[i].var)))) + break; + if (GET_OUTPUT(snmptoolctx) != OUTPUT_QUIET) { if (!ISSET_NUMERIC(snmptoolctx) && (snmp_fill_object(snmptoolctx, &object, @@ -2058,9 +2065,13 @@ snmp_output_resp(struct snmp_toolinfo *s } } error |= snmp_output_numval(snmptoolctx, &(pdu->bindings[i]), object.info); + i++; } - return (error); + if (error) + return (-1); + + return (i); } void Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.h ============================================================================== --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.h Tue Jan 10 13:41:14 2012 (r229932) +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.h Tue Jan 10 15:29:03 2012 (r229933) @@ -47,6 +47,8 @@ #define SNMP_DEFS_DIR "/usr/share/snmp/defs/" #define SNMP_DEFAULT_LOCAL "/var/run/snmpd.sock" +#define SNMP_MAX_REPETITIONS 10 + enum snmp_access { SNMP_ACCESS_NONE = 0, SNMP_ACCESS_GET, @@ -323,7 +325,7 @@ int32_t snmp_parse_resp(struct snmp_pdu int32_t snmp_output_numval(struct snmp_toolinfo *, struct snmp_value *, struct snmp_oid2str *); void snmp_output_val(struct snmp_value *); -int32_t snmp_output_resp(struct snmp_toolinfo *, struct snmp_pdu *); +int32_t snmp_output_resp(struct snmp_toolinfo *, struct snmp_pdu *, struct asn_oid *); void snmp_output_err_resp(struct snmp_toolinfo *, struct snmp_pdu *); void snmp_output_engine(void); void snmp_output_keys(void); From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 15:57:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E55CB106567A for ; Tue, 10 Jan 2012 15:57:38 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm2-vm0.bullet.mail.sp2.yahoo.com (nm2-vm0.bullet.mail.sp2.yahoo.com [98.139.91.248]) by mx1.freebsd.org (Postfix) with SMTP id 8EB3C8FC1A for ; Tue, 10 Jan 2012 15:57:38 +0000 (UTC) Received: from [98.139.91.63] by nm2.bullet.mail.sp2.yahoo.com with NNFMP; 10 Jan 2012 15:57:38 -0000 Received: from [98.139.91.30] by tm3.bullet.mail.sp2.yahoo.com with NNFMP; 10 Jan 2012 15:57:38 -0000 Received: from [127.0.0.1] by omp1030.mail.sp2.yahoo.com with NNFMP; 10 Jan 2012 15:57:38 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 1061.9333.bm@omp1030.mail.sp2.yahoo.com Received: (qmail 79374 invoked by uid 60001); 10 Jan 2012 15:57:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1326211057; bh=wvc17yvGAjl7JEtsA1CI7bzS4hpgvz1mZMuk7jQVKWI=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=hitaDtBsB54EDYdZhKSP6bCys9Y9Z9aTfE1Ca1cAYdCheqQOqDuzF5yJS/COcpiD4RNVW3dFrjE2DUCDevNXwz8rp7rwyaBEqSLCzzttE7w8ZUzmuVY4r7s542huVJ+WWq5H+zbvhqPqZmeGWjew6DxpbHrpc7z/44R+A5nYweI= X-YMail-OSG: FeF29KYVM1m5Zan7Opq52MU2P29M1mCPX9JyVGnmijme9kZ LhenMa_lEG1_j4Yd5AHfiZ1h9AiMlAem0vT67hUzc8WXe_41O2gUPELJW1PQ H8SZyT6R4ne.ILgyFWFr3XVO4vV3zT9HCZqHjErG41hXbm3wxcfADj.IhHEa MCM0GzNe6RUdMWRPet_mQG_o6lePPVtAG4OakjfDeXwKt0wlBjOEiQRtGzzu ruQzXoizOvUzP.kghcehPG_IeMFwYfJ._DKj5zONsnXSKDAxkok3Bi6DnyGG 7sOanQhidyjuUnbaifZmBlct6yhq13DF7JJnyneEi.vF7rAKgITXlKd.1vR_ YRpiW4fYbgz1mvCS2p5W6G_QJ8ph27QAQezIatM48ozDmBBOhS9GG66xCQi2 5dAoMplRLmqyaF.e_aAZ6S1mhbainSxTbG97R68Vwf_LFGuUiNRF0P7IC0Lz MZppkh1fvYrelG2s_EQ6NbVbFYG5t61MRCgx5__J1XkZvsXLTrt0txY5FVft Tu2J1rzqL90uWwCGSbg6VVWMVhSgB.mDM_CPo5ffL Received: from [200.118.157.7] by web113501.mail.gq1.yahoo.com via HTTP; Tue, 10 Jan 2012 07:57:37 PST X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.115.331698 Message-ID: <1326211057.75222.YahooMailClassic@web113501.mail.gq1.yahoo.com> Date: Tue, 10 Jan 2012 07:57:37 -0800 (PST) From: Pedro Giffuni To: Dimitry Andric In-Reply-To: <4F0BF1D3.7090902@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229415 - head/lib/libvgl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 15:57:39 -0000 =0AHello;=0A=0A--- Mar 10/1/12, Dimitry Andric ha scritto= :=0A=0A> Data: Marted=EC 10 gennaio 2012, 03:07=0A> On 2012-01-03 20:47, Pe= dro F. Giffuni=0A> wrote:=0A> > Author: pfg=0A> > Date: Tue Jan=A0 3 19:47:= 32 2012=0A> > New Revision: 229415=0A> > URL: http://svn.freebsd.org/change= set/base/229415=0A> >=0A> > Log:=0A> >=A0 =A0 Integrate the line drawing al= gorithm from=0A> the book "Graphic Gems 1".=0A> >=0A> >=A0 =A0 http://www.g= raphicsgems.org/=0A> >=0A> >=A0 =A0 At the time it claimed to be 3-4 times= =0A> faster than the traditional=0A> >=A0 =A0 algorithm.=0A> =0A> Btw, why = is this library in the base system at all?=A0=0A> It seems totally unused, = except for one picobsd=0A> Makefile?=0A> =0A=0AIt's a very FreeBSD-specific= library and it's the best=0Aexample on how to do low level screen manipula= tion.=0A=0AI think it was not meant to live for so long in the base=0Asyste= m but it's pretty small and specific so no one has=0Ataken the time to turn= it into a port. I think it is=0Astill used in some ports like libggi.=0A= =0Acheers,=0A=0APedro.=0A=0A From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 18:05:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 743ED106566B; Tue, 10 Jan 2012 18:05:44 +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 638DB8FC1C; Tue, 10 Jan 2012 18:05:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AI5iOn021663; Tue, 10 Jan 2012 18:05:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AI5i24021661; Tue, 10 Jan 2012 18:05:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201101805.q0AI5i24021661@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 10 Jan 2012 18:05: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: r229934 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 18:05:44 -0000 Author: kib Date: Tue Jan 10 18:05:44 2012 New Revision: 229934 URL: http://svn.freebsd.org/changeset/base/229934 Log: Change the type of the paging_in_progress refcounter from u_short to u_int. With the auto-sized buffer cache on the modern machines, UFS metadata can generate more the 65535 pages belonging to the buffers undergoing i/o, overflowing the counter. Reported and tested by: jimharris Reviewed by: alc MFC after: 1 week Modified: head/sys/vm/vm_object.h Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Jan 10 15:29:03 2012 (r229933) +++ head/sys/vm/vm_object.h Tue Jan 10 18:05:44 2012 (r229934) @@ -96,7 +96,7 @@ struct vm_object { objtype_t type; /* type of pager */ u_short flags; /* see below */ u_short pg_color; /* (c) color of first page in obj */ - u_short paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ + u_int paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ int resident_page_count; /* number of resident pages */ struct vm_object *backing_object; /* object that I'm a shadow of */ vm_ooffset_t backing_object_offset;/* Offset in backing object */ From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 18:07:06 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02270106566C; Tue, 10 Jan 2012 18:07:06 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) by mx1.freebsd.org (Postfix) with ESMTP id CA7DC8FC0A; Tue, 10 Jan 2012 18:07:05 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id q0AI73X8082213 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Jan 2012 10:07:03 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id q0AI73D7082207; Tue, 10 Jan 2012 10:07:03 -0800 (PST) (envelope-from jmg) Date: Tue, 10 Jan 2012 10:07:03 -0800 From: John-Mark Gurney To: Eitan Adler Message-ID: <20120110180703.GF52468@funkthat.com> References: <201201031947.q03JlXnx039684@svn.freebsd.org> <20120110040219.GE52468@funkthat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Tue, 10 Jan 2012 10:07:03 -0800 (PST) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, "Pedro F. Giffuni" , src-committers@FreeBSD.org Subject: Re: svn commit: r229415 - head/lib/libvgl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 18:07:06 -0000 Eitan Adler wrote this message on Mon, Jan 09, 2012 at 23:48 -0500: > On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney wrote: > > Last time I did benchmarking on this ~10 years ago, it was slower to > > use xor instead of using assignments... > > I'd be shocked if the compiler didn't optimize this away to an XCHG. As someone else mentioned, it did... But it's still an obfuscation of the code... Not everyone knows this "trick" to swap two vars... If it isn't timing critical, it's better to be maintainable... Thanks. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 18:43:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D0D81065670; Tue, 10 Jan 2012 18:43:27 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C5698FC0A; Tue, 10 Jan 2012 18:43:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AIhRTK022951; Tue, 10 Jan 2012 18:43:27 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AIhRuM022949; Tue, 10 Jan 2012 18:43:27 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201101843.q0AIhRuM022949@svn.freebsd.org> From: Guy Helmer Date: Tue, 10 Jan 2012 18:43: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: r229936 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 18:43:27 -0000 Author: ghelmer Date: Tue Jan 10 18:43:27 2012 New Revision: 229936 URL: http://svn.freebsd.org/changeset/base/229936 Log: Set the FD_CLOEXEC flag on the open pidfile file descriptor. Discussed with: pjd, des Modified: head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Tue Jan 10 18:20:19 2012 (r229935) +++ head/lib/libutil/pidfile.c Tue Jan 10 18:43:27 2012 (r229936) @@ -137,6 +137,20 @@ pidfile_open(const char *path, mode_t mo free(pfh); return (NULL); } + + /* + * Prevent the file descriptor from escaping to other + * programs via exec(3). + */ + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { + error = errno; + unlink(pfh->pf_path); + close(fd); + free(pfh); + errno = error; + return (NULL); + } + /* * Remember file information, so in pidfile_write() we are sure we write * to the proper descriptor. From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 19:16:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83B34106566B for ; Tue, 10 Jan 2012 19:16:28 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm8.bullet.mail.sp2.yahoo.com (nm8.bullet.mail.sp2.yahoo.com [98.139.91.78]) by mx1.freebsd.org (Postfix) with SMTP id 5B0A08FC15 for ; Tue, 10 Jan 2012 19:16:28 +0000 (UTC) Received: from [98.139.91.68] by nm8.bullet.mail.sp2.yahoo.com with NNFMP; 10 Jan 2012 19:16:28 -0000 Received: from [98.139.91.49] by tm8.bullet.mail.sp2.yahoo.com with NNFMP; 10 Jan 2012 19:16:28 -0000 Received: from [127.0.0.1] by omp1049.mail.sp2.yahoo.com with NNFMP; 10 Jan 2012 19:16:28 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 145073.45919.bm@omp1049.mail.sp2.yahoo.com Received: (qmail 9514 invoked by uid 60001); 10 Jan 2012 19:16:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1326222987; bh=OlDuVB4DVqxxYHVxFww5fQ922pS/zwF5N+jdEOYNW/E=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=MC+tfDEuVRDCsSauUo4jVBfuaOCLA0JigfllRleMVmsMFOGEEXFUcFotl0CPbbTSOxcglGB29LUjjW+MDHQZ6fDFC15nI0JykawCENPwEE3jSWynQpRmhr7LO/37GWLs7dadozOt8TEpAYEsux/ayGIdHKyp089MxH7c0Dchsqw= X-YMail-OSG: tvKQl7kVM1n3eoAFMcfUszNy8yim9lVUuLGUBCB287cuP6x t7tZuNJJOTpOxizSJcOX1o1YkaidcPv80WN4iHPtfQcGSbxPf8yIYhph9ZKr njb0w17HR2ilgIhfX40sU2mMw8_t8PPK4zug280xY_NiNmPyMMVg8AVeo72o bDeExCXCc0PIpIC3GM_f1T_toQ1dx9ViEFgR8AmJDSS5z5k_p1d1Q8q4D7yo bj7_z8D7_u9.FhvUfpyWzp5X2hDgZLF8feKl1ft.c3vMEJHuESbOl0RctU0T ak4dnMRrwpnb9c_1JEvVCjwtEOZvDbg1__zV4JTE001QDbK9Bua.9Njn2yls wAlg9.zWGSakq7L.emyOIYd7V_qqgjwLndVUZeEiFIrv3AnYeY7UOFISyKzA zO6pc0vSNCadvD8Ig52UrbblWHwZDp4kqR5w0C_8YFN_dp4MbbDqZP3FqMfT ox4db0bJgfYTmWFHOgopF9xI7Qw-- Received: from [200.118.157.7] by web113516.mail.gq1.yahoo.com via HTTP; Tue, 10 Jan 2012 11:16:27 PST X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.115.331698 Message-ID: <1326222987.8062.YahooMailClassic@web113516.mail.gq1.yahoo.com> Date: Tue, 10 Jan 2012 11:16:27 -0800 (PST) From: Pedro Giffuni To: Eitan Adler , John-Mark Gurney In-Reply-To: <20120110180703.GF52468@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229415 - head/lib/libvgl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 19:16:28 -0000 =0A=0A--- Mar 10/1/12, John-Mark Gurney ha scritto:=0A= =0A> Eitan Adler wrote this message on=0A> Mon, Jan 09, 2012 at 23:48 -0500= :=0A> > On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney=0A> =0A> wrote:=0A> > > Last time I did benchmarking on this ~10 years=0A>= > > ago, it was slower to use xor instead of=0A> > > using assignments...= =0A> > =0A> > I'd be shocked if the compiler didn't optimize this=0A> > awa= y to an XCHG.=0A> =0A> As someone else mentioned, it did...=A0 But it's sti= ll=0A> an obfuscation of the code...=A0 =0A> Not everyone knows this "trick= " to swap two vars...=0A> If it isn't timing critical, it's better to be=0A= > maintainable...=0A>=0A=0AThe code was taken from a book and it's pretty m= uch=0Aubiquitous as-is. If not everyone knows this "trick",=0Athen I guess = it simply proves that there is a lot of=0Avalue in reading books after all = ;-).=0A=0Acheers,=0A=0APedro.=0A From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 19:53:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 290A2106567C; Tue, 10 Jan 2012 19:53:26 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE0BD8FC1C; Tue, 10 Jan 2012 19:53:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AJrPdT025102; Tue, 10 Jan 2012 19:53:25 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AJrPao025097; Tue, 10 Jan 2012 19:53:25 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201101953.q0AJrPao025097@svn.freebsd.org> From: Guy Helmer Date: Tue, 10 Jan 2012 19:53: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: r229937 - in head/lib: libc/gen libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 19:53:26 -0000 Author: ghelmer Date: Tue Jan 10 19:53:25 2012 New Revision: 229937 URL: http://svn.freebsd.org/changeset/base/229937 Log: Add pidfile_fileno() to obtain the file descriptor for an open pidfile. Modified: head/lib/libc/gen/getnetgrent.c head/lib/libutil/libutil.h head/lib/libutil/pidfile.3 head/lib/libutil/pidfile.c Modified: head/lib/libc/gen/getnetgrent.c ============================================================================== --- head/lib/libc/gen/getnetgrent.c Tue Jan 10 18:43:27 2012 (r229936) +++ head/lib/libc/gen/getnetgrent.c Tue Jan 10 19:53:25 2012 (r229937) @@ -203,9 +203,7 @@ setnetgrent(const char *group) if (parse_netgrp(group)) endnetgrent(); else { - grouphead.grname = (char *) - malloc(strlen(group) + 1); - strcpy(grouphead.grname, group); + grouphead.grname = strdup(group); } if (netf) fclose(netf); @@ -417,7 +415,7 @@ static int parse_netgrp(const char *group) { char *spos, *epos; - int len, strpos; + int len, strpos, freepos; #ifdef DEBUG int fields; #endif @@ -454,9 +452,9 @@ parse_netgrp(const char *group) while (pos != NULL && *pos != '\0') { if (*pos == '(') { grp = (struct netgrp *)malloc(sizeof (struct netgrp)); + if (grp == NULL) + return(1); bzero((char *)grp, sizeof (struct netgrp)); - grp->ng_next = grouphead.gr; - grouphead.gr = grp; pos++; gpos = strsep(&pos, ")"); #ifdef DEBUG @@ -477,6 +475,13 @@ parse_netgrp(const char *group) if (len > 0) { grp->ng_str[strpos] = (char *) malloc(len + 1); + if (grp->ng_str[strpos] == NULL) { + for (freepos = 0; freepos < strpos; freepos++) + if (grp->ng_str[freepos] != NULL) + free(grp->ng_str[freepos]); + free(grp); + return(1); + } bcopy(spos, grp->ng_str[strpos], len + 1); } @@ -490,6 +495,8 @@ parse_netgrp(const char *group) grp->ng_str[strpos] = NULL; } } + grp->ng_next = grouphead.gr; + grouphead.gr = grp; #ifdef DEBUG /* * Note: on other platforms, malformed netgroup @@ -526,7 +533,7 @@ parse_netgrp(const char *group) static struct linelist * read_for_group(const char *group) { - char *pos, *spos, *linep, *olinep; + char *pos, *spos, *linep; int len, olen; int cont; struct linelist *lp; @@ -534,6 +541,7 @@ read_for_group(const char *group) #ifdef YP char *result; int resultlen; + linep = NULL; while (_netgr_yp_enabled || fgets(line, LINSIZ, netf) != NULL) { if (_netgr_yp_enabled) { @@ -554,6 +562,7 @@ read_for_group(const char *group) free(result); } #else + linep = NULL; while (fgets(line, LINSIZ, netf) != NULL) { #endif pos = (char *)&line; @@ -576,8 +585,14 @@ read_for_group(const char *group) pos++; if (*pos != '\n' && *pos != '\0') { lp = (struct linelist *)malloc(sizeof (*lp)); + if (lp == NULL) + return(NULL); lp->l_parsed = 0; lp->l_groupname = (char *)malloc(len + 1); + if (lp->l_groupname == NULL) { + free(lp); + return(NULL); + } bcopy(spos, lp->l_groupname, len); *(lp->l_groupname + len) = '\0'; len = strlen(pos); @@ -595,15 +610,15 @@ read_for_group(const char *group) } else cont = 0; if (len > 0) { - linep = (char *)malloc(olen + len + 1); - if (olen > 0) { - bcopy(olinep, linep, olen); - free(olinep); + linep = (char *)reallocf(linep, olen + len + 1); + if (linep == NULL) { + free(lp->l_groupname); + free(lp); + return(NULL); } bcopy(pos, linep + olen, len); olen += len; *(linep + olen) = '\0'; - olinep = linep; } if (cont) { if (fgets(line, LINSIZ, netf)) { @@ -634,5 +649,5 @@ read_for_group(const char *group) */ rewind(netf); #endif - return ((struct linelist *)0); + return (NULL); } Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Tue Jan 10 18:43:27 2012 (r229936) +++ head/lib/libutil/libutil.h Tue Jan 10 19:53:25 2012 (r229937) @@ -170,6 +170,7 @@ struct pidfh *pidfile_open(const char *p int pidfile_write(struct pidfh *pfh); int pidfile_close(struct pidfh *pfh); int pidfile_remove(struct pidfh *pfh); +int pidfile_fileno(struct pidfh *pfh); #endif #ifdef _UFS_UFS_QUOTA_H_ Modified: head/lib/libutil/pidfile.3 ============================================================================== --- head/lib/libutil/pidfile.3 Tue Jan 10 18:43:27 2012 (r229936) +++ head/lib/libutil/pidfile.3 Tue Jan 10 19:53:25 2012 (r229937) @@ -46,6 +46,8 @@ .Fn pidfile_close "struct pidfh *pfh" .Ft int .Fn pidfile_remove "struct pidfh *pfh" +.Ft int +.Fn pidfile_fileno "struct pidfh *pfh" .Sh DESCRIPTION The .Nm pidfile @@ -92,6 +94,10 @@ to start a child process. The .Fn pidfile_remove function closes and removes a pidfile. +.Pp +The +.Fn pidfile_fileno +function returns the file descriptor for the open pid file. .Sh RETURN VALUES The .Fn pidfile_open @@ -105,15 +111,25 @@ If an error occurs, will be set. .Pp .Rv -std pidfile_write pidfile_close pidfile_remove +.Pp +The +.Fn pidfile_fileno +function returns the low-level file descriptor. +It returns -1 and sets +.Va errno +if a NULL +.Vt pidfh +is specified, or if the pidfile is no longer open. .Sh EXAMPLES The following example shows in which order these functions should be used. Note that it is safe to pass .Dv NULL to .Fn pidfile_write , -.Fn pidfile_remove -and +.Fn pidfile_remove , .Fn pidfile_close +and +.Fn pidfile_fileno functions. .Bd -literal struct pidfh *pfh; @@ -244,6 +260,16 @@ and system calls and the .Xr flopen 3 library function. +.Pp +The +.Fn pidfile_fileno +function will fail if: +.Bl -tag -width Er +.It Bq Er EDOOFUS +Improper function use. +Probably called not from the process which used +.Fn pidfile_open . +.El .Sh SEE ALSO .Xr open 2 , .Xr daemon 3 , Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Tue Jan 10 18:43:27 2012 (r229936) +++ head/lib/libutil/pidfile.c Tue Jan 10 19:53:25 2012 (r229937) @@ -266,3 +266,13 @@ pidfile_remove(struct pidfh *pfh) return (_pidfile_remove(pfh, 1)); } + +int +pidfile_fileno(struct pidfh *pfh) +{ + if (pfh == NULL || pfh->pf_fd == -1) { + errno = EDOOFUS; + return (-1); + } + return (pfh->pf_fd); +} From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 19:54:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3702D1065670; Tue, 10 Jan 2012 19:54:54 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B2F58FC14; Tue, 10 Jan 2012 19:54:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AJssaG025196; Tue, 10 Jan 2012 19:54:54 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AJsrUY025194; Tue, 10 Jan 2012 19:54:53 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201101954.q0AJsrUY025194@svn.freebsd.org> From: Guy Helmer Date: Tue, 10 Jan 2012 19:54: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: r229938 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 19:54:54 -0000 Author: ghelmer Date: Tue Jan 10 19:54:53 2012 New Revision: 229938 URL: http://svn.freebsd.org/changeset/base/229938 Log: Revert unintentional commit of changes to getnetgrent.c. Modified: head/lib/libc/gen/getnetgrent.c Modified: head/lib/libc/gen/getnetgrent.c ============================================================================== --- head/lib/libc/gen/getnetgrent.c Tue Jan 10 19:53:25 2012 (r229937) +++ head/lib/libc/gen/getnetgrent.c Tue Jan 10 19:54:53 2012 (r229938) @@ -203,7 +203,9 @@ setnetgrent(const char *group) if (parse_netgrp(group)) endnetgrent(); else { - grouphead.grname = strdup(group); + grouphead.grname = (char *) + malloc(strlen(group) + 1); + strcpy(grouphead.grname, group); } if (netf) fclose(netf); @@ -415,7 +417,7 @@ static int parse_netgrp(const char *group) { char *spos, *epos; - int len, strpos, freepos; + int len, strpos; #ifdef DEBUG int fields; #endif @@ -452,9 +454,9 @@ parse_netgrp(const char *group) while (pos != NULL && *pos != '\0') { if (*pos == '(') { grp = (struct netgrp *)malloc(sizeof (struct netgrp)); - if (grp == NULL) - return(1); bzero((char *)grp, sizeof (struct netgrp)); + grp->ng_next = grouphead.gr; + grouphead.gr = grp; pos++; gpos = strsep(&pos, ")"); #ifdef DEBUG @@ -475,13 +477,6 @@ parse_netgrp(const char *group) if (len > 0) { grp->ng_str[strpos] = (char *) malloc(len + 1); - if (grp->ng_str[strpos] == NULL) { - for (freepos = 0; freepos < strpos; freepos++) - if (grp->ng_str[freepos] != NULL) - free(grp->ng_str[freepos]); - free(grp); - return(1); - } bcopy(spos, grp->ng_str[strpos], len + 1); } @@ -495,8 +490,6 @@ parse_netgrp(const char *group) grp->ng_str[strpos] = NULL; } } - grp->ng_next = grouphead.gr; - grouphead.gr = grp; #ifdef DEBUG /* * Note: on other platforms, malformed netgroup @@ -533,7 +526,7 @@ parse_netgrp(const char *group) static struct linelist * read_for_group(const char *group) { - char *pos, *spos, *linep; + char *pos, *spos, *linep, *olinep; int len, olen; int cont; struct linelist *lp; @@ -541,7 +534,6 @@ read_for_group(const char *group) #ifdef YP char *result; int resultlen; - linep = NULL; while (_netgr_yp_enabled || fgets(line, LINSIZ, netf) != NULL) { if (_netgr_yp_enabled) { @@ -562,7 +554,6 @@ read_for_group(const char *group) free(result); } #else - linep = NULL; while (fgets(line, LINSIZ, netf) != NULL) { #endif pos = (char *)&line; @@ -585,14 +576,8 @@ read_for_group(const char *group) pos++; if (*pos != '\n' && *pos != '\0') { lp = (struct linelist *)malloc(sizeof (*lp)); - if (lp == NULL) - return(NULL); lp->l_parsed = 0; lp->l_groupname = (char *)malloc(len + 1); - if (lp->l_groupname == NULL) { - free(lp); - return(NULL); - } bcopy(spos, lp->l_groupname, len); *(lp->l_groupname + len) = '\0'; len = strlen(pos); @@ -610,15 +595,15 @@ read_for_group(const char *group) } else cont = 0; if (len > 0) { - linep = (char *)reallocf(linep, olen + len + 1); - if (linep == NULL) { - free(lp->l_groupname); - free(lp); - return(NULL); + linep = (char *)malloc(olen + len + 1); + if (olen > 0) { + bcopy(olinep, linep, olen); + free(olinep); } bcopy(pos, linep + olen, len); olen += len; *(linep + olen) = '\0'; + olinep = linep; } if (cont) { if (fgets(line, LINSIZ, netf)) { @@ -649,5 +634,5 @@ read_for_group(const char *group) */ rewind(netf); #endif - return (NULL); + return ((struct linelist *)0); } From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 19:57:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5139F106566B; Tue, 10 Jan 2012 19:57:24 +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 3ED8B8FC0C; Tue, 10 Jan 2012 19:57:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AJvOqw025344; Tue, 10 Jan 2012 19:57:24 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AJvOZ5025332; Tue, 10 Jan 2012 19:57:24 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201101957.q0AJvOZ5025332@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 10 Jan 2012 19:57: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: r229939 - in head/sys/dev: e1000 ixgbe netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 19:57:24 -0000 Author: luigi Date: Tue Jan 10 19:57:23 2012 New Revision: 229939 URL: http://svn.freebsd.org/changeset/base/229939 Log: small code cleanup in preparation for future modifications in the memory allocator used by netmap. No functional change, two small bug fixes: - in if_re.c add a missing bus_dmamap_sync() - in netmap.c comment out a spurious free() in an error handling block Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/e1000/if_em.c Tue Jan 10 19:57:23 2012 (r229939) @@ -3297,16 +3297,15 @@ em_setup_transmit_ring(struct tx_ring *t #ifdef DEV_NETMAP if (slot) { int si = i + na->tx_rings[txr->me].nkr_hwofs; + uint64_t paddr; void *addr; if (si >= na->num_tx_desc) si -= na->num_tx_desc; - addr = NMB(slot + si); - txr->tx_base[i].buffer_addr = - htole64(vtophys(addr)); + addr = PNMB(slot + si, &paddr); + txr->tx_base[i].buffer_addr = htole64(paddr); /* reload the map for netmap mode */ - netmap_load_map(txr->txtag, - txbuf->map, addr, na->buff_size); + netmap_load_map(txr->txtag, txbuf->map, addr); } #endif /* DEV_NETMAP */ @@ -4104,9 +4103,6 @@ em_setup_receive_ring(struct rx_ring *rx sj += adapter->num_rx_desc; for (int j = 0; j != adapter->num_rx_desc; j++, sj++) { - void *addr; - int sz; - rxbuf = &rxr->rx_buffers[j]; /* no mbuf and regular mode -> skip this entry */ if (rxbuf->m_head == NULL && !slot) @@ -4115,12 +4111,20 @@ em_setup_receive_ring(struct rx_ring *rx if (sj >= adapter->num_rx_desc) sj -= adapter->num_rx_desc; /* see comment, set slot addr and map */ - addr = slot ? NMB(slot + sj) : rxbuf->m_head->m_data; - sz = slot ? na->buff_size : adapter->rx_mbuf_sz; - // XXX load or reload ? - netmap_load_map(rxr->rxtag, rxbuf->map, addr, sz); - /* Update descriptor */ - rxr->rx_base[j].buffer_addr = htole64(vtophys(addr)); + if (slot) { + uint64_t paddr; + void *addr = PNMB(slot + sj, &paddr); + netmap_load_map(rxr->rxtag, rxbuf->map, addr); + /* Update descriptor */ + rxr->rx_base[j].buffer_addr = htole64(paddr); + } else { + /* Get the memory mapping */ + bus_dmamap_load_mbuf_sg(rxr->rxtag, + rxbuf->map, rxbuf->m_head, seg, + &nsegs, BUS_DMA_NOWAIT); + /* Update descriptor */ + rxr->rx_base[j].buffer_addr = htole64(seg[0].ds_addr); + } bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); } } Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/e1000/if_igb.c Tue Jan 10 19:57:23 2012 (r229939) @@ -3320,8 +3320,7 @@ igb_setup_transmit_ring(struct tx_ring * if (si < 0) si += na->num_tx_desc; - netmap_load_map(txr->txtag, txbuf->map, - NMB(slot + si), na->buff_size); + netmap_load_map(txr->txtag, txbuf->map, NMB(slot + si)); } #endif /* DEV_NETMAP */ /* clear the watch index */ @@ -4062,15 +4061,15 @@ igb_setup_receive_ring(struct rx_ring *r if (slot) { /* slot sj is mapped to the i-th NIC-ring entry */ int sj = j + na->rx_rings[rxr->me].nkr_hwofs; + uint64_t paddr; void *addr; if (sj < 0) sj += na->num_rx_desc; - addr = NMB(slot + sj); - netmap_load_map(rxr->ptag, - rxbuf->pmap, addr, na->buff_size); + addr = PNMB(slot + sj, &paddr); + netmap_load_map(rxr->ptag, rxbuf->pmap, addr); /* Update descriptor */ - rxr->rx_base[j].read.pkt_addr = htole64(vtophys(addr)); + rxr->rx_base[j].read.pkt_addr = htole64(paddr); continue; } #endif /* DEV_NETMAP */ Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/e1000/if_lem.c Tue Jan 10 19:57:23 2012 (r229939) @@ -2670,16 +2670,15 @@ lem_setup_transmit_structures(struct ada if (slot) { /* slot si is mapped to the i-th NIC-ring entry */ int si = i + na->tx_rings[0].nkr_hwofs; + uint64_t paddr; void *addr; if (si > na->num_tx_desc) si -= na->num_tx_desc; - addr = NMB(slot + si); - adapter->tx_desc_base[si].buffer_addr = - htole64(vtophys(addr)); + addr = PNMB(slot + si, &paddr); + adapter->tx_desc_base[si].buffer_addr = htole64(paddr); /* reload the map for netmap mode */ - netmap_load_map(adapter->txtag, - tx_buffer->map, addr, na->buff_size); + netmap_load_map(adapter->txtag, tx_buffer->map, addr); } #endif /* DEV_NETMAP */ tx_buffer->next_eop = -1; @@ -3247,16 +3246,15 @@ lem_setup_receive_structures(struct adap if (slot) { /* slot si is mapped to the i-th NIC-ring entry */ int si = i + na->rx_rings[0].nkr_hwofs; + uint64_t paddr; void *addr; if (si > na->num_rx_desc) si -= na->num_rx_desc; - addr = NMB(slot + si); - netmap_load_map(adapter->rxtag, - rx_buffer->map, addr, na->buff_size); + addr = PNMB(slot + si, &paddr); + netmap_load_map(adapter->rxtag, rx_buffer->map, addr); /* Update descriptor */ - adapter->rx_desc_base[i].buffer_addr = - htole64(vtophys(addr)); + adapter->rx_desc_base[i].buffer_addr = htole64(paddr); continue; } #endif /* DEV_NETMAP */ Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/ixgbe/ixgbe.c Tue Jan 10 19:57:23 2012 (r229939) @@ -2876,8 +2876,7 @@ ixgbe_setup_transmit_ring(struct tx_ring if (si >= na->num_tx_desc) si -= na->num_tx_desc; - netmap_load_map(txr->txtag, txbuf->map, - NMB(slot + si), na->buff_size); + netmap_load_map(txr->txtag, txbuf->map, NMB(slot + si)); } #endif /* DEV_NETMAP */ /* Clear the EOP index */ @@ -3810,16 +3809,15 @@ ixgbe_setup_receive_ring(struct rx_ring */ if (slot) { int sj = j + na->rx_rings[rxr->me].nkr_hwofs; + uint64_t paddr; void *addr; if (sj >= na->num_rx_desc) sj -= na->num_rx_desc; - addr = NMB(slot + sj); - netmap_load_map(rxr->ptag, - rxbuf->pmap, addr, na->buff_size); + addr = PNMB(slot + sj, &paddr); + netmap_load_map(rxr->ptag, rxbuf->pmap, addr); /* Update descriptor */ - rxr->rx_base[j].read.pkt_addr = - htole64(vtophys(addr)); + rxr->rx_base[j].read.pkt_addr = htole64(paddr); continue; } #endif /* DEV_NETMAP */ Modified: head/sys/dev/netmap/if_em_netmap.h ============================================================================== --- head/sys/dev/netmap/if_em_netmap.h Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/netmap/if_em_netmap.h Tue Jan 10 19:57:23 2012 (r229939) @@ -222,7 +222,8 @@ em_netmap_txsync(void *a, u_int ring_nr, int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? E1000_TXD_CMD_RS : 0; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); int len = slot->len; if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) { if (do_lock) @@ -236,10 +237,9 @@ em_netmap_txsync(void *a, u_int ring_nr, htole32(adapter->txd_cmd | len | (E1000_TXD_CMD_EOP | flags) ); if (slot->flags & NS_BUF_CHANGED) { - curr->buffer_addr = htole64(vtophys(addr)); + curr->buffer_addr = htole64(paddr); /* buffer has changed, reload map */ - netmap_reload_map(txr->txtag, txbuf->map, - addr, na->buff_size); + netmap_reload_map(txr->txtag, txbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } @@ -355,7 +355,8 @@ em_netmap_rxsync(void *a, u_int ring_nr, struct netmap_slot *slot = &ring->slot[j]; struct e1000_rx_desc *curr = &rxr->rx_base[l]; struct em_buffer *rxbuf = &rxr->rx_buffers[l]; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); if (addr == netmap_buffer_base) { /* bad buf */ if (do_lock) @@ -365,10 +366,9 @@ em_netmap_rxsync(void *a, u_int ring_nr, curr->status = 0; if (slot->flags & NS_BUF_CHANGED) { - curr->buffer_addr = htole64(vtophys(addr)); + curr->buffer_addr = htole64(paddr); /* buffer has changed, reload map */ - netmap_reload_map(rxr->rxtag, rxbuf->map, - addr, na->buff_size); + netmap_reload_map(rxr->rxtag, rxbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } Modified: head/sys/dev/netmap/if_igb_netmap.h ============================================================================== --- head/sys/dev/netmap/if_igb_netmap.h Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/netmap/if_igb_netmap.h Tue Jan 10 19:57:23 2012 (r229939) @@ -181,7 +181,8 @@ igb_netmap_txsync(void *a, u_int ring_nr struct igb_tx_buffer *txbuf = &txr->tx_buffers[l]; union e1000_adv_tx_desc *curr = (union e1000_adv_tx_desc *)&txr->tx_base[l]; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? E1000_ADVTXD_DCMD_RS : 0; @@ -195,7 +196,7 @@ igb_netmap_txsync(void *a, u_int ring_nr slot->flags &= ~NS_REPORT; // XXX do we need to set the address ? - curr->read.buffer_addr = htole64(vtophys(addr)); + curr->read.buffer_addr = htole64(paddr); curr->read.olinfo_status = htole32(olinfo_status | (len<< E1000_ADVTXD_PAYLEN_SHIFT)); @@ -206,8 +207,7 @@ igb_netmap_txsync(void *a, u_int ring_nr E1000_ADVTXD_DCMD_EOP | flags); if (slot->flags & NS_BUF_CHANGED) { /* buffer has changed, reload map */ - netmap_reload_map(txr->txtag, txbuf->map, - addr, na->buff_size); + netmap_reload_map(txr->txtag, txbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } @@ -317,7 +317,8 @@ igb_netmap_rxsync(void *a, u_int ring_nr struct netmap_slot *slot = ring->slot + j; union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; struct igb_rx_buf *rxbuf = rxr->rx_buffers + l; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); if (addr == netmap_buffer_base) { /* bad buf */ if (do_lock) @@ -326,10 +327,9 @@ igb_netmap_rxsync(void *a, u_int ring_nr } curr->wb.upper.status_error = 0; - curr->read.pkt_addr = htole64(vtophys(addr)); + curr->read.pkt_addr = htole64(paddr); if (slot->flags & NS_BUF_CHANGED) { - netmap_reload_map(rxr->ptag, rxbuf->pmap, - addr, na->buff_size); + netmap_reload_map(rxr->ptag, rxbuf->pmap, addr); slot->flags &= ~NS_BUF_CHANGED; } Modified: head/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- head/sys/dev/netmap/if_lem_netmap.h Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/netmap/if_lem_netmap.h Tue Jan 10 19:57:23 2012 (r229939) @@ -186,7 +186,8 @@ lem_netmap_txsync(void *a, u_int ring_nr struct netmap_slot *slot = &ring->slot[j]; struct e1000_tx_desc *curr = &adapter->tx_desc_base[l]; struct em_buffer *txbuf = &adapter->tx_buffer_area[l]; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? E1000_TXD_CMD_RS : 0; @@ -204,10 +205,9 @@ lem_netmap_txsync(void *a, u_int ring_nr htole32( adapter->txd_cmd | len | (E1000_TXD_CMD_EOP | flags) ); if (slot->flags & NS_BUF_CHANGED) { - curr->buffer_addr = htole64(vtophys(addr)); + curr->buffer_addr = htole64(paddr); /* buffer has changed, reload map */ - netmap_reload_map(adapter->txtag, txbuf->map, - addr, na->buff_size); + netmap_reload_map(adapter->txtag, txbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } @@ -314,7 +314,8 @@ lem_netmap_rxsync(void *a, u_int ring_nr struct netmap_slot *slot = &ring->slot[j]; struct e1000_rx_desc *curr = &adapter->rx_desc_base[l]; struct em_buffer *rxbuf = &adapter->rx_buffer_area[l]; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); if (addr == netmap_buffer_base) { /* bad buf */ if (do_lock) @@ -323,10 +324,9 @@ lem_netmap_rxsync(void *a, u_int ring_nr } curr->status = 0; if (slot->flags & NS_BUF_CHANGED) { - curr->buffer_addr = htole64(vtophys(addr)); + curr->buffer_addr = htole64(paddr); /* buffer has changed, and reload map */ - netmap_reload_map(adapter->rxtag, rxbuf->map, - addr, na->buff_size); + netmap_reload_map(adapter->rxtag, rxbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } Modified: head/sys/dev/netmap/if_re_netmap.h ============================================================================== --- head/sys/dev/netmap/if_re_netmap.h Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/netmap/if_re_netmap.h Tue Jan 10 19:57:23 2012 (r229939) @@ -183,7 +183,8 @@ re_netmap_txsync(void *a, u_int ring_nr, struct rl_desc *desc = &sc->rl_ldata.rl_tx_list[l]; int cmd = slot->len | RL_TDESC_CMD_EOF | RL_TDESC_CMD_OWN | RL_TDESC_CMD_SOF ; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); int len = slot->len; if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) { @@ -197,12 +198,11 @@ re_netmap_txsync(void *a, u_int ring_nr, cmd |= RL_TDESC_CMD_EOR; if (slot->flags & NS_BUF_CHANGED) { - uint64_t paddr = vtophys(addr); desc->rl_bufaddr_lo = htole32(RL_ADDR_LO(paddr)); desc->rl_bufaddr_hi = htole32(RL_ADDR_HI(paddr)); /* buffer has changed, unload and reload map */ netmap_reload_map(sc->rl_ldata.rl_tx_mtag, - txd[l].tx_dmamap, addr, na->buff_size); + txd[l].tx_dmamap, addr); slot->flags &= ~NS_BUF_CHANGED; } slot->flags &= ~NS_REPORT; @@ -304,7 +304,8 @@ re_netmap_rxsync(void *a, u_int ring_nr, struct netmap_slot *slot = ring->slot + j; struct rl_desc *desc = &sc->rl_ldata.rl_rx_list[l]; int cmd = na->buff_size | RL_RDESC_CMD_OWN; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); if (addr == netmap_buffer_base) { /* bad buf */ if (do_lock) @@ -318,11 +319,10 @@ re_netmap_rxsync(void *a, u_int ring_nr, desc->rl_cmdstat = htole32(cmd); slot->flags &= ~NS_REPORT; if (slot->flags & NS_BUF_CHANGED) { - uint64_t paddr = vtophys(addr); desc->rl_bufaddr_lo = htole32(RL_ADDR_LO(paddr)); desc->rl_bufaddr_hi = htole32(RL_ADDR_HI(paddr)); netmap_reload_map(sc->rl_ldata.rl_rx_mtag, - rxd[l].rx_dmamap, addr, na->buff_size); + rxd[l].rx_dmamap, addr); slot->flags &= ~NS_BUF_CHANGED; } bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag, @@ -377,12 +377,11 @@ re_netmap_tx_init(struct rl_softc *sc) if (l >= n) l -= n; - addr = NMB(slot + l); - paddr = vtophys(addr); + addr = PNMB(slot + l, &paddr); desc[i].rl_bufaddr_lo = htole32(RL_ADDR_LO(paddr)); desc[i].rl_bufaddr_hi = htole32(RL_ADDR_HI(paddr)); netmap_load_map(sc->rl_ldata.rl_tx_mtag, - txd[i].tx_dmamap, addr, na->buff_size); + txd[i].tx_dmamap, addr); } } @@ -407,8 +406,12 @@ re_netmap_rx_init(struct rl_softc *sc) if (l >= n) l -= n; - addr = NMB(slot + l); - paddr = vtophys(addr); + addr = PNMB(slot + l, &paddr); + + netmap_reload_map(sc->rl_ldata.rl_rx_mtag, + sc->rl_ldata.rl_rx_desc[i].rx_dmamap, addr); + bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag, + sc->rl_ldata.rl_rx_desc[i].rx_dmamap, BUS_DMASYNC_PREREAD); desc[i].rl_bufaddr_lo = htole32(RL_ADDR_LO(paddr)); desc[i].rl_bufaddr_hi = htole32(RL_ADDR_HI(paddr)); cmdstat = na->buff_size; @@ -422,9 +425,5 @@ re_netmap_rx_init(struct rl_softc *sc) if (i < n - 1 - kring->nr_hwavail) // XXX + 1 ? cmdstat |= RL_RDESC_CMD_OWN; desc[i].rl_cmdstat = htole32(cmdstat); - - netmap_reload_map(sc->rl_ldata.rl_rx_mtag, - sc->rl_ldata.rl_rx_desc[i].rx_dmamap, - addr, na->buff_size); } } Modified: head/sys/dev/netmap/ixgbe_netmap.h ============================================================================== --- head/sys/dev/netmap/ixgbe_netmap.h Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/netmap/ixgbe_netmap.h Tue Jan 10 19:57:23 2012 (r229939) @@ -253,7 +253,7 @@ ixgbe_netmap_txsync(void *a, u_int ring_ * Note that txbuf and curr are indexed by l. * * In this driver we collect the buffer address - * (using the NMB() macro) because we always + * (using the PNMB() macro) because we always * need to rewrite it into the NIC ring. * Many other drivers preserve the address, so * we only need to access it if NS_BUF_CHANGED @@ -262,7 +262,8 @@ ixgbe_netmap_txsync(void *a, u_int ring_ struct netmap_slot *slot = &ring->slot[j]; struct ixgbe_tx_buf *txbuf = &txr->tx_buffers[l]; union ixgbe_adv_tx_desc *curr = &txr->tx_base[l]; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); // XXX type for flags and len ? int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? @@ -290,7 +291,7 @@ ring_reset: * address in the NIC ring. Other drivers do not * need this. */ - curr->read.buffer_addr = htole64(vtophys(addr)); + curr->read.buffer_addr = htole64(paddr); curr->read.olinfo_status = 0; curr->read.cmd_type_len = htole32(txr->txd_cmd | len | @@ -303,8 +304,7 @@ ring_reset: */ if (slot->flags & NS_BUF_CHANGED) { /* buffer has changed, unload and reload map */ - netmap_reload_map(txr->txtag, txbuf->map, - addr, na->buff_size); + netmap_reload_map(txr->txtag, txbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } @@ -479,16 +479,16 @@ ixgbe_netmap_rxsync(void *a, u_int ring_ struct netmap_slot *slot = &ring->slot[j]; union ixgbe_adv_rx_desc *curr = &rxr->rx_base[l]; struct ixgbe_rx_buf *rxbuf = &rxr->rx_buffers[l]; - void *addr = NMB(slot); + uint64_t paddr; + void *addr = PNMB(slot, &paddr); if (addr == netmap_buffer_base) /* bad buf */ goto ring_reset; curr->wb.upper.status_error = 0; - curr->read.pkt_addr = htole64(vtophys(addr)); + curr->read.pkt_addr = htole64(paddr); if (slot->flags & NS_BUF_CHANGED) { - netmap_reload_map(rxr->ptag, rxbuf->pmap, - addr, na->buff_size); + netmap_reload_map(rxr->ptag, rxbuf->pmap, addr); slot->flags &= ~NS_BUF_CHANGED; } Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/netmap/netmap.c Tue Jan 10 19:57:23 2012 (r229939) @@ -104,6 +104,13 @@ MALLOC_DEFINE(M_NETMAP, "netmap", "Netwo static void * netmap_malloc(size_t size, const char *msg); static void netmap_free(void *addr, const char *msg); +#define netmap_if_malloc(len) netmap_malloc(len, "nifp") +#define netmap_if_free(v) netmap_free((v), "nifp") + +#define netmap_ring_malloc(len) netmap_malloc(len, "ring") +#define netmap_free_rings(na) \ + netmap_free((na)->tx_rings[0].ring, "shadow rings"); + /* * Allocator for a pool of packet buffers. For each buffer we have * one entry in the bitmap to signal the state. Allocation scans @@ -123,7 +130,7 @@ struct netmap_buf_pool { struct netmap_buf_pool nm_buf_pool; /* XXX move these two vars back into netmap_buf_pool */ u_int netmap_total_buffers; -char *netmap_buffer_base; +char *netmap_buffer_base; /* address of an invalid buffer */ /* user-controlled variables */ int netmap_verbose; @@ -233,6 +240,12 @@ struct netmap_priv_d { uint16_t np_txpoll; }; +/* Shorthand to compute a netmap interface offset. */ +#define netmap_if_offset(v) \ + ((char *) (v) - (char *) netmap_mem_d->nm_buffer) +/* .. and get a physical address given a memory offset */ +#define netmap_ofstophys(o) \ + (vtophys(netmap_mem_d->nm_buffer) + (o)) static struct cdev *netmap_dev; /* /dev/netmap character device. */ static struct netmap_mem_d *netmap_mem_d; /* Our memory allocator. */ @@ -397,10 +410,10 @@ netmap_dtor(void *data) ring->slot[j].buf_idx); } NMA_UNLOCK(); - netmap_free(na->tx_rings[0].ring, "shadow rings"); + netmap_free_rings(na); wakeup(na); } - netmap_free(nifp, "nifp"); + netmap_if_free(nifp); na->nm_lock(ifp->if_softc, NETMAP_CORE_UNLOCK, 0); @@ -432,7 +445,7 @@ netmap_if_new(const char *ifname, struct * to the tx and rx rings in the shared memory region. */ len = sizeof(struct netmap_if) + 2 * n * sizeof(ssize_t); - nifp = netmap_malloc(len, "nifp"); + nifp = netmap_if_malloc(len); if (nifp == NULL) return (NULL); @@ -455,13 +468,13 @@ netmap_if_new(const char *ifname, struct len = n * (2 * sizeof(struct netmap_ring) + (na->num_tx_desc + na->num_rx_desc) * sizeof(struct netmap_slot) ); - buff = netmap_malloc(len, "shadow rings"); + buff = netmap_ring_malloc(len); if (buff == NULL) { D("failed to allocate %d bytes for %s shadow ring", len, ifname); error: (na->refcount)--; - netmap_free(nifp, "nifp, rings failed"); + netmap_if_free(nifp); return (NULL); } /* do we have the bufers ? we are in need of num_tx_desc buffers for @@ -907,11 +920,12 @@ netmap_ioctl(__unused struct cdev *dev, /* * do something similar to netmap_dtor(). */ - netmap_free(na->tx_rings[0].ring, "rings, reg.failed"); - free(na->tx_rings, M_DEVBUF); + netmap_free_rings(na); + // XXX tx_rings is inline, must not be freed. + // free(na->tx_rings, M_DEVBUF); // XXX wrong ? na->tx_rings = na->rx_rings = NULL; na->refcount--; - netmap_free(nifp, "nifp, rings failed"); + netmap_if_free(nifp); nifp = NULL; } } @@ -1388,22 +1402,18 @@ ns_dmamap_cb(__unused void *arg, __unuse * XXX buflen is probably not needed, buffers have constant size. */ void -netmap_reload_map(bus_dma_tag_t tag, bus_dmamap_t map, - void *buf, bus_size_t buflen) +netmap_reload_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf) { - bus_addr_t paddr; bus_dmamap_unload(tag, map); - bus_dmamap_load(tag, map, buf, buflen, ns_dmamap_cb, &paddr, - BUS_DMA_NOWAIT); + bus_dmamap_load(tag, map, buf, NETMAP_BUF_SIZE, ns_dmamap_cb, + NULL, BUS_DMA_NOWAIT); } void -netmap_load_map(bus_dma_tag_t tag, bus_dmamap_t map, - void *buf, bus_size_t buflen) +netmap_load_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf) { - bus_addr_t paddr; - bus_dmamap_load(tag, map, buf, buflen, ns_dmamap_cb, &paddr, - BUS_DMA_NOWAIT); + bus_dmamap_load(tag, map, buf, NETMAP_BUF_SIZE, ns_dmamap_cb, + NULL, BUS_DMA_NOWAIT); } /*------ netmap memory allocator -------*/ Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Tue Jan 10 19:54:53 2012 (r229938) +++ head/sys/dev/netmap/netmap_kern.h Tue Jan 10 19:57:23 2012 (r229939) @@ -169,10 +169,8 @@ int netmap_start(struct ifnet *, struct enum txrx { NR_RX = 0, NR_TX = 1 }; struct netmap_slot *netmap_reset(struct netmap_adapter *na, enum txrx tx, int n, u_int new_cur); -void netmap_load_map(bus_dma_tag_t tag, bus_dmamap_t map, - void *buf, bus_size_t buflen); -void netmap_reload_map(bus_dma_tag_t tag, bus_dmamap_t map, - void *buf, bus_size_t buflen); +void netmap_load_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf); +void netmap_reload_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf); int netmap_ring_reinit(struct netmap_kring *); /* @@ -206,11 +204,11 @@ enum { /* - * return the address of a buffer. + * NMB return the virtual address of a buffer (buffer 0 on bad index) + * PNMB also fills the physical address * XXX this is a special version with hardwired 2k bufs - * On error return netmap_buffer_base which is detected as a bad pointer. */ -static inline char * +static inline void * NMB(struct netmap_slot *slot) { uint32_t i = slot->buf_idx; @@ -222,4 +220,18 @@ NMB(struct netmap_slot *slot) #endif } +static inline void * +PNMB(struct netmap_slot *slot, uint64_t *pp) +{ + uint32_t i = slot->buf_idx; + void *ret = (i >= netmap_total_buffers) ? netmap_buffer_base : +#if NETMAP_BUF_SIZE == 2048 + netmap_buffer_base + (i << 11); +#else + netmap_buffer_base + (i *NETMAP_BUF_SIZE); +#endif + *pp = vtophys(ret); + return ret; +} + #endif /* _NET_NETMAP_KERN_H_ */ From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 20:52:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 416021065672; Tue, 10 Jan 2012 20:52:03 +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 2FBAA8FC13; Tue, 10 Jan 2012 20:52:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AKq3gO027118; Tue, 10 Jan 2012 20:52:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AKq3Ic027116; Tue, 10 Jan 2012 20:52:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201102052.q0AKq3Ic027116@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 10 Jan 2012 20:52: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: r229940 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 20:52:03 -0000 Author: yongari Date: Tue Jan 10 20:52:02 2012 New Revision: 229940 URL: http://svn.freebsd.org/changeset/base/229940 Log: style. No functional changes. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Tue Jan 10 19:57:23 2012 (r229939) +++ head/sys/dev/et/if_et.c Tue Jan 10 20:52:02 2012 (r229940) @@ -363,8 +363,9 @@ fail: static int et_detach(device_t dev) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; + sc = device_get_softc(dev); if (device_is_attached(dev)) { ether_ifdetach(sc->ifp); ET_LOCK(sc); @@ -401,8 +402,9 @@ et_detach(device_t dev) static int et_shutdown(device_t dev) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; + sc = device_get_softc(dev); ET_LOCK(sc); et_stop(sc); ET_UNLOCK(sc); @@ -412,10 +414,11 @@ et_shutdown(device_t dev) static int et_miibus_readreg(device_t dev, int phy, int reg) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; uint32_t val; int i, ret; + sc = device_get_softc(dev); /* Stop any pending operations */ CSR_WRITE_4(sc, ET_MII_CMD, 0); @@ -455,10 +458,11 @@ back: static int et_miibus_writereg(device_t dev, int phy, int reg, int val0) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; uint32_t val; int i; + sc = device_get_softc(dev); /* Stop any pending operations */ CSR_WRITE_4(sc, ET_MII_CMD, 0); @@ -593,10 +597,12 @@ et_miibus_statchg(device_t dev) static int et_ifmedia_upd_locked(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct et_softc *sc; + struct mii_data *mii; struct mii_softc *miisc; + sc = ifp->if_softc; + mii = device_get_softc(sc->sc_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); return (mii_mediachg(mii)); @@ -605,9 +611,10 @@ et_ifmedia_upd_locked(struct ifnet *ifp) static int et_ifmedia_upd(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; int res; + sc = ifp->if_softc; ET_LOCK(sc); res = et_ifmedia_upd_locked(ifp); ET_UNLOCK(sc); @@ -638,10 +645,11 @@ et_ifmedia_sts(struct ifnet *ifp, struct static void et_stop(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; + struct ifnet *ifp; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; callout_stop(&sc->sc_tick); /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); @@ -757,6 +765,7 @@ et_get_eaddr(device_t dev, uint8_t eaddr static void et_reset(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_MAC_CFG1, ET_MAC_CFG1_RST_TXFUNC | ET_MAC_CFG1_RST_RXFUNC | ET_MAC_CFG1_RST_TXMC | ET_MAC_CFG1_RST_RXMC | @@ -1163,10 +1172,11 @@ et_chip_attach(struct et_softc *sc) static void et_intr(void *xsc) { - struct et_softc *sc = xsc; + struct et_softc *sc; struct ifnet *ifp; uint32_t status; + sc = xsc; ET_LOCK(sc); ifp = sc->ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -1268,10 +1278,14 @@ et_init(void *xsc) static int et_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); - struct ifreq *ifr = (struct ifreq *)data; - int error = 0, mask, max_framelen; + struct et_softc *sc; + struct mii_data *mii; + struct ifreq *ifr; + int error, mask, max_framelen; + + sc = ifp->if_softc; + ifr = (struct ifreq *)data; + error = 0; /* XXX LOCKSUSED */ switch (cmd) { @@ -1295,6 +1309,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, case SIOCSIFMEDIA: case SIOCGIFMEDIA: + mii = device_get_softc(sc->sc_miibus); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); break; @@ -1424,8 +1439,9 @@ et_start_locked(struct ifnet *ifp) static void et_start(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; + sc = ifp->if_softc; ET_LOCK(sc); et_start_locked(ifp); ET_UNLOCK(sc); @@ -1456,6 +1472,7 @@ et_watchdog(struct et_softc *sc) static int et_stop_rxdma(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_RXDMA_CTRL, ET_RXDMA_CTRL_HALT | ET_RXDMA_CTRL_RING1_ENABLE); @@ -1470,6 +1487,7 @@ et_stop_rxdma(struct et_softc *sc) static int et_stop_txdma(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_TXDMA_CTRL, ET_TXDMA_CTRL_HALT | ET_TXDMA_CTRL_SINGLE_EPKT); return (0); @@ -1598,10 +1616,11 @@ back: static int et_chip_init(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; + struct ifnet *ifp; uint32_t rxq_end; int error, frame_len, rxmem_size; + ifp = sc->ifp; /* * Split 16Kbytes internal memory between TX and RX * according to frame length. @@ -1716,8 +1735,8 @@ et_init_rx_ring(struct et_softc *sc) static int et_init_rxdma(struct et_softc *sc) { - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; + struct et_rxstatus_data *rxsd; + struct et_rxstat_ring *rxst_ring; struct et_rxdesc_ring *rx_ring; int error; @@ -1730,12 +1749,14 @@ et_init_rxdma(struct et_softc *sc) /* * Install RX status */ + rxsd = &sc->sc_rx_status; CSR_WRITE_4(sc, ET_RX_STATUS_HI, ET_ADDR_HI(rxsd->rxsd_paddr)); CSR_WRITE_4(sc, ET_RX_STATUS_LO, ET_ADDR_LO(rxsd->rxsd_paddr)); /* * Install RX stat ring */ + rxst_ring = &sc->sc_rxstat_ring; CSR_WRITE_4(sc, ET_RXSTAT_HI, ET_ADDR_HI(rxst_ring->rsr_paddr)); CSR_WRITE_4(sc, ET_RXSTAT_LO, ET_ADDR_LO(rxst_ring->rsr_paddr)); CSR_WRITE_4(sc, ET_RXSTAT_CNT, ET_RX_NSTAT - 1); @@ -1786,8 +1807,8 @@ et_init_rxdma(struct et_softc *sc) static int et_init_txdma(struct et_softc *sc) { - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; + struct et_txdesc_ring *tx_ring; + struct et_txstatus_data *txsd; int error; error = et_stop_txdma(sc); @@ -1799,6 +1820,7 @@ et_init_txdma(struct et_softc *sc) /* * Install TX descriptor ring */ + tx_ring = &sc->sc_tx_ring; CSR_WRITE_4(sc, ET_TX_RING_HI, ET_ADDR_HI(tx_ring->tr_paddr)); CSR_WRITE_4(sc, ET_TX_RING_LO, ET_ADDR_LO(tx_ring->tr_paddr)); CSR_WRITE_4(sc, ET_TX_RING_CNT, ET_TX_NDESC - 1); @@ -1806,6 +1828,7 @@ et_init_txdma(struct et_softc *sc) /* * Install TX status */ + txsd = &sc->sc_tx_status; CSR_WRITE_4(sc, ET_TX_STATUS_HI, ET_ADDR_HI(txsd->txsd_paddr)); CSR_WRITE_4(sc, ET_TX_STATUS_LO, ET_ADDR_LO(txsd->txsd_paddr)); @@ -1821,8 +1844,8 @@ et_init_txdma(struct et_softc *sc) static void et_init_mac(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const uint8_t *eaddr = IF_LLADDR(ifp); + struct ifnet *ifp; + const uint8_t *eaddr; uint32_t val; /* Reset MAC */ @@ -1858,6 +1881,8 @@ et_init_mac(struct et_softc *sc) /* * Set MAC address */ + ifp = sc->ifp; + eaddr = IF_LLADDR(ifp); val = eaddr[2] | (eaddr[3] << 8) | (eaddr[4] << 16) | (eaddr[5] << 24); CSR_WRITE_4(sc, ET_MAC_ADDR1, val); val = (eaddr[0] << 16) | (eaddr[1] << 24); @@ -1873,8 +1898,8 @@ et_init_mac(struct et_softc *sc) static void et_init_rxmac(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const uint8_t *eaddr = IF_LLADDR(ifp); + struct ifnet *ifp; + const uint8_t *eaddr; uint32_t val; int i; @@ -1892,6 +1917,8 @@ et_init_rxmac(struct et_softc *sc) /* * Set WOL source address. XXX is this necessary? */ + ifp = sc->ifp; + eaddr = IF_LLADDR(ifp); val = (eaddr[2] << 24) | (eaddr[3] << 16) | (eaddr[4] << 8) | eaddr[5]; CSR_WRITE_4(sc, ET_WOL_SA_LO, val); val = (eaddr[0] << 8) | eaddr[1]; @@ -1958,6 +1985,7 @@ et_init_rxmac(struct et_softc *sc) static void et_init_txmac(struct et_softc *sc) { + /* Disable TX MAC and FC(?) */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, ET_TXMAC_CTRL_FC_DISABLE); @@ -1976,12 +2004,12 @@ et_init_txmac(struct et_softc *sc) static int et_start_rxdma(struct et_softc *sc) { - uint32_t val = 0; + uint32_t val; - val |= (sc->sc_rx_data[0].rbd_bufsize & ET_RXDMA_CTRL_RING0_SIZE_MASK) | - ET_RXDMA_CTRL_RING0_ENABLE; + val = (sc->sc_rx_data[0].rbd_bufsize & ET_RXDMA_CTRL_RING0_SIZE_MASK) | + ET_RXDMA_CTRL_RING0_ENABLE; val |= (sc->sc_rx_data[1].rbd_bufsize & ET_RXDMA_CTRL_RING1_SIZE_MASK) | - ET_RXDMA_CTRL_RING1_ENABLE; + ET_RXDMA_CTRL_RING1_ENABLE; CSR_WRITE_4(sc, ET_RXDMA_CTRL, val); @@ -1997,6 +2025,7 @@ et_start_rxdma(struct et_softc *sc) static int et_start_txdma(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_TXDMA_CTRL, ET_TXDMA_CTRL_SINGLE_EPKT); return (0); } @@ -2274,10 +2303,11 @@ et_txeof(struct et_softc *sc) static void et_tick(void *xsc) { - struct et_softc *sc = xsc; + struct et_softc *sc; struct ifnet *ifp; struct mii_data *mii; + sc = xsc; ET_LOCK_ASSERT(sc); ifp = sc->ifp; mii = device_get_softc(sc->sc_miibus); @@ -2539,10 +2569,12 @@ et_add_sysctls(struct et_softc * sc) static int et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_ARGS) { - struct et_softc *sc = arg1; - struct ifnet *ifp = sc->ifp; - int error = 0, v; + struct et_softc *sc; + struct ifnet *ifp; + int error, v; + sc = arg1; + ifp = sc->ifp; v = sc->sc_rx_intr_npkts; error = sysctl_handle_int(oidp, &v, 0, req); if (error || req->newptr == NULL) @@ -2564,10 +2596,12 @@ back: static int et_sysctl_rx_intr_delay(SYSCTL_HANDLER_ARGS) { - struct et_softc *sc = arg1; - struct ifnet *ifp = sc->ifp; - int error = 0, v; + struct et_softc *sc; + struct ifnet *ifp; + int error, v; + sc = arg1; + ifp = sc->ifp; v = sc->sc_rx_intr_delay; error = sysctl_handle_int(oidp, &v, 0, req); if (error || req->newptr == NULL) From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 21:02:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 856F8106566C; Tue, 10 Jan 2012 21:02:10 +0000 (UTC) (envelope-from guy.helmer@palisadesystems.com) Received: from ps-1-a.compliancesafe.com (ps-1-a.compliancesafe.com [216.81.161.161]) by mx1.freebsd.org (Postfix) with ESMTP id 412BA8FC15; Tue, 10 Jan 2012 21:02:09 +0000 (UTC) Received: from mail.palisadesystems.com (localhost [127.0.0.1]) by ps-1-a.compliancesafe.com (8.14.4/8.14.3) with ESMTP id q0AL1p8k033851; Tue, 10 Jan 2012 15:01:51 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) Received: from guysmbp.dyn.palisadesys.com (GuysMBP.dyn.palisadesys.com [172.16.2.90]) (authenticated bits=0) by mail.palisadesystems.com (8.14.3/8.14.3) with ESMTP id q0AL1loY022008 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 10 Jan 2012 15:01:48 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.palisadesystems.com q0AL1loY022008 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=palisadesystems.com; s=mail; t=1326229308; bh=ajo4+kp4np+e+ApwHz3GAzCSOst26ZNcXFEVSUiY/f8=; l=128; h=Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=nSx1VK/4V13AvyfDNEFOG4hZD9vAPbvlo5EM1kWd7E9uONg2Ppmb0zflake/y/Dvr bgvgSMTSaYGBQM/VFZIdpzSAAMNvApWYGY4HjaBKN6L6IhE4SpOQfaaqxLCnxlmXa+ 8vgMlvfqsR2zRCECvkfu8u3ahdu6YpjzeF/tb4e8= Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=windows-1252 From: Guy Helmer In-Reply-To: Date: Tue, 10 Jan 2012 15:01:47 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201201052248.q05MmaZk059871@svn.freebsd.org> <4F066340.9010507@FreeBSD.org> To: Garrett Cooper X-Mailer: Apple Mail (2.1251.1) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.palisadesystems.com [172.16.1.5]); Tue, 10 Jan 2012 15:01:48 -0600 (CST) X-Palisade-MailScanner-Information: Please contact the ISP for more information X-Palisade-MailScanner-ID: q0AL1loY022008 X-Palisade-MailScanner: Found to be clean X-Palisade-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-1.628, required 5, ALL_TRUSTED -1.00, BAYES_00 -1.90, RP_8BIT 1.27) X-Palisade-MailScanner-From: guy.helmer@palisadesystems.com X-Spam-Status: No X-PacketSure-Scanned: Yes Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org Subject: Re: svn commit: r229667 - head/usr.sbin/daemon X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:02:10 -0000 On Jan 6, 2012, at 12:00 AM, Garrett Cooper wrote: > On Thu, Jan 5, 2012 at 6:58 PM, Doug Barton wrote: >> On 01/05/2012 14:48, Guy Helmer wrote: >>> Allow daemon(8) to run pidfile_open() before relenquishing = privileges >>> so pid files can be written in /var/run when started as root. >>=20 >> I'm not sure how useful this is since when daemon is exiting it won't = be >> able to remove the pid file (unless I'm missing something). >>=20 >> Isn't it better to pre-create the pid file with the proper = permissions >> for the unprivileged user? >=20 > As another aside, the file descriptor never has fcntl(, > FD_CLOEXEC) run on it, so it leaks the file descriptors across execs.. > that's not good... I just added an fcntl(=85, FD_CLOEXEC) call to pidfile_open() so this = particular problem should be resolved. Guy= -------- This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure. From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 21:26:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EC11106564A; Tue, 10 Jan 2012 21:26:36 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id E5C928FC08; Tue, 10 Jan 2012 21:26:35 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id C643FD98; Tue, 10 Jan 2012 22:26:33 +0100 (CET) Date: Tue, 10 Jan 2012 22:25:26 +0100 From: Pawel Jakub Dawidek To: Guy Helmer Message-ID: <20120110212525.GA1694@garage.freebsd.pl> References: <201201101843.q0AIhRuM022949@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="opJtzjQTFsWo+cga" Content-Disposition: inline In-Reply-To: <201201101843.q0AIhRuM022949@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229936 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:26:36 -0000 --opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 10, 2012 at 06:43:27PM +0000, Guy Helmer wrote: > Author: ghelmer > Date: Tue Jan 10 18:43:27 2012 > New Revision: 229936 > URL: http://svn.freebsd.org/changeset/base/229936 >=20 > Log: > Set the FD_CLOEXEC flag on the open pidfile file descriptor. > =20 > Discussed with: pjd, des Could you also update manual page to note that pidfile_open(3) can now also set errno via fcntl(2)? > Modified: > head/lib/libutil/pidfile.c >=20 > Modified: head/lib/libutil/pidfile.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/libutil/pidfile.c Tue Jan 10 18:20:19 2012 (r229935) > +++ head/lib/libutil/pidfile.c Tue Jan 10 18:43:27 2012 (r229936) > @@ -137,6 +137,20 @@ pidfile_open(const char *path, mode_t mo > free(pfh); > return (NULL); > } > + > + /* > + * Prevent the file descriptor from escaping to other > + * programs via exec(3). > + */ > + if (fcntl(fd, F_SETFD, FD_CLOEXEC) =3D=3D -1) { > + error =3D errno; > + unlink(pfh->pf_path); > + close(fd); > + free(pfh); > + errno =3D error; > + return (NULL); > + } > + > /* > * Remember file information, so in pidfile_write() we are sure we write > * to the proper descriptor. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --opJtzjQTFsWo+cga Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8MrMUACgkQForvXbEpPzREVQCgud/IWcYtGthH+KWcv70yASfg s/UAn14wIVzxl42Gn62dZ4VgTynEe4Wo =PeFr -----END PGP SIGNATURE----- --opJtzjQTFsWo+cga-- From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 21:28:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0478E1065677; Tue, 10 Jan 2012 21:28:21 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id A18738FC17; Tue, 10 Jan 2012 21:28:20 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id A96A7D9C; Tue, 10 Jan 2012 22:28:18 +0100 (CET) Date: Tue, 10 Jan 2012 22:27:11 +0100 From: Pawel Jakub Dawidek To: Guy Helmer Message-ID: <20120110212710.GB1694@garage.freebsd.pl> References: <201201101843.q0AIhRuM022949@svn.freebsd.org> <20120110212525.GA1694@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eJnRUKwClWJh1Khz" Content-Disposition: inline In-Reply-To: <20120110212525.GA1694@garage.freebsd.pl> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229936 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:28:21 -0000 --eJnRUKwClWJh1Khz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 10, 2012 at 10:25:26PM +0100, Pawel Jakub Dawidek wrote: > On Tue, Jan 10, 2012 at 06:43:27PM +0000, Guy Helmer wrote: > > Author: ghelmer > > Date: Tue Jan 10 18:43:27 2012 > > New Revision: 229936 > > URL: http://svn.freebsd.org/changeset/base/229936 > >=20 > > Log: > > Set the FD_CLOEXEC flag on the open pidfile file descriptor. > > =20 > > Discussed with: pjd, des >=20 > Could you also update manual page to note that pidfile_open(3) can now > also set errno via fcntl(2)? Actually, it would also be useful to document the fact that we now set FD_CLOEXEC flag, so one doesn't have to look at the code to find it. > > Modified: > > head/lib/libutil/pidfile.c > >=20 > > Modified: head/lib/libutil/pidfile.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/libutil/pidfile.c Tue Jan 10 18:20:19 2012 (r229935) > > +++ head/lib/libutil/pidfile.c Tue Jan 10 18:43:27 2012 (r229936) > > @@ -137,6 +137,20 @@ pidfile_open(const char *path, mode_t mo > > free(pfh); > > return (NULL); > > } > > + > > + /* > > + * Prevent the file descriptor from escaping to other > > + * programs via exec(3). > > + */ > > + if (fcntl(fd, F_SETFD, FD_CLOEXEC) =3D=3D -1) { > > + error =3D errno; > > + unlink(pfh->pf_path); > > + close(fd); > > + free(pfh); > > + errno =3D error; > > + return (NULL); > > + } > > + > > /* > > * Remember file information, so in pidfile_write() we are sure we wr= ite > > * to the proper descriptor. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --eJnRUKwClWJh1Khz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8MrS0ACgkQForvXbEpPzQxogCfa/9gbXsgdYUPnmaUlYiAnA92 B58An3t1bIujsh51y1Xber8lyCy7NikY =9emm -----END PGP SIGNATURE----- --eJnRUKwClWJh1Khz-- From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 21:39:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA3FD1065672; Tue, 10 Jan 2012 21:39:43 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9A478FC15; Tue, 10 Jan 2012 21:39:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ALdhnV028573; Tue, 10 Jan 2012 21:39:43 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ALdhpm028571; Tue, 10 Jan 2012 21:39:43 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201102139.q0ALdhpm028571@svn.freebsd.org> From: Guy Helmer Date: Tue, 10 Jan 2012 21:39: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: r229941 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:39:43 -0000 Author: ghelmer Date: Tue Jan 10 21:39:43 2012 New Revision: 229941 URL: http://svn.freebsd.org/changeset/base/229941 Log: Document that pidfile_open() now sets the FD_CLOEXEC flag on the open file descriptor, and that errors can be returned as a result of the fcntl(2) system call. Modified: head/lib/libutil/pidfile.3 Modified: head/lib/libutil/pidfile.3 ============================================================================== --- head/lib/libutil/pidfile.3 Tue Jan 10 20:52:02 2012 (r229940) +++ head/lib/libutil/pidfile.3 Tue Jan 10 21:39:43 2012 (r229941) @@ -79,6 +79,9 @@ argument is .Dv NULL , .Pa /var/run/ Ns Ao Va progname Ac Ns Pa .pid file will be used. +The +.Fn pidfile_open +function sets the FD_CLOEXEC close-on-exec flag on the open file descriptor. .Pp The .Fn pidfile_write @@ -200,6 +203,7 @@ The function may also fail and set .Va errno for any errors specified for the +.Xr fcntl 2 , .Xr fstat 2 , .Xr open 2 , and From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 21:40:20 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 193E91065741; Tue, 10 Jan 2012 21:40:20 +0000 (UTC) (envelope-from guy.helmer@palisadesystems.com) Received: from ps-1-a.compliancesafe.com (ps-1-a.compliancesafe.com [216.81.161.161]) by mx1.freebsd.org (Postfix) with ESMTP id 914898FC1C; Tue, 10 Jan 2012 21:40:19 +0000 (UTC) Received: from mail.palisadesystems.com (localhost [127.0.0.1]) by ps-1-a.compliancesafe.com (8.14.4/8.14.3) with ESMTP id q0ALeI8K035557; Tue, 10 Jan 2012 15:40:18 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) Received: from guysmbp.dyn.palisadesys.com (GuysMBP.dyn.palisadesys.com [172.16.2.90]) (authenticated bits=0) by mail.palisadesystems.com (8.14.3/8.14.3) with ESMTP id q0ALeC55022958 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 10 Jan 2012 15:40:14 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.palisadesystems.com q0ALeC55022958 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=palisadesystems.com; s=mail; t=1326231615; bh=NCISRWPevMHqBphtFpnkE5B/ryqCvBmRVCL+LxBotyU=; l=128; h=Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=HtYQmRz/1QG84clyoYmvXNum7NYZkqipmZuR4fQo8E5w/URIrs6xkx4DxMDwvcGdP p3zWROblFmRXk7PfF1/VCpv+HWDl6yarq1V8KbaYYj9m7j3umCGLGcE/WDcdIw//5H 9eooJxg4kebKNn4Xpm9x/ULr+ezMOiKppu2Dq8EU= Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: Guy Helmer In-Reply-To: <20120110212710.GB1694@garage.freebsd.pl> Date: Tue, 10 Jan 2012 15:39:54 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <2C686047-0D47-4B29-A78A-3D1240953F41@palisadesystems.com> References: <201201101843.q0AIhRuM022949@svn.freebsd.org> <20120110212525.GA1694@garage.freebsd.pl> <20120110212710.GB1694@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1251.1) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.palisadesystems.com [172.16.1.5]); Tue, 10 Jan 2012 15:40:15 -0600 (CST) X-Palisade-MailScanner-Information: Please contact the ISP for more information X-Palisade-MailScanner-ID: q0ALeC55022958 X-Palisade-MailScanner: Found to be clean X-Palisade-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-1.628, required 5, ALL_TRUSTED -1.00, BAYES_00 -1.90, RP_8BIT 1.27) X-Palisade-MailScanner-From: guy.helmer@palisadesystems.com X-Spam-Status: No X-PacketSure-Scanned: Yes Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229936 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:40:20 -0000 On Jan 10, 2012, at 3:27 PM, Pawel Jakub Dawidek wrote: > On Tue, Jan 10, 2012 at 10:25:26PM +0100, Pawel Jakub Dawidek wrote: >> On Tue, Jan 10, 2012 at 06:43:27PM +0000, Guy Helmer wrote: >>> Author: ghelmer >>> Date: Tue Jan 10 18:43:27 2012 >>> New Revision: 229936 >>> URL: http://svn.freebsd.org/changeset/base/229936 >>>=20 >>> Log: >>> Set the FD_CLOEXEC flag on the open pidfile file descriptor. >>>=20 >>> Discussed with: pjd, des >>=20 >> Could you also update manual page to note that pidfile_open(3) can = now >> also set errno via fcntl(2)? >=20 > Actually, it would also be useful to document the fact that we now set > FD_CLOEXEC flag, so one doesn't have to look at the code to find it. Thanks for reminding me, I mean to do that earlier. Guy >=20 >>> Modified: >>> head/lib/libutil/pidfile.c >>>=20 >>> Modified: head/lib/libutil/pidfile.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/libutil/pidfile.c Tue Jan 10 18:20:19 2012 = (r229935) >>> +++ head/lib/libutil/pidfile.c Tue Jan 10 18:43:27 2012 = (r229936) >>> @@ -137,6 +137,20 @@ pidfile_open(const char *path, mode_t mo >>> free(pfh); >>> return (NULL); >>> } >>> + >>> + /* >>> + * Prevent the file descriptor from escaping to other >>> + * programs via exec(3). >>> + */ >>> + if (fcntl(fd, F_SETFD, FD_CLOEXEC) =3D=3D -1) { >>> + error =3D errno; >>> + unlink(pfh->pf_path); >>> + close(fd); >>> + free(pfh); >>> + errno =3D error; >>> + return (NULL); >>> + } >>> + >>> /* >>> * Remember file information, so in pidfile_write() we are sure = we write >>> * to the proper descriptor. >=20 > --=20 > Pawel Jakub Dawidek http://www.wheelsystems.com > FreeBSD committer http://www.FreeBSD.org > Am I Evil? Yes, I Am! http://yomoli.com -------- This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure. From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 21:43:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 411F91065673; Tue, 10 Jan 2012 21:43:53 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id AC5AE8FC08; Tue, 10 Jan 2012 21:43:52 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 049F7DAC; Tue, 10 Jan 2012 22:43:50 +0100 (CET) Date: Tue, 10 Jan 2012 22:42:43 +0100 From: Pawel Jakub Dawidek To: Guy Helmer Message-ID: <20120110214243.GC1694@garage.freebsd.pl> References: <201201101953.q0AJrPao025097@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2JFBq9zoW8cOFH7v" Content-Disposition: inline In-Reply-To: <201201101953.q0AJrPao025097@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229937 - in head/lib: libc/gen libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:43:53 -0000 --2JFBq9zoW8cOFH7v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 10, 2012 at 07:53:25PM +0000, Guy Helmer wrote: > Author: ghelmer > Date: Tue Jan 10 19:53:25 2012 > New Revision: 229937 > URL: http://svn.freebsd.org/changeset/base/229937 >=20 > Log: > Add pidfile_fileno() to obtain the file descriptor for an open > pidfile. >=20 > Modified: > head/lib/libc/gen/getnetgrent.c > head/lib/libutil/libutil.h > head/lib/libutil/pidfile.3 > head/lib/libutil/pidfile.c [...] > @@ -92,6 +94,10 @@ to start a child process. > The > .Fn pidfile_remove > function closes and removes a pidfile. > +.Pp > +The > +.Fn pidfile_fileno > +function returns the file descriptor for the open pid file. In other places in this manual page we use 'pidfile' as a single word. > .Sh RETURN VALUES > The > .Fn pidfile_open > @@ -105,15 +111,25 @@ If an error occurs, > will be set. > .Pp > .Rv -std pidfile_write pidfile_close pidfile_remove > +.Pp > +The > +.Fn pidfile_fileno > +function returns the low-level file descriptor. > +It returns -1 and sets I think you should also use .Va or .Li macro for -1. > +.Va errno > +if a NULL > +.Vt pidfh > +is specified, or if the pidfile is no longer open. > .Sh EXAMPLES > The following example shows in which order these functions should be use= d. > Note that it is safe to pass > .Dv NULL > to > .Fn pidfile_write , > -.Fn pidfile_remove > -and > +.Fn pidfile_remove , > .Fn pidfile_close > +and > +.Fn pidfile_fileno > functions. > .Bd -literal > struct pidfh *pfh; > @@ -244,6 +260,16 @@ and > system calls and the > .Xr flopen 3 > library function. > +.Pp > +The > +.Fn pidfile_fileno > +function will fail if: > +.Bl -tag -width Er > +.It Bq Er EDOOFUS > +Improper function use. > +Probably called not from the process which used > +.Fn pidfile_open . > +.El > .Sh SEE ALSO > .Xr open 2 , > .Xr daemon 3 , >=20 > Modified: head/lib/libutil/pidfile.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/libutil/pidfile.c Tue Jan 10 18:43:27 2012 (r229936) > +++ head/lib/libutil/pidfile.c Tue Jan 10 19:53:25 2012 (r229937) > @@ -266,3 +266,13 @@ pidfile_remove(struct pidfh *pfh) > =20 > return (_pidfile_remove(pfh, 1)); > } > + > +int > +pidfile_fileno(struct pidfh *pfh) > +{ Missing empty line here for function without local variables. > + if (pfh =3D=3D NULL || pfh->pf_fd =3D=3D -1) { > + errno =3D EDOOFUS; > + return (-1); > + } > + return (pfh->pf_fd); > +} BTW. If you are working on pidfile, it would be nice to move pidfile structure declaration into pidfile.c. There is no need to expose it. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --2JFBq9zoW8cOFH7v Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8MsNMACgkQForvXbEpPzTQ0ACg6Xs4CrH44dt3dVbL99D0M5YI luYAn0jfLA+gwrKwkuKV+R6FqyAhOZz1 =Le5F -----END PGP SIGNATURE----- --2JFBq9zoW8cOFH7v-- From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 21:47:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 080DE1065670; Tue, 10 Jan 2012 21:47:59 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBA608FC0C; Tue, 10 Jan 2012 21:47:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ALlwf8028847; Tue, 10 Jan 2012 21:47:58 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ALlwIt028844; Tue, 10 Jan 2012 21:47:58 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201102147.q0ALlwIt028844@svn.freebsd.org> From: Guy Helmer Date: Tue, 10 Jan 2012 21:47: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: r229942 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:47:59 -0000 Author: ghelmer Date: Tue Jan 10 21:47:58 2012 New Revision: 229942 URL: http://svn.freebsd.org/changeset/base/229942 Log: Style fixes courtesy of pjd. Modified: head/lib/libutil/pidfile.3 head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.3 ============================================================================== --- head/lib/libutil/pidfile.3 Tue Jan 10 21:39:43 2012 (r229941) +++ head/lib/libutil/pidfile.3 Tue Jan 10 21:47:58 2012 (r229942) @@ -100,7 +100,7 @@ function closes and removes a pidfile. .Pp The .Fn pidfile_fileno -function returns the file descriptor for the open pid file. +function returns the file descriptor for the open pidfile. .Sh RETURN VALUES The .Fn pidfile_open @@ -118,7 +118,9 @@ will be set. The .Fn pidfile_fileno function returns the low-level file descriptor. -It returns -1 and sets +It returns +.Li -1 +and sets .Va errno if a NULL .Vt pidfh Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Tue Jan 10 21:39:43 2012 (r229941) +++ head/lib/libutil/pidfile.c Tue Jan 10 21:47:58 2012 (r229942) @@ -270,6 +270,7 @@ pidfile_remove(struct pidfh *pfh) int pidfile_fileno(struct pidfh *pfh) { + if (pfh == NULL || pfh->pf_fd == -1) { errno = EDOOFUS; return (-1); From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 21:52:44 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87986106566B; Tue, 10 Jan 2012 21:52:44 +0000 (UTC) (envelope-from guy.helmer@palisadesystems.com) Received: from ps-1-a.compliancesafe.com (ps-1-a.compliancesafe.com [216.81.161.161]) by mx1.freebsd.org (Postfix) with ESMTP id 00BE88FC16; Tue, 10 Jan 2012 21:52:43 +0000 (UTC) Received: from mail.palisadesystems.com (localhost [127.0.0.1]) by ps-1-a.compliancesafe.com (8.14.4/8.14.3) with ESMTP id q0ALqgO9036063; Tue, 10 Jan 2012 15:52:43 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) Received: from guysmbp.dyn.palisadesys.com (GuysMBP.dyn.palisadesys.com [172.16.2.90]) (authenticated bits=0) by mail.palisadesystems.com (8.14.3/8.14.3) with ESMTP id q0ALqZNK023300 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 10 Jan 2012 15:52:37 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.palisadesystems.com q0ALqZNK023300 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=palisadesystems.com; s=mail; t=1326232358; bh=W45c4R5Xw0Sn4OaUDGOMubwQrxB9McKe+i/NqtaNos0=; l=128; h=Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=Db2L/zQpi7R0s4/44q4wC+Y++QdLsKhHls/55ym455qSblcHqBAFa1W46/4sNxrrs Ouebh6mFXYJqUHgvYs59FahBuERaTacn3GTG8ocktIFqlp4+IBfvSU+ElMycMkmfuW EcwM+eVSGNtHp7GkVDWPBFJjrX4xofTmnV9eTgbE= Mime-Version: 1.0 (Apple Message framework v1251.1) From: Guy Helmer In-Reply-To: <20120110214243.GC1694@garage.freebsd.pl> Date: Tue, 10 Jan 2012 15:52:35 -0600 Message-Id: References: <201201101953.q0AJrPao025097@svn.freebsd.org> <20120110214243.GC1694@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1251.1) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.palisadesystems.com [172.16.1.5]); Tue, 10 Jan 2012 15:52:38 -0600 (CST) X-Palisade-MailScanner-Information: Please contact the ISP for more information X-Palisade-MailScanner-ID: q0ALqZNK023300 X-Palisade-MailScanner: Found to be clean X-Palisade-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-1.627, required 5, ALL_TRUSTED -1.00, BAYES_00 -1.90, HTML_MESSAGE 0.00, RP_8BIT 1.27) X-Palisade-MailScanner-From: guy.helmer@palisadesystems.com X-Spam-Status: No X-PacketSure-Scanned: Yes Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229937 - in head/lib: libc/gen libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:52:44 -0000 On Jan 10, 2012, at 3:42 PM, Pawel Jakub Dawidek wrote: > On Tue, Jan 10, 2012 at 07:53:25PM +0000, Guy Helmer wrote: >> Author: ghelmer >> Date: Tue Jan 10 19:53:25 2012 >> New Revision: 229937 >> URL: http://svn.freebsd.org/changeset/base/229937 >> >> Log: >> Add pidfile_fileno() to obtain the file descriptor for an open >> pidfile. > > BTW. If you are working on pidfile, it would be nice to move pidfile > structure declaration into pidfile.c. There is no need to expose it. Is that change likely to require a "make universe" to validate? Guy -------- This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure. From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 22:02:29 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22B31106564A; Tue, 10 Jan 2012 22:02:29 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id C80778FC12; Tue, 10 Jan 2012 22:02:28 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 650E8DBE; Tue, 10 Jan 2012 23:02:27 +0100 (CET) Date: Tue, 10 Jan 2012 23:01:19 +0100 From: Pawel Jakub Dawidek To: Guy Helmer Message-ID: <20120110220119.GD1694@garage.freebsd.pl> References: <201201101953.q0AJrPao025097@svn.freebsd.org> <20120110214243.GC1694@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1sNVjLsmu1MXqwQ/" Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229937 - in head/lib: libc/gen libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 22:02:29 -0000 --1sNVjLsmu1MXqwQ/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 10, 2012 at 03:52:35PM -0600, Guy Helmer wrote: >=20 > On Jan 10, 2012, at 3:42 PM, Pawel Jakub Dawidek wrote: >=20 > > On Tue, Jan 10, 2012 at 07:53:25PM +0000, Guy Helmer wrote: > >> Author: ghelmer > >> Date: Tue Jan 10 19:53:25 2012 > >> New Revision: 229937 > >> URL: http://svn.freebsd.org/changeset/base/229937 > >>=20 > >> Log: > >> Add pidfile_fileno() to obtain the file descriptor for an open > >> pidfile. > >=20 > > BTW. If you are working on pidfile, it would be nice to move pidfile > > structure declaration into pidfile.c. There is no need to expose it. >=20 >=20 > Is that change likely to require a "make universe" to validate? Nice try:) No, I won't take the responsibility:) Ok, seriously. Nothing should use this structure directly. You will still need forward declaration in pidfile.h. It is not something that is arch-depended, so simple buildworld should be sufficient. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --1sNVjLsmu1MXqwQ/ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8MtS8ACgkQForvXbEpPzQEnACghiFdyOr9cR6saokirJh3LqeF pI4Anivt31CKTeHKDVTCZEgKn/4ZE9sg =oa00 -----END PGP SIGNATURE----- --1sNVjLsmu1MXqwQ/-- From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 22:14:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 074501065670; Tue, 10 Jan 2012 22:14:34 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id AD1508FC08; Tue, 10 Jan 2012 22:14:33 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id E132CDC8; Tue, 10 Jan 2012 23:14:31 +0100 (CET) Date: Tue, 10 Jan 2012 23:13:24 +0100 From: Pawel Jakub Dawidek To: Guy Helmer Message-ID: <20120110221323.GE1694@garage.freebsd.pl> References: <201201101953.q0AJrPao025097@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EXKGNeO8l0xGFBjy" Content-Disposition: inline In-Reply-To: <201201101953.q0AJrPao025097@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229937 - in head/lib: libc/gen libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 22:14:34 -0000 --EXKGNeO8l0xGFBjy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 10, 2012 at 07:53:25PM +0000, Guy Helmer wrote: > Author: ghelmer > Date: Tue Jan 10 19:53:25 2012 > New Revision: 229937 > URL: http://svn.freebsd.org/changeset/base/229937 >=20 > Log: > Add pidfile_fileno() to obtain the file descriptor for an open > pidfile. >=20 > Modified: > head/lib/libc/gen/getnetgrent.c > head/lib/libutil/libutil.h > head/lib/libutil/pidfile.3 > head/lib/libutil/pidfile.c [...] > Modified: head/lib/libutil/libutil.h > =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/libutil/libutil.h Tue Jan 10 18:43:27 2012 (r229936) > +++ head/lib/libutil/libutil.h Tue Jan 10 19:53:25 2012 (r229937) > @@ -170,6 +170,7 @@ struct pidfh *pidfile_open(const char *p > int pidfile_write(struct pidfh *pfh); > int pidfile_close(struct pidfh *pfh); > int pidfile_remove(struct pidfh *pfh); > +int pidfile_fileno(struct pidfh *pfh); > #endif > =20 > #ifdef _UFS_UFS_QUOTA_H_ One more thing. You also need to add link in Makefile, so that 'man pidfile_fileno' will work. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --EXKGNeO8l0xGFBjy Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8MuAMACgkQForvXbEpPzRkhQCgmX/QK0C9wNbQBr3Iem+0Igjl SMsAoNHS2p0GztBLdirMr7GOExffM3uk =ibq4 -----END PGP SIGNATURE----- --EXKGNeO8l0xGFBjy-- From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 22:22:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54018106566B; Tue, 10 Jan 2012 22:22:36 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C51C8FC18; Tue, 10 Jan 2012 22:22:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AMMahg030025; Tue, 10 Jan 2012 22:22:36 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AMMa9X030023; Tue, 10 Jan 2012 22:22:36 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201102222.q0AMMa9X030023@svn.freebsd.org> From: Guy Helmer Date: Tue, 10 Jan 2012 22:22: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: r229943 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 22:22:36 -0000 Author: ghelmer Date: Tue Jan 10 22:22:35 2012 New Revision: 229943 URL: http://svn.freebsd.org/changeset/base/229943 Log: Add link for pidfile_fileno.3 to pidfile.3 - thanks again pjd! Modified: head/lib/libutil/Makefile Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Tue Jan 10 21:47:58 2012 (r229942) +++ head/lib/libutil/Makefile Tue Jan 10 22:22:35 2012 (r229943) @@ -58,7 +58,8 @@ MLINKS+=uucplock.3 uu_lock.3 uucplock.3 MLINKS+=pidfile.3 pidfile_open.3 \ pidfile.3 pidfile_write.3 \ pidfile.3 pidfile_close.3 \ - pidfile.3 pidfile_remove.3 + pidfile.3 pidfile_remove.3 \ + pidfile.3 pidfile_fileno.3 MLINKS+=quotafile.3 quota_open.3 \ quotafile.3 quota_fsname.3 \ quotafile.3 quota_qfname.3 \ From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 22:24:58 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FD02106566B; Tue, 10 Jan 2012 22:24:58 +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 14F738FC14; Tue, 10 Jan 2012 22:24:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AMOvVc030161; Tue, 10 Jan 2012 22:24:57 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AMOvxH030159; Tue, 10 Jan 2012 22:24:57 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201102224.q0AMOvxH030159@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 10 Jan 2012 22:24: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: r229944 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 22:24:58 -0000 Author: pjd Date: Tue Jan 10 22:24:57 2012 New Revision: 229944 URL: http://svn.freebsd.org/changeset/base/229944 Log: Don't touch pidfiles when running in foreground. Before that change we would create an empty pidfile on start and check if it changed on SIGHUP. MFC after: 3 days Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Tue Jan 10 22:22:35 2012 (r229943) +++ head/sbin/hastd/hastd.c Tue Jan 10 22:24:57 2012 (r229944) @@ -68,6 +68,8 @@ static struct hastd_config *cfg; bool sigexit_received = false; /* PID file handle. */ struct pidfh *pfh; +/* Do we run in foreground? */ +static bool foreground; /* How often check for hooks running for too long. */ #define REPORT_INTERVAL 5 @@ -531,7 +533,7 @@ hastd_reload(void) /* * Check if pidfile's path has changed. */ - if (strcmp(cfg->hc_pidfile, newcfg->hc_pidfile) != 0) { + if (!foreground && strcmp(cfg->hc_pidfile, newcfg->hc_pidfile) != 0) { newpfh = pidfile_open(newcfg->hc_pidfile, 0600, &otherpid); if (newpfh == NULL) { if (errno == EEXIST) { @@ -1155,7 +1157,6 @@ main(int argc, char *argv[]) struct hastd_listen *lst; const char *pidfile; pid_t otherpid; - bool foreground; int debuglevel; sigset_t mask; @@ -1220,16 +1221,23 @@ main(int argc, char *argv[]) pjdlog_exitx(EX_CONFIG, "Pidfile path is too long."); } } - pfh = pidfile_open(cfg->hc_pidfile, 0600, &otherpid); - if (pfh == NULL) { - if (errno == EEXIST) { - pjdlog_exitx(EX_TEMPFAIL, - "Another hastd is already running, pidfile: %s, pid: %jd.", - cfg->hc_pidfile, (intmax_t)otherpid); - } - /* If we cannot create pidfile for other reasons, only warn. */ - pjdlog_errno(LOG_WARNING, "Unable to open or create pidfile %s", - cfg->hc_pidfile); + + if (!foreground) { + pfh = pidfile_open(cfg->hc_pidfile, 0600, &otherpid); + if (pfh == NULL) { + if (errno == EEXIST) { + pjdlog_exitx(EX_TEMPFAIL, + "Another hastd is already running, pidfile: %s, pid: %jd.", + cfg->hc_pidfile, (intmax_t)otherpid); + } + /* + * If we cannot create pidfile for other reasons, + * only warn. + */ + pjdlog_errno(LOG_WARNING, + "Unable to open or create pidfile %s", + cfg->hc_pidfile); + } } /* From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 22:39:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40F16106566C; Tue, 10 Jan 2012 22:39: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 2E3108FC13; Tue, 10 Jan 2012 22:39:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AMd8tJ030652; Tue, 10 Jan 2012 22:39:08 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AMd8i6030635; Tue, 10 Jan 2012 22:39:08 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201102239.q0AMd8i6030635@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 10 Jan 2012 22:39: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: r229945 - in head/sbin: hastctl hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 22:39:08 -0000 Author: pjd Date: Tue Jan 10 22:39:07 2012 New Revision: 229945 URL: http://svn.freebsd.org/changeset/base/229945 Log: For functions that return -1 on failure check exactly for -1 and not for any negative number. MFC after: 3 days Modified: head/sbin/hastctl/hastctl.c head/sbin/hastd/control.c head/sbin/hastd/ebuf.c head/sbin/hastd/event.c head/sbin/hastd/hast_proto.c head/sbin/hastd/hastd.c head/sbin/hastd/hooks.c head/sbin/hastd/metadata.c head/sbin/hastd/nv.c head/sbin/hastd/primary.c head/sbin/hastd/proto.c head/sbin/hastd/proto_common.c head/sbin/hastd/proto_socketpair.c head/sbin/hastd/proto_tcp.c head/sbin/hastd/proto_uds.c head/sbin/hastd/secondary.c head/sbin/hastd/subr.c Modified: head/sbin/hastctl/hastctl.c ============================================================================== --- head/sbin/hastctl/hastctl.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastctl/hastctl.c Tue Jan 10 22:39:07 2012 (r229945) @@ -104,7 +104,7 @@ create_one(struct hast_resource *res, in ec = 0; pjdlog_prefix_set("[%s] ", res->hr_name); - if (provinfo(res, true) < 0) { + if (provinfo(res, true) == -1) { ec = EX_NOINPUT; goto end; } @@ -146,7 +146,7 @@ create_one(struct hast_resource *res, in res->hr_localoff = METADATA_SIZE + mapsize; - if (metadata_write(res) < 0) { + if (metadata_write(res) == -1) { ec = EX_IOERR; goto end; } @@ -401,15 +401,15 @@ main(int argc, char *argv[]) debug++; break; case 'e': - if (expand_number(optarg, &extentsize) < 0) + if (expand_number(optarg, &extentsize) == -1) errx(EX_USAGE, "Invalid extentsize"); break; case 'k': - if (expand_number(optarg, &keepdirty) < 0) + if (expand_number(optarg, &keepdirty) == -1) errx(EX_USAGE, "Invalid keepdirty"); break; case 'm': - if (expand_number(optarg, &mediasize) < 0) + if (expand_number(optarg, &mediasize) == -1) errx(EX_USAGE, "Invalid mediasize"); break; case 'h': @@ -479,13 +479,13 @@ main(int argc, char *argv[]) } /* Setup control connection... */ - if (proto_client(NULL, cfg->hc_controladdr, &controlconn) < 0) { + if (proto_client(NULL, cfg->hc_controladdr, &controlconn) == -1) { pjdlog_exit(EX_OSERR, "Unable to setup control connection to %s", cfg->hc_controladdr); } /* ...and connect to hastd. */ - if (proto_connect(controlconn, HAST_TIMEOUT) < 0) { + if (proto_connect(controlconn, HAST_TIMEOUT) == -1) { pjdlog_exit(EX_OSERR, "Unable to connect to hastd via %s", cfg->hc_controladdr); } @@ -494,14 +494,14 @@ main(int argc, char *argv[]) exit(EX_CONFIG); /* Send the command to the server... */ - if (hast_proto_send(NULL, controlconn, nv, NULL, 0) < 0) { + if (hast_proto_send(NULL, controlconn, nv, NULL, 0) == -1) { pjdlog_exit(EX_UNAVAILABLE, "Unable to send command to hastd via %s", cfg->hc_controladdr); } nv_free(nv); /* ...and receive reply. */ - if (hast_proto_recv_hdr(controlconn, &nv) < 0) { + if (hast_proto_recv_hdr(controlconn, &nv) == -1) { pjdlog_exit(EX_UNAVAILABLE, "cannot receive reply from hastd via %s", cfg->hc_controladdr); Modified: head/sbin/hastd/control.c ============================================================================== --- head/sbin/hastd/control.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/control.c Tue Jan 10 22:39:07 2012 (r229945) @@ -115,7 +115,7 @@ control_set_role_common(struct hastd_con * doing that work. */ if (res->hr_workerpid != 0) { - if (kill(res->hr_workerpid, SIGTERM) < 0) { + if (kill(res->hr_workerpid, SIGTERM) == -1) { pjdlog_errno(LOG_WARNING, "Unable to kill worker process %u", (unsigned int)res->hr_workerpid); @@ -167,7 +167,7 @@ control_status_worker(struct hast_resour "Unable to prepare control header"); goto end; } - if (hast_proto_send(res, res->hr_ctrl, cnvout, NULL, 0) < 0) { + if (hast_proto_send(res, res->hr_ctrl, cnvout, NULL, 0) == -1) { error = errno; pjdlog_errno(LOG_ERR, "Unable to send control header"); goto end; @@ -176,7 +176,7 @@ control_status_worker(struct hast_resour /* * Receive response. */ - if (hast_proto_recv_hdr(res->hr_ctrl, &cnvin) < 0) { + if (hast_proto_recv_hdr(res->hr_ctrl, &cnvin) == -1) { error = errno; pjdlog_errno(LOG_ERR, "Unable to receive control header"); goto end; @@ -293,7 +293,7 @@ control_handle(struct hastd_config *cfg) uint8_t cmd, role; int error; - if (proto_accept(cfg->hc_controlconn, &conn) < 0) { + if (proto_accept(cfg->hc_controlconn, &conn) == -1) { pjdlog_errno(LOG_ERR, "Unable to accept control connection"); return; } @@ -302,7 +302,7 @@ control_handle(struct hastd_config *cfg) nvin = nvout = NULL; role = HAST_ROLE_UNDEF; - if (hast_proto_recv_hdr(conn, &nvin) < 0) { + if (hast_proto_recv_hdr(conn, &nvin) == -1) { pjdlog_errno(LOG_ERR, "Unable to receive control header"); nvin = NULL; goto close; @@ -395,7 +395,7 @@ fail: if (error != 0) nv_add_int16(nvout, error, "error"); - if (hast_proto_send(NULL, conn, nvout, NULL, 0) < 0) + if (hast_proto_send(NULL, conn, nvout, NULL, 0) == -1) pjdlog_errno(LOG_ERR, "Unable to send control response"); close: if (nvin != NULL) @@ -417,7 +417,7 @@ ctrl_thread(void *arg) uint8_t cmd; for (;;) { - if (hast_proto_recv_hdr(res->hr_ctrl, &nvin) < 0) { + if (hast_proto_recv_hdr(res->hr_ctrl, &nvin) == -1) { if (sigexit_received) pthread_exit(NULL); pjdlog_errno(LOG_ERR, @@ -481,7 +481,7 @@ ctrl_thread(void *arg) nv_free(nvout); continue; } - if (hast_proto_send(NULL, res->hr_ctrl, nvout, NULL, 0) < 0) { + if (hast_proto_send(NULL, res->hr_ctrl, nvout, NULL, 0) == -1) { pjdlog_errno(LOG_ERR, "Unable to send reply to control message"); } Modified: head/sbin/hastd/ebuf.c ============================================================================== --- head/sbin/hastd/ebuf.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/ebuf.c Tue Jan 10 22:39:07 2012 (r229945) @@ -116,7 +116,7 @@ ebuf_add_head(struct ebuf *eb, const voi * We can't add more entries at the front, so we have to extend * our buffer. */ - if (ebuf_head_extend(eb, size) < 0) + if (ebuf_head_extend(eb, size) == -1) return (-1); } PJDLOG_ASSERT(size <= (size_t)(eb->eb_used - eb->eb_start)); @@ -143,7 +143,7 @@ ebuf_add_tail(struct ebuf *eb, const voi * We can't add more entries at the back, so we have to extend * our buffer. */ - if (ebuf_tail_extend(eb, size) < 0) + if (ebuf_tail_extend(eb, size) == -1) return (-1); } PJDLOG_ASSERT(size <= Modified: head/sbin/hastd/event.c ============================================================================== --- head/sbin/hastd/event.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/event.c Tue Jan 10 22:39:07 2012 (r229945) @@ -61,11 +61,11 @@ event_send(const struct hast_resource *r "Unable to prepare event header"); goto done; } - if (hast_proto_send(res, res->hr_event, nvout, NULL, 0) < 0) { + if (hast_proto_send(res, res->hr_event, nvout, NULL, 0) == -1) { pjdlog_errno(LOG_ERR, "Unable to send event header"); goto done; } - if (hast_proto_recv_hdr(res->hr_event, &nvin) < 0) { + if (hast_proto_recv_hdr(res->hr_event, &nvin) == -1) { pjdlog_errno(LOG_ERR, "Unable to receive event header"); goto done; } @@ -92,7 +92,7 @@ event_recv(const struct hast_resource *r nvin = nvout = NULL; - if (hast_proto_recv_hdr(res->hr_event, &nvin) < 0) { + if (hast_proto_recv_hdr(res->hr_event, &nvin) == -1) { /* * First error log as debug. This is because worker process * most likely exited. @@ -145,7 +145,7 @@ event_recv(const struct hast_resource *r "Unable to prepare event header"); goto fail; } - if (hast_proto_send(res, res->hr_event, nvout, NULL, 0) < 0) { + if (hast_proto_send(res, res->hr_event, nvout, NULL, 0) == -1) { pjdlog_errno(LOG_ERR, "Unable to send event header"); goto fail; } Modified: head/sbin/hastd/hast_proto.c ============================================================================== --- head/sbin/hastd/hast_proto.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/hast_proto.c Tue Jan 10 22:39:07 2012 (r229945) @@ -114,13 +114,13 @@ hast_proto_send(const struct hast_resour hdr.version = HAST_PROTO_VERSION; hdr.size = htole32((uint32_t)ebuf_size(eb)); - if (ebuf_add_head(eb, &hdr, sizeof(hdr)) < 0) + if (ebuf_add_head(eb, &hdr, sizeof(hdr)) == -1) goto end; hptr = ebuf_data(eb, &hsize); - if (proto_send(conn, hptr, hsize) < 0) + if (proto_send(conn, hptr, hsize) == -1) goto end; - if (data != NULL && proto_send(conn, dptr, size) < 0) + if (data != NULL && proto_send(conn, dptr, size) == -1) goto end; ret = 0; @@ -141,7 +141,7 @@ hast_proto_recv_hdr(const struct proto_c eb = NULL; nv = NULL; - if (proto_recv(conn, &hdr, sizeof(hdr)) < 0) + if (proto_recv(conn, &hdr, sizeof(hdr)) == -1) goto fail; if (hdr.version != HAST_PROTO_VERSION) { @@ -154,11 +154,11 @@ hast_proto_recv_hdr(const struct proto_c eb = ebuf_alloc(hdr.size); if (eb == NULL) goto fail; - if (ebuf_add_tail(eb, NULL, hdr.size) < 0) + if (ebuf_add_tail(eb, NULL, hdr.size) == -1) goto fail; hptr = ebuf_data(eb, NULL); PJDLOG_ASSERT(hptr != NULL); - if (proto_recv(conn, hptr, hdr.size) < 0) + if (proto_recv(conn, hptr, hdr.size) == -1) goto fail; nv = nv_ntoh(eb); if (nv == NULL) @@ -196,7 +196,7 @@ hast_proto_recv_data(const struct hast_r } else if (dsize == 0) { (void)nv_set_error(nv, 0); } else { - if (proto_recv(conn, data, dsize) < 0) + if (proto_recv(conn, data, dsize) == -1) goto end; for (ii = sizeof(pipeline) / sizeof(pipeline[0]); ii > 0; ii--) { Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/hastd.c Tue Jan 10 22:39:07 2012 (r229945) @@ -174,7 +174,7 @@ descriptors_assert(const struct hast_res msg[0] = '\0'; maxfd = sysconf(_SC_OPEN_MAX); - if (maxfd < 0) { + if (maxfd == -1) { pjdlog_init(pjdlogmode); pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); @@ -452,7 +452,7 @@ resource_reload(const struct hast_resour pjdlog_error("Unable to allocate header for reload message."); return; } - if (hast_proto_send(res, res->hr_ctrl, nvout, NULL, 0) < 0) { + if (hast_proto_send(res, res->hr_ctrl, nvout, NULL, 0) == -1) { pjdlog_errno(LOG_ERR, "Unable to send reload message"); nv_free(nvout); return; @@ -460,7 +460,7 @@ resource_reload(const struct hast_resour nv_free(nvout); /* Receive response. */ - if (hast_proto_recv_hdr(res->hr_ctrl, &nvin) < 0) { + if (hast_proto_recv_hdr(res->hr_ctrl, &nvin) == -1) { pjdlog_errno(LOG_ERR, "Unable to receive reload reply"); return; } @@ -496,7 +496,7 @@ hastd_reload(void) */ if (strcmp(cfg->hc_controladdr, newcfg->hc_controladdr) != 0) { if (proto_server(newcfg->hc_controladdr, - &newcfg->hc_controlconn) < 0) { + &newcfg->hc_controlconn) == -1) { pjdlog_errno(LOG_ERR, "Unable to listen on control address %s", newcfg->hc_controladdr); @@ -545,7 +545,7 @@ hastd_reload(void) "Unable to open or create pidfile %s", newcfg->hc_pidfile); } - } else if (pidfile_write(newpfh) < 0) { + } else if (pidfile_write(newpfh) == -1) { /* Write PID to a file. */ pjdlog_errno(LOG_WARNING, "Unable to write PID to file %s", @@ -744,7 +744,7 @@ listen_accept(struct hastd_listen *lst) proto_local_address(lst->hl_conn, laddr, sizeof(laddr)); pjdlog_debug(1, "Accepting connection to %s.", laddr); - if (proto_accept(lst->hl_conn, &conn) < 0) { + if (proto_accept(lst->hl_conn, &conn) == -1) { pjdlog_errno(LOG_ERR, "Unable to accept connection %s", laddr); return; } @@ -754,7 +754,7 @@ listen_accept(struct hastd_listen *lst) pjdlog_info("Connection from %s to %s.", raddr, laddr); /* Error in setting timeout is not critical, but why should it fail? */ - if (proto_timeout(conn, HAST_TIMEOUT) < 0) + if (proto_timeout(conn, HAST_TIMEOUT) == -1) pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); nvin = nvout = nverr = NULL; @@ -773,7 +773,7 @@ listen_accept(struct hastd_listen *lst) } /* Ok, remote host can access at least one resource. */ - if (hast_proto_recv_hdr(conn, &nvin) < 0) { + if (hast_proto_recv_hdr(conn, &nvin) == -1) { pjdlog_errno(LOG_ERR, "Unable to receive header from %s", raddr); goto close; @@ -861,7 +861,7 @@ listen_accept(struct hastd_listen *lst) "Worker process exists (pid=%u), stopping it.", (unsigned int)res->hr_workerpid); /* Stop child process. */ - if (kill(res->hr_workerpid, SIGINT) < 0) { + if (kill(res->hr_workerpid, SIGINT) == -1) { pjdlog_errno(LOG_ERR, "Unable to stop worker process (pid=%u)", (unsigned int)res->hr_workerpid); @@ -911,7 +911,7 @@ listen_accept(struct hastd_listen *lst) strerror(nv_error(nvout))); goto fail; } - if (hast_proto_send(NULL, conn, nvout, NULL, 0) < 0) { + if (hast_proto_send(NULL, conn, nvout, NULL, 0) == -1) { int error = errno; pjdlog_errno(LOG_ERR, "Unable to send response to %s", @@ -940,7 +940,7 @@ fail: "Unable to prepare error header for %s", raddr); goto close; } - if (hast_proto_send(NULL, conn, nverr, NULL, 0) < 0) { + if (hast_proto_send(NULL, conn, nverr, NULL, 0) == -1) { pjdlog_errno(LOG_ERR, "Unable to send error to %s", raddr); goto close; } @@ -965,20 +965,20 @@ connection_migrate(struct hast_resource PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY); - if (proto_recv(res->hr_conn, &val, sizeof(val)) < 0) { + if (proto_recv(res->hr_conn, &val, sizeof(val)) == -1) { pjdlog_errno(LOG_WARNING, "Unable to receive connection command"); return; } if (proto_client(res->hr_sourceaddr[0] != '\0' ? res->hr_sourceaddr : NULL, - res->hr_remoteaddr, &conn) < 0) { + res->hr_remoteaddr, &conn) == -1) { val = errno; pjdlog_errno(LOG_WARNING, "Unable to create outgoing connection to %s", res->hr_remoteaddr); goto out; } - if (proto_connect(conn, -1) < 0) { + if (proto_connect(conn, -1) == -1) { val = errno; pjdlog_errno(LOG_WARNING, "Unable to connect to %s", res->hr_remoteaddr); @@ -987,11 +987,11 @@ connection_migrate(struct hast_resource } val = 0; out: - if (proto_send(res->hr_conn, &val, sizeof(val)) < 0) { + if (proto_send(res->hr_conn, &val, sizeof(val)) == -1) { pjdlog_errno(LOG_WARNING, "Unable to send reply to connection request"); } - if (val == 0 && proto_connection_send(res->hr_conn, conn) < 0) + if (val == 0 && proto_connection_send(res->hr_conn, conn) == -1) pjdlog_errno(LOG_WARNING, "Unable to send connection"); pjdlog_prefix_set("%s", ""); @@ -1261,14 +1261,14 @@ main(int argc, char *argv[]) PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); /* Listen on control address. */ - if (proto_server(cfg->hc_controladdr, &cfg->hc_controlconn) < 0) { + if (proto_server(cfg->hc_controladdr, &cfg->hc_controlconn) == -1) { KEEP_ERRNO((void)pidfile_remove(pfh)); pjdlog_exit(EX_OSERR, "Unable to listen on control address %s", cfg->hc_controladdr); } /* Listen for remote connections. */ TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) { - if (proto_server(lst->hl_addr, &lst->hl_conn) < 0) { + if (proto_server(lst->hl_addr, &lst->hl_conn) == -1) { KEEP_ERRNO((void)pidfile_remove(pfh)); pjdlog_exit(EX_OSERR, "Unable to listen on address %s", lst->hl_addr); @@ -1276,7 +1276,7 @@ main(int argc, char *argv[]) } if (!foreground) { - if (daemon(0, 0) < 0) { + if (daemon(0, 0) == -1) { KEEP_ERRNO((void)pidfile_remove(pfh)); pjdlog_exit(EX_OSERR, "Unable to daemonize"); } @@ -1285,7 +1285,7 @@ main(int argc, char *argv[]) pjdlog_mode_set(PJDLOG_MODE_SYSLOG); /* Write PID to a file. */ - if (pidfile_write(pfh) < 0) { + if (pidfile_write(pfh) == -1) { pjdlog_errno(LOG_WARNING, "Unable to write PID to a file %s", cfg->hc_pidfile); Modified: head/sbin/hastd/hooks.c ============================================================================== --- head/sbin/hastd/hooks.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/hooks.c Tue Jan 10 22:39:07 2012 (r229945) @@ -105,26 +105,26 @@ descriptors(void) * Redirect stdin, stdout and stderr to /dev/null. */ fd = open(_PATH_DEVNULL, O_RDONLY); - if (fd < 0) { + if (fd == -1) { pjdlog_errno(LOG_WARNING, "Unable to open %s for reading", _PATH_DEVNULL); } else if (fd != STDIN_FILENO) { - if (dup2(fd, STDIN_FILENO) < 0) { + if (dup2(fd, STDIN_FILENO) == -1) { pjdlog_errno(LOG_WARNING, "Unable to duplicate descriptor for stdin"); } close(fd); } fd = open(_PATH_DEVNULL, O_WRONLY); - if (fd < 0) { + if (fd == -1) { pjdlog_errno(LOG_WARNING, "Unable to open %s for writing", _PATH_DEVNULL); } else { - if (fd != STDOUT_FILENO && dup2(fd, STDOUT_FILENO) < 0) { + if (fd != STDOUT_FILENO && dup2(fd, STDOUT_FILENO) == -1) { pjdlog_errno(LOG_WARNING, "Unable to duplicate descriptor for stdout"); } - if (fd != STDERR_FILENO && dup2(fd, STDERR_FILENO) < 0) { + if (fd != STDERR_FILENO && dup2(fd, STDERR_FILENO) == -1) { pjdlog_errno(LOG_WARNING, "Unable to duplicate descriptor for stderr"); } Modified: head/sbin/hastd/metadata.c ============================================================================== --- head/sbin/hastd/metadata.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/metadata.c Tue Jan 10 22:39:07 2012 (r229945) @@ -61,14 +61,14 @@ metadata_read(struct hast_resource *res, * Is this first metadata_read() call for this resource? */ if (res->hr_localfd == -1) { - if (provinfo(res, openrw) < 0) { + if (provinfo(res, openrw) == -1) { rerrno = errno; goto fail; } opened_here = true; pjdlog_debug(1, "Obtained info about %s.", res->hr_localpath); if (openrw) { - if (flock(res->hr_localfd, LOCK_EX | LOCK_NB) < 0) { + if (flock(res->hr_localfd, LOCK_EX | LOCK_NB) == -1) { rerrno = errno; if (errno == EOPNOTSUPP) { pjdlog_warning("Unable to lock %s (operation not supported), but continuing.", @@ -91,7 +91,7 @@ metadata_read(struct hast_resource *res, "Unable to allocate memory to read metadata"); goto fail; } - if (ebuf_add_tail(eb, NULL, METADATA_SIZE) < 0) { + if (ebuf_add_tail(eb, NULL, METADATA_SIZE) == -1) { rerrno = errno; pjdlog_errno(LOG_ERR, "Unable to allocate memory to read metadata"); @@ -101,7 +101,7 @@ metadata_read(struct hast_resource *res, buf = ebuf_data(eb, NULL); PJDLOG_ASSERT(buf != NULL); done = pread(res->hr_localfd, buf, METADATA_SIZE, 0); - if (done < 0 || done != METADATA_SIZE) { + if (done == -1 || done != METADATA_SIZE) { rerrno = errno; pjdlog_errno(LOG_ERR, "Unable to read metadata"); ebuf_free(eb); @@ -213,7 +213,7 @@ metadata_write(struct hast_resource *res PJDLOG_ASSERT(size < METADATA_SIZE); bcopy(ptr, buf, size); done = pwrite(res->hr_localfd, buf, METADATA_SIZE, 0); - if (done < 0 || done != METADATA_SIZE) { + if (done == -1 || done != METADATA_SIZE) { pjdlog_errno(LOG_ERR, "Unable to write metadata"); goto end; } Modified: head/sbin/hastd/nv.c ============================================================================== --- head/sbin/hastd/nv.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/nv.c Tue Jan 10 22:39:07 2012 (r229945) @@ -385,7 +385,7 @@ nv_ntoh(struct ebuf *eb) nv->nv_ebuf = eb; nv->nv_magic = NV_MAGIC; - if (nv_validate(nv, &extra) < 0) { + if (nv_validate(nv, &extra) == -1) { rerrno = errno; nv->nv_magic = 0; free(nv); @@ -480,7 +480,7 @@ nv_add_stringv(struct nv *nv, const char ssize_t size; size = vasprintf(&value, valuefmt, valueap); - if (size < 0) { + if (size == -1) { if (nv->nv_error == 0) nv->nv_error = ENOMEM; return; @@ -627,7 +627,7 @@ nv_dump(struct nv *nv) unsigned int ii; bool swap; - if (nv_validate(nv, NULL) < 0) { + if (nv_validate(nv, NULL) == -1) { printf("error: %d\n", errno); return; } @@ -784,7 +784,7 @@ nv_add(struct nv *nv, const unsigned cha bcopy(name, nvh->nvh_name, namesize); /* Add header first. */ - if (ebuf_add_tail(nv->nv_ebuf, nvh, NVH_HSIZE(nvh)) < 0) { + if (ebuf_add_tail(nv->nv_ebuf, nvh, NVH_HSIZE(nvh)) == -1) { PJDLOG_ASSERT(errno != 0); if (nv->nv_error == 0) nv->nv_error = errno; @@ -793,7 +793,7 @@ nv_add(struct nv *nv, const unsigned cha } free(nvh); /* Add the actual data. */ - if (ebuf_add_tail(nv->nv_ebuf, value, vsize) < 0) { + if (ebuf_add_tail(nv->nv_ebuf, value, vsize) == -1) { PJDLOG_ASSERT(errno != 0); if (nv->nv_error == 0) nv->nv_error = errno; @@ -804,7 +804,7 @@ nv_add(struct nv *nv, const unsigned cha if (vsize == 0) return; PJDLOG_ASSERT(vsize > 0 && vsize <= sizeof(align)); - if (ebuf_add_tail(nv->nv_ebuf, align, vsize) < 0) { + if (ebuf_add_tail(nv->nv_ebuf, align, vsize) == -1) { PJDLOG_ASSERT(errno != 0); if (nv->nv_error == 0) nv->nv_error = errno; Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/primary.c Tue Jan 10 22:39:07 2012 (r229945) @@ -254,7 +254,7 @@ cleanup(struct hast_resource *res) ggiod.gctl_version = G_GATE_VERSION; ggiod.gctl_unit = res->hr_ggateunit; ggiod.gctl_force = 1; - if (ioctl(res->hr_ggatefd, G_GATE_CMD_DESTROY, &ggiod) < 0) { + if (ioctl(res->hr_ggatefd, G_GATE_CMD_DESTROY, &ggiod) == -1) { pjdlog_errno(LOG_WARNING, "Unable to destroy hast/%s device", res->hr_provname); @@ -451,7 +451,7 @@ init_resuid(struct hast_resource *res) /* Initialize unique resource identifier. */ arc4random_buf(&res->hr_resuid, sizeof(res->hr_resuid)); mtx_unlock(&metadata_lock); - if (metadata_write(res) < 0) + if (metadata_write(res) == -1) exit(EX_NOINPUT); return (true); } @@ -463,19 +463,19 @@ init_local(struct hast_resource *res) unsigned char *buf; size_t mapsize; - if (metadata_read(res, true) < 0) + if (metadata_read(res, true) == -1) exit(EX_NOINPUT); mtx_init(&res->hr_amp_lock); if (activemap_init(&res->hr_amp, res->hr_datasize, res->hr_extentsize, - res->hr_local_sectorsize, res->hr_keepdirty) < 0) { + res->hr_local_sectorsize, res->hr_keepdirty) == -1) { primary_exit(EX_TEMPFAIL, "Unable to create activemap"); } mtx_init(&range_lock); cv_init(&range_regular_cond); - if (rangelock_init(&range_regular) < 0) + if (rangelock_init(&range_regular) == -1) primary_exit(EX_TEMPFAIL, "Unable to create regular range lock"); cv_init(&range_sync_cond); - if (rangelock_init(&range_sync) < 0) + if (rangelock_init(&range_sync) == -1) primary_exit(EX_TEMPFAIL, "Unable to create sync range lock"); mapsize = activemap_ondisk_size(res->hr_amp); buf = calloc(1, mapsize); @@ -500,7 +500,7 @@ init_local(struct hast_resource *res) */ res->hr_primary_localcnt = 0; res->hr_primary_remotecnt = 0; - if (metadata_write(res) < 0) + if (metadata_write(res) == -1) exit(EX_NOINPUT); } @@ -511,11 +511,11 @@ primary_connect(struct hast_resource *re int16_t val; val = 1; - if (proto_send(res->hr_conn, &val, sizeof(val)) < 0) { + if (proto_send(res->hr_conn, &val, sizeof(val)) == -1) { primary_exit(EX_TEMPFAIL, "Unable to send connection request to parent"); } - if (proto_recv(res->hr_conn, &val, sizeof(val)) < 0) { + if (proto_recv(res->hr_conn, &val, sizeof(val)) == -1) { primary_exit(EX_TEMPFAIL, "Unable to receive reply to connection request from parent"); } @@ -525,18 +525,18 @@ primary_connect(struct hast_resource *re res->hr_remoteaddr); return (-1); } - if (proto_connection_recv(res->hr_conn, true, &conn) < 0) { + if (proto_connection_recv(res->hr_conn, true, &conn) == -1) { primary_exit(EX_TEMPFAIL, "Unable to receive connection from parent"); } - if (proto_connect_wait(conn, res->hr_timeout) < 0) { + if (proto_connect_wait(conn, res->hr_timeout) == -1) { pjdlog_errno(LOG_WARNING, "Unable to connect to %s", res->hr_remoteaddr); proto_close(conn); return (-1); } /* Error in setting timeout is not critical, but why should it fail? */ - if (proto_timeout(conn, res->hr_timeout) < 0) + if (proto_timeout(conn, res->hr_timeout) == -1) pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); *connp = conn; @@ -583,7 +583,7 @@ init_remote(struct hast_resource *res, s nv_free(nvout); goto close; } - if (hast_proto_send(res, out, nvout, NULL, 0) < 0) { + if (hast_proto_send(res, out, nvout, NULL, 0) == -1) { pjdlog_errno(LOG_WARNING, "Unable to send handshake header to %s", res->hr_remoteaddr); @@ -591,7 +591,7 @@ init_remote(struct hast_resource *res, s goto close; } nv_free(nvout); - if (hast_proto_recv_hdr(out, &nvin) < 0) { + if (hast_proto_recv_hdr(out, &nvin) == -1) { pjdlog_errno(LOG_WARNING, "Unable to receive handshake header from %s", res->hr_remoteaddr); @@ -655,7 +655,7 @@ init_remote(struct hast_resource *res, s nv_free(nvout); goto close; } - if (hast_proto_send(res, in, nvout, NULL, 0) < 0) { + if (hast_proto_send(res, in, nvout, NULL, 0) == -1) { pjdlog_errno(LOG_WARNING, "Unable to send handshake header to %s", res->hr_remoteaddr); @@ -663,7 +663,7 @@ init_remote(struct hast_resource *res, s goto close; } nv_free(nvout); - if (hast_proto_recv_hdr(out, &nvin) < 0) { + if (hast_proto_recv_hdr(out, &nvin) == -1) { pjdlog_errno(LOG_WARNING, "Unable to receive handshake header from %s", res->hr_remoteaddr); @@ -726,7 +726,7 @@ init_remote(struct hast_resource *res, s * download its activemap. */ if (hast_proto_recv_data(res, out, nvin, map, - mapsize) < 0) { + mapsize) == -1) { pjdlog_errno(LOG_ERR, "Unable to receive remote activemap"); nv_free(nvin); @@ -801,7 +801,7 @@ init_ggate(struct hast_resource *res) * We communicate with ggate via /dev/ggctl. Open it. */ res->hr_ggatefd = open("/dev/" G_GATE_CTL_NAME, O_RDWR); - if (res->hr_ggatefd < 0) + if (res->hr_ggatefd == -1) primary_exit(EX_OSFILE, "Unable to open /dev/" G_GATE_CTL_NAME); /* * Create provider before trying to connect, as connection failure @@ -859,7 +859,7 @@ hastd_primary(struct hast_resource *res) * Create communication channel for sending control commands from * parent to child. */ - if (proto_client(NULL, "socketpair://", &res->hr_ctrl) < 0) { + if (proto_client(NULL, "socketpair://", &res->hr_ctrl) == -1) { /* TODO: There's no need for this to be fatal error. */ KEEP_ERRNO((void)pidfile_remove(pfh)); pjdlog_exit(EX_OSERR, @@ -868,7 +868,7 @@ hastd_primary(struct hast_resource *res) /* * Create communication channel for sending events from child to parent. */ - if (proto_client(NULL, "socketpair://", &res->hr_event) < 0) { + if (proto_client(NULL, "socketpair://", &res->hr_event) == -1) { /* TODO: There's no need for this to be fatal error. */ KEEP_ERRNO((void)pidfile_remove(pfh)); pjdlog_exit(EX_OSERR, @@ -878,7 +878,7 @@ hastd_primary(struct hast_resource *res) * Create communication channel for sending connection requests from * child to parent. */ - if (proto_client(NULL, "socketpair://", &res->hr_conn) < 0) { + if (proto_client(NULL, "socketpair://", &res->hr_conn) == -1) { /* TODO: There's no need for this to be fatal error. */ KEEP_ERRNO((void)pidfile_remove(pfh)); pjdlog_exit(EX_OSERR, @@ -1095,7 +1095,7 @@ write_complete(struct hast_resource *res mtx_unlock(&metadata_lock); } rw_unlock(&hio_remote_lock[ncomp]); - if (ioctl(res->hr_ggatefd, G_GATE_CMD_DONE, ggio) < 0) + if (ioctl(res->hr_ggatefd, G_GATE_CMD_DONE, ggio) == -1) primary_exit(EX_OSERR, "G_GATE_CMD_DONE failed"); hio->hio_done = true; } @@ -1133,7 +1133,7 @@ ggate_recv_thread(void *arg) pjdlog_debug(2, "ggate_recv: (%p) Waiting for request from the kernel.", hio); - if (ioctl(res->hr_ggatefd, G_GATE_CMD_START, ggio) < 0) { + if (ioctl(res->hr_ggatefd, G_GATE_CMD_START, ggio) == -1) { if (sigexit_received) pthread_exit(NULL); primary_exit(EX_OSERR, "G_GATE_CMD_START failed"); @@ -1225,7 +1225,7 @@ ggate_recv_thread(void *arg) continue; } if (rangelock_add(range_regular, - ggio->gctl_offset, ggio->gctl_length) < 0) { + ggio->gctl_offset, ggio->gctl_length) == -1) { mtx_unlock(&range_lock); pjdlog_debug(2, "regular: Range offset=%jd length=%zu is already locked, waiting.", @@ -1296,7 +1296,7 @@ local_send_thread(void *arg) /* * If READ failed, try to read from remote node. */ - if (ret < 0) { + if (ret == -1) { reqlog(LOG_WARNING, 0, ggio, "Local request failed (%s), trying remote node. ", strerror(errno)); @@ -1313,7 +1313,7 @@ local_send_thread(void *arg) ret = pwrite(res->hr_localfd, ggio->gctl_data, ggio->gctl_length, ggio->gctl_offset + res->hr_localoff); - if (ret < 0) { + if (ret == -1) { hio->hio_errors[ncomp] = errno; reqlog(LOG_WARNING, 0, ggio, "Local request failed (%s): ", @@ -1336,7 +1336,7 @@ local_send_thread(void *arg) ret = g_delete(res->hr_localfd, ggio->gctl_offset + res->hr_localoff, ggio->gctl_length); - if (ret < 0) { + if (ret == -1) { hio->hio_errors[ncomp] = errno; reqlog(LOG_WARNING, 0, ggio, "Local request failed (%s): ", @@ -1352,7 +1352,7 @@ local_send_thread(void *arg) break; } ret = g_flush(res->hr_localfd); - if (ret < 0) { + if (ret == -1) { if (errno == EOPNOTSUPP) res->hr_localflush = false; hio->hio_errors[ncomp] = errno; @@ -1406,7 +1406,7 @@ keepalive_send(struct hast_resource *res "keepalive_send: Unable to prepare header to send."); return; } - if (hast_proto_send(res, res->hr_remoteout, nv, NULL, 0) < 0) { + if (hast_proto_send(res, res->hr_remoteout, nv, NULL, 0) == -1) { rw_unlock(&hio_remote_lock[ncomp]); pjdlog_common(LOG_DEBUG, 1, errno, "keepalive_send: Unable to send request"); @@ -1520,7 +1520,7 @@ remote_send_thread(void *arg) TAILQ_INSERT_TAIL(&hio_recv_list[ncomp], hio, hio_next[ncomp]); mtx_unlock(&hio_recv_list_lock[ncomp]); if (hast_proto_send(res, res->hr_remoteout, nv, data, - data != NULL ? length : 0) < 0) { + data != NULL ? length : 0) == -1) { hio->hio_errors[ncomp] = errno; rw_unlock(&hio_remote_lock[ncomp]); pjdlog_debug(2, @@ -1617,7 +1617,7 @@ remote_recv_thread(void *arg) mtx_unlock(&hio_recv_list_lock[ncomp]); goto done_queue; } - if (hast_proto_recv_hdr(res->hr_remotein, &nv) < 0) { + if (hast_proto_recv_hdr(res->hr_remotein, &nv) == -1) { pjdlog_errno(LOG_ERR, "Unable to receive reply header"); rw_unlock(&hio_remote_lock[ncomp]); @@ -1665,7 +1665,7 @@ remote_recv_thread(void *arg) goto done_queue; } if (hast_proto_recv_data(res, res->hr_remotein, nv, - ggio->gctl_data, ggio->gctl_length) < 0) { + ggio->gctl_data, ggio->gctl_length) == -1) { hio->hio_errors[ncomp] = errno; pjdlog_errno(LOG_ERR, "Unable to receive reply data"); @@ -1766,7 +1766,7 @@ ggate_send_thread(void *arg) if (!hio->hio_done) write_complete(res, hio); } else { - if (ioctl(res->hr_ggatefd, G_GATE_CMD_DONE, ggio) < 0) { + if (ioctl(res->hr_ggatefd, G_GATE_CMD_DONE, ggio) == -1) { primary_exit(EX_OSERR, "G_GATE_CMD_DONE failed"); } @@ -1834,7 +1834,7 @@ sync_thread(void *arg __unused) mtx_unlock(&res->hr_amp_lock); if (dorewind) { dorewind = false; - if (offset < 0) + if (offset == -1) pjdlog_info("Nodes are in sync."); else { pjdlog_info("Synchronization started. %NB to go.", @@ -1844,7 +1844,7 @@ sync_thread(void *arg __unused) gettimeofday(&tstart, NULL); } } - if (offset < 0) { + if (offset == -1) { sync_stop(); pjdlog_debug(1, "Nothing to synchronize."); /* @@ -1903,7 +1903,7 @@ sync_thread(void *arg __unused) mtx_unlock(&range_lock); continue; } - if (rangelock_add(range_sync, offset, length) < 0) { + if (rangelock_add(range_sync, offset, length) == -1) { mtx_unlock(&range_lock); pjdlog_debug(2, "sync: Range offset=%jd length=%jd is already locked, waiting.", @@ -2124,12 +2124,12 @@ primary_config_reload(struct hast_resour } rw_unlock(&hio_remote_lock[ii]); if (proto_timeout(gres->hr_remotein, - gres->hr_timeout) < 0) { + gres->hr_timeout) == -1) { pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); } if (proto_timeout(gres->hr_remoteout, - gres->hr_timeout) < 0) { + gres->hr_timeout) == -1) { pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); } Modified: head/sbin/hastd/proto.c ============================================================================== --- head/sbin/hastd/proto.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/proto.c Tue Jan 10 22:39:07 2012 (r229945) @@ -419,14 +419,14 @@ proto_timeout(const struct proto_conn *c PJDLOG_ASSERT(conn->pc_proto != NULL); fd = proto_descriptor(conn); - if (fd < 0) + if (fd == -1) return (-1); tv.tv_sec = timeout; tv.tv_usec = 0; - if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) < 0) + if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) == -1) return (-1); - if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) + if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) return (-1); return (0); Modified: head/sbin/hastd/proto_common.c ============================================================================== --- head/sbin/hastd/proto_common.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/proto_common.c Tue Jan 10 22:39:07 2012 (r229945) @@ -116,7 +116,7 @@ proto_common_send(int sock, const unsign done = send(sock, data, sendsize, MSG_NOSIGNAL); if (done == 0) { return (ENOTCONN); - } else if (done < 0) { + } else if (done == -1) { if (errno == EINTR) continue; if (errno == ENOBUFS) { @@ -215,7 +215,7 @@ proto_common_recv(int sock, unsigned cha } while (done == -1 && errno == EINTR); if (done == 0) { return (ENOTCONN); - } else if (done < 0) { + } else if (done == -1) { /* * If this is blocking socket and we got EAGAIN, this * means the request timed out. Translate errno to Modified: head/sbin/hastd/proto_socketpair.c ============================================================================== --- head/sbin/hastd/proto_socketpair.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/proto_socketpair.c Tue Jan 10 22:39:07 2012 (r229945) @@ -70,7 +70,7 @@ sp_client(const char *srcaddr, const cha if (spctx == NULL) return (errno); - if (socketpair(PF_UNIX, SOCK_STREAM, 0, spctx->sp_fd) < 0) { + if (socketpair(PF_UNIX, SOCK_STREAM, 0, spctx->sp_fd) == -1) { ret = errno; free(spctx); return (ret); Modified: head/sbin/hastd/proto_tcp.c ============================================================================== --- head/sbin/hastd/proto_tcp.c Tue Jan 10 22:24:57 2012 (r229944) +++ head/sbin/hastd/proto_tcp.c Tue Jan 10 22:39:07 2012 (r229945) @@ -151,7 +151,7 @@ tcp_addr(const char *addr, int defport, /* Port not given, use the default. */ port = defport; } else { - if (numfromstr(pp + 1, 1, 65535, &port) < 0) + if (numfromstr(pp + 1, 1, 65535, &port) == -1) return (errno); } (void)snprintf(portstr, sizeof(portstr), "%jd", (intmax_t)port); @@ -275,7 +275,7 @@ tcp_client(const char *srcaddr, const ch tcp_close(tctx); return (ret); } - if (bind(tctx->tc_fd, (struct sockaddr *)&sa, sa.ss_len) < 0) { + if (bind(tctx->tc_fd, (struct sockaddr *)&sa, sa.ss_len) == -1) { ret = errno; tcp_close(tctx); return (ret); @@ -423,12 +423,12 @@ tcp_server(const char *addr, void **ctxp PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC); if (bind(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sa, - tctx->tc_sa.ss_len) < 0) { + tctx->tc_sa.ss_len) == -1) { ret = errno; tcp_close(tctx); return (ret); } - if (listen(tctx->tc_fd, 8) < 0) { + if (listen(tctx->tc_fd, 8) == -1) { ret = errno; tcp_close(tctx); return (ret); @@ -458,7 +458,7 @@ tcp_accept(void *ctx, void **newctxp) fromlen = tctx->tc_sa.ss_len; newtctx->tc_fd = accept(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sa, &fromlen); - if (newtctx->tc_fd < 0) { + if (newtctx->tc_fd == -1) { ret = errno; free(newtctx); return (ret); @@ -530,7 +530,7 @@ tcp_address_match(const void *ctx, const return (false); salen = sizeof(sa2); - if (getpeername(tctx->tc_fd, (struct sockaddr *)&sa2, &salen) < 0) + if (getpeername(tctx->tc_fd, (struct sockaddr *)&sa2, &salen) == -1) return (false); if (sa1.ss_family != sa2.ss_family || sa1.ss_len != sa2.ss_len) @@ -573,7 +573,7 @@ tcp_local_address(const void *ctx, char PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC); salen = sizeof(sa); - if (getsockname(tctx->tc_fd, (struct sockaddr *)&sa, &salen) < 0) { + if (getsockname(tctx->tc_fd, (struct sockaddr *)&sa, &salen) == -1) { PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size); return; } @@ -591,7 +591,7 @@ tcp_remote_address(const void *ctx, char PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC); salen = sizeof(sa); - if (getpeername(tctx->tc_fd, (struct sockaddr *)&sa, &salen) < 0) { + if (getpeername(tctx->tc_fd, (struct sockaddr *)&sa, &salen) == -1) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 22:41:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20E741065672; Tue, 10 Jan 2012 22:41: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 101FF8FC13; Tue, 10 Jan 2012 22:41:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AMf9Og030755; Tue, 10 Jan 2012 22:41:09 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AMf9YA030753; Tue, 10 Jan 2012 22:41:09 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201102241.q0AMf9YA030753@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 10 Jan 2012 22:41: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: r229946 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 22:41:10 -0000 Author: pjd Date: Tue Jan 10 22:41:09 2012 New Revision: 229946 URL: http://svn.freebsd.org/changeset/base/229946 Log: - Fix a bug where pidfile was removed in SIGHUP when it hasn't changed in configuration file. - Log the fact that pidfile has changed. MFC after: 3 days Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Tue Jan 10 22:39:07 2012 (r229945) +++ head/sbin/hastd/hastd.c Tue Jan 10 22:41:09 2012 (r229946) @@ -573,10 +573,14 @@ hastd_reload(void) /* * Switch to new pidfile. */ - (void)pidfile_remove(pfh); - pfh = newpfh; - (void)strlcpy(cfg->hc_pidfile, newcfg->hc_pidfile, - sizeof(cfg->hc_pidfile)); + if (newpfh != NULL) { + pjdlog_info("Pidfile changed from %s to %s.", cfg->hc_pidfile, + newcfg->hc_pidfile); + (void)pidfile_remove(pfh); + pfh = newpfh; + (void)strlcpy(cfg->hc_pidfile, newcfg->hc_pidfile, + sizeof(cfg->hc_pidfile)); + } /* * Switch to new listen addresses. Close all that were removed. */ From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 22:43:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 899BD1065673; Tue, 10 Jan 2012 22:43:44 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id B006F15053F; Tue, 10 Jan 2012 22:43:37 +0000 (UTC) Message-ID: <4F0CBF11.6080608@FreeBSD.org> Date: Tue, 10 Jan 2012 14:43:29 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201201102239.q0AMd8i6030635@svn.freebsd.org> In-Reply-To: <201201102239.q0AMd8i6030635@svn.freebsd.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229945 - in head/sbin: hastctl hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 22:43:44 -0000 On 01/10/2012 14:39, Pawel Jakub Dawidek wrote: > For functions that return -1 on failure check exactly for -1 and not for > any negative number. what is the likelihood that at some point in the future the semantics for those functions will change, such that more than one negative value may be returned? -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 22:51:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AD5D106564A; Tue, 10 Jan 2012 22:51:39 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id E17178FC18; Tue, 10 Jan 2012 22:51:38 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id CB365DE2; Tue, 10 Jan 2012 23:51:36 +0100 (CET) Date: Tue, 10 Jan 2012 23:50:29 +0100 From: Pawel Jakub Dawidek To: Doug Barton Message-ID: <20120110225028.GF1694@garage.freebsd.pl> References: <201201102239.q0AMd8i6030635@svn.freebsd.org> <4F0CBF11.6080608@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oPmsXEqKQNHCSXW7" Content-Disposition: inline In-Reply-To: <4F0CBF11.6080608@FreeBSD.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229945 - in head/sbin: hastctl hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 22:51:39 -0000 --oPmsXEqKQNHCSXW7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 10, 2012 at 02:43:29PM -0800, Doug Barton wrote: > On 01/10/2012 14:39, Pawel Jakub Dawidek wrote: > > For functions that return -1 on failure check exactly for -1 and not = for > > any negative number. >=20 > what is the likelihood that at some point in the future the semantics > for those functions will change, such that more than one negative value > may be returned? This is of course just being extra careful, but what if the function will start returning negative values different than -1 on success? This works in both direction, but is really only theory. All in all, the manual pages now clearly state that those functions return -1 on failure. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --oPmsXEqKQNHCSXW7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8MwLQACgkQForvXbEpPzRVOQCg20IjxPQuumoBdNEqk8UuoPoZ MUUAn3NWShHYJdqaFxg71KAb4Bn7CCdW =oenf -----END PGP SIGNATURE----- --oPmsXEqKQNHCSXW7-- From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 23:02:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59F0E1065675; Tue, 10 Jan 2012 23:02:02 +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 2E37A8FC14; Tue, 10 Jan 2012 23:02:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0AN22rB031454; Tue, 10 Jan 2012 23:02:02 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0AN22FK031452; Tue, 10 Jan 2012 23:02:02 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201102302.q0AN22FK031452@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 10 Jan 2012 23:02: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: r229947 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 23:02:02 -0000 Author: luigi Date: Tue Jan 10 23:02:01 2012 New Revision: 229947 URL: http://svn.freebsd.org/changeset/base/229947 Log: other simplifications in the internal interfaces to the memory allocator. Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Tue Jan 10 22:41:09 2012 (r229946) +++ head/sys/dev/netmap/netmap.c Tue Jan 10 23:02:01 2012 (r229947) @@ -152,8 +152,10 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, free_b * Buffer 0 is the 'junk' buffer. */ static void -netmap_new_bufs(struct netmap_buf_pool *p, struct netmap_slot *slot, u_int n) +netmap_new_bufs(struct netmap_if *nifp __unused, + struct netmap_slot *slot, u_int n) { + struct netmap_buf_pool *p = &nm_buf_pool; uint32_t bi = 0; /* index in the bitmap */ uint32_t mask, j, i = 0; /* slot counter */ @@ -182,8 +184,10 @@ netmap_new_bufs(struct netmap_buf_pool * static void -netmap_free_buf(struct netmap_buf_pool *p, uint32_t i) +netmap_free_buf(struct netmap_if *nifp __unused, uint32_t i) { + struct netmap_buf_pool *p = &nm_buf_pool; + uint32_t pos, mask; if (i >= p->total_buffers) { D("invalid free index %d", i); @@ -399,15 +403,13 @@ netmap_dtor(void *data) ring = na->tx_rings[i].ring; lim = na->tx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) - netmap_free_buf(&nm_buf_pool, - ring->slot[j].buf_idx); + netmap_free_buf(nifp, ring->slot[j].buf_idx); ND("rx queue %d", i); ring = na->rx_rings[i].ring; lim = na->rx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) - netmap_free_buf(&nm_buf_pool, - ring->slot[j].buf_idx); + netmap_free_buf(nifp, ring->slot[j].buf_idx); } NMA_UNLOCK(); netmap_free_rings(na); @@ -516,7 +518,7 @@ error: */ ring->avail = kring->nr_hwavail = numdesc - 1; ring->cur = kring->nr_hwcur = 0; - netmap_new_bufs(&nm_buf_pool, ring->slot, numdesc); + netmap_new_bufs(nifp, ring->slot, numdesc); ofs += sizeof(struct netmap_ring) + numdesc * sizeof(struct netmap_slot); @@ -535,7 +537,7 @@ error: kring->nkr_num_slots = numdesc; ring->cur = kring->nr_hwcur = 0; ring->avail = kring->nr_hwavail = 0; /* empty */ - netmap_new_bufs(&nm_buf_pool, ring->slot, numdesc); + netmap_new_bufs(nifp, ring->slot, numdesc); ofs += sizeof(struct netmap_ring) + numdesc * sizeof(struct netmap_slot); } @@ -580,8 +582,9 @@ netmap_mmap(__unused struct cdev *dev, v { if (nprot & PROT_EXEC) return (-1); // XXX -1 or EINVAL ? + ND("request for offset 0x%x", (uint32_t)offset); - *paddr = vtophys(netmap_mem_d->nm_buffer) + offset; + *paddr = netmap_ofstophys(offset); return (0); } @@ -953,8 +956,7 @@ error: nmr->nr_numrings = na->num_queues; nmr->nr_numslots = na->num_tx_desc; nmr->nr_memsize = netmap_mem_d->nm_totalsize; - nmr->nr_offset = - ((char *) nifp - (char *) netmap_mem_d->nm_buffer); + nmr->nr_offset = netmap_if_offset(nifp); break; case NIOCUNREGIF: From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 23:06:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F2961065670; Tue, 10 Jan 2012 23:06:10 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id E95BE8FC12; Tue, 10 Jan 2012 23:06:09 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id CD1CD1DD607; Wed, 11 Jan 2012 00:06:07 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id AF65E28468; Wed, 11 Jan 2012 00:06:07 +0100 (CET) Date: Wed, 11 Jan 2012 00:06:07 +0100 From: Jilles Tjoelker To: Guy Helmer Message-ID: <20120110230607.GA15897@stack.nl> References: <201201101843.q0AIhRuM022949@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201101843.q0AIhRuM022949@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229936 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 23:06:10 -0000 On Tue, Jan 10, 2012 at 06:43:27PM +0000, Guy Helmer wrote: > Author: ghelmer > Date: Tue Jan 10 18:43:27 2012 > New Revision: 229936 > URL: http://svn.freebsd.org/changeset/base/229936 > Log: > Set the FD_CLOEXEC flag on the open pidfile file descriptor. > Discussed with: pjd, des > Modified: > head/lib/libutil/pidfile.c > + /* > + * Prevent the file descriptor from escaping to other > + * programs via exec(3). > + */ > + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { Consider adding O_CLOEXEC to the flopen() flags instead. That saves a system call and removes a possible race condition with fork/exec from threads or signal handlers. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Tue Jan 10 23:37:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCB741065672; Tue, 10 Jan 2012 23:37:32 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBE698FC0A; Tue, 10 Jan 2012 23:37:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ANbW3j032590; Tue, 10 Jan 2012 23:37:32 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ANbWQF032588; Tue, 10 Jan 2012 23:37:32 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201102337.q0ANbWQF032588@svn.freebsd.org> From: Adrian Chadd Date: Tue, 10 Jan 2012 23:37: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: r229948 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 23:37:33 -0000 Author: adrian Date: Tue Jan 10 23:37:32 2012 New Revision: 229948 URL: http://svn.freebsd.org/changeset/base/229948 Log: Add in the vendor extension bit in the radiotap header. Modified: head/sys/net80211/ieee80211_radiotap.h Modified: head/sys/net80211/ieee80211_radiotap.h ============================================================================== --- head/sys/net80211/ieee80211_radiotap.h Tue Jan 10 23:02:01 2012 (r229947) +++ head/sys/net80211/ieee80211_radiotap.h Tue Jan 10 23:37:32 2012 (r229948) @@ -190,6 +190,7 @@ enum ieee80211_radiotap_type { IEEE80211_RADIOTAP_DB_ANTNOISE = 13, /* NB: gap for netbsd definitions */ IEEE80211_RADIOTAP_XCHANNEL = 18, + IEEE80211_RADIOTAP_VENDOREXT = 30, IEEE80211_RADIOTAP_EXT = 31, }; From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 00:16:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5DD2106566B; Wed, 11 Jan 2012 00:16:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D37808FC12; Wed, 11 Jan 2012 00:16:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0B0GiEU033841; Wed, 11 Jan 2012 00:16:44 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0B0GigL033839; Wed, 11 Jan 2012 00:16:44 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201110016.q0B0GigL033839@svn.freebsd.org> From: Adrian Chadd Date: Wed, 11 Jan 2012 00:16: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: r229949 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 00:16:45 -0000 Author: adrian Date: Wed Jan 11 00:16:44 2012 New Revision: 229949 URL: http://svn.freebsd.org/changeset/base/229949 Log: style(9) changes. This shouldn't change functionality. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Jan 10 23:37:32 2012 (r229948) +++ head/sys/dev/ath/if_ath_tx.c Wed Jan 11 00:16:44 2012 (r229949) @@ -435,7 +435,8 @@ ath_tx_setds_11n(struct ath_softc *sc, s * Setup the last descriptor in the list. * bf_prev points to the last; bf is NULL here. */ - ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_desc, bf_first->bf_desc); + ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_desc, + bf_first->bf_desc); /* * Set the first descriptor bf_lastds field to point to @@ -481,7 +482,8 @@ ath_tx_handoff_mcast(struct ath_softc *s * Hand-off packet to a hardware queue. */ static void -ath_tx_handoff_hw(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf) +ath_tx_handoff_hw(struct ath_softc *sc, struct ath_txq *txq, + struct ath_buf *bf) { struct ath_hal *ah = sc->sc_ah; @@ -548,7 +550,8 @@ ath_tx_handoff_hw(struct ath_softc *sc, * frame at SWBA. */ if (!qbusy) { - ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); + ath_hal_puttxbuf(ah, txq->axq_qnum, + bf->bf_daddr); txq->axq_flags &= ~ATH_TXQ_PUTPENDING; DPRINTF(sc, ATH_DEBUG_XMIT, "%s: TXDP[%u] = %p (%p) depth %d\n", @@ -566,7 +569,8 @@ ath_tx_handoff_hw(struct ath_softc *sc, DPRINTF(sc, ATH_DEBUG_XMIT, "%s: link[%u](%p)=%p (%p) depth %d\n", __func__, txq->axq_qnum, txq->axq_link, - (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth); + (caddr_t)bf->bf_daddr, bf->bf_desc, + txq->axq_depth); if ((txq->axq_flags & ATH_TXQ_PUTPENDING) && !qbusy) { /* * The q was busy when we previously tried @@ -599,7 +603,8 @@ ath_tx_handoff_hw(struct ath_softc *sc, DPRINTF(sc, ATH_DEBUG_XMIT, "%s: link[%u](%p)=%p (%p) depth %d\n", __func__, txq->axq_qnum, txq->axq_link, - (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth); + (caddr_t)bf->bf_daddr, bf->bf_desc, + txq->axq_depth); } #endif /* IEEE80211_SUPPORT_TDMA */ if (bf->bf_state.bfs_aggr) @@ -652,7 +657,8 @@ ath_tx_handoff(struct ath_softc *sc, str static int ath_tx_tag_crypto(struct ath_softc *sc, struct ieee80211_node *ni, - struct mbuf *m0, int iswep, int isfrag, int *hdrlen, int *pktlen, int *keyix) + struct mbuf *m0, int iswep, int isfrag, int *hdrlen, int *pktlen, + int *keyix) { if (iswep) { const struct ieee80211_cipher *cip; @@ -671,7 +677,7 @@ ath_tx_tag_crypto(struct ath_softc *sc, * 802.11 layer counts failures and provides * debugging/diagnostics. */ - return 0; + return (0); } /* * Adjust the packet + header lengths for the crypto @@ -698,7 +704,7 @@ ath_tx_tag_crypto(struct ath_softc *sc, } else (*keyix) = HAL_TXKEYIX_INVALID; - return 1; + return (1); } static uint8_t @@ -720,7 +726,7 @@ ath_tx_get_rtscts_rate(struct ath_hal *a if (shortPreamble) ctsrate |= rt->info[cix].shortPreamble; - return ctsrate; + return (ctsrate); } /* @@ -737,7 +743,7 @@ ath_tx_calc_ctsduration(struct ath_hal * if (rt->info[cix].phy == IEEE80211_T_HT) { printf("%s: HT rate where it shouldn't be (0x%x)\n", __func__, rt->info[cix].rateCode); - return -1; + return (-1); } /* @@ -765,7 +771,7 @@ ath_tx_calc_ctsduration(struct ath_hal * ctsduration += rt->info[rix].lpAckDuration; } - return ctsduration; + return (ctsduration); } /* @@ -1906,9 +1912,11 @@ ath_tx_addto_baw(struct ath_softc *sc, s if (bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, - "%s: re-added? tid=%d, seqno %d; window %d:%d; baw head=%d tail=%d\n", + "%s: re-added? tid=%d, seqno %d; window %d:%d; " + "baw head=%d tail=%d\n", __func__, tid->tid, SEQNO(bf->bf_state.bfs_seqno), - tap->txa_start, tap->txa_wnd, tid->baw_head, tid->baw_tail); + tap->txa_start, tap->txa_wnd, tid->baw_head, + tid->baw_tail); /* * ni->ni_txseqs[] is the currently allocated seqno. @@ -1917,9 +1925,11 @@ ath_tx_addto_baw(struct ath_softc *sc, s index = ATH_BA_INDEX(tap->txa_start, SEQNO(bf->bf_state.bfs_seqno)); cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, - "%s: tid=%d, seqno %d; window %d:%d; index=%d cindex=%d baw head=%d tail=%d\n", + "%s: tid=%d, seqno %d; window %d:%d; index=%d cindex=%d " + "baw head=%d tail=%d\n", __func__, tid->tid, SEQNO(bf->bf_state.bfs_seqno), - tap->txa_start, tap->txa_wnd, index, cindex, tid->baw_head, tid->baw_tail); + tap->txa_start, tap->txa_wnd, index, cindex, tid->baw_head, + tid->baw_tail); #if 0 @@ -1941,7 +1951,8 @@ ath_tx_addto_baw(struct ath_softc *sc, s } tid->tx_buf[cindex] = bf; - if (index >= ((tid->baw_tail - tid->baw_head) & (ATH_TID_MAX_BUFS - 1))) { + if (index >= ((tid->baw_tail - tid->baw_head) & + (ATH_TID_MAX_BUFS - 1))) { tid->baw_tail = cindex; INCR(tid->baw_tail, ATH_TID_MAX_BUFS); } @@ -2019,7 +2030,8 @@ ath_tx_update_baw(struct ath_softc *sc, cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, - "%s: tid=%d, baw=%d:%d, seqno=%d, index=%d, cindex=%d, baw head=%d, tail=%d\n", + "%s: tid=%d, baw=%d:%d, seqno=%d, index=%d, cindex=%d, " + "baw head=%d, tail=%d\n", __func__, tid->tid, tap->txa_start, tap->txa_wnd, seqno, index, cindex, tid->baw_head, tid->baw_tail); @@ -2044,11 +2056,13 @@ ath_tx_update_baw(struct ath_softc *sc, tid->tx_buf[cindex] = NULL; - while (tid->baw_head != tid->baw_tail && !tid->tx_buf[tid->baw_head]) { + while (tid->baw_head != tid->baw_tail && + !tid->tx_buf[tid->baw_head]) { INCR(tap->txa_start, IEEE80211_SEQ_RANGE); INCR(tid->baw_head, ATH_TID_MAX_BUFS); } - DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: baw is now %d:%d, baw head=%d\n", + DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, + "%s: baw is now %d:%d, baw head=%d\n", __func__, tap->txa_start, tap->txa_wnd, tid->baw_head); } @@ -2248,24 +2262,34 @@ ath_tx_swq(struct ath_softc *sc, struct ATH_TXQ_LOCK(txq); if (atid->paused) { /* TID is paused, queue */ + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: paused\n", __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); } else if (ath_tx_ampdu_pending(sc, an, tid)) { /* AMPDU pending; queue */ + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: pending\n", __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); /* XXX sched? */ } else if (ath_tx_ampdu_running(sc, an, tid)) { /* AMPDU running, attempt direct dispatch if possible */ - if (txq->axq_depth < sc->sc_hwq_limit) + if (txq->axq_depth < sc->sc_hwq_limit) { ath_tx_xmit_aggr(sc, an, bf); - else { + DPRINTF(sc, ATH_DEBUG_SW_TX, + "%s: xmit_aggr\n", + __func__); + } else { + DPRINTF(sc, ATH_DEBUG_SW_TX, + "%s: ampdu; swq'ing\n", + __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); } } else if (txq->axq_depth < sc->sc_hwq_limit) { /* AMPDU not running, attempt direct dispatch */ + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: xmit_normal\n", __func__); ath_tx_xmit_normal(sc, txq, bf); } else { /* Busy; queue */ + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: swq'ing\n", __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); } @@ -2374,8 +2398,8 @@ ath_tx_tid_resume(struct ath_softc *sc, * forward. */ static void -ath_tx_tid_drain(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid, - ath_bufhead *bf_cq) +ath_tx_tid_drain(struct ath_softc *sc, struct ath_node *an, + struct ath_tid *tid, ath_bufhead *bf_cq) { struct ath_buf *bf; struct ieee80211_tx_ampdu *tap; @@ -2398,8 +2422,8 @@ ath_tx_tid_drain(struct ath_softc *sc, s device_printf(sc->sc_dev, "%s: node %p: tid %d: txq_depth=%d, " "txq_aggr_depth=%d, sched=%d, paused=%d, " - "hwq_depth=%d, incomp=%d, baw_head=%d, baw_tail=%d " - "txa_start=%d, ni_txseqs=%d\n", + "hwq_depth=%d, incomp=%d, baw_head=%d, " + "baw_tail=%d txa_start=%d, ni_txseqs=%d\n", __func__, ni, tid->tid, txq->axq_depth, txq->axq_aggr_depth, tid->sched, tid->paused, tid->hwq_depth, tid->incomp, tid->baw_head, @@ -2644,7 +2668,8 @@ ath_tx_cleanup(struct ath_softc *sc, str if (! bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, "%s: wasn't added: seqno %d\n", - __func__, SEQNO(bf->bf_state.bfs_seqno)); + __func__, + SEQNO(bf->bf_state.bfs_seqno)); } bf->bf_state.bfs_dobaw = 0; /* @@ -3061,7 +3086,8 @@ ath_tx_comp_cleanup_aggr(struct ath_soft * not the last descriptor in the first frame. */ static void -ath_tx_aggr_comp_aggr(struct ath_softc *sc, struct ath_buf *bf_first, int fail) +ath_tx_aggr_comp_aggr(struct ath_softc *sc, struct ath_buf *bf_first, + int fail) { //struct ath_desc *ds = bf->bf_lastds; struct ieee80211_node *ni = bf_first->bf_node; @@ -3148,7 +3174,8 @@ ath_tx_aggr_comp_aggr(struct ath_softc * memcpy(rc, bf_first->bf_state.bfs_rc, sizeof(rc)); DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, - "%s: txa_start=%d, tx_ok=%d, status=%.8x, flags=%.8x, isaggr=%d, seq_st=%d, hasba=%d, ba=%.8x, %.8x\n", + "%s: txa_start=%d, tx_ok=%d, status=%.8x, flags=%.8x, " + "isaggr=%d, seq_st=%d, hasba=%d, ba=%.8x, %.8x\n", __func__, tap->txa_start, tx_ok, ts.ts_status, ts.ts_flags, isaggr, seq_st, hasba, ba[0], ba[1]); @@ -3162,7 +3189,8 @@ ath_tx_aggr_comp_aggr(struct ath_softc * /* AR5416 BA bug; this requires an interface reset */ if (isaggr && tx_ok && (! hasba)) { device_printf(sc->sc_dev, - "%s: AR5416 bug: hasba=%d; txok=%d, isaggr=%d, seq_st=%d\n", + "%s: AR5416 bug: hasba=%d; txok=%d, isaggr=%d, " + "seq_st=%d\n", __func__, hasba, tx_ok, isaggr, seq_st); /* XXX TODO: schedule an interface reset */ } @@ -3193,7 +3221,8 @@ ath_tx_aggr_comp_aggr(struct ath_softc * */ while (bf) { nframes++; - ba_index = ATH_BA_INDEX(seq_st, SEQNO(bf->bf_state.bfs_seqno)); + ba_index = ATH_BA_INDEX(seq_st, + SEQNO(bf->bf_state.bfs_seqno)); bf_next = bf->bf_next; bf->bf_next = NULL; /* Remove it from the aggr list */ @@ -3245,7 +3274,8 @@ ath_tx_aggr_comp_aggr(struct ath_softc * * control code. */ if (fail == 0) - ath_tx_update_ratectrl(sc, ni, rc, &ts, pktlen, nframes, nbad); + ath_tx_update_ratectrl(sc, ni, rc, &ts, pktlen, nframes, + nbad); /* * send bar if we dropped any frames @@ -3313,8 +3343,10 @@ ath_tx_aggr_comp_unaggr(struct ath_softc if (tid == IEEE80211_NONQOS_TID) device_printf(sc->sc_dev, "%s: TID=16!\n", __func__); - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: tid=%d, hwq_depth=%d\n", - __func__, bf, bf->bf_state.bfs_tid, atid->hwq_depth); + DPRINTF(sc, ATH_DEBUG_SW_TX, + "%s: bf=%p: tid=%d, hwq_depth=%d, seqno=%d\n", + __func__, bf, bf->bf_state.bfs_tid, atid->hwq_depth, + SEQNO(bf->bf_state.bfs_seqno)); atid->hwq_depth--; if (atid->hwq_depth < 0) @@ -3329,6 +3361,8 @@ ath_tx_aggr_comp_unaggr(struct ath_softc */ if (atid->cleanup_inprogress) { ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: cleanup_unaggr\n", + __func__); ath_tx_comp_cleanup_unaggr(sc, bf); return; } @@ -3339,6 +3373,8 @@ ath_tx_aggr_comp_unaggr(struct ath_softc */ if (fail == 0 && ts->ts_status & HAL_TXERR_XRETRY) { ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: retry_unaggr\n", + __func__); ath_tx_aggr_retry_unaggr(sc, bf); return; } @@ -3419,7 +3455,8 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft * data frame), schedule it directly; continue. */ if (! bf->bf_state.bfs_dobaw) { - DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: non-baw packet\n", + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, + "%s: non-baw packet\n", __func__); ATH_TXQ_REMOVE(tid, bf, bf_list); bf->bf_state.bfs_aggr = 0; @@ -3489,7 +3526,8 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft sc->sc_aggr_stats.aggr_single_pkt++; } else { DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, - "%s: multi-frame aggregate: %d frames, length %d\n", + "%s: multi-frame aggregate: %d frames, " + "length %d\n", __func__, bf->bf_state.bfs_nframes, bf->bf_state.bfs_al); bf->bf_state.bfs_aggr = 1; From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 00:18:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC39A1065670; Wed, 11 Jan 2012 00:18:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB9438FC12; Wed, 11 Jan 2012 00:18:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0B0IXwG033932; Wed, 11 Jan 2012 00:18:33 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0B0IXGD033930; Wed, 11 Jan 2012 00:18:33 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201110018.q0B0IXGD033930@svn.freebsd.org> From: Adrian Chadd Date: Wed, 11 Jan 2012 00:18: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: r229950 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 00:18:33 -0000 Author: adrian Date: Wed Jan 11 00:18:33 2012 New Revision: 229950 URL: http://svn.freebsd.org/changeset/base/229950 Log: Re-enable the PHY radar error frames if sc_dodfs is set. This was messing up a local port of the atheros reference radar detection code; I'll fix the port instead. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Wed Jan 11 00:16:44 2012 (r229949) +++ head/sys/dev/ath/if_ath.c Wed Jan 11 00:18:33 2012 (r229950) @@ -2486,6 +2486,13 @@ ath_calcrxfilter(struct ath_softc *sc) if (IEEE80211_IS_CHAN_HT(ic->ic_curchan)) rfilt |= HAL_RX_FILTER_COMPBAR; + /* + * Enable radar PHY errors if requested by the + * DFS module. + */ + if (sc->sc_dodfs) + rfilt |= HAL_RX_FILTER_PHYRADAR; + DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x, %s if_flags 0x%x\n", __func__, rfilt, ieee80211_opmode_name[ic->ic_opmode], ifp->if_flags); return rfilt; From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 00:31:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C19961065672; Wed, 11 Jan 2012 00:31:04 +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 B084F8FC08; Wed, 11 Jan 2012 00:31:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0B0V4Y2034375; Wed, 11 Jan 2012 00:31:04 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0B0V4tW034372; Wed, 11 Jan 2012 00:31:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201110031.q0B0V4tW034372@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 11 Jan 2012 00:31: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: r229951 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 00:31:04 -0000 Author: pjd Date: Wed Jan 11 00:31:04 2012 New Revision: 229951 URL: http://svn.freebsd.org/changeset/base/229951 Log: Constify arguments. Modified: head/lib/libutil/libutil.h head/lib/libutil/pidfile.c Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Wed Jan 11 00:18:33 2012 (r229950) +++ head/lib/libutil/libutil.h Wed Jan 11 00:31:04 2012 (r229951) @@ -170,7 +170,7 @@ struct pidfh *pidfile_open(const char *p int pidfile_write(struct pidfh *pfh); int pidfile_close(struct pidfh *pfh); int pidfile_remove(struct pidfh *pfh); -int pidfile_fileno(struct pidfh *pfh); +int pidfile_fileno(const struct pidfh *pfh); #endif #ifdef _UFS_UFS_QUOTA_H_ Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Wed Jan 11 00:18:33 2012 (r229950) +++ head/lib/libutil/pidfile.c Wed Jan 11 00:31:04 2012 (r229951) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); static int _pidfile_remove(struct pidfh *pfh, int freeit); static int -pidfile_verify(struct pidfh *pfh) +pidfile_verify(const struct pidfh *pfh) { struct stat sb; @@ -268,7 +268,7 @@ pidfile_remove(struct pidfh *pfh) } int -pidfile_fileno(struct pidfh *pfh) +pidfile_fileno(const struct pidfh *pfh) { if (pfh == NULL || pfh->pf_fd == -1) { From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 00:47:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 81B63106566C; Wed, 11 Jan 2012 00:47:07 +0000 (UTC) Date: Wed, 11 Jan 2012 00:47:07 +0000 From: Alexander Best To: Dimitry Andric Message-ID: <20120111004707.GA76892@freebsd.org> References: <201201100258.q0A2wT7E079753@svn.freebsd.org> <20120110082106.GD1801@garage.freebsd.pl> <4F0C0714.6060501@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F0C0714.6060501@FreeBSD.org> Cc: svn-src-head@freebsd.org, Eitan Adler , svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek Subject: Re: svn commit: r229908 - head/usr.bin/brandelf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 00:47:07 -0000 On Tue Jan 10 12, Dimitry Andric wrote: > On 2012-01-10 09:21, Pawel Jakub Dawidek wrote: > >On Tue, Jan 10, 2012 at 02:58:29AM +0000, Eitan Adler wrote: > >>Author: eadler (ports committer) > >>Date: Tue Jan 10 02:58:29 2012 > >>New Revision: 229908 > >>URL: http://svn.freebsd.org/changeset/base/229908 > >> > >>Log: > >> Fix warning when compiling with gcc46: > >> error: variable 'verbose' set but not use > > > >Maybe we should remove -v from the manual page as well or document as > >no-op? > >I'd still leave it in the code though, so there is no POLA violation. > > It has been a no-op since the beginning of brandelf, and I have really > no idea what the original author intended the verbose output to be. :) > > It is probably best to document it as a no-op now, to reduce possible > confusion. shouldn't brandelf be replaced with the version from the elftoolchain project? any news when the first import is going to happen? cheers. alex From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 00:51:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 81F151065670; Wed, 11 Jan 2012 00:51:35 +0000 (UTC) Date: Wed, 11 Jan 2012 00:51:35 +0000 From: Alexander Best To: Dimitry Andric Message-ID: <20120111005135.GA77727@freebsd.org> References: <201201100258.q0A2wT7E079753@svn.freebsd.org> <20120110082106.GD1801@garage.freebsd.pl> <4F0C0714.6060501@FreeBSD.org> <20120111004707.GA76892@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120111004707.GA76892@freebsd.org> Cc: svn-src-head@freebsd.org, Eitan Adler , svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek Subject: Re: svn commit: r229908 - head/usr.bin/brandelf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 00:51:35 -0000 On Wed Jan 11 12, Alexander Best wrote: > On Tue Jan 10 12, Dimitry Andric wrote: > > On 2012-01-10 09:21, Pawel Jakub Dawidek wrote: > > >On Tue, Jan 10, 2012 at 02:58:29AM +0000, Eitan Adler wrote: > > >>Author: eadler (ports committer) > > >>Date: Tue Jan 10 02:58:29 2012 > > >>New Revision: 229908 > > >>URL: http://svn.freebsd.org/changeset/base/229908 > > >> > > >>Log: > > >> Fix warning when compiling with gcc46: > > >> error: variable 'verbose' set but not use > > > > > >Maybe we should remove -v from the manual page as well or document as > > >no-op? > > >I'd still leave it in the code though, so there is no POLA violation. > > > > It has been a no-op since the beginning of brandelf, and I have really > > no idea what the original author intended the verbose output to be. :) > > > > It is probably best to document it as a no-op now, to reduce possible > > confusion. > > shouldn't brandelf be replaced with the version from the elftoolchain project? > any news when the first import is going to happen? also you might want to report your changes to the elftoolchain project, because otherwise your commit will be reverted when the import happens. cheers. alex > > cheers. > alex From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 01:09:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13DCB106564A; Wed, 11 Jan 2012 01:09:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1B328FC12; Wed, 11 Jan 2012 01:09:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0B198CV035681; Wed, 11 Jan 2012 01:09:08 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0B198Ie035678; Wed, 11 Jan 2012 01:09:08 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201110109.q0B198Ie035678@svn.freebsd.org> From: Adrian Chadd Date: Wed, 11 Jan 2012 01:09: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: r229952 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 01:09:09 -0000 Author: adrian Date: Wed Jan 11 01:09:08 2012 New Revision: 229952 URL: http://svn.freebsd.org/changeset/base/229952 Log: Add the MCS radiotype entry. Modified: head/sys/net80211/ieee80211_radiotap.c head/sys/net80211/ieee80211_radiotap.h Modified: head/sys/net80211/ieee80211_radiotap.c ============================================================================== --- head/sys/net80211/ieee80211_radiotap.c Wed Jan 11 00:31:04 2012 (r229951) +++ head/sys/net80211/ieee80211_radiotap.c Wed Jan 11 01:09:08 2012 (r229952) @@ -325,6 +325,10 @@ radiotap_offset(struct ieee80211_radiota .align = sizeof(uint32_t), .width = 2*sizeof(uint32_t), }, + [IEEE80211_RADIOTAP_MCS] = { + .align = sizeof(uint8_t), + .width = 3*sizeof(uint8_t), + }, }; uint32_t present = le32toh(rh->it_present); int off, i; Modified: head/sys/net80211/ieee80211_radiotap.h ============================================================================== --- head/sys/net80211/ieee80211_radiotap.h Wed Jan 11 00:31:04 2012 (r229951) +++ head/sys/net80211/ieee80211_radiotap.h Wed Jan 11 01:09:08 2012 (r229952) @@ -190,6 +190,7 @@ enum ieee80211_radiotap_type { IEEE80211_RADIOTAP_DB_ANTNOISE = 13, /* NB: gap for netbsd definitions */ IEEE80211_RADIOTAP_XCHANNEL = 18, + IEEE80211_RADIOTAP_MCS = 19, IEEE80211_RADIOTAP_VENDOREXT = 30, IEEE80211_RADIOTAP_EXT = 31, }; From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 02:43:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D0481065672; Wed, 11 Jan 2012 02:43:52 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 04FC28FC1A; Wed, 11 Jan 2012 02:43:51 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so477125obb.13 for ; Tue, 10 Jan 2012 18:43:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=edS6qsfiso8QYHh65J9zyRJoFt6jvnV4CXLUzlhCA6g=; b=vWLnrPBj+OuTELu1OD5eQfJ7kCJ6ZiUVXXwNvobSKUh1cIndrtS6JMFln8Q2JBbufi P4QRavjXN31bpe9MN6di/siYXtsyhrbE8Gf8+yjf91CbxWjojogBcU1zUSThOb9P9PIS c1sEZ8WiNBx0jZ0C7BsllEFyqiSOnqDUphJ7Q= MIME-Version: 1.0 Received: by 10.182.2.169 with SMTP id 9mr20710775obv.79.1326249831526; Tue, 10 Jan 2012 18:43:51 -0800 (PST) Received: by 10.182.152.6 with HTTP; Tue, 10 Jan 2012 18:43:51 -0800 (PST) In-Reply-To: References: <201201052248.q05MmaZk059871@svn.freebsd.org> <4F066340.9010507@FreeBSD.org> Date: Tue, 10 Jan 2012 18:43:51 -0800 Message-ID: From: Garrett Cooper To: Guy Helmer Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org Subject: Re: svn commit: r229667 - head/usr.sbin/daemon X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 02:43:52 -0000 On Tue, Jan 10, 2012 at 1:01 PM, Guy Helmer wrote: > On Jan 6, 2012, at 12:00 AM, Garrett Cooper wrote: > >> On Thu, Jan 5, 2012 at 6:58 PM, Doug Barton wrote: >>> On 01/05/2012 14:48, Guy Helmer wrote: >>>> =A0 Allow daemon(8) to run pidfile_open() before relenquishing privile= ges >>>> =A0 so pid files can be written in /var/run when started as root. >>> >>> I'm not sure how useful this is since when daemon is exiting it won't b= e >>> able to remove the pid file (unless I'm missing something). >>> >>> Isn't it better to pre-create the pid file with the proper permissions >>> for the unprivileged user? >> >> =A0 =A0As another aside, the file descriptor never has fcntl(, >> FD_CLOEXEC) run on it, so it leaks the file descriptors across execs.. >> that's not good... > > I just added an fcntl(=85, FD_CLOEXEC) call to pidfile_open() so this par= ticular problem should be resolved. I saw -- thanks! -Garrett From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 02:46:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E83761065670; Wed, 11 Jan 2012 02:46:42 +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 D20758FC08; Wed, 11 Jan 2012 02:46:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0B2kgAk038818; Wed, 11 Jan 2012 02:46:42 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0B2kgcv038816; Wed, 11 Jan 2012 02:46:42 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201110246.q0B2kgcv038816@svn.freebsd.org> From: Rick Macklem Date: Wed, 11 Jan 2012 02:46: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: r229956 - head/sys/fs/nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 02:46:43 -0000 Author: rmacklem Date: Wed Jan 11 02:46:42 2012 New Revision: 229956 URL: http://svn.freebsd.org/changeset/base/229956 Log: jwd@ reported via email that the "CacheSize" field reported by "nfsstat -e -s" would go negative after using the "-z" option to zero out the stats. This patch fixes that by not zeroing out the srvcache_size field for "-z", since it is the size of the cache and not a counter. MFC after: 2 weeks Modified: head/sys/fs/nfs/nfs_commonport.c Modified: head/sys/fs/nfs/nfs_commonport.c ============================================================================== --- head/sys/fs/nfs/nfs_commonport.c Wed Jan 11 01:58:49 2012 (r229955) +++ head/sys/fs/nfs/nfs_commonport.c Wed Jan 11 02:46:42 2012 (r229956) @@ -483,7 +483,6 @@ nfssvc_call(struct thread *p, struct nfs newnfsstats.srvcache_nonidemdonehits = 0; newnfsstats.srvcache_misses = 0; newnfsstats.srvcache_tcppeak = 0; - newnfsstats.srvcache_size = 0; newnfsstats.srvclients = 0; newnfsstats.srvopenowners = 0; newnfsstats.srvopens = 0; From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 12:26:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B283106566C; Wed, 11 Jan 2012 12:26:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id A622E8FC16; Wed, 11 Jan 2012 12:26:01 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0BCPv2J013153 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Jan 2012 23:25:58 +1100 Date: Wed, 11 Jan 2012 23:25:57 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <20120110221323.GE1694@garage.freebsd.pl> Message-ID: <20120111214848.K1813@besplex.bde.org> References: <201201101953.q0AJrPao025097@svn.freebsd.org> <20120110221323.GE1694@garage.freebsd.pl> 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, Guy Helmer Subject: Re: svn commit: r229937 - in head/lib: libc/gen libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 12:26:02 -0000 On Tue, 10 Jan 2012, Pawel Jakub Dawidek wrote: > On Tue, Jan 10, 2012 at 07:53:25PM +0000, Guy Helmer wrote: > [...] >> Modified: head/lib/libutil/libutil.h >> ============================================================================== >> --- head/lib/libutil/libutil.h Tue Jan 10 18:43:27 2012 (r229936) >> +++ head/lib/libutil/libutil.h Tue Jan 10 19:53:25 2012 (r229937) >> @@ -170,6 +170,7 @@ struct pidfh *pidfile_open(const char *p >> int pidfile_write(struct pidfh *pfh); >> int pidfile_close(struct pidfh *pfh); >> int pidfile_remove(struct pidfh *pfh); >> +int pidfile_fileno(struct pidfh *pfh); >> #endif >> >> #ifdef _UFS_UFS_QUOTA_H_ > > One more thing. You also need to add link in Makefile, so that > 'man pidfile_fileno' will work. Is there any chance of keeping sorted lists sorted? This file used to be mostly sorted and mostly in KNF (tab before function names) and mostly without namespace pollution in parameter names). Newer code in it violates all of these style and header implementation rules. The pidfile code was already especially bad, and adding to the end of the unsorted list in it doesn't help. The pidfile man page is also unsorted. It was in "operations" order "open/write/close/remove". That is hard to maintain and hard to search for long lists. Adding pidfile_fileno() to the end of the list in the same disorder as above makes the list not even in "operations" order (since pidfile_fileno() is only valid betwen pidfile_open() and pidfile_close()). Old disorder and nearby bugs in libutil.h (old := before 2005): - the forward declarations of structs are totally disordered - the following prototypes are disordered (mostly by adding them to the end of a orginally-almost-sorted list: trimdomain(), forkpty(), humanize_number(), uu_lockerr(), uu_unlock(), _secure_path(), properties_read(), properties_free(), properties_find(), auth_getval(), realhostname(), - the forward declaration of struct sockaddr is disorderd (not unsorted at the beginning with the others) - surprisingly, realhostname_sa() is not unsorted relative to realhostname() - the following prototypes have namespace pollution in parameter names (their parameter names are in the implementation namespace, unlike for all of the older prototypes in the file): properties read(), properties free(), properties free(), auth_getval(), realhostname(), realhostname_sa(). The properties code used to be the only really ugly code in this file. - formatting errors for openpty() (premature line splitting and wrong continuation indent). The very first prototype in this file gives an example of normal splitting and continuation indent - formatting errors for forkpty() (same as for openpty()) - line too long for realhostname_sa(), pw_copy() - consider fparseln() as being in a new section so it isn't unsorted. The start of this section should be delimited by a blank line (this is done in -current). The new section isn't really justified. It is just 1 function ifdefed to avoid a namespace problem. - no namespace pollution for fparseln()'s parameters, but that it because it is in a style different from all older prototypes in the file -- it doesn't name its parameters. Newer disorder and nearby bugs: - further unsorting of the forward declarations by adding kinfo* to the end of the unsorted list. At least the new declarations are sorted internally. - the following protypes in the early sections are disordered: expand_number(), kld*(), kinfo* (no need for a new section for the last 2. At least they are each sorted internally), gr_scan() - the following prototypes have namespace pollution in parameter names: hexdump(), kld*(), gr_dup(), gr_equal(), gr_make(), gr_scan(). Only about half of the gr*() prototypes have this bug - better indentation for kinfo*() than for older or newer entries! - line too long for gr_entry() - pidfile*() have all of the above bugs, plus they are the only prototypes up to this point in the file that don't put a tab before the function name when the return type is int - quota*() are slightly worse than pidfile*(). They add the additional style bug of not using parameter names at all, except for 1 of 2 parameters in 1 of 12 prototypes. That parameter is namespace pollution. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 13:57:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADC001065670; Wed, 11 Jan 2012 13:57:48 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BEAC8FC0A; Wed, 11 Jan 2012 13:57:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BDvmRr062201; Wed, 11 Jan 2012 13:57:48 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BDvm36062199; Wed, 11 Jan 2012 13:57:48 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201111357.q0BDvm36062199@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 11 Jan 2012 13:57: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: r229959 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 13:57:48 -0000 Author: glebius Date: Wed Jan 11 13:57:48 2012 New Revision: 229959 URL: http://svn.freebsd.org/changeset/base/229959 Log: When running with INVARIANTS the mutex(9) code does all necessary asserts for non-recursive mutexes. Modified: head/sys/contrib/pf/net/pfvar.h Modified: head/sys/contrib/pf/net/pfvar.h ============================================================================== --- head/sys/contrib/pf/net/pfvar.h Wed Jan 11 13:56:31 2012 (r229958) +++ head/sys/contrib/pf/net/pfvar.h Wed Jan 11 13:57:48 2012 (r229959) @@ -241,15 +241,8 @@ extern struct mtx pf_task_mtx; #define PF_LOCK_ASSERT() mtx_assert(&pf_task_mtx, MA_OWNED) #define PF_UNLOCK_ASSERT() mtx_assert(&pf_task_mtx, MA_NOTOWNED) - -#define PF_LOCK() do { \ - PF_UNLOCK_ASSERT(); \ - mtx_lock(&pf_task_mtx); \ -} while(0) -#define PF_UNLOCK() do { \ - PF_LOCK_ASSERT(); \ - mtx_unlock(&pf_task_mtx); \ -} while(0) +#define PF_LOCK() mtx_lock(&pf_task_mtx) +#define PF_UNLOCK() mtx_unlock(&pf_task_mtx) #else #define PF_LOCK_ASSERT() #define PF_UNLOCK_ASSERT() From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 14:11:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6746106566B; Wed, 11 Jan 2012 14:11:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D48538FC14; Wed, 11 Jan 2012 14:11:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BEBAaM062745; Wed, 11 Jan 2012 14:11:10 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BEBA9x062743; Wed, 11 Jan 2012 14:11:10 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201111411.q0BEBA9x062743@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 11 Jan 2012 14:11:10 +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: r229961 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 14:11:11 -0000 Author: glebius Date: Wed Jan 11 14:11:10 2012 New Revision: 229961 URL: http://svn.freebsd.org/changeset/base/229961 Log: Merge from OpenBSD: revision 1.128 date: 2009/08/16 13:01:57; author: jsg; state: Exp; lines: +1 -5 remove prototypes of a bunch of functions that had their implementations removed in pfsync v5. Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 13:59:49 2012 (r229960) +++ head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 14:11:10 2012 (r229961) @@ -47,6 +47,7 @@ * 1.118, 1.124, 1.148, 1.149, 1.151, 1.171 - fixes to bulk updates * 1.120, 1.175 - use monotonic time_uptime * 1.122 - reduce number of updates for non-TCP sessions + * 1.128 - cleanups * 1.170 - SIOCSIFMTU checks */ @@ -342,7 +343,6 @@ int pfsyncioctl(struct ifnet *, u_long, void pfsyncstart(struct ifnet *); struct mbuf *pfsync_if_dequeue(struct ifnet *); -struct mbuf *pfsync_get_mbuf(struct pfsync_softc *); void pfsync_deferred(struct pf_state *, int); void pfsync_undefer(struct pfsync_deferral *, int); @@ -354,11 +354,8 @@ void pfsync_update_state_req(struct pf_s void pfsync_drop(struct pfsync_softc *); void pfsync_sendout(void); void pfsync_send_plus(void *, size_t); -int pfsync_tdb_sendout(struct pfsync_softc *); -int pfsync_sendout_mbuf(struct pfsync_softc *, struct mbuf *); void pfsync_timeout(void *); void pfsync_tdb_timeout(void *); -void pfsync_send_bus(struct pfsync_softc *, u_int8_t); void pfsync_bulk_start(void); void pfsync_bulk_status(u_int8_t); From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 14:13:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1116C106566B; Wed, 11 Jan 2012 14:13:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F38248FC16; Wed, 11 Jan 2012 14:13:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BEDgcY062861; Wed, 11 Jan 2012 14:13:42 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BEDgDP062859; Wed, 11 Jan 2012 14:13:42 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201111413.q0BEDgDP062859@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 11 Jan 2012 14:13: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: r229962 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 14:13:43 -0000 Author: glebius Date: Wed Jan 11 14:13:42 2012 New Revision: 229962 URL: http://svn.freebsd.org/changeset/base/229962 Log: Move PF_LOCK_ASSERT() under __FreeBSD__. Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 14:11:10 2012 (r229961) +++ head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 14:13:42 2012 (r229962) @@ -681,9 +681,9 @@ pfsync_state_import(struct pfsync_state int pool_flags; int error; +#ifdef __FreeBSD__ PF_LOCK_ASSERT(); -#ifdef __FreeBSD__ if (sp->creatorid == 0 && V_pf_status.debug >= PF_DEBUG_MISC) { #else if (sp->creatorid == 0 && pf_status.debug >= PF_DEBUG_MISC) { From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 14:19:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE558106566C; Wed, 11 Jan 2012 14:19:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACADA8FC0A; Wed, 11 Jan 2012 14:19:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BEJ4DY063064; Wed, 11 Jan 2012 14:19:04 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BEJ4bg063062; Wed, 11 Jan 2012 14:19:04 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201111419.q0BEJ4bg063062@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 11 Jan 2012 14:19: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: r229963 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 14:19:04 -0000 Author: glebius Date: Wed Jan 11 14:19:04 2012 New Revision: 229963 URL: http://svn.freebsd.org/changeset/base/229963 Log: Add necessary locking in pfsync_in_ureq(). Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 14:13:42 2012 (r229962) +++ head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 14:19:04 2012 (r229963) @@ -1433,6 +1433,9 @@ pfsync_in_ureq(struct pfsync_pkt *pkt, s } ura = (struct pfsync_upd_req *)(mp->m_data + offp); +#ifdef __FreeBSD__ + PF_LOCK(); +#endif for (i = 0; i < count; i++) { ur = &ura[i]; @@ -1450,11 +1453,12 @@ pfsync_in_ureq(struct pfsync_pkt *pkt, s if (ISSET(st->state_flags, PFSTATE_NOSYNC)) continue; - PF_LOCK(); pfsync_update_state_req(st); - PF_UNLOCK(); } } +#ifdef __FreeBSD__ + PF_UNLOCK(); +#endif return (len); } @@ -2975,7 +2979,7 @@ pfsync_bulk_start(void) printf("pfsync: received bulk update request\n"); #ifdef __FreeBSD__ - PF_LOCK(); + PF_LOCK_ASSERT(); if (TAILQ_EMPTY(&V_state_list)) #else if (TAILQ_EMPTY(&state_list)) @@ -2994,9 +2998,6 @@ pfsync_bulk_start(void) pfsync_bulk_status(PFSYNC_BUS_START); callout_reset(&sc->sc_bulk_tmo, 1, pfsync_bulk_update, sc); } -#ifdef __FreeBSD__ - PF_UNLOCK(); -#endif } void From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 14:24:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B66BF106564A; Wed, 11 Jan 2012 14:24:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A487E8FC17; Wed, 11 Jan 2012 14:24:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BEO35h063268; Wed, 11 Jan 2012 14:24:03 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BEO3CI063266; Wed, 11 Jan 2012 14:24:03 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201111424.q0BEO3CI063266@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 11 Jan 2012 14:24: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: r229964 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 14:24:03 -0000 Author: glebius Date: Wed Jan 11 14:24:03 2012 New Revision: 229964 URL: http://svn.freebsd.org/changeset/base/229964 Log: Fix some spacing in code under __FreeBSD__. Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 14:19:04 2012 (r229963) +++ head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 14:24:03 2012 (r229964) @@ -2068,7 +2068,7 @@ pfsync_drop(struct pfsync_softc *sc) #ifdef PFSYNC_DEBUG #ifdef __FreeBSD__ KASSERT(st->sync_state == q, - ("%s: st->sync_state == q", + ("%s: st->sync_state == q", __FUNCTION__)); #else KASSERT(st->sync_state == q); @@ -2848,7 +2848,7 @@ pfsync_q_del(struct pf_state *st) int q = st->sync_state; #ifdef __FreeBSD__ - KASSERT(st->sync_state != PFSYNC_S_NONE, + KASSERT(st->sync_state != PFSYNC_S_NONE, ("%s: st->sync_state != PFSYNC_S_NONE", __FUNCTION__)); #else KASSERT(st->sync_state != PFSYNC_S_NONE); @@ -3348,14 +3348,14 @@ pfsync_multicast_cleanup(struct pfsync_s #ifdef INET extern struct domain inetdomain; static struct protosw in_pfsync_protosw = { - .pr_type = SOCK_RAW, - .pr_domain = &inetdomain, - .pr_protocol = IPPROTO_PFSYNC, - .pr_flags = PR_ATOMIC|PR_ADDR, - .pr_input = pfsync_input, - .pr_output = (pr_output_t *)rip_output, - .pr_ctloutput = rip_ctloutput, - .pr_usrreqs = &rip_usrreqs + .pr_type = SOCK_RAW, + .pr_domain = &inetdomain, + .pr_protocol = IPPROTO_PFSYNC, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_input = pfsync_input, + .pr_output = (pr_output_t *)rip_output, + .pr_ctloutput = rip_ctloutput, + .pr_usrreqs = &rip_usrreqs }; #endif From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 15:00:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FACD106564A; Wed, 11 Jan 2012 15:00:17 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EDAE48FC0A; Wed, 11 Jan 2012 15:00:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BF0GI3064530; Wed, 11 Jan 2012 15:00:16 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BF0Gda064528; Wed, 11 Jan 2012 15:00:16 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201201111500.q0BF0Gda064528@svn.freebsd.org> From: "George V. Neville-Neil" Date: Wed, 11 Jan 2012 15:00: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: r229965 - head/sys/dev/null X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 15:00:17 -0000 Author: gnn Date: Wed Jan 11 15:00:16 2012 New Revision: 229965 URL: http://svn.freebsd.org/changeset/base/229965 Log: Fix for PR 138526. Add the ability for /dev/null and /dev/zero to accept being set into non blocking mode via fcntl(). This brings the code into compliance with IEEE Std 1003.1-2001 as referenced in another PR, 94729. Reviewed by: jhb MFC after: 1 week Modified: head/sys/dev/null/null.c Modified: head/sys/dev/null/null.c ============================================================================== --- head/sys/dev/null/null.c Wed Jan 11 14:24:03 2012 (r229964) +++ head/sys/dev/null/null.c Wed Jan 11 15:00:16 2012 (r229965) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -49,6 +50,7 @@ static struct cdev *zero_dev; static d_write_t null_write; static d_ioctl_t null_ioctl; +static d_ioctl_t zero_ioctl; static d_read_t zero_read; static struct cdevsw null_cdevsw = { @@ -63,6 +65,7 @@ static struct cdevsw zero_cdevsw = { .d_version = D_VERSION, .d_read = zero_read, .d_write = null_write, + .d_ioctl = zero_ioctl, .d_name = "zero", .d_flags = D_MMAP_ANON, }; @@ -82,17 +85,50 @@ null_ioctl(struct cdev *dev __unused, u_ int flags __unused, struct thread *td) { int error; + error = 0; - if (cmd != DIOCSKERNELDUMP) - return (ENOIOCTL); - error = priv_check(td, PRIV_SETDUMPER); - if (error) - return (error); - return (set_dumper(NULL)); + switch (cmd) { + case DIOCSKERNELDUMP: + error = priv_check(td, PRIV_SETDUMPER); + if (error == 0) + error = set_dumper(NULL); + break; + case FIONBIO: + break; + case FIOASYNC: + if (*(int *)data != 0) + error = EINVAL; + break; + default: + error = ENOIOCTL; + } + return (error); } /* ARGSUSED */ static int +zero_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data __unused, + int flags __unused, struct thread *td) +{ + int error; + error = 0; + + switch (cmd) { + case FIONBIO: + break; + case FIOASYNC: + if (*(int *)data != 0) + error = EINVAL; + break; + default: + error = ENOIOCTL; + } + return (error); +} + + +/* ARGSUSED */ +static int zero_read(struct cdev *dev __unused, struct uio *uio, int flags __unused) { void *zbuf; From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 15:10:19 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DAA0106566C; Wed, 11 Jan 2012 15:10:19 +0000 (UTC) (envelope-from guy.helmer@palisadesystems.com) Received: from ps-1-a.compliancesafe.com (ps-1-a.compliancesafe.com [216.81.161.161]) by mx1.freebsd.org (Postfix) with ESMTP id EFB918FC0C; Wed, 11 Jan 2012 15:10:16 +0000 (UTC) Received: from mail.palisadesystems.com (localhost [127.0.0.1]) by ps-1-a.compliancesafe.com (8.14.4/8.14.3) with ESMTP id q0BF9x73078862; Wed, 11 Jan 2012 09:10:00 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) Received: from guysmbp.dyn.palisadesys.com (GuysMBP.dyn.palisadesys.com [172.16.2.90]) (authenticated bits=0) by mail.palisadesystems.com (8.14.3/8.14.3) with ESMTP id q0BF9mcM039415 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 11 Jan 2012 09:09:48 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.palisadesystems.com q0BF9mcM039415 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=palisadesystems.com; s=mail; t=1326294589; bh=Zp6FbHlcomOFzQin4pDrMb9pCYqrJ5k8vB0b+5+mCvM=; l=128; h=Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=Wzog3aS+3y7KlFO6cU+EDWEZbDXpbB6CcwifE1hkNA6DekFrRyUUYRExx5z5SrH+D glARaA7mJMQAqbwoTuHoAAN8ti+THOST8nXpFRCrQ/0YF2qCGGvo1JxBKKNKf62LkW NgSUpCN4bADaZVzz0xWI9n5qsdbZKee1iPNetIYY= Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: Guy Helmer In-Reply-To: <20120111214848.K1813@besplex.bde.org> Date: Wed, 11 Jan 2012 09:09:47 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <26EF49B4-1B8E-43BC-AC7B-FD24BB94C961@palisadesystems.com> References: <201201101953.q0AJrPao025097@svn.freebsd.org> <20120110221323.GE1694@garage.freebsd.pl> <20120111214848.K1813@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1251.1) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.palisadesystems.com [172.16.1.5]); Wed, 11 Jan 2012 09:09:49 -0600 (CST) X-Palisade-MailScanner-Information: Please contact the ISP for more information X-Palisade-MailScanner-ID: q0BF9mcM039415 X-Palisade-MailScanner: Found to be clean X-Palisade-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=0.172, required 5, ALL_TRUSTED -1.00, BAYES_00 -1.90, J_CHICKENPOX_65 0.60, J_CHICKENPOX_73 0.60, J_CHICKENPOX_75 0.60, RP_8BIT 1.27) X-Palisade-MailScanner-From: guy.helmer@palisadesystems.com X-Spam-Status: No X-PacketSure-Scanned: Yes Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek Subject: Re: svn commit: r229937 - in head/lib: libc/gen libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 15:10:19 -0000 On Jan 11, 2012, at 6:25 AM, Bruce Evans wrote: > On Tue, 10 Jan 2012, Pawel Jakub Dawidek wrote: >=20 >> On Tue, Jan 10, 2012 at 07:53:25PM +0000, Guy Helmer wrote: >> [...] >>> Modified: head/lib/libutil/libutil.h >>> = =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/libutil/libutil.h Tue Jan 10 18:43:27 2012 = (r229936) >>> +++ head/lib/libutil/libutil.h Tue Jan 10 19:53:25 2012 = (r229937) >>> @@ -170,6 +170,7 @@ struct pidfh *pidfile_open(const char *p >>> int pidfile_write(struct pidfh *pfh); >>> int pidfile_close(struct pidfh *pfh); >>> int pidfile_remove(struct pidfh *pfh); >>> +int pidfile_fileno(struct pidfh *pfh); >>> #endif >>>=20 >>> #ifdef _UFS_UFS_QUOTA_H_ >>=20 >> One more thing. You also need to add link in Makefile, so that >> 'man pidfile_fileno' will work. >=20 > Is there any chance of keeping sorted lists sorted? >=20 > This file used to be mostly sorted and mostly in KNF (tab before > function names) and mostly without namespace pollution in parameter > names). Newer code in it violates all of these style and header > implementation rules. The pidfile code was already especially bad, > and adding to the end of the unsorted list in it doesn't help. >=20 > The pidfile man page is also unsorted. It was in "operations" order > "open/write/close/remove". That is hard to maintain and hard to = search > for long lists. Adding pidfile_fileno() to the end of the list in the > same disorder as above makes the list not even in "operations" order > (since pidfile_fileno() is only valid betwen pidfile_open() and > pidfile_close()). >=20 > Old disorder and nearby bugs in libutil.h (old :=3D before 2005): > - the forward declarations of structs are totally disordered > - the following prototypes are disordered (mostly by adding them to > the end of a orginally-almost-sorted list: > trimdomain(), forkpty(), humanize_number(), uu_lockerr(), = uu_unlock(), > _secure_path(), properties_read(), properties_free(), = properties_find(), > auth_getval(), realhostname(), > - the forward declaration of struct sockaddr is disorderd (not = unsorted > at the beginning with the others) > - surprisingly, realhostname_sa() is not unsorted relative to = realhostname() > - the following prototypes have namespace pollution in parameter names > (their parameter names are in the implementation namespace, unlike = for > all of the older prototypes in the file): > properties read(), properties free(), properties free(), = auth_getval(), > realhostname(), realhostname_sa(). The properties code used to be = the > only really ugly code in this file. > - formatting errors for openpty() (premature line splitting and wrong > continuation indent). The very first prototype in this file gives > an example of normal splitting and continuation indent > - formatting errors for forkpty() (same as for openpty()) > - line too long for realhostname_sa(), pw_copy() > - consider fparseln() as being in a new section so it isn't unsorted. > The start of this section should be delimited by a blank line (this = is > done in -current). The new section isn't really justified. It is > just 1 function ifdefed to avoid a namespace problem. > - no namespace pollution for fparseln()'s parameters, but that it = because > it is in a style different from all older prototypes in the file -- = it > doesn't name its parameters. >=20 > Newer disorder and nearby bugs: > - further unsorting of the forward declarations by adding kinfo* to = the > end of the unsorted list. At least the new declarations are sorted > internally. > - the following protypes in the early sections are disordered: > expand_number(), kld*(), kinfo* (no need for a new section for the > last 2. At least they are each sorted internally), gr_scan() > - the following prototypes have namespace pollution in parameter = names: > hexdump(), kld*(), gr_dup(), gr_equal(), gr_make(), gr_scan(). = Only > about half of the gr*() prototypes have this bug > - better indentation for kinfo*() than for older or newer entries! > - line too long for gr_entry() > - pidfile*() have all of the above bugs, plus they are the only = prototypes > up to this point in the file that don't put a tab before the function > name when the return type is int > - quota*() are slightly worse than pidfile*(). They add the = additional > style bug of not using parameter names at all, except for 1 of 2 > parameters in 1 of 12 prototypes. That parameter is namespace = pollution. >=20 > Bruce Does this patch improve the situation? I have not found guidance for line lengths in style(9) -- am I looking = in the wrong place? Guy Index: libutil.h =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 --- libutil.h (revision 229961) +++ libutil.h (working copy) @@ -84,110 +84,117 @@ #endif =20 /* Avoid pulling in all the include files for no need */ -struct termios; -struct winsize; struct in_addr; struct kinfo_file; struct kinfo_proc; struct kinfo_vmentry; +struct sockaddr; +struct termios; +struct winsize; =20 __BEGIN_DECLS -void clean_environment(const char * const *_white, +char *auth_getval(const char *_name); +void clean_environment(const char * const *_white, const char * const *_more_white); -int extattr_namespace_to_string(int _attrnamespace, char **_string); -int extattr_string_to_namespace(const char *_string, int = *_attrnamespace); -int flopen(const char *_path, int _flags, ...); -void hexdump(const void *ptr, int length, const char *hdr, int = flags); -int login_tty(int _fd); -void trimdomain(char *_fullhost, int _hostsize); -int openpty(int *_amaster, int *_aslave, char *_name, - struct termios *_termp, struct winsize *_winp); -int forkpty(int *_amaster, char *_name, - struct termios *_termp, struct winsize *_winp); -int humanize_number(char *_buf, size_t _len, int64_t _number, +int expand_number(const char *_buf, uint64_t *_num); +int extattr_namespace_to_string(int _attrnamespace, char = **_string); +int extattr_string_to_namespace(const char *_string, int = *_attrnamespace); +int flopen(const char *_path, int _flags, ...); +int forkpty(int *_amaster, char *_name, + struct termios *_termp, struct winsize *_winp); +void hexdump(const void *_ptr, int _length, const char *_hdr, int = _flags); +int humanize_number(char *_buf, size_t _len, int64_t _number, const char *_suffix, int _scale, int _flags); -int expand_number(const char *_buf, uint64_t *_num); -const char *uu_lockerr(int _uu_lockresult); -int uu_lock(const char *_ttyname); -int uu_unlock(const char *_ttyname); -int uu_lock_txfr(const char *_ttyname, pid_t _pid); -int _secure_path(const char *_path, uid_t _uid, gid_t _gid); -properties properties_read(int fd); -void properties_free(properties list); -char *property_find(properties list, const char *name); -char *auth_getval(const char *name); -int realhostname(char *host, size_t hsize, const struct in_addr = *ip); -struct sockaddr; -int realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, - int addrlen); - -int kld_isloaded(const char *name); -int kld_load(const char *name); struct kinfo_file * - kinfo_getfile(pid_t _pid, int *_cntp); + kinfo_getfile(pid_t _pid, int *_cntp); struct kinfo_vmentry * - kinfo_getvmmap(pid_t _pid, int *_cntp); + kinfo_getvmmap(pid_t _pid, int *_cntp); struct kinfo_proc * - kinfo_getallproc(int *_cntp); + kinfo_getallproc(int *_cntp); struct kinfo_proc * - kinfo_getproc(pid_t _pid); + kinfo_getproc(pid_t _pid); +int kld_isloaded(const char *_name); +int kld_load(const char *_name); +int login_tty(int _fd); +int openpty(int *_amaster, int *_aslave, char *_name, + struct termios *_termp, struct winsize *_winp); +void properties_free(properties _list); +properties + properties_read(int fd); +char *property_find(properties _list, const char *_name); +int realhostname(char *_host, size_t _hsize, const struct in_addr = *_ip); +int realhostname_sa(char *_host, size_t _hsize, struct sockaddr = *_addr, + int _addrlen); +void trimdomain(char *_fullhost, int _hostsize); +const char * + uu_lockerr(int _uu_lockresult); +int uu_lock(const char *_ttyname); +int uu_unlock(const char *_ttyname); +int uu_lock_txfr(const char *_ttyname, pid_t _pid); +int _secure_path(const char *_path, uid_t _uid, gid_t _gid); =20 + #ifdef _STDIO_H_ /* avoid adding new includes */ -char *fparseln(FILE *, size_t *, size_t *, const char[3], int); +char *fparseln(FILE *_fp, size_t *_len, size_t *_lineno, + const char _delim[3], int _flags); #endif =20 #ifdef _PWD_H_ -int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct = passwd *_old_pw); +int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct = passwd *_old_pw); struct passwd *pw_dup(const struct passwd *_pw); -int pw_edit(int _notsetuid); -int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); -void pw_fini(void); -int pw_init(const char *_dir, const char *_master); +int pw_edit(int _notsetuid); +int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); +void pw_fini(void); +int pw_init(const char *_dir, const char *_master); char *pw_make(const struct passwd *_pw); char *pw_make_v7(const struct passwd *_pw); -int pw_mkdb(const char *_user); -int pw_lock(void); +int pw_mkdb(const char *_user); +int pw_lock(void); struct passwd *pw_scan(const char *_line, int _flags); const char *pw_tempname(void); -int pw_tmp(int _mfd); +int pw_tmp(int _mfd); #endif =20 #ifdef _GRP_H_ -int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct = group *_old_gr); -struct group *gr_dup(const struct group *gr); -int gr_equal(const struct group *gr1, const struct group *gr2); -void gr_fini(void); -int gr_init(const char *_dir, const char *_master); -int gr_lock(void); -char *gr_make(const struct group *gr); -int gr_mkdb(void); -int gr_tmp(int _mdf); -struct group *gr_scan(const char *line); +int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct = group *_old_gr); +struct group *gr_dup(const struct group *_gr); +int gr_equal(const struct group *_gr1, const struct group *_gr2); +void gr_fini(void); +int gr_init(const char *_dir, const char *_master); +int gr_lock(void); +char *gr_make(const struct group *_gr); +int gr_mkdb(void); +struct group *gr_scan(const char *_line); +int gr_tmp(int _mdf); #endif =20 #ifdef _SYS_PARAM_H_ -struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t = *pidptr); -int pidfile_write(struct pidfh *pfh); -int pidfile_close(struct pidfh *pfh); -int pidfile_remove(struct pidfh *pfh); -int pidfile_fileno(const struct pidfh *pfh); +int pidfile_close(struct pidfh *_pfh); +int pidfile_fileno(const struct pidfh *_pfh); +struct pidfh * + pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); +int pidfile_remove(struct pidfh *_pfh); +int pidfile_write(struct pidfh *_pfh); #endif =20 #ifdef _UFS_UFS_QUOTA_H_ struct quotafile; struct fstab; -struct quotafile *quota_open(struct fstab *, int, int); -void quota_close(struct quotafile *); -int quota_on(struct quotafile *); -int quota_off(struct quotafile *); -const char *quota_fsname(const struct quotafile *); -const char *quota_qfname(const struct quotafile *); -int quota_maxid(struct quotafile *); -int quota_check_path(const struct quotafile *, const char *path); -int quota_read(struct quotafile *, struct dqblk *, int); -int quota_write_limits(struct quotafile *, struct dqblk *, int); -int quota_write_usage(struct quotafile *, struct dqblk *, int); -int quota_convert(struct quotafile *, int); +int quota_check_path(const struct quotafile *_qf, const char = *_path); +void quota_close(struct quotafile *_qf); +int quota_convert(struct quotafile *_qf, int _wordsize); +const char * + quota_fsname(const struct quotafile *_qf); +int quota_maxid(struct quotafile *_qf); +int quota_off(struct quotafile *_qf); +int quota_on(struct quotafile *_qf); +struct quotafile * + quota_open(struct fstab *_fs, int _quotatype, int _openflags); +const char * + quota_qfname(const struct quotafile *_qf); +int quota_read(struct quotafile *_qf, struct dqblk *_dqb, int _id); +int quota_write_limits(struct quotafile *_qf, struct dqblk *_dqb, = int _id); +int quota_write_usage(struct quotafile *_qf, struct dqblk *_dqb, = int _id); #endif =20 __END_DECLS -------- This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure. From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 16:35:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA787106566C; Wed, 11 Jan 2012 16:35:26 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8C4C8FC0A; Wed, 11 Jan 2012 16:35:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BGZQZh067530; Wed, 11 Jan 2012 16:35:26 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BGZQmQ067528; Wed, 11 Jan 2012 16:35:26 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201111635.q0BGZQmQ067528@svn.freebsd.org> From: Guy Helmer Date: Wed, 11 Jan 2012 16:35: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: r229966 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 16:35:26 -0000 Author: ghelmer Date: Wed Jan 11 16:35:26 2012 New Revision: 229966 URL: http://svn.freebsd.org/changeset/base/229966 Log: jilles pointed out that O_CLOEXEC could be used in the open(2) flags rather than using fcntl(2) later, and in addition to saving a system call, removes a possible race with fork/exec from threads or signal handlers. Modified: head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Wed Jan 11 15:00:16 2012 (r229965) +++ head/lib/libutil/pidfile.c Wed Jan 11 16:35:26 2012 (r229966) @@ -117,7 +117,7 @@ pidfile_open(const char *path, mode_t mo * pidfile_write() can be called multiple times. */ fd = flopen(pfh->pf_path, - O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, mode); + O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NONBLOCK, mode); if (fd == -1) { if (errno == EWOULDBLOCK && pidptr != NULL) { count = 20; @@ -139,19 +139,6 @@ pidfile_open(const char *path, mode_t mo } /* - * Prevent the file descriptor from escaping to other - * programs via exec(3). - */ - if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { - error = errno; - unlink(pfh->pf_path); - close(fd); - free(pfh); - errno = error; - return (NULL); - } - - /* * Remember file information, so in pidfile_write() we are sure we write * to the proper descriptor. */ From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 16:36:44 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 535851065675; Wed, 11 Jan 2012 16:36:44 +0000 (UTC) (envelope-from guy.helmer@palisadesystems.com) Received: from ps-1-a.compliancesafe.com (ps-1-a.compliancesafe.com [216.81.161.161]) by mx1.freebsd.org (Postfix) with ESMTP id 169D58FC13; Wed, 11 Jan 2012 16:36:43 +0000 (UTC) Received: from mail.palisadesystems.com (localhost [127.0.0.1]) by ps-1-a.compliancesafe.com (8.14.4/8.14.3) with ESMTP id q0BGaPuX082734; Wed, 11 Jan 2012 10:36:25 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) Received: from guysmbp.dyn.palisadesys.com (GuysMBP.dyn.palisadesys.com [172.16.2.90]) (authenticated bits=0) by mail.palisadesystems.com (8.14.3/8.14.3) with ESMTP id q0BGaAqe041728 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 11 Jan 2012 10:36:19 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.palisadesystems.com q0BGaAqe041728 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=palisadesystems.com; s=mail; t=1326299779; bh=AOsWNRkvZ4VEI675YH7H1A6JJM+QLY4D8htAVExs8YM=; l=128; h=Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=RsWbeGa/wU9S6mWjcPQh5mQwdPkUTl1ixQ7unmPn88rTEDXG4k9EaRVvC6hZfFvQl z1sGhmq9ls/4o/sjm6CFlhCmsY64ZCLU3G7d1dlZqL0Df42ZDMwn0iBoQL3GSMTpNx 3XZmIys3gOc8KCzMwzoXYEzh7+RGPoJ92k1wYpfM= Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: Guy Helmer In-Reply-To: <20120110230607.GA15897@stack.nl> Date: Wed, 11 Jan 2012 10:36:09 -0600 Content-Transfer-Encoding: 7bit Message-Id: <38F874EE-9573-4370-A3BD-DA08594023CD@palisadesystems.com> References: <201201101843.q0AIhRuM022949@svn.freebsd.org> <20120110230607.GA15897@stack.nl> To: Jilles Tjoelker X-Mailer: Apple Mail (2.1251.1) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.palisadesystems.com [172.16.1.5]); Wed, 11 Jan 2012 10:36:19 -0600 (CST) X-Palisade-MailScanner-Information: Please contact the ISP for more information X-Palisade-MailScanner-ID: q0BGaAqe041728 X-Palisade-MailScanner: Found to be clean X-Palisade-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-1.628, required 5, ALL_TRUSTED -1.00, BAYES_00 -1.90, RP_8BIT 1.27) X-Palisade-MailScanner-From: guy.helmer@palisadesystems.com X-Spam-Status: No X-PacketSure-Scanned: Yes Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229936 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 16:36:44 -0000 On Jan 10, 2012, at 5:06 PM, Jilles Tjoelker wrote: > On Tue, Jan 10, 2012 at 06:43:27PM +0000, Guy Helmer wrote: >> Author: ghelmer >> Date: Tue Jan 10 18:43:27 2012 >> New Revision: 229936 >> URL: http://svn.freebsd.org/changeset/base/229936 > >> Log: >> Set the FD_CLOEXEC flag on the open pidfile file descriptor. > >> Discussed with: pjd, des > >> Modified: >> head/lib/libutil/pidfile.c > >> + /* >> + * Prevent the file descriptor from escaping to other >> + * programs via exec(3). >> + */ >> + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { > > Consider adding O_CLOEXEC to the flopen() flags instead. That saves a > system call and removes a possible race condition with fork/exec from > threads or signal handlers. > > -- > Jilles Tjoelker Good idea, thanks! Guy -------- This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure. From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 16:40:08 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44CC0106564A; Wed, 11 Jan 2012 16:40:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id CAAFA8FC18; Wed, 11 Jan 2012 16:40:07 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0BGe3Vg010012 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 Jan 2012 03:40:05 +1100 Date: Thu, 12 Jan 2012 03:40:03 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Guy Helmer In-Reply-To: <26EF49B4-1B8E-43BC-AC7B-FD24BB94C961@palisadesystems.com> Message-ID: <20120112025133.H2744@besplex.bde.org> References: <201201101953.q0AJrPao025097@svn.freebsd.org> <20120110221323.GE1694@garage.freebsd.pl> <20120111214848.K1813@besplex.bde.org> <26EF49B4-1B8E-43BC-AC7B-FD24BB94C961@palisadesystems.com> 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, Pawel Jakub Dawidek , Bruce Evans Subject: Re: svn commit: r229937 - in head/lib: libc/gen libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 16:40:08 -0000 On Wed, 11 Jan 2012, Guy Helmer wrote: > On Jan 11, 2012, at 6:25 AM, Bruce Evans wrote: >> Is there any chance of keeping sorted lists sorted? >> >> This file used to be mostly sorted and mostly in KNF (tab before >> function names) and mostly without namespace pollution in parameter >> names). Newer code in it violates all of these style and header >> implementation rules. The pidfile code was already especially bad, >> and adding to the end of the unsorted list in it doesn't help. >> >> The pidfile man page is also unsorted. It was in "operations" order >> ... The Makefile for libutil is also unsorted: - SRCS is sorted or nearly so - disorder in MAN begins with pty.3. The rest of MAN is unsorted in much the same disorder as the prototypes - MLINKS is considerably more disordered, but is much larger so it needs ordering even more. SRCS and MAN are simple lists (except for the internal structure of MAN -- sections). MLINKS has more internal structure (pairs of link source and target, which should be sorted on the source first, then the target. See Makefile.inc's in libc for rasonably correct examples. > Does this patch improve the situation? Sure. > I have not found guidance for line lengths in style(9) -- am I looking in the wrong place? Not really. style(9) is supposed to consist mainly of examples. It contains no examples of lines longer than 80 (preferably 79). Therefore, lines longer than 80 are bad style. You have to know that it has been mangled into man page form and cancel the lossages from this. One lossage is that man adds a left margin of 5 spaces. So it is lines of length longer than 85 in the man output that would be too long. man should format man pages for the terminal or page width. This might exceed 80, or it might be less than 85 so it might be man and not the examples that are giving the line length limit. However, most of the examples are in literal text which man should not reformat. Thus the output has some lines slightly longer than 80 if that is the terminal width, but hopefully none more than 85. The 5 character margin also destroys the tab structure in the output. The man page is careful to preserve the 8-column primary indentation and the 4-column continuation-line indentation, but these cannot be done with tabs. Some user like wide terminals, but small screens are more common now, so even 80 columns may be too wide for a default. It's just too hard to have enough indentation in 64 columns. > Index: libutil.h > =================================================================== > --- libutil.h (revision 229961) > +++ libutil.h (working copy) > @@ -84,110 +84,117 @@ > ... > __BEGIN_DECLS > -void clean_environment(const char * const *_white, > +char *auth_getval(const char *_name); > +void clean_environment(const char * const *_white, > const char * const *_more_white); > -int extattr_namespace_to_string(int _attrnamespace, char **_string); > -int extattr_string_to_namespace(const char *_string, int *_attrnamespace); > -int flopen(const char *_path, int _flags, ...); I'd prefer to see the changes separately: sort, reformat, fix namespaces; not necessarily in that order. Sorting gives especially unreadable diffs. Here you changed to the style that leaves an extra space before the function name to line up with function names that have a `*' before them. That is too much for me. It also gives unreadable diffs by changing almost every line, since it was not used in this file before. This can be seen in the declaration of `clean_environment' above. > ... > +int uu_unlock(const char *_ttyname); > +int uu_lock_txfr(const char *_ttyname, pid_t _pid); > +int _secure_path(const char *_path, uid_t _uid, gid_t _gid); The best order for sorting `_foo' is unclear. In ASCII it is between A-Z and a-z. Lists in makefiles mostly use pure ASCII order since that is easiest to generate and check by doing the sorting using ls. In source code we might prefer to ignore underscores in sorting. The leading underscore in this name seems to be bogus. The function is documented. Use of it in other library functions might require an underscore to avoid namespace pollution, but this library is not generally careful about that. > > + Extra blank line. > +int quota_check_path(const struct quotafile *_qf, const char *_path); > +void quota_close(struct quotafile *_qf); > +int quota_convert(struct quotafile *_qf, int _wordsize); > ... I checked that a few of these names match the man page. Seems fairly complete and correct. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 16:53:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE8FB1065686; Wed, 11 Jan 2012 16:53:51 +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 DCCA58FC16; Wed, 11 Jan 2012 16:53:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BGrpiX068126; Wed, 11 Jan 2012 16:53:51 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BGrpuq068124; Wed, 11 Jan 2012 16:53:51 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201201111653.q0BGrpuq068124@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 11 Jan 2012 16:53: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: r229967 - head/sys/powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 16:53:52 -0000 Author: nwhitehorn Date: Wed Jan 11 16:53:51 2012 New Revision: 229967 URL: http://svn.freebsd.org/changeset/base/229967 Log: Add a memory barrier to bus_dmamap_sync(), as should have always been present. We need a sync instead of eieio, as eieio does not enforce storage ordering between main and device memory. Modified: head/sys/powerpc/powerpc/busdma_machdep.c Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Wed Jan 11 16:35:26 2012 (r229966) +++ head/sys/powerpc/powerpc/busdma_machdep.c Wed Jan 11 16:53:51 2012 (r229967) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "iommu_if.h" @@ -979,6 +980,8 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus dmat->bounce_zone->total_bounced++; } } + + powerpc_sync(); } static void From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 17:10:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C86E106566B; Wed, 11 Jan 2012 17:10:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B3CB8FC0A; Wed, 11 Jan 2012 17:10:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BHARkJ068684; Wed, 11 Jan 2012 17:10:27 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BHARJO068682; Wed, 11 Jan 2012 17:10:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201111710.q0BHARJO068682@svn.freebsd.org> From: Adrian Chadd Date: Wed, 11 Jan 2012 17:10: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: r229968 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 17:10:27 -0000 Author: adrian Date: Wed Jan 11 17:10:27 2012 New Revision: 229968 URL: http://svn.freebsd.org/changeset/base/229968 Log: Add the ability to kick an existing mesh node without waiting for it to time out. Submitted by: Monthadar Al Jaberi Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Wed Jan 11 16:53:51 2012 (r229967) +++ head/sys/net80211/ieee80211_ioctl.c Wed Jan 11 17:10:27 2012 (r229968) @@ -1397,6 +1397,17 @@ setmlme_common(struct ieee80211vap *vap, IEEE80211_FC0_SUBTYPE_DEAUTH, reason); ieee80211_free_node(ni); break; + case IEEE80211_M_MBSS: + IEEE80211_NODE_LOCK(nt); + ni = ieee80211_find_node_locked(nt, mac); + if (ni != NULL) { + ieee80211_node_leave(ni); + ieee80211_free_node(ni); + } else { + error = ENOENT; + } + IEEE80211_NODE_UNLOCK(nt); + break; default: error = EINVAL; break; From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 17:41:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1C42106567C; Wed, 11 Jan 2012 17:41:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DDBB8FC14; Wed, 11 Jan 2012 17:41:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BHfEBX069721; Wed, 11 Jan 2012 17:41:14 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BHfEEl069717; Wed, 11 Jan 2012 17:41:14 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201111741.q0BHfEEl069717@svn.freebsd.org> From: Adrian Chadd Date: Wed, 11 Jan 2012 17:41:14 +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: r229970 - in head/sys: dev/wtap dev/wtap/plugins dev/wtap/wtap_hal modules/wtap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 17:41:14 -0000 Author: adrian Date: Wed Jan 11 17:41:14 2012 New Revision: 229970 URL: http://svn.freebsd.org/changeset/base/229970 Log: Introduce wtap, the beginnings of a net80211 wlan simulator. This introduces: * a basic wtap interface * a HAL, which implements an abstraction layer for implementing different device behavious; * A visibility plugin, which allows for control over which nodes see other nodes (useful for mesh work.) It doesn't yet implement sta/adhoc/hostap modes but these are quite feasible to implement. Monthadar uses it to do 802.11s mesh verification. The userland tools will be committed in a follow-up commit. Submitted by: Monthadar Al Jaberi Added: head/sys/dev/wtap/ head/sys/dev/wtap/if_medium.c (contents, props changed) head/sys/dev/wtap/if_medium.h (contents, props changed) head/sys/dev/wtap/if_wtap.c (contents, props changed) head/sys/dev/wtap/if_wtap_module.c (contents, props changed) head/sys/dev/wtap/if_wtapioctl.h (contents, props changed) head/sys/dev/wtap/if_wtapvar.h (contents, props changed) head/sys/dev/wtap/plugins/ head/sys/dev/wtap/plugins/visibility.c (contents, props changed) head/sys/dev/wtap/plugins/visibility.h (contents, props changed) head/sys/dev/wtap/plugins/visibility_ioctl.h (contents, props changed) head/sys/dev/wtap/plugins/wtap_plugin.h (contents, props changed) head/sys/dev/wtap/wtap_hal/ head/sys/dev/wtap/wtap_hal/hal.c (contents, props changed) head/sys/dev/wtap/wtap_hal/hal.h (contents, props changed) head/sys/dev/wtap/wtap_hal/handler.h (contents, props changed) head/sys/modules/wtap/ head/sys/modules/wtap/Makefile (contents, props changed) Added: head/sys/dev/wtap/if_medium.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/wtap/if_medium.c Wed Jan 11 17:41:14 2012 (r229970) @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 2010-2011 Monthadar Al Jaberi, TerraNet AB + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ +#include "if_wtapvar.h" +#include "if_medium.h" + +void +init_medium(struct wtap_medium *md) +{ + + DWTAP_PRINTF("%s\n", __func__); + STAILQ_INIT(&md->md_pktbuf); + mtx_init(&md->md_mtx, "wtap_medium mtx", NULL, MTX_DEF | MTX_RECURSE); + + /* Event handler for sending packets between wtaps */ + struct eventhandler *eh = (struct eventhandler *) + malloc(sizeof(struct eventhandler), M_WTAP, M_NOWAIT | M_ZERO); + eh->tq = taskqueue_create("wtap_tx_taskq", M_NOWAIT | M_ZERO, + taskqueue_thread_enqueue, &eh->tq); + taskqueue_start_threads(&eh->tq, 1, PI_NET, "%s taskq", "wtap_medium"); + md->tx_handler = eh; + /* Mark medium closed by default */ + md->open = 0; +} + +void +deinit_medium(struct wtap_medium *md) +{ + + DWTAP_PRINTF("%s\n", __func__); + taskqueue_free(md->tx_handler->tq); + free(md->tx_handler, M_WTAP); +} + +int +medium_transmit(struct wtap_medium *md, int id, struct mbuf*m) +{ + + mtx_lock(&md->md_mtx); + if (md->open == 0){ + DWTAP_PRINTF("[%d] dropping m=%p\n", id, m); + m_free(m); + mtx_unlock(&md->md_mtx); + return 0; + } + + DWTAP_PRINTF("[%d] transmiting m=%p\n", id, m); + struct packet *p = (struct packet *)malloc(sizeof(struct packet), + M_WTAP_PACKET, M_ZERO | M_NOWAIT); + p->id = id; + p->m = m; + + STAILQ_INSERT_TAIL(&md->md_pktbuf, p, pf_list); + taskqueue_enqueue(md->tx_handler->tq, &md->tx_handler->proc); + mtx_unlock(&md->md_mtx); + + return 0; +} + +struct packet * +medium_get_next_packet(struct wtap_medium *md) +{ + struct packet *p; + + mtx_lock(&md->md_mtx); + p = STAILQ_FIRST(&md->md_pktbuf); + if (p == NULL){ + mtx_unlock(&md->md_mtx); + return NULL; + } + + STAILQ_REMOVE_HEAD(&md->md_pktbuf, pf_list); + mtx_unlock(&md->md_mtx); + return p; +} + +void +medium_open(struct wtap_medium *md) +{ + + mtx_lock(&md->md_mtx); + md->open = 1; + mtx_unlock(&md->md_mtx); +} + +void +medium_close(struct wtap_medium *md) +{ + + mtx_lock(&md->md_mtx); + md->open = 0; + mtx_unlock(&md->md_mtx); +} Added: head/sys/dev/wtap/if_medium.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/wtap/if_medium.h Wed Jan 11 17:41:14 2012 (r229970) @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 2010-2011 Monthadar Al Jaberi, TerraNet AB + * All rights reserved. + * + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +#ifndef __DEV_WTAP_MEDIUM_H__ +#define __DEV_WTAP_MEDIUM_H__ + +#include "if_wtapvar.h" +#include "wtap_hal/handler.h" + +struct packet { + STAILQ_ENTRY(packet) pf_list; + struct mbuf * m; + int id; +}; +typedef STAILQ_HEAD(, packet) md_pkthead; + +struct wtap_medium { + struct mtx md_mtx; +#if 0 + int visibility[MAX_NBR_WTAP]; + struct stailhead *headp; + packet_head pktbuf; + STAILQ_HEAD(stailhead, packet) pktbuf; + STAILQ_HEAD(stailhead, packet) pktbuf; + /* = STAILQ_HEAD_INITIALIZER(head); */ +#endif + /* 0 means we drop packets, 1 we queue them */ + int open; + md_pkthead md_pktbuf; /* master queue */ + struct eventhandler *tx_handler; + struct timehandler *bc_handler; +}; + +extern void init_medium(struct wtap_medium *); +extern void deinit_medium(struct wtap_medium *); +extern void medium_open(struct wtap_medium *); +extern void medium_close(struct wtap_medium *); +extern int medium_transmit(struct wtap_medium *, int id, struct mbuf*); +extern struct packet *medium_get_next_packet(struct wtap_medium *); + +#endif /* __DEV_WTAP_MEDIUM_H__ */ Added: head/sys/dev/wtap/if_wtap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/wtap/if_wtap.c Wed Jan 11 17:41:14 2012 (r229970) @@ -0,0 +1,904 @@ +/*- + * Copyright (c) 2010-2011 Monthadar Al Jaberi, TerraNet AB + * All rights reserved. + * + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ +#include "if_wtapvar.h" +#include /* uio struct */ +#include +#include +#include + +#include +#include "if_medium.h" + +/* device for IOCTL and read/write for debuggin purposes */ +/* Function prototypes */ +static d_open_t wtap_node_open; +static d_close_t wtap_node_close; +static d_write_t wtap_node_write; +static d_ioctl_t wtap_node_ioctl; + +static struct cdevsw wtap_cdevsw = { + .d_version = D_VERSION, + .d_flags = 0, + .d_open = wtap_node_open, + .d_close = wtap_node_close, + .d_write = wtap_node_write, + .d_ioctl = wtap_node_ioctl, + .d_name = "wtapnode", +}; + +static int +wtap_node_open(struct cdev *dev, int oflags, int devtype, struct thread *p) +{ + + int err = 0; + uprintf("Opened device \"echo\" successfully.\n"); + return(err); +} + +static int +wtap_node_close(struct cdev *dev, int fflag, int devtype, struct thread *p) +{ + + uprintf("Closing device \"echo.\"\n"); + return(0); +} + +static int +wtap_node_write(struct cdev *dev, struct uio *uio, int ioflag) +{ + int err = 0; + struct mbuf *m; + struct ifnet *ifp; + struct wtap_softc *sc; + uint8_t buf[1024]; + int buf_len; + + uprintf("write device %s \"echo.\"\n", dev->si_name); + buf_len = MIN(uio->uio_iov->iov_len, 1024); + err = copyin(uio->uio_iov->iov_base, buf, buf_len); + + if (err != 0) { + uprintf("Write failed: bad address!\n"); + return (err); + } + + MGETHDR(m, M_DONTWAIT, MT_DATA); + m_copyback(m, 0, buf_len, buf); + + CURVNET_SET(TD_TO_VNET(curthread)); + IFNET_RLOCK_NOSLEEP(); + + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + printf("ifp->if_xname = %s\n", ifp->if_xname); + if(strcmp(dev->si_name, ifp->if_xname) == 0){ + printf("found match, correspoding wtap = %s\n", + ifp->if_xname); + sc = (struct wtap_softc *)ifp->if_softc; + printf("wtap id = %d\n", sc->id); + wtap_inject(sc, m); + } + } + + IFNET_RUNLOCK_NOSLEEP(); + CURVNET_RESTORE(); + + return(err); +} + +int +wtap_node_ioctl(struct cdev *dev, u_long cmd, caddr_t data, + int fflag, struct thread *td) +{ + int error = 0; + + switch(cmd) { + default: + DWTAP_PRINTF("Unkown WTAP IOCTL\n"); + error = EINVAL; + } + return error; +} + +static int wtap_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, + const struct ieee80211_bpf_params *params); + +static int +wtap_medium_enqueue(struct wtap_vap *avp, struct mbuf *m) +{ + + return medium_transmit(avp->av_md, avp->id, m); +} + +static int +wtap_media_change(struct ifnet *ifp) +{ + + DWTAP_PRINTF("%s\n", __func__); + int error = ieee80211_media_change(ifp); + /* NB: only the fixed rate can change and that doesn't need a reset */ + return (error == ENETRESET ? 0 : error); +} + +/* + * Intercept management frames to collect beacon rssi data + * and to do ibss merges. + */ +static void +wtap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m, + int subtype, int rssi, int nf) +{ + struct ieee80211vap *vap = ni->ni_vap; +#if 0 + DWTAP_PRINTF("[%d] %s\n", myath_id(ni), __func__); +#endif + WTAP_VAP(vap)->av_recv_mgmt(ni, m, subtype, rssi, nf); +} + +static int +wtap_reset_vap(struct ieee80211vap *vap, u_long cmd) +{ + + DWTAP_PRINTF("%s\n", __func__); + return 0; +} + +static void +wtap_beacon_update(struct ieee80211vap *vap, int item) +{ + struct ieee80211_beacon_offsets *bo = &WTAP_VAP(vap)->av_boff; + + DWTAP_PRINTF("%s\n", __func__); + setbit(bo->bo_flags, item); +} + +/* + * Allocate and setup an initial beacon frame. + */ +static int +wtap_beacon_alloc(struct wtap_softc *sc, struct ieee80211_node *ni) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct wtap_vap *avp = WTAP_VAP(vap); + + DWTAP_PRINTF("[%s] %s\n", ether_sprintf(ni->ni_macaddr), __func__); + + /* + * NB: the beacon data buffer must be 32-bit aligned; + * we assume the mbuf routines will return us something + * with this alignment (perhaps should assert). + */ + avp->beacon = ieee80211_beacon_alloc(ni, &avp->av_boff); + if (avp->beacon == NULL) { + printf("%s: cannot get mbuf\n", __func__); + return ENOMEM; + } + callout_init(&avp->av_swba, 0); + avp->bf_node = ieee80211_ref_node(ni); + + return 0; +} + +static void +wtap_beacon_config(struct wtap_softc *sc, struct ieee80211vap *vap) +{ + + DWTAP_PRINTF("%s\n", __func__); +} + +static void +wtap_beacon_intrp(void *arg) +{ + struct wtap_vap *avp = arg; + struct ieee80211vap *vap = arg; + struct mbuf *m; + + KASSERT(vap->iv_state >= IEEE80211_S_RUN, + ("not running, state %d", vap->iv_state)); + DWTAP_PRINTF("[%d] beacon intrp\n", avp->id); //burst mode + /* + * Update dynamic beacon contents. If this returns + * non-zero then we need to remap the memory because + * the beacon frame changed size (probably because + * of the TIM bitmap). + */ + m = m_dup(avp->beacon, M_DONTWAIT); + if (ieee80211_beacon_update(avp->bf_node, &avp->av_boff, m, 0)) { + printf("%s, need to remap the memory because the beacon frame" + " changed size.\n",__func__); + } + + if (ieee80211_radiotap_active_vap(vap)) + ieee80211_radiotap_tx(vap, m); + +#if 0 + medium_transmit(avp->av_md, avp->id, m); +#endif + wtap_medium_enqueue(avp, m); + callout_schedule(&avp->av_swba, avp->av_bcinterval); +} + +static int +wtap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) +{ + struct ieee80211com *ic = vap->iv_ic; + struct wtap_softc *sc = ic->ic_ifp->if_softc; + struct wtap_vap *avp = WTAP_VAP(vap); + struct ieee80211_node *ni = NULL; + int error; + + DWTAP_PRINTF("%s\n", __func__); + + ni = vap->iv_bss; + /* + * Invoke the parent method to do net80211 work. + */ + error = avp->av_newstate(vap, nstate, arg); + if (error != 0) + goto bad; + + if (nstate == IEEE80211_S_RUN) { + /* NB: collect bss node again, it may have changed */ + ni = vap->iv_bss; + switch (vap->iv_opmode) { + case IEEE80211_M_MBSS: + error = wtap_beacon_alloc(sc, ni); + if (error != 0) + goto bad; + wtap_beacon_config(sc, vap); + callout_reset(&avp->av_swba, avp->av_bcinterval, + wtap_beacon_intrp, vap); + break; + default: + goto bad; + } + } + return 0; +bad: + printf("%s: bad\n", __func__); + return error; +} + +static void +wtap_bmiss(struct ieee80211vap *vap) +{ + struct wtap_vap *avp = (struct wtap_vap *)vap; + + DWTAP_PRINTF("%s\n", __func__); + avp->av_bmiss(vap); +} + +static struct ieee80211vap * +wtap_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], + int unit, enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) +{ + struct wtap_softc *sc = ic->ic_ifp->if_softc; + struct ieee80211vap *vap; + struct wtap_vap *avp; + int error; + + DWTAP_PRINTF("%s\n", __func__); + + avp = (struct wtap_vap *) malloc(sizeof(struct wtap_vap), + M_80211_VAP, M_NOWAIT | M_ZERO); + avp->id = sc->id; + avp->av_md = sc->sc_md; + avp->av_bcinterval = BEACON_INTRERVAL + 100*sc->id; + vap = (struct ieee80211vap *) avp; + error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + /* override various methods */ + avp->av_recv_mgmt = vap->iv_recv_mgmt; + vap->iv_recv_mgmt = wtap_recv_mgmt; + vap->iv_reset = wtap_reset_vap; + vap->iv_update_beacon = wtap_beacon_update; + avp->av_newstate = vap->iv_newstate; + vap->iv_newstate = wtap_newstate; + avp->av_bmiss = vap->iv_bmiss; + vap->iv_bmiss = wtap_bmiss; + + /* complete setup */ + ieee80211_vap_attach(vap, wtap_media_change, ieee80211_media_status); + avp->av_dev = make_dev(&wtap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, + (const char *)ic->ic_ifp->if_xname); + + /* TODO this is a hack to force it to choose the rate we want */ + vap->iv_bss->ni_txrate = 130; + return vap; +} + +static void +wtap_vap_delete(struct ieee80211vap *vap) +{ + struct wtap_vap *avp = WTAP_VAP(vap); + + DWTAP_PRINTF("%s\n", __func__); + destroy_dev(avp->av_dev); + callout_stop(&avp->av_swba); + ieee80211_vap_detach(vap); + free((struct wtap_vap*) vap, M_80211_VAP); +} + +/* NB: This function is not used. + * I had the problem of the queue + * being empty all the time. + * Maybe I am setting the queue wrong? + */ +static void +wtap_start(struct ifnet *ifp) +{ + struct ieee80211com *ic = ifp->if_l2com; + struct ifnet *icifp = ic->ic_ifp; + struct wtap_softc *sc = icifp->if_softc; + struct ieee80211_node *ni; + struct mbuf *m; + + DWTAP_PRINTF("my_start, with id=%u\n", sc->id); + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sc->up == 0) + return; + for (;;) { + if(IFQ_IS_EMPTY(&ifp->if_snd)){ + printf("queue empty, just trying to see " + "if the other queue is empty\n"); +#if 0 + printf("queue for id=1, %u\n", + IFQ_IS_EMPTY(&global_mscs[1]->ifp->if_snd)); + printf("queue for id=0, %u\n", + IFQ_IS_EMPTY(&global_mscs[0]->ifp->if_snd)); +#endif + break; + } + IFQ_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) { + printf("error dequeueing from ifp->snd\n"); + break; + } + ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; + /* + * Check for fragmentation. If this frame + * has been broken up verify we have enough + * buffers to send all the fragments so all + * go out or none... + */ +#if 0 + STAILQ_INIT(&frags); +#endif + if ((m->m_flags & M_FRAG)){ + printf("dont support frags\n"); + ifp->if_oerrors++; + return; + } + ifp->if_opackets++; + if(wtap_raw_xmit(ni, m, NULL) < 0){ + printf("error raw_xmiting\n"); + ifp->if_oerrors++; + return; + } + } +} + +static int +wtap_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ +#if 0 + DWTAP_PRINTF("%s\n", __func__); + uprintf("%s, command %lu\n", __func__, cmd); +#endif +#define IS_RUNNING(ifp) \ + ((ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING)) + struct ieee80211com *ic = ifp->if_l2com; + struct wtap_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *)data; + int error = 0; + + switch (cmd) { + case SIOCSIFFLAGS: + //printf("%s: %s\n", __func__, "SIOCSIFFLAGS"); + if (IS_RUNNING(ifp)) { + DWTAP_PRINTF("running\n"); +#if 0 + /* + * To avoid rescanning another access point, + * do not call ath_init() here. Instead, + * only reflect promisc mode settings. + */ + //ath_mode_init(sc); +#endif + } else if (ifp->if_flags & IFF_UP) { + DWTAP_PRINTF("up\n"); + sc->up = 1; +#if 0 + /* + * Beware of being called during attach/detach + * to reset promiscuous mode. In that case we + * will still be marked UP but not RUNNING. + * However trying to re-init the interface + * is the wrong thing to do as we've already + * torn down much of our state. There's + * probably a better way to deal with this. + */ + //if (!sc->sc_invalid) + // ath_init(sc); /* XXX lose error */ +#endif + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ieee80211_start_all(ic); + } else { + DWTAP_PRINTF("stoping\n"); +#if 0 + ath_stop_locked(ifp); +#ifdef notyet + /* XXX must wakeup in places like ath_vap_delete */ + if (!sc->sc_invalid) + ath_hal_setpower(sc->sc_ah, HAL_PM_FULL_SLEEP); +#endif +#endif + } + break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: +#if 0 + DWTAP_PRINTF("%s: %s\n", __func__, "SIOCGIFMEDIA|SIOCSIFMEDIA"); +#endif + error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd); + break; + case SIOCGIFADDR: +#if 0 + DWTAP_PRINTF("%s: %s\n", __func__, "SIOCGIFADDR"); +#endif + error = ether_ioctl(ifp, cmd, data); + break; + default: + DWTAP_PRINTF("%s: %s [%lu]\n", __func__, "EINVAL", cmd); + error = EINVAL; + break; + } + return error; +#undef IS_RUNNING +} + +static void +wtap_init(void *arg){ + + DWTAP_PRINTF("%s\n", __func__); +} + +static void +wtap_scan_start(struct ieee80211com *ic) +{ + +#if 0 + DWTAP_PRINTF("%s\n", __func__); +#endif +} + +static void +wtap_scan_end(struct ieee80211com *ic) +{ + +#if 0 + DWTAP_PRINTF("%s\n", __func__); +#endif +} + +static void +wtap_set_channel(struct ieee80211com *ic) +{ + +#if 0 + DWTAP_PRINTF("%s\n", __func__); +#endif +} + +static int +wtap_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, + const struct ieee80211_bpf_params *params) +{ +#if 0 + DWTAP_PRINTF("%s, %p\n", __func__, m); +#endif + struct ieee80211vap *vap = ni->ni_vap; + struct wtap_vap *avp = WTAP_VAP(vap); + + if (ieee80211_radiotap_active_vap(vap)) { + ieee80211_radiotap_tx(vap, m); + } + if (m->m_flags & M_TXCB) + ieee80211_process_callback(ni, m, 0); + ieee80211_free_node(ni); + return wtap_medium_enqueue(avp, m); +} + +void +wtap_inject(struct wtap_softc *sc, struct mbuf *m) +{ + struct wtap_buf *bf = (struct wtap_buf *)malloc(sizeof(struct wtap_buf), + M_WTAP_RXBUF, M_NOWAIT | M_ZERO); + KASSERT(bf != NULL, ("could not allocated a new wtap_buf\n")); + bf->m = m; + + mtx_lock(&sc->sc_mtx); + STAILQ_INSERT_TAIL(&sc->sc_rxbuf, bf, bf_list); + taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); + mtx_unlock(&sc->sc_mtx); +} + +void +wtap_rx_deliver(struct wtap_softc *sc, struct mbuf *m) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211_node *ni; + int type; +#if 0 + DWTAP_PRINTF("%s\n", __func__); +#endif + + DWTAP_PRINTF("[%d] receiving m=%p\n", sc->id, m); + if (m == NULL) { /* NB: shouldn't happen */ + if_printf(ifp, "%s: no mbuf!\n", __func__); + } + + ifp->if_ipackets++; + + ieee80211_dump_pkt(ic, mtod(m, caddr_t), 0,0,0); + + /* + * Locate the node for sender, track state, and then + * pass the (referenced) node up to the 802.11 layer + * for its use. + */ + ni = ieee80211_find_rxnode_withkey(ic, + mtod(m, const struct ieee80211_frame_min *),IEEE80211_KEYIX_NONE); + if (ni != NULL) { + /* + * Sending station is known, dispatch directly. + */ + type = ieee80211_input(ni, m, 1<<7, 10); + ieee80211_free_node(ni); + } else { + type = ieee80211_input_all(ic, m, 1<<7, 10); + } +} + +static void +wtap_rx_proc(void *arg, int npending) +{ + struct wtap_softc *sc = (struct wtap_softc *)arg; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct mbuf *m; + struct ieee80211_node *ni; + int type; + struct wtap_buf *bf; + +#if 0 + DWTAP_PRINTF("%s\n", __func__); +#endif + + for(;;) { + mtx_lock(&sc->sc_mtx); + bf = STAILQ_FIRST(&sc->sc_rxbuf); + if (bf == NULL) { + mtx_unlock(&sc->sc_mtx); + return; + } + STAILQ_REMOVE_HEAD(&sc->sc_rxbuf, bf_list); + mtx_unlock(&sc->sc_mtx); + KASSERT(bf != NULL, ("wtap_buf is NULL\n")); + m = bf->m; + DWTAP_PRINTF("[%d] receiving m=%p\n", sc->id, bf->m); + if (m == NULL) { /* NB: shouldn't happen */ + if_printf(ifp, "%s: no mbuf!\n", __func__); + free(bf, M_WTAP_RXBUF); + return; + } + + ifp->if_ipackets++; +#if 0 + ieee80211_dump_pkt(ic, mtod(m, caddr_t), 0,0,0); +#endif + + /* + * Locate the node for sender, track state, and then + * pass the (referenced) node up to the 802.11 layer + * for its use. + */ + ni = ieee80211_find_rxnode_withkey(ic, + mtod(m, const struct ieee80211_frame_min *), + IEEE80211_KEYIX_NONE); + if (ni != NULL) { + /* + * Sending station is known, dispatch directly. + */ +#if 0 + ieee80211_radiotap_rx(ni->ni_vap, m); +#endif + type = ieee80211_input(ni, m, 1<<7, 10); + ieee80211_free_node(ni); + } else { +#if 0 + ieee80211_radiotap_rx_all(ic, m); +#endif + type = ieee80211_input_all(ic, m, 1<<7, 10); + } + + /* The mbufs are freed by the Net80211 stack */ + free(bf, M_WTAP_RXBUF); + } +} + +static void +wtap_newassoc(struct ieee80211_node *ni, int isnew) +{ + + DWTAP_PRINTF("%s\n", __func__); +} + +/* + * Callback from the 802.11 layer to update WME parameters. + */ +static int +wtap_wme_update(struct ieee80211com *ic) +{ + + DWTAP_PRINTF("%s\n", __func__); + return 0; +} + +static void +wtap_update_mcast(struct ifnet *ifp) +{ + + DWTAP_PRINTF("%s\n", __func__); +} + +static void +wtap_update_promisc(struct ifnet *ifp) +{ + + DWTAP_PRINTF("%s\n", __func__); +} + +static int +wtap_if_transmit(struct ifnet *ifp, struct mbuf *m) +{ + struct ieee80211_node *ni = + (struct ieee80211_node *) m->m_pkthdr.rcvif; + struct ieee80211vap *vap = ni->ni_vap; + struct wtap_vap *avp = WTAP_VAP(vap); + + if(ni == NULL){ + printf("m->m_pkthdr.rcvif is NULL we cant radiotap_tx\n"); + }else{ + if (ieee80211_radiotap_active_vap(vap)) + ieee80211_radiotap_tx(vap, m); + } + if (m->m_flags & M_TXCB) + ieee80211_process_callback(ni, m, 0); + ieee80211_free_node(ni); + return wtap_medium_enqueue(avp, m); +} + +static struct ieee80211_node * +wtap_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) +{ + struct ieee80211_node *ni; + + DWTAP_PRINTF("%s\n", __func__); + + ni = malloc(sizeof(struct ieee80211_node), M_80211_NODE, + M_NOWAIT|M_ZERO); + + ni->ni_txrate = 130; + return ni; +} + +static void +wtap_node_free(struct ieee80211_node *ni) +{ + struct ieee80211com *ic = ni->ni_ic; + struct wtap_softc *sc = ic->ic_ifp->if_softc; + + DWTAP_PRINTF("%s\n", __func__); + sc->sc_node_free(ni); +} + +int32_t +wtap_attach(struct wtap_softc *sc, const uint8_t *macaddr) +{ + struct ifnet *ifp; + struct ieee80211com *ic; + char wtap_name[] = {'w','T','a','p',sc->id, + '_','t','a','s','k','q','\0'}; + + DWTAP_PRINTF("%s\n", __func__); + + ifp = if_alloc(IFT_IEEE80211); + if (ifp == NULL) { + printf("can not if_alloc()\n"); + return -1; + } + ic = ifp->if_l2com; + if_initname(ifp, "wtap", sc->id); + + sc->sc_ifp = ifp; + sc->up = 0; + + STAILQ_INIT(&sc->sc_rxbuf); + sc->sc_tq = taskqueue_create(wtap_name, M_NOWAIT | M_ZERO, + taskqueue_thread_enqueue, &sc->sc_tq); + taskqueue_start_threads(&sc->sc_tq, 1, PI_SOFT, "%s taskQ", + ifp->if_xname); + TASK_INIT(&sc->sc_rxtask, 0, wtap_rx_proc, sc); + + ifp->if_softc = sc; + ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; + ifp->if_start = wtap_start; + ifp->if_ioctl = wtap_ioctl; + ifp->if_init = wtap_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + ic->ic_ifp = ifp; + ic->ic_phytype = IEEE80211_T_DS; + ic->ic_opmode = IEEE80211_M_MBSS; + ic->ic_caps = IEEE80211_C_MBSS; + + ic->ic_max_keyix = 128; /* A value read from Atheros ATH_KEYMAX */ + + ic->ic_regdomain.regdomain = SKU_ETSI; + ic->ic_regdomain.country = CTRY_SWEDEN; + ic->ic_regdomain.location = 1; /* Indoors */ + ic->ic_regdomain.isocc[0] = 'S'; + ic->ic_regdomain.isocc[1] = 'E'; + /* + * Indicate we need the 802.11 header padded to a + * 32-bit boundary for 4-address and QoS frames. + */ + ic->ic_flags |= IEEE80211_F_DATAPAD; + ic->ic_nchans = 1; + ic->ic_channels[0].ic_flags = IEEE80211_CHAN_B; + ic->ic_channels[0].ic_freq = 2412; + + ieee80211_ifattach(ic, macaddr); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 17:46:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 016BD1065676; Wed, 11 Jan 2012 17:46:09 +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 E44FB8FC18; Wed, 11 Jan 2012 17:46:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BHk8Fr069934; Wed, 11 Jan 2012 17:46:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BHk8Of069932; Wed, 11 Jan 2012 17:46:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201111746.q0BHk8Of069932@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 11 Jan 2012 17:46: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: r229971 - head/sys/dev/uart X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 17:46:09 -0000 Author: kib Date: Wed Jan 11 17:46:08 2012 New Revision: 229971 URL: http://svn.freebsd.org/changeset/base/229971 Log: Add PCI Id for the AMT SOL UART on 5 series Intel chipsets. MFC after: 1 week Modified: head/sys/dev/uart/uart_bus_pci.c Modified: head/sys/dev/uart/uart_bus_pci.c ============================================================================== --- head/sys/dev/uart/uart_bus_pci.c Wed Jan 11 17:41:14 2012 (r229970) +++ head/sys/dev/uart/uart_bus_pci.c Wed Jan 11 17:46:08 2012 (r229971) @@ -112,6 +112,8 @@ static struct pci_id pci_ns8250_ids[] = 0x10, 16384000 }, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, +{ 0x8086, 0x3b67, 0xffff, 0, "5 Series/3400 Series Chipset KT Controller", + 0x10 }, { 0x8086, 0x8811, 0xffff, 0, "Intel EG20T Serial Port 0", 0x10 }, { 0x8086, 0x8812, 0xffff, 0, "Intel EG20T Serial Port 1", 0x10 }, { 0x8086, 0x8813, 0xffff, 0, "Intel EG20T Serial Port 2", 0x10 }, From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 17:51:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29231106564A; Wed, 11 Jan 2012 17:51:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C8808FC17; Wed, 11 Jan 2012 17:51:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BHpugj070159; Wed, 11 Jan 2012 17:51:56 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BHpuNF070157; Wed, 11 Jan 2012 17:51:56 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201111751.q0BHpuNF070157@svn.freebsd.org> From: Adrian Chadd Date: Wed, 11 Jan 2012 17:51: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: r229972 - in head/tools/tools/wtap: . wtap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 17:51:57 -0000 Author: adrian Date: Wed Jan 11 17:51:56 2012 New Revision: 229972 URL: http://svn.freebsd.org/changeset/base/229972 Log: Bring over a tool to create and destroy wtap instances. Submitted by: Monthadar Al Jaberi Added: head/tools/tools/wtap/ head/tools/tools/wtap/wtap/ head/tools/tools/wtap/wtap/Makefile (contents, props changed) head/tools/tools/wtap/wtap/wtap.c (contents, props changed) Added: head/tools/tools/wtap/wtap/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/wtap/wtap/Makefile Wed Jan 11 17:51:56 2012 (r229972) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG= wtap +SRC= wtap.c +NO_MAN= 1 + +CFLAGS+= -I${.CURDIR}/../../../../sys/dev/wtap/ + +.include Added: head/tools/tools/wtap/wtap/wtap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/wtap/wtap/wtap.c Wed Jan 11 17:51:56 2012 (r229972) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2010-2011 Monthadar Al Jaberi, TerraNet AB + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ +#include +#include +#include +#include + +#include "if_wtapioctl.h" + +static int dev = -1; + +static void create(int id) +{ + if(ioctl(dev, WTAPIOCTLCRT, &id) < 0){ + printf("error creating wtap with id=%d\n", id); + } +} + +static void delete(int id) +{ + if(ioctl(dev, WTAPIOCTLDEL, &id) < 0){ + printf("error deleting wtap with id=%d\n", id); + } +} + +int main( int argc, const char* argv[]) +{ + if(argc != 3){ + printf("usage: %s [c | d] wtap_id\n", argv[0]); + return -1; + } + int id = atoi(argv[2]); + if(!(id >= 0 && id < 64)){ + printf("wtap_id must be between 0 and 7\n"); + return -1; + } + dev = open("/dev/wtapctl", O_RDONLY); + if(dev < 0){ + printf("error opening wtapctl cdev\n"); + return -1; + } + switch((char)*argv[1]){ + case 'c': + create(id); + break; + case 'd': + delete(id); + break; + default: + printf("wtap ioctl: unkown command '%c'\n", *argv[1]); + return -1; + } + return 0; +} From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 18:09:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29ECC106566C; Wed, 11 Jan 2012 18:09:53 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id BAF648FC0C; Wed, 11 Jan 2012 18:09:52 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so1874945obb.13 for ; Wed, 11 Jan 2012 10:09:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=kuGHaH5ghvJ8gzoZ45/oHgcyIsra2v3dQXhTZsdYFzU=; b=dq3RzodE2llZ/teRI9RNJjXG2t63rn7dRFagv88cYPxYzHSUoWPQxEUT30FK5r4ASQ /ZhbqdfsODKeCe3ZXgtPDBoM+Iwubw2ocRBQR5LplVsHH2iL0Wpub9KphFELnOBUeUHz z+wLSgcSZV1vtZySdFiOVAgy+OqFcwI6sQXvA= MIME-Version: 1.0 Received: by 10.182.43.10 with SMTP id s10mr193580obl.43.1326305392046; Wed, 11 Jan 2012 10:09:52 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Wed, 11 Jan 2012 10:09:52 -0800 (PST) In-Reply-To: <201201111751.q0BHpuNF070157@svn.freebsd.org> References: <201201111751.q0BHpuNF070157@svn.freebsd.org> Date: Wed, 11 Jan 2012 21:09:52 +0300 X-Google-Sender-Auth: 3FaMfc5aXYQLRMLXCmnCADN6ANw Message-ID: From: Sergey Kandaurov To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229972 - in head/tools/tools/wtap: . wtap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 18:09:53 -0000 On 11 January 2012 21:51, Adrian Chadd wrote: > Author: adrian > Date: Wed Jan 11 17:51:56 2012 > New Revision: 229972 > URL: http://svn.freebsd.org/changeset/base/229972 > > Log: > =A0Bring over a tool to create and destroy wtap instances. > > =A0Submitted by: Monthadar Al Jaberi > > Added: > =A0head/tools/tools/wtap/ > =A0head/tools/tools/wtap/wtap/ > =A0head/tools/tools/wtap/wtap/Makefile =A0 (contents, props changed) > =A0head/tools/tools/wtap/wtap/wtap.c =A0 (contents, props changed) > > Added: head/tools/tools/wtap/wtap/Makefile > =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 > --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added) > +++ head/tools/tools/wtap/wtap/Makefile Wed Jan 11 17:51:56 2012 =A0 =A0 = =A0 =A0(r229972) > @@ -0,0 +1,9 @@ > +# $FreeBSD$ > + > +PROG=3D =A0wtap > +SRC=3D =A0 wtap.c > +NO_MAN=3D =A0 =A0 =A0 =A01 > + > +CFLAGS+=3D =A0 =A0 =A0 -I${.CURDIR}/../../../../sys/dev/wtap/ [nitpicking] I assume this is to properly build with if_wtapioctl.h. Maybe better install this header to /usr/include/sys then? > + > +.include > > Added: head/tools/tools/wtap/wtap/wtap.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 > --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added) > +++ head/tools/tools/wtap/wtap/wtap.c =A0 Wed Jan 11 17:51:56 2012 =A0 = =A0 =A0 =A0(r229972) > @@ -0,0 +1,82 @@ > +/*- > + * Copyright (c) 2010-2011 Monthadar Al Jaberi, TerraNet AB > + * 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 > + * =A0 =A0notice, this list of conditions and the following disclaimer, > + * =A0 =A0without modification. > + * 2. Redistributions in binary form must reproduce at minimum a disclai= mer > + * =A0 =A0similar to the "NO WARRANTY" disclaimer below ("Disclaimer") a= nd any > + * =A0 =A0redistribution must be conditioned upon including a substantia= lly > + * =A0 =A0similar Disclaimer requirement for further binary redistributi= on. > + * > + * NO WARRANTY > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILIT= Y > + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHAL= L > + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLAR= Y, > + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT = OF > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSIN= ESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER > + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHER= WISE) > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O= F > + * THE POSSIBILITY OF SUCH DAMAGES. > + * > + * $FreeBSD$ > + */ > +#include > +#include > +#include > +#include > + > +#include "if_wtapioctl.h" .. to use rather > + > +static int dev =3D -1; > + > +static void create(int id) > +{ > + =A0 =A0if(ioctl(dev, WTAPIOCTLCRT, &id) < 0){ > + =A0 =A0 =A0 printf("error creating wtap with id=3D%d\n", id); > + =A0 =A0} > +} > + > +static void delete(int id) > +{ > + =A0 =A0if(ioctl(dev, WTAPIOCTLDEL, &id) < 0){ > + =A0 =A0 =A0 printf("error deleting wtap with id=3D%d\n", id); > + =A0 =A0} > +} > + > +int main( int argc, const char* argv[]) > +{ > + =A0 =A0if(argc !=3D 3){ > + =A0 =A0 =A0printf("usage: %s [c | d] wtap_id\n", argv[0]); > + =A0 =A0 =A0return -1; > + =A0 =A0} > + =A0 =A0int id =3D atoi(argv[2]); > + =A0 =A0if(!(id >=3D 0 && id < 64)){ > + =A0 =A0 =A0 printf("wtap_id must be between 0 and 7\n"); > + =A0 =A0 =A0 return -1; > + =A0 =A0} This checks to be not larger than 64, but prints a warning to be not larger than 7. > + =A0 =A0dev =3D open("/dev/wtapctl", O_RDONLY); > + =A0 =A0if(dev < 0){ > + =A0 =A0 =A0printf("error opening wtapctl cdev\n"); > + =A0 =A0 =A0return -1; > + =A0 =A0} Perhaps, it makes sense to print errno. > + =A0 =A0switch((char)*argv[1]){ > + =A0 =A0 =A0case 'c': > + =A0 =A0 =A0 create(id); > + =A0 =A0 =A0 break; > + =A0 =A0 =A0case 'd': > + =A0 =A0 =A0 delete(id); > + =A0 =A0 =A0 break; > + =A0 =A0 =A0default: > + =A0 =A0 =A0 printf("wtap ioctl: unkown command '%c'\n", *argv[1]); a typo there > + =A0 =A0 =A0 return -1; > + =A0 =A0} > + =A0 =A0return 0; > +} The code could be better styled. Thanks for your work! --=20 wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 18:34:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE9F6106566B; Wed, 11 Jan 2012 18:34:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C32738FC0A; Wed, 11 Jan 2012 18:34:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BIYvew071838; Wed, 11 Jan 2012 18:34:57 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BIYvkL071836; Wed, 11 Jan 2012 18:34:57 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201111834.q0BIYvkL071836@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 11 Jan 2012 18:34: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: r229976 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 18:34:58 -0000 Author: glebius Date: Wed Jan 11 18:34:57 2012 New Revision: 229976 URL: http://svn.freebsd.org/changeset/base/229976 Log: Redo r226660: - Define schednetisr() to swi_sched. - In the swi handler check if there is some data prepared, and if true, then call pfsync_sendout(), however tell it not to schedule swi again. - Since now we don't obtain the pfsync lock in the swi handler, don't use ifqueue mutex to synchronize queue access. Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 18:18:37 2012 (r229975) +++ head/sys/contrib/pf/net/if_pfsync.c Wed Jan 11 18:34:57 2012 (r229976) @@ -309,6 +309,9 @@ static int pfsync_multicast_setup(struct static void pfsync_multicast_cleanup(struct pfsync_softc *); static int pfsync_init(void); static void pfsync_uninit(void); +static void pfsync_sendout1(int); + +#define schednetisr(NETISR_PFSYNC) swi_sched(V_pfsync_swi_cookie, 0) SYSCTL_NODE(_net, OID_AUTO, pfsync, CTLFLAG_RW, 0, "PFSYNC"); SYSCTL_VNET_STRUCT(_net_pfsync, OID_AUTO, stats, CTLFLAG_RW, @@ -823,11 +826,7 @@ pfsync_state_import(struct pfsync_state CLR(st->state_flags, PFSTATE_NOSYNC); if (ISSET(st->state_flags, PFSTATE_ACK)) { pfsync_q_ins(st, PFSYNC_S_IACK); -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif } } CLR(st->state_flags, PFSTATE_ACK); @@ -1283,11 +1282,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, st V_pfsyncstats.pfsyncs_stale++; pfsync_update_state(st); -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif continue; } pfsync_alloc_scrub_memory(&sp->dst, &st->dst); @@ -1393,11 +1388,7 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, V_pfsyncstats.pfsyncs_stale++; pfsync_update_state(st); -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif continue; } pfsync_alloc_scrub_memory(&up->dst, &st->dst); @@ -2098,12 +2089,20 @@ pfsync_drop(struct pfsync_softc *sc) sc->sc_len = PFSYNC_MINPKT; } -void -pfsync_sendout(void) -{ #ifdef __FreeBSD__ +void pfsync_sendout() +{ + pfsync_sendout1(1); +} + +static void +pfsync_sendout1(int schedswi) +{ struct pfsync_softc *sc = V_pfsyncif; #else +void +pfsync_sendout(void) +{ struct pfsync_softc *sc = pfsyncif; #endif #if NBPFILTER > 0 @@ -2124,7 +2123,6 @@ pfsync_sendout(void) #endif #ifdef __FreeBSD__ size_t pktlen; - int dummy_error; #endif int offset; int q, count = 0; @@ -2329,8 +2327,14 @@ pfsync_sendout(void) sc->sc_ifp->if_obytes += m->m_pkthdr.len; sc->sc_len = PFSYNC_MINPKT; - IFQ_ENQUEUE(&sc->sc_ifp->if_snd, m, dummy_error); - swi_sched(V_pfsync_swi_cookie, 0); + if (!_IF_QFULL(&sc->sc_ifp->if_snd)) + _IF_ENQUEUE(&sc->sc_ifp->if_snd, m); + else { + m_freem(m); + sc->sc_ifp->if_snd.ifq_drops++; + } + if (schedswi) + swi_sched(V_pfsync_swi_cookie, 0); #else sc->sc_if.if_opackets++; sc->sc_if.if_obytes += m->m_pkthdr.len; @@ -2389,11 +2393,7 @@ pfsync_insert_state(struct pf_state *st) pfsync_q_ins(st, PFSYNC_S_INS); if (ISSET(st->state_flags, PFSTATE_ACK)) -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif else st->sync_updates = 0; } @@ -2592,11 +2592,7 @@ pfsync_update_state(struct pf_state *st) if (sync || (time_uptime - st->pfsync_time) < 2) { pfsync_upds++; -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif } } @@ -2647,11 +2643,7 @@ pfsync_request_update(u_int32_t creatori TAILQ_INSERT_TAIL(&sc->sc_upd_req_list, item, ur_entry); sc->sc_len += nlen; -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif } void @@ -2680,11 +2672,7 @@ pfsync_update_state_req(struct pf_state pfsync_q_del(st); case PFSYNC_S_NONE: pfsync_q_ins(st, PFSYNC_S_UPD); -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif return; case PFSYNC_S_INS: @@ -3255,7 +3243,11 @@ pfsyncintr(void *arg) CURVNET_SET(sc->sc_ifp->if_vnet); pfsync_ints++; - IF_DEQUEUE_ALL(&sc->sc_ifp->if_snd, m); + PF_LOCK(); + if (sc->sc_len > PFSYNC_MINPKT) + pfsync_sendout1(0); + _IF_DEQUEUE_ALL(&sc->sc_ifp->if_snd, m); + PF_UNLOCK(); for (; m != NULL; m = n) { From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 18:38:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB31B106564A; Wed, 11 Jan 2012 18:38:52 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A90918FC15; Wed, 11 Jan 2012 18:38:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BIcq5u071988; Wed, 11 Jan 2012 18:38:52 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BIcqmq071985; Wed, 11 Jan 2012 18:38:52 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201201111838.q0BIcqmq071985@svn.freebsd.org> From: Christian Brueffer Date: Wed, 11 Jan 2012 18:38: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: r229977 - in head/release/doc: en_US.ISO8859-1/hardware share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 18:38:52 -0000 Author: brueffer Date: Wed Jan 11 18:38:52 2012 New Revision: 229977 URL: http://svn.freebsd.org/changeset/base/229977 Log: Add hpt27xx to the hardware notes, While here, add the 2012 copyright. MFC after: 1 week Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml head/release/doc/share/misc/dev.archlist.txt Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Wed Jan 11 18:34:57 2012 (r229976) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Wed Jan 11 18:38:52 2012 (r229977) @@ -32,6 +32,7 @@ 2009 2010 2011 + 2012 The &os; Documentation Project @@ -773,6 +774,8 @@ &hwlist.esp; + &hwlist.hpt27xx; + &hwlist.hptiop; &hwlist.hptmv; Modified: head/release/doc/share/misc/dev.archlist.txt ============================================================================== --- head/release/doc/share/misc/dev.archlist.txt Wed Jan 11 18:34:57 2012 (r229976) +++ head/release/doc/share/misc/dev.archlist.txt Wed Jan 11 18:38:52 2012 (r229977) @@ -72,6 +72,7 @@ ex i386,amd64 fe i386,pc98,amd64 fwohci i386,sparc64,ia64,amd64,powerpc hifn i386,pc98,amd64 +hpt27xx i386,amd64 hptiop i386,amd64 hptmv i386,amd64 hptrr i386,amd64 From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 18:45:45 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8028F1065672; Wed, 11 Jan 2012 18:45:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id F3EB48FC19; Wed, 11 Jan 2012 18:45:44 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q0BIjhEm097076; Wed, 11 Jan 2012 22:45:43 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q0BIjhOh097075; Wed, 11 Jan 2012 22:45:43 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 11 Jan 2012 22:45:43 +0400 From: Gleb Smirnoff To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Message-ID: <20120111184543.GJ74141@FreeBSD.org> References: <201201111834.q0BIYvkL071836@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201201111834.q0BIYvkL071836@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: svn commit: r229976 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 18:45:45 -0000 On Wed, Jan 11, 2012 at 06:34:57PM +0000, Gleb Smirnoff wrote: T> Author: glebius T> Date: Wed Jan 11 18:34:57 2012 T> New Revision: 229976 T> URL: http://svn.freebsd.org/changeset/base/229976 T> T> Log: T> Redo r226660: T> - Define schednetisr() to swi_sched. T> - In the swi handler check if there is some data prepared, T> and if true, then call pfsync_sendout(), however tell it T> not to schedule swi again. T> - Since now we don't obtain the pfsync lock in the swi handler, ^^^ T> don't use ifqueue mutex to synchronize queue access. Sorry, that should have been "now we do obtain" :( -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 21:03:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A591106564A; Wed, 11 Jan 2012 21:03:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6973F8FC17; Wed, 11 Jan 2012 21:03:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BL3sAh076591; Wed, 11 Jan 2012 21:03:54 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BL3svp076589; Wed, 11 Jan 2012 21:03:54 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201112103.q0BL3svp076589@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 11 Jan 2012 21:03: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: r229980 - head/sys/dev/sound/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 21:03:54 -0000 Author: pfg Date: Wed Jan 11 21:03:54 2012 New Revision: 229980 URL: http://svn.freebsd.org/changeset/base/229980 Log: Fix an inconsistency that crept in while replacing constants from the new header. Approved by: jhb (mentor) MFC after: 3 days Modified: head/sys/dev/sound/pci/emu10k1.c Modified: head/sys/dev/sound/pci/emu10k1.c ============================================================================== --- head/sys/dev/sound/pci/emu10k1.c Wed Jan 11 20:04:52 2012 (r229979) +++ head/sys/dev/sound/pci/emu10k1.c Wed Jan 11 21:03:54 2012 (r229980) @@ -1079,9 +1079,9 @@ emurchan_trigger(kobj_t obj, void *data, emu_wrptr(sc, 0, ch->sizereg, sz); if (ch->num == 0) { if (sc->audigy) { - val = EMU_ADCCR_LCHANENABLE; + val = EMU_A_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= EMU_ADCCR_RCHANENABLE; + val |= EMU_A_ADCCR_RCHANENABLE; val |= audigy_recval(ch->spd); } else { val = EMU_ADCCR_LCHANENABLE; From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 21:17:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8058106566B; Wed, 11 Jan 2012 21:17:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4E3D8FC1E; Wed, 11 Jan 2012 21:17:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BLHEos077028; Wed, 11 Jan 2012 21:17:14 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BLHEck077022; Wed, 11 Jan 2012 21:17:14 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201112117.q0BLHEck077022@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 11 Jan 2012 21:17:14 +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: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 21:17:14 -0000 Author: pfg Date: Wed Jan 11 21:17:14 2012 New Revision: 229981 URL: http://svn.freebsd.org/changeset/base/229981 Log: Replace GPL'd headers in the emu10kx snd driver code. This uses the emuxkireg.h already used in the emu10k1 snd driver. Special thanks go to Alexander Motin as he was able to find some errors and reverse engineer some wrong values in the emuxkireg header. The emu10kx driver is now free from the GPL. PR: 153901 Tested by: mav, joel Approved by: jhb (mentor) MFC after: 2 weeks Deleted: head/sys/gnu/dev/sound/pci/emu10k1-alsa.h head/sys/gnu/dev/sound/pci/p16v-alsa.h head/sys/gnu/dev/sound/pci/p17v-alsa.h Modified: head/sys/conf/files head/sys/dev/sound/pci/emu10kx-midi.c head/sys/dev/sound/pci/emu10kx-pcm.c head/sys/dev/sound/pci/emu10kx.c head/sys/dev/sound/pci/emu10kx.h head/sys/dev/sound/pci/emuxkireg.h head/sys/modules/sound/driver/emu10kx/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Jan 11 21:03:54 2012 (r229980) +++ head/sys/conf/files Wed Jan 11 21:17:14 2012 (r229981) @@ -50,11 +50,6 @@ aic79xx_reg_print.c optional ahd pci aic79xx_reg_print.o optional ahd pci ahd_reg_pretty_print \ compile-with "${NORMAL_C}" \ no-implicit-rule local -emu10k1-alsa%diked.h optional snd_emu10kx \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "emu10k1-alsa%diked.h" # # The 'fdt_dtb_file' target covers an actual DTB file name, which is derived # from the specified source (DTS) file: .dts -> .dtb @@ -67,16 +62,6 @@ fdt_static_dtb.h optional fdt fdt_dtb_s compile-with "sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ." \ no-obj no-implicit-rule before-depend \ clean "fdt_static_dtb.h" -p16v-alsa%diked.h optional snd_emu10kx pci \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h p16v-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "p16v-alsa%diked.h" -p17v-alsa%diked.h optional snd_emu10kx pci \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h p17v-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "p17v-alsa%diked.h" feeder_eq_gen.h optional sound \ dependency "$S/tools/sound/feeder_eq_mkfilter.awk" \ compile-with "${AWK} -f $S/tools/sound/feeder_eq_mkfilter.awk -- ${FEEDER_EQ_PRESETS} > feeder_eq_gen.h" \ @@ -1733,19 +1718,9 @@ dev/sound/pci/csa.c optional snd_csa pc dev/sound/pci/csapcm.c optional snd_csa pci dev/sound/pci/ds1.c optional snd_ds1 pci dev/sound/pci/emu10k1.c optional snd_emu10k1 pci -dev/sound/pci/emu10kx.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - dependency "p16v-alsa%diked.h" \ - dependency "p17v-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" -dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - dependency "p16v-alsa%diked.h" \ - dependency "p17v-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" -dev/sound/pci/emu10kx-midi.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" +dev/sound/pci/emu10kx.c optional snd_emu10kx pci +dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci +dev/sound/pci/emu10kx-midi.c optional snd_emu10kx pci dev/sound/pci/envy24.c optional snd_envy24 pci dev/sound/pci/envy24ht.c optional snd_envy24ht pci dev/sound/pci/es137x.c optional snd_es137x pci Modified: head/sys/dev/sound/pci/emu10kx-midi.c ============================================================================== --- head/sys/dev/sound/pci/emu10kx-midi.c Wed Jan 11 21:03:54 2012 (r229980) +++ head/sys/dev/sound/pci/emu10kx-midi.c Wed Jan 11 21:17:14 2012 (r229981) @@ -50,8 +50,8 @@ #include #include "mpufoi_if.h" +#include #include -#include "emu10k1-alsa%diked.h" struct emu_midi_softc { struct mtx mtx; @@ -176,25 +176,25 @@ emu_midi_attach(device_t dev) if (scp->is_emu10k1) { /* SB Live! - only one MIDI device here */ inte_val = 0; - /* inte_val |= INTE_MIDITXENABLE;*/ - inte_val |= INTE_MIDIRXENABLE; - ipr_val = IPR_MIDITRANSBUFEMPTY; - ipr_val |= IPR_MIDIRECVBUFEMPTY; + /* inte_val |= EMU_INTE_MIDITXENABLE;*/ + inte_val |= EMU_INTE_MIDIRXENABLE; + ipr_val = EMU_IPR_MIDITRANSBUFE; + ipr_val |= EMU_IPR_MIDIRECVBUFE; } else { - if (scp->port == A_MUDATA1) { + if (scp->port == EMU_A_MUDATA1) { /* EXTERNAL MIDI (AudigyDrive) */ inte_val = 0; - /* inte_val |= A_INTE_MIDITXENABLE1;*/ - inte_val |= INTE_MIDIRXENABLE; - ipr_val = IPR_MIDITRANSBUFEMPTY; - ipr_val |= IPR_MIDIRECVBUFEMPTY; + /* inte_val |= A_EMU_INTE_MIDITXENABLE1;*/ + inte_val |= EMU_INTE_MIDIRXENABLE; + ipr_val = EMU_IPR_MIDITRANSBUFE; + ipr_val |= EMU_IPR_MIDIRECVBUFE; } else { /* MIDI hw config port 2 */ inte_val = 0; - /* inte_val |= A_INTE_MIDITXENABLE2;*/ - inte_val |= INTE_A_MIDIRXENABLE2; - ipr_val = IPR_A_MIDITRANSBUFEMPTY2; - ipr_val |= IPR_A_MIDIRECVBUFEMPTY2; + /* inte_val |= A_EMU_INTE_MIDITXENABLE2;*/ + inte_val |= EMU_INTE_A_MIDIRXENABLE2; + ipr_val = EMU_IPR_A_MIDITRANSBUFE2; + ipr_val |= EMU_IPR_A_MIDIRECBUFE2; } } @@ -214,7 +214,7 @@ emu_midi_attach(device_t dev) if (scp->is_emu10k1) emu_enable_ir(scp->card); else { - if (scp->port == A_MUDATA1) + if (scp->port == EMU_A_MUDATA1) emu_enable_ir(scp->card); } Modified: head/sys/dev/sound/pci/emu10kx-pcm.c ============================================================================== --- head/sys/dev/sound/pci/emu10kx-pcm.c Wed Jan 11 21:03:54 2012 (r229980) +++ head/sys/dev/sound/pci/emu10kx-pcm.c Wed Jan 11 21:17:14 2012 (r229981) @@ -49,8 +49,8 @@ #include "mixer_if.h" +#include #include -#include "emu10k1-alsa%diked.h" struct emu_pcm_pchinfo { int spd; @@ -555,8 +555,8 @@ emu_ac97_read_emulation(struct emu_pcm_i break; } - emu_wr(sc->card, AC97ADDRESS, regno, 1); - tmp = emu_rd(sc->card, AC97DATA, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + tmp = emu_rd(sc->card, EMU_AC97DATA, 2); if (use_ac97) emulated = tmp; @@ -621,8 +621,8 @@ emu_ac97_write_emulation(struct emu_pcm_ break; } if (write_ac97) { - emu_wr(sc->card, AC97ADDRESS, regno, 1); - emu_wr(sc->card, AC97DATA, data, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + emu_wr(sc->card, EMU_AC97DATA, data, 2); } } @@ -658,8 +658,8 @@ emu_rdcd(kobj_t obj __unused, void *devi struct emu_pcm_info *sc = (struct emu_pcm_info *)devinfo; KASSERT(sc->card != NULL, ("emu_rdcd: no soundcard")); - emu_wr(sc->card, AC97ADDRESS, regno, 1); - rd = emu_rd(sc->card, AC97DATA, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + rd = emu_rd(sc->card, EMU_AC97DATA, 2); return (rd); } @@ -669,8 +669,8 @@ emu_wrcd(kobj_t obj __unused, void *devi struct emu_pcm_info *sc = (struct emu_pcm_info *)devinfo; KASSERT(sc->card != NULL, ("emu_wrcd: no soundcard")); - emu_wr(sc->card, AC97ADDRESS, regno, 1); - emu_wr(sc->card, AC97DATA, data, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + emu_wr(sc->card, EMU_AC97DATA, data, 2); return (0); } @@ -870,12 +870,12 @@ emurchan_init(kobj_t obj __unused, void ch->blksz = sc->bufsz / 2; /* We rise interrupt for half-full buffer */ ch->fmt = SND_FORMAT(AFMT_U8, 1, 0); ch->spd = 8000; - ch->idxreg = sc->is_emu10k1 ? ADCIDX : A_ADCIDX; - ch->basereg = ADCBA; - ch->sizereg = ADCBS; - ch->setupreg = ADCCR; - ch->irqmask = INTE_ADCBUFENABLE; - ch->iprmask = IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL; + ch->idxreg = sc->is_emu10k1 ? EMU_ADCIDX : EMU_A_ADCIDX; + ch->basereg = EMU_ADCBA; + ch->sizereg = EMU_ADCBS; + ch->setupreg = EMU_ADCCR; + ch->irqmask = EMU_INTE_ADCBUFENABLE; + ch->iprmask = EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL; if (sndbuf_alloc(ch->buffer, emu_gettag(sc->card), 0, sc->bufsz) != 0) return (NULL); @@ -953,22 +953,22 @@ emurchan_trigger(kobj_t obj __unused, vo switch (sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -976,9 +976,9 @@ emurchan_trigger(kobj_t obj __unused, vo case PCMTRIG_START: ch->run = 1; emu_wrptr(sc->card, 0, ch->sizereg, sz); - val = sc->is_emu10k1 ? ADCCR_LCHANENABLE : A_ADCCR_LCHANENABLE; + val = sc->is_emu10k1 ? EMU_ADCCR_LCHANENABLE : EMU_A_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= sc->is_emu10k1 ? ADCCR_RCHANENABLE : A_ADCCR_RCHANENABLE; + val |= sc->is_emu10k1 ? EMU_ADCCR_RCHANENABLE : EMU_A_ADCCR_RCHANENABLE; val |= sc->is_emu10k1 ? emu_k1_recval(ch->spd) : emu_k2_recval(ch->spd); emu_wrptr(sc->card, 0, ch->setupreg, 0); emu_wrptr(sc->card, 0, ch->setupreg, val); @@ -1049,11 +1049,11 @@ emufxrchan_init(kobj_t obj __unused, voi ch = &(sc->rch_efx); ch->fmt = SND_FORMAT(AFMT_S16_LE, 1, 0); ch->spd = sc->is_emu10k1 ? 48000*32 : 48000 * 64; - ch->idxreg = FXIDX; - ch->basereg = FXBA; - ch->sizereg = FXBS; - ch->irqmask = INTE_EFXBUFENABLE; - ch->iprmask = IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL; + ch->idxreg = EMU_FXIDX; + ch->basereg = EMU_FXBA; + ch->sizereg = EMU_FXBS; + ch->irqmask = EMU_INTE_EFXBUFENABLE; + ch->iprmask = EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL; ch->buffer = b; ch->pcm = sc; ch->channel = c; @@ -1113,22 +1113,22 @@ emufxrchan_trigger(kobj_t obj __unused, switch (sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -1140,14 +1140,14 @@ emufxrchan_trigger(kobj_t obj __unused, /* * SB Live! is limited to 32 mono channels. Audigy * has 64 mono channels. Channels are enabled - * by setting a bit in A_FXWC[1|2] registers. + * by setting a bit in EMU_A_FXWC[1|2] registers. */ /* XXX there is no way to demultiplex this streams for now */ if (sc->is_emu10k1) { - emu_wrptr(sc->card, 0, FXWC, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_FXWC, 0xffffffff); } else { - emu_wrptr(sc->card, 0, A_FXWC1, 0xffffffff); - emu_wrptr(sc->card, 0, A_FXWC2, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_A_FXWC1, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_A_FXWC2, 0xffffffff); } break; case PCMTRIG_STOP: @@ -1155,10 +1155,10 @@ emufxrchan_trigger(kobj_t obj __unused, case PCMTRIG_ABORT: ch->run = 0; if (sc->is_emu10k1) { - emu_wrptr(sc->card, 0, FXWC, 0x0); + emu_wrptr(sc->card, 0, EMU_FXWC, 0x0); } else { - emu_wrptr(sc->card, 0, A_FXWC1, 0x0); - emu_wrptr(sc->card, 0, A_FXWC2, 0x0); + emu_wrptr(sc->card, 0, EMU_A_FXWC1, 0x0); + emu_wrptr(sc->card, 0, EMU_A_FXWC2, 0x0); } emu_wrptr(sc->card, 0, ch->sizereg, 0); (void)emu_intr_unregister(sc->card, ch->ihandle); @@ -1238,8 +1238,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) snd_mtxlock(sc->lock); - if (stat & IPR_INTERVALTIMER) { - ack |= IPR_INTERVALTIMER; + if (stat & EMU_IPR_INTERVALTIMER) { + ack |= EMU_IPR_INTERVALTIMER; for (i = 0; i < MAX_CHANNELS; i++) if (sc->pch[i].channel) { if (sc->pch[i].run == 1) { @@ -1262,8 +1262,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) } - if (stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) { - ack |= stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL); + if (stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) { + ack |= stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL); if (sc->rch_adc.channel) { snd_mtxunlock(sc->lock); chn_intr(sc->rch_adc.channel); @@ -1271,8 +1271,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) } } - if (stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) { - ack |= stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL); + if (stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) { + ack |= stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL); if (sc->rch_efx.channel) { snd_mtxunlock(sc->lock); chn_intr(sc->rch_efx.channel); @@ -1450,8 +1450,8 @@ emu_pcm_attach(device_t dev) goto bad; } - inte = INTE_INTERVALTIMERENB; - ipr = IPR_INTERVALTIMER; /* Used by playback & ADC */ + inte = EMU_INTE_INTERTIMERENB; + ipr = EMU_IPR_INTERVALTIMER; /* Used by playback & ADC */ sc->ihandle = emu_intr_register(sc->card, inte, ipr, &emu_pcm_intr, sc); if (emu_pcm_init(sc) == -1) { Modified: head/sys/dev/sound/pci/emu10kx.c ============================================================================== --- head/sys/dev/sound/pci/emu10kx.c Wed Jan 11 21:03:54 2012 (r229980) +++ head/sys/dev/sound/pci/emu10kx.c Wed Jan 11 21:17:14 2012 (r229981) @@ -53,6 +53,7 @@ #include #include +#include #include /* hw flags */ @@ -181,7 +182,7 @@ #define A_IN_AUX2_R 0x0d #define A_IN_AUX2 A_IN_AUX2_L -/* Audigiy Outputs */ +/* Audigy Outputs */ #define A_OUT_D_FRONT_L 0x00 #define A_OUT_D_FRONT_R 0x01 #define A_OUT_D_FRONT A_OUT_D_FRONT_L @@ -217,9 +218,19 @@ #define A_OUT_ADC_REC_R 0x17 #define A_OUT_ADC_REC A_OUT_ADC_REC_L -#include "emu10k1-alsa%diked.h" -#include "p16v-alsa%diked.h" -#include "p17v-alsa%diked.h" +#define EMU_DATA2 0x24 +#define EMU_IPR2 0x28 +#define EMU_INTE2 0x2c +#define EMU_IPR3 0x38 +#define EMU_INTE3 0x3c + +#define EMU_A2_SRCSel 0x60 +#define EMU_A2_SRCMULTI_ENABLE 0x6e + +#define EMU_A_I2S_CAPTURE_96000 0x00000400 + +#define EMU_A2_MIXER_I2S_ENABLE 0x7B +#define EMU_A2_MIXER_SPDIF_ENABLE 0x7A #define C_FRONT_L 0 #define C_FRONT_R 1 @@ -630,7 +641,7 @@ emu_wr_nolock(struct emu_sc_info *sc, un } } /* - * PTR / DATA interface. Access to EMU10Kx is made + * EMU_PTR / EMU_DATA interface. Access to EMU10Kx is made * via (channel, register) pair. Some registers are channel-specific, * some not. */ @@ -639,11 +650,11 @@ emu_rdptr(struct emu_sc_info *sc, unsign { uint32_t ptr, val, mask, size, offset; - ptr = ((reg << 16) & sc->address_mask) | (chn & PTR_CHANNELNUM_MASK); + ptr = ((reg << 16) & sc->address_mask) | (chn & EMU_PTR_CHNO_MASK); EMU_RWLOCK(); - emu_wr_nolock(sc, PTR, ptr, 4); - val = emu_rd_nolock(sc, DATA, 4); + emu_wr_nolock(sc, EMU_PTR, ptr, 4); + val = emu_rd_nolock(sc, EMU_DATA, 4); EMU_RWUNLOCK(); /* @@ -666,10 +677,10 @@ emu_wrptr(struct emu_sc_info *sc, unsign { uint32_t ptr, mask, size, offset; - ptr = ((reg << 16) & sc->address_mask) | (chn & PTR_CHANNELNUM_MASK); + ptr = ((reg << 16) & sc->address_mask) | (chn & EMU_PTR_CHNO_MASK); EMU_RWLOCK(); - emu_wr_nolock(sc, PTR, ptr, 4); + emu_wr_nolock(sc, EMU_PTR, ptr, 4); /* * XXX Another kind of magic encoding in register number. This can * give you side effect - it will read previous data from register @@ -681,13 +692,13 @@ emu_wrptr(struct emu_sc_info *sc, unsign mask = ((1 << size) - 1) << offset; data <<= offset; data &= mask; - data |= emu_rd_nolock(sc, DATA, 4) & ~mask; + data |= emu_rd_nolock(sc, EMU_DATA, 4) & ~mask; } - emu_wr_nolock(sc, DATA, data, 4); + emu_wr_nolock(sc, EMU_DATA, data, 4); EMU_RWUNLOCK(); } /* - * PTR2 / DATA2 interface. Access to P16v is made + * EMU_A2_PTR / EMU_DATA2 interface. Access to P16v is made * via (channel, register) pair. Some registers are channel-specific, * some not. This interface is supported by CA0102 and CA0108 chips only. */ @@ -698,8 +709,8 @@ emu_rd_p16vptr(struct emu_sc_info *sc, u /* XXX separate lock? */ EMU_RWLOCK(); - emu_wr_nolock(sc, PTR2, (reg << 16) | chn, 4); - val = emu_rd_nolock(sc, DATA2, 4); + emu_wr_nolock(sc, EMU_A2_PTR, (reg << 16) | chn, 4); + val = emu_rd_nolock(sc, EMU_DATA2, 4); EMU_RWUNLOCK(); @@ -711,8 +722,8 @@ emu_wr_p16vptr(struct emu_sc_info *sc, u { EMU_RWLOCK(); - emu_wr_nolock(sc, PTR2, (reg << 16) | chn, 4); - emu_wr_nolock(sc, DATA2, data, 4); + emu_wr_nolock(sc, EMU_A2_PTR, (reg << 16) | chn, 4); + emu_wr_nolock(sc, EMU_DATA2, data, 4); EMU_RWUNLOCK(); } /* @@ -737,13 +748,13 @@ emu_wr_cbptr(struct emu_sc_info *sc, uin /* * Direct hardware register access - * Assume that it is never used to access PTR-based registers and can run unlocked. + * Assume that it is never used to access EMU_PTR-based registers and can run unlocked. */ void emu_wr(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size) { - KASSERT(regno != PTR, ("emu_wr: attempt to write to PTR")); - KASSERT(regno != PTR2, ("emu_wr: attempt to write to PTR2")); + KASSERT(regno != EMU_PTR, ("emu_wr: attempt to write to EMU_PTR")); + KASSERT(regno != EMU_A2_PTR, ("emu_wr: attempt to write to EMU_A2_PTR")); emu_wr_nolock(sc, regno, data, size); } @@ -753,8 +764,8 @@ emu_rd(struct emu_sc_info *sc, unsigned { uint32_t rd; - KASSERT(regno != DATA, ("emu_rd: attempt to read DATA")); - KASSERT(regno != DATA2, ("emu_rd: attempt to read DATA2")); + KASSERT(regno != EMU_DATA, ("emu_rd: attempt to read DATA")); + KASSERT(regno != EMU_DATA2, ("emu_rd: attempt to read DATA2")); rd = emu_rd_nolock(sc, regno, size); return (rd); @@ -770,24 +781,24 @@ emu_enable_ir(struct emu_sc_info *sc) uint32_t iocfg; if (sc->is_emu10k2 || sc->is_ca0102) { - iocfg = emu_rd_nolock(sc, A_IOCFG, 2); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT2, 2); + iocfg = emu_rd_nolock(sc, EMU_A_IOCFG, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT2, 2); DELAY(500); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT1 | A_IOCFG_GPOUT2, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT1 | EMU_A_IOCFG_GPOUT2, 2); DELAY(500); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT1, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT1, 2); DELAY(100); - emu_wr_nolock(sc, A_IOCFG, iocfg, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg, 2); device_printf(sc->dev, "Audigy IR MIDI events enabled.\n"); sc->enable_ir = 1; } if (sc->is_emu10k1) { - iocfg = emu_rd_nolock(sc, HCFG, 4); - emu_wr_nolock(sc, HCFG, iocfg | HCFG_GPOUT2, 4); + iocfg = emu_rd_nolock(sc, EMU_HCFG, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg | EMU_HCFG_GPOUT2, 4); DELAY(500); - emu_wr_nolock(sc, HCFG, iocfg | HCFG_GPOUT1 | HCFG_GPOUT2, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg | EMU_HCFG_GPOUT1 | EMU_HCFG_GPOUT2, 4); DELAY(100); - emu_wr_nolock(sc, HCFG, iocfg, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg, 4); device_printf(sc->dev, "SB Live! IR MIDI events enabled.\n"); sc->enable_ir = 1; } @@ -835,7 +846,7 @@ emu_timer_set(struct emu_sc_info *sc, in sc->timerinterval = sc->timer[i]; /* XXX */ - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); mtx_unlock(&sc->lock); return (timer); @@ -868,16 +879,16 @@ emu_timer_enable(struct emu_sc_info *sc, ena_int = 1; } - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); if (ena_int == 1) { - x = emu_rd(sc, INTE, 4); - x |= INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x |= EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } else { - x = emu_rd(sc, INTE, 4); - x &= ~INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x &= ~EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } mtx_unlock(&sc->lock); return (0); @@ -917,9 +928,9 @@ emu_intr_register(struct emu_sc_info *sc sc->ihandler[i].intr_mask = intr_mask; sc->ihandler[i].softc = isc; sc->ihandler[i].irq_func = func; - x = emu_rd(sc, INTE, 4); + x = emu_rd(sc, EMU_INTE, 4); x |= inte_mask; - emu_wr(sc, INTE, x, 4); + emu_wr(sc, EMU_INTE, x, 4); mtx_unlock(&sc->lock); if (sc->dbg_level > 1) device_printf(sc->dev, "ihandle %d registered\n", i); @@ -946,7 +957,7 @@ emu_intr_unregister(struct emu_sc_info * return (-1); } - x = emu_rd(sc, INTE, 4); + x = emu_rd(sc, EMU_INTE, 4); x &= ~sc->ihandler[hnumber].inte_mask; sc->ihandler[hnumber].inte_mask = 0; @@ -954,12 +965,12 @@ emu_intr_unregister(struct emu_sc_info * sc->ihandler[hnumber].softc = NULL; sc->ihandler[hnumber].irq_func = NULL; - /* other interrupt handlers may use this INTE value */ + /* other interrupt handlers may use this EMU_INTE value */ for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) if (sc->ihandler[i].inte_mask != 0) x |= sc->ihandler[i].inte_mask; - emu_wr(sc, INTE, x, 4); + emu_wr(sc, EMU_INTE, x, 4); mtx_unlock(&sc->lock); return (hnumber); @@ -973,11 +984,11 @@ emu_intr(void *p) int i; for (;;) { - stat = emu_rd(sc, IPR, 4); + stat = emu_rd(sc, EMU_IPR, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR, stat, 4); + emu_wr(sc, EMU_IPR, stat, 4); for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) { if ((((sc->ihandler[i].intr_mask) & stat) != 0) && (((void *)sc->ihandler[i].irq_func) != NULL)) { @@ -993,13 +1004,13 @@ emu_intr(void *p) if ((sc->is_ca0102) || (sc->is_ca0108)) for (;;) { - stat = emu_rd(sc, IPR2, 4); + stat = emu_rd(sc, EMU_IPR2, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR2, stat, 4); + emu_wr(sc, EMU_IPR2, stat, 4); if (sc->dbg_level > 1) - device_printf(sc->dev, "IPR2: %08x\n", stat); + device_printf(sc->dev, "EMU_IPR2: %08x\n", stat); break; /* to avoid infinite loop. shoud be removed * after completion of P16V interface. */ @@ -1007,13 +1018,13 @@ emu_intr(void *p) if (sc->is_ca0102) for (;;) { - stat = emu_rd(sc, IPR3, 4); + stat = emu_rd(sc, EMU_IPR3, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR3, stat, 4); + emu_wr(sc, EMU_IPR3, stat, 4); if (sc->dbg_level > 1) - device_printf(sc->dev, "IPR3: %08x\n", stat); + device_printf(sc->dev, "EMU_IPR3: %08x\n", stat); break; /* to avoid infinite loop. should be removed * after completion of S/PDIF interface */ @@ -1374,61 +1385,61 @@ emu_vwrite(struct emu_sc_info *sc, struc if (v->stereo) { - emu_wrptr(sc, v->vnum, CPF, CPF_STEREO_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, EMU_CHAN_CPF_STEREO_MASK); } else { - emu_wrptr(sc, v->vnum, CPF, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, 0); } val = v->stereo ? 28 : 30; val *= v->b16 ? 1 : 2; start = v->sa + val; if (sc->is_emu10k1) { - emu_wrptr(sc, v->vnum, FXRT, ((v->routing[3] << 12) | + emu_wrptr(sc, v->vnum, EMU_CHAN_FXRT, ((v->routing[3] << 12) | (v->routing[2] << 8) | (v->routing[1] << 4) | (v->routing[0] << 0)) << 16); } else { - emu_wrptr(sc, v->vnum, A_FXRT1, (v->routing[3] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT1, (v->routing[3] << 24) | (v->routing[2] << 16) | (v->routing[1] << 8) | (v->routing[0] << 0)); - emu_wrptr(sc, v->vnum, A_FXRT2, (v->routing[7] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT2, (v->routing[7] << 24) | (v->routing[6] << 16) | (v->routing[5] << 8) | (v->routing[4] << 0)); - emu_wrptr(sc, v->vnum, A_SENDAMOUNTS, (v->amounts[7] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_SENDAMOUNTS, (v->amounts[7] << 24) | (v->amounts[6] << 26) | (v->amounts[5] << 8) | (v->amounts[4] << 0)); } - emu_wrptr(sc, v->vnum, PTRX, (v->amounts[0] << 8) | (v->amounts[1] << 0)); - emu_wrptr(sc, v->vnum, DSL, v->ea | (v->amounts[3] << 24)); - emu_wrptr(sc, v->vnum, PSST, v->sa | (v->amounts[2] << 24)); - - emu_wrptr(sc, v->vnum, CCCA, start | (v->b16 ? 0 : CCCA_8BITSELECT)); - emu_wrptr(sc, v->vnum, Z1, 0); - emu_wrptr(sc, v->vnum, Z2, 0); - - silent_page = ((uint32_t) (sc->mem.silent_page_addr) << 1) | MAP_PTI_MASK; - emu_wrptr(sc, v->vnum, MAPA, silent_page); - emu_wrptr(sc, v->vnum, MAPB, silent_page); - - emu_wrptr(sc, v->vnum, CVCF, CVCF_CURRENTFILTER_MASK); - emu_wrptr(sc, v->vnum, VTFT, VTFT_FILTERTARGET_MASK); - emu_wrptr(sc, v->vnum, ATKHLDM, 0); - emu_wrptr(sc, v->vnum, DCYSUSM, DCYSUSM_DECAYTIME_MASK); - emu_wrptr(sc, v->vnum, LFOVAL1, 0x8000); - emu_wrptr(sc, v->vnum, LFOVAL2, 0x8000); - emu_wrptr(sc, v->vnum, FMMOD, 0); - emu_wrptr(sc, v->vnum, TREMFRQ, 0); - emu_wrptr(sc, v->vnum, FM2FRQ2, 0); - emu_wrptr(sc, v->vnum, ENVVAL, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX, (v->amounts[0] << 8) | (v->amounts[1] << 0)); + emu_wrptr(sc, v->vnum, EMU_CHAN_DSL, v->ea | (v->amounts[3] << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PSST, v->sa | (v->amounts[2] << 24)); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CCCA, start | (v->b16 ? 0 : EMU_CHAN_CCCA_8BITSELECT)); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z1, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z2, 0); + + silent_page = ((uint32_t) (sc->mem.silent_page_addr) << 1) | EMU_CHAN_MAP_PTI_MASK; + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPA, silent_page); + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPB, silent_page); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, EMU_CHAN_CVCF_CURRFILTER_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, EMU_CHAN_VTFT_FILTERTARGET_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSM, EMU_CHAN_DCYSUSM_DECAYTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL1, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL2, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_TREMFRQ, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_FM2FRQ2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVAL, 0x8000); - emu_wrptr(sc, v->vnum, ATKHLDV, ATKHLDV_HOLDTIME_MASK | ATKHLDV_ATTACKTIME_MASK); - emu_wrptr(sc, v->vnum, ENVVOL, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDV, EMU_CHAN_ATKHLDV_HOLDTIME_MASK | EMU_CHAN_ATKHLDV_ATTACKTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVOL, 0x8000); - emu_wrptr(sc, v->vnum, PEFE_FILTERAMOUNT, 0x7f); - emu_wrptr(sc, v->vnum, PEFE_PITCHAMOUNT, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_FILTERAMOUNT, 0x7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_PITCHAMOUNT, 0); if ((v->stereo) && (v->slave != NULL)) emu_vwrite(sc, v->slave); } @@ -1438,7 +1449,7 @@ emu_vstop(struct emu_sc_info *sc, char c { int reg; - reg = (channel & 0x20) ? SOLEH : SOLEL; + reg = (channel & 0x20) ? EMU_SOLEH : EMU_SOLEL; channel &= 0x1f; reg |= 1 << 24; reg |= channel << 16; @@ -1459,29 +1470,29 @@ emu_vtrigger(struct emu_sc_info *sc, str ccis *= v->b16 ? 1 : 2; sample = v->b16 ? 0x00000000 : 0x80808080; for (i = 0; i < cs; i++) - emu_wrptr(sc, v->vnum, CD0 + i, sample); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, 0); - emu_wrptr(sc, v->vnum, CCR_READADDRESS, cra); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, ccis); - - emu_wrptr(sc, v->vnum, IFATN, 0xff00); - emu_wrptr(sc, v->vnum, VTFT, 0xffffffff); - emu_wrptr(sc, v->vnum, CVCF, 0xffffffff); - emu_wrptr(sc, v->vnum, DCYSUSV, 0x00007f7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_CD0 + i, sample); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_READADDRESS, cra); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, ccis); + + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xff00); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSV, 0x00007f7f); emu_vstop(sc, v->vnum, 0); pitch_target = emu_rate_to_linearpitch(v->speed); initial_pitch = emu_rate_to_pitch(v->speed) >> 8; - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, pitch_target); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, pitch_target); - emu_wrptr(sc, v->vnum, IP, initial_pitch); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, initial_pitch); } else { - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, 0); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, 0); - emu_wrptr(sc, v->vnum, IFATN, 0xffff); - emu_wrptr(sc, v->vnum, VTFT, 0x0000ffff); - emu_wrptr(sc, v->vnum, CVCF, 0x0000ffff); - emu_wrptr(sc, v->vnum, IP, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, 0); emu_vstop(sc, v->vnum, 1); } if ((v->stereo) && (v->slave != NULL)) @@ -1494,7 +1505,7 @@ emu_vpos(struct emu_sc_info *sc, struct int s, ptr; s = (v->b16 ? 1 : 0) + (v->stereo ? 1 : 0); - ptr = (emu_rdptr(sc, v->vnum, CCCA_CURRADDR) - (v->start >> s)) << s; + ptr = (emu_rdptr(sc, v->vnum, EMU_CHAN_CCCA_CURRADDR) - (v->start >> s)) << s; return (ptr & ~0x0000001f); } @@ -1694,9 +1705,9 @@ emu_initefx(struct emu_sc_info *sc) /* stop DSP */ if (sc->is_emu10k1) { - emu_wrptr(sc, 0, DBG, EMU10K1_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_DBG, EMU_DBG_SINGLE_STEP); } else { - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); } /* code size is in instructions */ @@ -2162,9 +2173,9 @@ emu_initefx(struct emu_sc_info *sc) /* start DSP */ if (sc->is_emu10k1) { - emu_wrptr(sc, 0, DBG, 0); + emu_wrptr(sc, 0, EMU_DBG, 0); } else { - emu_wrptr(sc, 0, A_DBG, 0); + emu_wrptr(sc, 0, EMU_A_DBG, 0); } } @@ -2450,24 +2461,24 @@ emumix_set_mode(struct emu_sc_info *sc, return; } - hcfg = HCFG_AUDIOENABLE | HCFG_AUTOMUTE; + hcfg = EMU_HCFG_AUDIOENABLE | EMU_HCFG_AUTOMUTE; a_iocfg = 0; if (sc->rev >= 6) - hcfg |= HCFG_JOYENABLE; + hcfg |= EMU_HCFG_JOYENABLE; if (sc->is_emu10k1) - hcfg |= HCFG_LOCKTANKCACHE_MASK; + hcfg |= EMU_HCFG_LOCKTANKCACHE_MASK; else - hcfg |= HCFG_CODECFORMAT_I2S | HCFG_JOYENABLE; + hcfg |= EMU_HCFG_CODECFMT_I2S | EMU_HCFG_JOYENABLE; if (mode == MODE_DIGITAL) { if (sc->broken_digital) { device_printf(sc->dev, "Digital mode is reported as broken on this card.\n"); } - a_iocfg |= A_IOCFG_ENABLE_DIGITAL; - hcfg |= HCFG_GPOUT0; + a_iocfg |= EMU_A_IOCFG_GPOUT1; + hcfg |= EMU_HCFG_GPOUT0; } if (mode == MODE_ANALOG) @@ -2478,12 +2489,12 @@ emumix_set_mode(struct emu_sc_info *sc, if ((sc->is_ca0102) || (sc->is_ca0108)) /* - * Setting A_IOCFG_DISABLE_ANALOG will do opposite things + * Setting EMU_A_IOCFG_DISABLE_ANALOG will do opposite things * on diffrerent cards. * "don't disable analog outs" on Audigy 2 (ca0102/ca0108) * "disable analog outs" on Audigy (emu10k2) */ - a_iocfg |= A_IOCFG_DISABLE_ANALOG; + a_iocfg |= EMU_A_IOCFG_DISABLE_ANALOG; if (sc->is_ca0108) a_iocfg |= 0x20; /* XXX */ @@ -2492,12 +2503,12 @@ emumix_set_mode(struct emu_sc_info *sc, if (mode == MODE_DIGITAL) emumix_set_gpr(sc, sc->mute_gpr[ANALOGMUTE], 1); - emu_wr(sc, HCFG, hcfg, 4); + emu_wr(sc, EMU_HCFG, hcfg, 4); if ((sc->is_emu10k2) || (sc->is_ca0102) || (sc->is_ca0108)) { - tmp = emu_rd(sc, A_IOCFG, 2); + tmp = emu_rd(sc, EMU_A_IOCFG, 2); tmp = a_iocfg; - emu_wr(sc, A_IOCFG, tmp, 2); + emu_wr(sc, EMU_A_IOCFG, tmp, 2); } /* Unmute if we have changed mode to analog. */ @@ -2523,16 +2534,16 @@ emumix_set_spdif_mode(struct emu_sc_info return; } - spcs = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | - SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | - SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | - SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; + spcs = EMU_SPCS_CLKACCY_1000PPM | EMU_SPCS_SAMPLERATE_48 | + EMU_SPCS_CHANNELNUM_LEFT | EMU_SPCS_SOURCENUM_UNSPEC | + EMU_SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | + EMU_SPCS_EMPHASIS_NONE | EMU_SPCS_COPYRIGHT; mode = SPDIF_MODE_PCM; - emu_wrptr(sc, 0, SPCS0, spcs); - emu_wrptr(sc, 0, SPCS1, spcs); - emu_wrptr(sc, 0, SPCS2, spcs); + emu_wrptr(sc, 0, EMU_SPCS0, spcs); + emu_wrptr(sc, 0, EMU_SPCS1, spcs); + emu_wrptr(sc, 0, EMU_SPCS2, spcs); } #define L2L_POINTS 10 @@ -2635,8 +2646,8 @@ emu_cardbus_init(struct emu_sc_info *sc) { /* - * XXX May not need this if we have IPR3 handler. - * Is it a real init calls, or IPR3 interrupt acknowledgments? + * XXX May not need this if we have EMU_IPR3 handler. + * Is it a real init calls, or EMU_IPR3 interrupt acknowledgments? * Looks much like "(data << 16) | register". */ emu_wr_cbptr(sc, (0x00d0 << 16) | 0x0000); @@ -2660,42 +2671,42 @@ emu_init(struct emu_sc_info *sc) int i; /* disable audio and lock cache */ - emu_wr(sc, HCFG, HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, 4); + emu_wr(sc, EMU_HCFG, EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); /* disable channel interrupt */ - emu_wr(sc, INTE, INTE_INTERVALTIMERENB | INTE_SAMPLERATETRACKER | INTE_PCIERRORENABLE, 4); - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wr(sc, EMU_INTE, EMU_INTE_INTERTIMERENB | EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE, 4); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* disable P16V and S/PDIF interrupts */ if ((sc->is_ca0102) || (sc->is_ca0108)) - emu_wr(sc, INTE2, 0, 4); + emu_wr(sc, EMU_INTE2, 0, 4); if (sc->is_ca0102) - emu_wr(sc, INTE3, 0, 4); + emu_wr(sc, EMU_INTE3, 0, 4); /* init phys inputs and outputs */ ac97slot = 0; if (sc->has_51) - ac97slot = AC97SLOT_CNTR | AC97SLOT_LFE; + ac97slot = EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE; if (sc->has_71) - ac97slot = AC97SLOT_CNTR | AC97SLOT_LFE | AC97SLOT_REAR_LEFT | AC97SLOT_REAR_RIGHT; + ac97slot = EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE | EMU_AC97SLOT_REAR_LEFT | EMU_AC97SLOT_REAR_RIGHT; if (sc->is_emu10k2) ac97slot |= 0x40; - emu_wrptr(sc, 0, AC97SLOT, ac97slot); + emu_wrptr(sc, 0, EMU_AC97SLOT, ac97slot); if (sc->is_emu10k2) /* XXX for later cards? */ - emu_wrptr(sc, 0, SPBYPASS, 0xf00); /* What will happen if + emu_wrptr(sc, 0, EMU_SPBYPASS, 0xf00); /* What will happen if * we write 1 here? */ if (bus_dma_tag_create( /* parent */ bus_get_dma_tag(sc->dev), @@ -2729,61 +2740,61 @@ emu_init(struct emu_sc_info *sc) sc->mem.ptb_pages[i] = tmp | i; for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, MAPA, tmp | MAP_PTI_MASK); - emu_wrptr(sc, ch, MAPB, tmp | MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPA, tmp | EMU_CHAN_MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPB, tmp | EMU_CHAN_MAP_PTI_MASK); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 21:38:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57BA7106566C; Wed, 11 Jan 2012 21:38:06 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46C8D8FC0A; Wed, 11 Jan 2012 21:38:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BLc6vw077814; Wed, 11 Jan 2012 21:38:06 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BLc64Y077812; Wed, 11 Jan 2012 21:38:06 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201201112138.q0BLc64Y077812@svn.freebsd.org> From: Don Lewis Date: Wed, 11 Jan 2012 21:38: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: r229984 - head/sys/dev/pst X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 21:38:06 -0000 Author: truckman Date: Wed Jan 11 21:38:05 2012 New Revision: 229984 URL: http://svn.freebsd.org/changeset/base/229984 Log: Pass the arguments to mtx_init() in the correct order. There should be no change to the binary because the value of MTX_DEF is zero and there is a visible function prototype. MFC after: 1 week Modified: head/sys/dev/pst/pst-pci.c Modified: head/sys/dev/pst/pst-pci.c ============================================================================== --- head/sys/dev/pst/pst-pci.c Wed Jan 11 21:26:46 2012 (r229983) +++ head/sys/dev/pst/pst-pci.c Wed Jan 11 21:38:05 2012 (r229984) @@ -95,7 +95,7 @@ iop_pci_attach(device_t dev) sc->ibase = rman_get_virtual(sc->r_mem); sc->reg = (struct i2o_registers *)sc->ibase; sc->dev = dev; - mtx_init(&sc->mtx, "pst lock", MTX_DEF, 0); + mtx_init(&sc->mtx, "pst lock", NULL, MTX_DEF); if (!iop_init(sc)) return 0; From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 22:12:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B48C106564A; Wed, 11 Jan 2012 22:12:46 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49B558FC13; Wed, 11 Jan 2012 22:12:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BMCkKO078917; Wed, 11 Jan 2012 22:12:46 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BMCkvo078915; Wed, 11 Jan 2012 22:12:46 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201112212.q0BMCkvo078915@svn.freebsd.org> From: Guy Helmer Date: Wed, 11 Jan 2012 22:12: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: r229985 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 22:12:46 -0000 Author: ghelmer Date: Wed Jan 11 22:12:45 2012 New Revision: 229985 URL: http://svn.freebsd.org/changeset/base/229985 Log: Fix forward structure declaration and prototype disorder. Requested by bde. Modified: head/lib/libutil/libutil.h Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Wed Jan 11 21:38:05 2012 (r229984) +++ head/lib/libutil/libutil.h Wed Jan 11 22:12:45 2012 (r229985) @@ -84,45 +84,27 @@ struct pidfh { #endif /* Avoid pulling in all the include files for no need */ -struct termios; -struct winsize; struct in_addr; struct kinfo_file; struct kinfo_proc; struct kinfo_vmentry; +struct sockaddr; +struct termios; +struct winsize; __BEGIN_DECLS +char *auth_getval(const char *name); void clean_environment(const char * const *_white, const char * const *_more_white); +int expand_number(const char *_buf, uint64_t *_num); int extattr_namespace_to_string(int _attrnamespace, char **_string); int extattr_string_to_namespace(const char *_string, int *_attrnamespace); int flopen(const char *_path, int _flags, ...); -void hexdump(const void *ptr, int length, const char *hdr, int flags); -int login_tty(int _fd); -void trimdomain(char *_fullhost, int _hostsize); -int openpty(int *_amaster, int *_aslave, char *_name, - struct termios *_termp, struct winsize *_winp); int forkpty(int *_amaster, char *_name, struct termios *_termp, struct winsize *_winp); +void hexdump(const void *ptr, int length, const char *hdr, int flags); int humanize_number(char *_buf, size_t _len, int64_t _number, const char *_suffix, int _scale, int _flags); -int expand_number(const char *_buf, uint64_t *_num); -const char *uu_lockerr(int _uu_lockresult); -int uu_lock(const char *_ttyname); -int uu_unlock(const char *_ttyname); -int uu_lock_txfr(const char *_ttyname, pid_t _pid); -int _secure_path(const char *_path, uid_t _uid, gid_t _gid); -properties properties_read(int fd); -void properties_free(properties list); -char *property_find(properties list, const char *name); -char *auth_getval(const char *name); -int realhostname(char *host, size_t hsize, const struct in_addr *ip); -struct sockaddr; -int realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, - int addrlen); - -int kld_isloaded(const char *name); -int kld_load(const char *name); struct kinfo_file * kinfo_getfile(pid_t _pid, int *_cntp); struct kinfo_vmentry * @@ -131,6 +113,23 @@ struct kinfo_proc * kinfo_getallproc(int *_cntp); struct kinfo_proc * kinfo_getproc(pid_t _pid); +int kld_isloaded(const char *name); +int kld_load(const char *name); +int login_tty(int _fd); +int openpty(int *_amaster, int *_aslave, char *_name, + struct termios *_termp, struct winsize *_winp); +void properties_free(properties list); +char *property_find(properties list, const char *name); +properties properties_read(int fd); +int realhostname(char *host, size_t hsize, const struct in_addr *ip); +int realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, + int addrlen); +int _secure_path(const char *_path, uid_t _uid, gid_t _gid); +void trimdomain(char *_fullhost, int _hostsize); +const char *uu_lockerr(int _uu_lockresult); +int uu_lock(const char *_ttyname); +int uu_unlock(const char *_ttyname); +int uu_lock_txfr(const char *_ttyname, pid_t _pid); #ifdef _STDIO_H_ /* avoid adding new includes */ char *fparseln(FILE *, size_t *, size_t *, const char[3], int); @@ -166,28 +165,28 @@ struct group *gr_scan(const char *line); #endif #ifdef _SYS_PARAM_H_ -struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr); -int pidfile_write(struct pidfh *pfh); int pidfile_close(struct pidfh *pfh); -int pidfile_remove(struct pidfh *pfh); int pidfile_fileno(const struct pidfh *pfh); +struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr); +int pidfile_remove(struct pidfh *pfh); +int pidfile_write(struct pidfh *pfh); #endif #ifdef _UFS_UFS_QUOTA_H_ -struct quotafile; struct fstab; -struct quotafile *quota_open(struct fstab *, int, int); +struct quotafile; +int quota_check_path(const struct quotafile *, const char *path); void quota_close(struct quotafile *); -int quota_on(struct quotafile *); -int quota_off(struct quotafile *); +int quota_convert(struct quotafile *, int); const char *quota_fsname(const struct quotafile *); -const char *quota_qfname(const struct quotafile *); int quota_maxid(struct quotafile *); -int quota_check_path(const struct quotafile *, const char *path); +int quota_off(struct quotafile *); +int quota_on(struct quotafile *); +struct quotafile *quota_open(struct fstab *, int, int); +const char *quota_qfname(const struct quotafile *); int quota_read(struct quotafile *, struct dqblk *, int); int quota_write_limits(struct quotafile *, struct dqblk *, int); int quota_write_usage(struct quotafile *, struct dqblk *, int); -int quota_convert(struct quotafile *, int); #endif __END_DECLS From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 22:33:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ACC21065670; Wed, 11 Jan 2012 22:33:41 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 894D88FC24; Wed, 11 Jan 2012 22:33:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BMXf1x079584; Wed, 11 Jan 2012 22:33:41 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BMXfgD079582; Wed, 11 Jan 2012 22:33:41 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201112233.q0BMXfgD079582@svn.freebsd.org> From: Guy Helmer Date: Wed, 11 Jan 2012 22:33: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: r229986 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 22:33:41 -0000 Author: ghelmer Date: Wed Jan 11 22:33:41 2012 New Revision: 229986 URL: http://svn.freebsd.org/changeset/base/229986 Log: Fix namespace issues with prototype parameter names. Add missing prototype parameter names. Requested by bde. Modified: head/lib/libutil/libutil.h Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Wed Jan 11 22:12:45 2012 (r229985) +++ head/lib/libutil/libutil.h Wed Jan 11 22:33:41 2012 (r229986) @@ -93,7 +93,7 @@ struct termios; struct winsize; __BEGIN_DECLS -char *auth_getval(const char *name); +char *auth_getval(const char *_name); void clean_environment(const char * const *_white, const char * const *_more_white); int expand_number(const char *_buf, uint64_t *_num); @@ -102,7 +102,7 @@ int extattr_string_to_namespace(const ch int flopen(const char *_path, int _flags, ...); int forkpty(int *_amaster, char *_name, struct termios *_termp, struct winsize *_winp); -void hexdump(const void *ptr, int length, const char *hdr, int flags); +void hexdump(const void *_ptr, int _length, const char *_hdr, int _flags); int humanize_number(char *_buf, size_t _len, int64_t _number, const char *_suffix, int _scale, int _flags); struct kinfo_file * @@ -113,17 +113,17 @@ struct kinfo_proc * kinfo_getallproc(int *_cntp); struct kinfo_proc * kinfo_getproc(pid_t _pid); -int kld_isloaded(const char *name); -int kld_load(const char *name); +int kld_isloaded(const char *_name); +int kld_load(const char *_name); int login_tty(int _fd); int openpty(int *_amaster, int *_aslave, char *_name, struct termios *_termp, struct winsize *_winp); -void properties_free(properties list); -char *property_find(properties list, const char *name); -properties properties_read(int fd); -int realhostname(char *host, size_t hsize, const struct in_addr *ip); -int realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, - int addrlen); +void properties_free(properties _list); +char *property_find(properties _list, const char *_name); +properties properties_read(int _fd); +int realhostname(char *_host, size_t _hsize, const struct in_addr *_ip); +int realhostname_sa(char *_host, size_t _hsize, struct sockaddr *_addr, + int _addrlen); int _secure_path(const char *_path, uid_t _uid, gid_t _gid); void trimdomain(char *_fullhost, int _hostsize); const char *uu_lockerr(int _uu_lockresult); @@ -132,7 +132,7 @@ int uu_unlock(const char *_ttyname); int uu_lock_txfr(const char *_ttyname, pid_t _pid); #ifdef _STDIO_H_ /* avoid adding new includes */ -char *fparseln(FILE *, size_t *, size_t *, const char[3], int); +char *fparseln(FILE *_fp, size_t *_len, size_t *_lineno, const char _delim[3], int _flags); #endif #ifdef _PWD_H_ @@ -153,40 +153,40 @@ int pw_tmp(int _mfd); #ifdef _GRP_H_ int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct group *_old_gr); -struct group *gr_dup(const struct group *gr); -int gr_equal(const struct group *gr1, const struct group *gr2); +struct group *gr_dup(const struct group *_gr); +int gr_equal(const struct group *_gr1, const struct group *_gr2); void gr_fini(void); int gr_init(const char *_dir, const char *_master); int gr_lock(void); -char *gr_make(const struct group *gr); +char *gr_make(const struct group *_gr); int gr_mkdb(void); +struct group *gr_scan(const char *_line); int gr_tmp(int _mdf); -struct group *gr_scan(const char *line); #endif #ifdef _SYS_PARAM_H_ -int pidfile_close(struct pidfh *pfh); -int pidfile_fileno(const struct pidfh *pfh); -struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr); -int pidfile_remove(struct pidfh *pfh); -int pidfile_write(struct pidfh *pfh); +int pidfile_close(struct pidfh *_pfh); +int pidfile_fileno(const struct pidfh *_pfh); +struct pidfh *pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); +int pidfile_remove(struct pidfh *_pfh); +int pidfile_write(struct pidfh *_pfh); #endif #ifdef _UFS_UFS_QUOTA_H_ struct fstab; struct quotafile; -int quota_check_path(const struct quotafile *, const char *path); -void quota_close(struct quotafile *); -int quota_convert(struct quotafile *, int); -const char *quota_fsname(const struct quotafile *); -int quota_maxid(struct quotafile *); -int quota_off(struct quotafile *); -int quota_on(struct quotafile *); -struct quotafile *quota_open(struct fstab *, int, int); -const char *quota_qfname(const struct quotafile *); -int quota_read(struct quotafile *, struct dqblk *, int); -int quota_write_limits(struct quotafile *, struct dqblk *, int); -int quota_write_usage(struct quotafile *, struct dqblk *, int); +int quota_check_path(const struct quotafile *_qf, const char *_path); +void quota_close(struct quotafile *_qf); +int quota_convert(struct quotafile *_qf, int _wordsize); +const char *quota_fsname(const struct quotafile *_qf); +int quota_maxid(struct quotafile *_qf); +int quota_off(struct quotafile *_qf); +int quota_on(struct quotafile *_qf); +struct quotafile *quota_open(struct fstab *_fs, int _quotatype, int _openflags); +const char *quota_qfname(const struct quotafile *_qf); +int quota_read(struct quotafile *_qf, struct dqblk *_dqb, int _id); +int quota_write_limits(struct quotafile *_qf, struct dqblk *_dqb, int _id); +int quota_write_usage(struct quotafile *_qf, struct dqblk *_dqb, int _id); #endif __END_DECLS From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 22:45:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1532E106566C; Wed, 11 Jan 2012 22:45:16 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE02B8FC12; Wed, 11 Jan 2012 22:45:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BMjFkD080051; Wed, 11 Jan 2012 22:45:15 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BMjFYr080049; Wed, 11 Jan 2012 22:45:15 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201112245.q0BMjFYr080049@svn.freebsd.org> From: Guy Helmer Date: Wed, 11 Jan 2012 22:45: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: r229988 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 22:45:16 -0000 Author: ghelmer Date: Wed Jan 11 22:45:15 2012 New Revision: 229988 URL: http://svn.freebsd.org/changeset/base/229988 Log: Fix prototype formatting (indentation, long lines, and continued lines). Requested by bde. Modified: head/lib/libutil/libutil.h Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Wed Jan 11 22:37:45 2012 (r229987) +++ head/lib/libutil/libutil.h Wed Jan 11 22:45:15 2012 (r229988) @@ -101,7 +101,7 @@ int extattr_namespace_to_string(int _att int extattr_string_to_namespace(const char *_string, int *_attrnamespace); int flopen(const char *_path, int _flags, ...); int forkpty(int *_amaster, char *_name, - struct termios *_termp, struct winsize *_winp); + struct termios *_termp, struct winsize *_winp); void hexdump(const void *_ptr, int _length, const char *_hdr, int _flags); int humanize_number(char *_buf, size_t _len, int64_t _number, const char *_suffix, int _scale, int _flags); @@ -117,22 +117,25 @@ int kld_isloaded(const char *_name); int kld_load(const char *_name); int login_tty(int _fd); int openpty(int *_amaster, int *_aslave, char *_name, - struct termios *_termp, struct winsize *_winp); + struct termios *_termp, struct winsize *_winp); void properties_free(properties _list); char *property_find(properties _list, const char *_name); -properties properties_read(int _fd); +properties + properties_read(int fd); int realhostname(char *_host, size_t _hsize, const struct in_addr *_ip); int realhostname_sa(char *_host, size_t _hsize, struct sockaddr *_addr, - int _addrlen); + int _addrlen); int _secure_path(const char *_path, uid_t _uid, gid_t _gid); void trimdomain(char *_fullhost, int _hostsize); -const char *uu_lockerr(int _uu_lockresult); +const char * + uu_lockerr(int _uu_lockresult); int uu_lock(const char *_ttyname); int uu_unlock(const char *_ttyname); int uu_lock_txfr(const char *_ttyname, pid_t _pid); #ifdef _STDIO_H_ /* avoid adding new includes */ -char *fparseln(FILE *_fp, size_t *_len, size_t *_lineno, const char _delim[3], int _flags); +char *fparseln(FILE *_fp, size_t *_len, size_t *_lineno, + const char _delim[3], int _flags); #endif #ifdef _PWD_H_ @@ -165,28 +168,32 @@ int gr_tmp(int _mdf); #endif #ifdef _SYS_PARAM_H_ -int pidfile_close(struct pidfh *_pfh); -int pidfile_fileno(const struct pidfh *_pfh); -struct pidfh *pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); -int pidfile_remove(struct pidfh *_pfh); -int pidfile_write(struct pidfh *_pfh); +int pidfile_close(struct pidfh *_pfh); +int pidfile_fileno(const struct pidfh *_pfh); +struct pidfh * + pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); +int pidfile_remove(struct pidfh *_pfh); +int pidfile_write(struct pidfh *_pfh); #endif #ifdef _UFS_UFS_QUOTA_H_ struct fstab; struct quotafile; -int quota_check_path(const struct quotafile *_qf, const char *_path); -void quota_close(struct quotafile *_qf); -int quota_convert(struct quotafile *_qf, int _wordsize); -const char *quota_fsname(const struct quotafile *_qf); -int quota_maxid(struct quotafile *_qf); -int quota_off(struct quotafile *_qf); -int quota_on(struct quotafile *_qf); -struct quotafile *quota_open(struct fstab *_fs, int _quotatype, int _openflags); -const char *quota_qfname(const struct quotafile *_qf); -int quota_read(struct quotafile *_qf, struct dqblk *_dqb, int _id); -int quota_write_limits(struct quotafile *_qf, struct dqblk *_dqb, int _id); -int quota_write_usage(struct quotafile *_qf, struct dqblk *_dqb, int _id); +int quota_check_path(const struct quotafile *_qf, const char *_path); +void quota_close(struct quotafile *_qf); +int quota_convert(struct quotafile *_qf, int _wordsize); +const char * + quota_fsname(const struct quotafile *_qf); +int quota_maxid(struct quotafile *_qf); +int quota_off(struct quotafile *_qf); +int quota_on(struct quotafile *_qf); +struct quotafile * + quota_open(struct fstab *_fs, int _quotatype, int _openflags); +const char * + quota_qfname(const struct quotafile *_qf); +int quota_read(struct quotafile *_qf, struct dqblk *_dqb, int _id); +int quota_write_limits(struct quotafile *_qf, struct dqblk *_dqb, int _id); +int quota_write_usage(struct quotafile *_qf, struct dqblk *_dqb, int _id); #endif __END_DECLS From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 23:06:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35C41106566B; Wed, 11 Jan 2012 23:06:38 +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 1FA588FC1D; Wed, 11 Jan 2012 23:06:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0BN6cFi080858; Wed, 11 Jan 2012 23:06:38 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0BN6bx2080805; Wed, 11 Jan 2012 23:06:37 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201201112306.q0BN6bx2080805@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 11 Jan 2012 23:06:37 +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: r229989 - in head: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/debugger sys/contrib/dev/acpica/disassembler sys/... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 23:06:38 -0000 Author: jkim Date: Wed Jan 11 23:06:37 2012 New Revision: 229989 URL: http://svn.freebsd.org/changeset/base/229989 Log: Merge ACPICA 20120111. Added: head/sys/contrib/dev/acpica/utilities/utaddress.c - copied, changed from r229983, vendor-sys/acpica/dist/utilities/utaddress.c Modified: head/sys/conf/files head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/adfile.c head/sys/contrib/dev/acpica/common/adisasm.c head/sys/contrib/dev/acpica/common/adwalk.c head/sys/contrib/dev/acpica/common/dmextern.c 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/common/getopt.c head/sys/contrib/dev/acpica/compiler/aslanalyze.c head/sys/contrib/dev/acpica/compiler/aslbtypes.c head/sys/contrib/dev/acpica/compiler/aslcodegen.c head/sys/contrib/dev/acpica/compiler/aslcompile.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/aslerror.c head/sys/contrib/dev/acpica/compiler/aslfiles.c head/sys/contrib/dev/acpica/compiler/aslfold.c head/sys/contrib/dev/acpica/compiler/aslglobal.h head/sys/contrib/dev/acpica/compiler/asllength.c head/sys/contrib/dev/acpica/compiler/asllisting.c 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/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslopcodes.c head/sys/contrib/dev/acpica/compiler/asloperands.c head/sys/contrib/dev/acpica/compiler/aslopt.c head/sys/contrib/dev/acpica/compiler/aslpredef.c head/sys/contrib/dev/acpica/compiler/aslresource.c head/sys/contrib/dev/acpica/compiler/aslrestype1.c head/sys/contrib/dev/acpica/compiler/aslrestype1i.c head/sys/contrib/dev/acpica/compiler/aslrestype2.c head/sys/contrib/dev/acpica/compiler/aslrestype2d.c head/sys/contrib/dev/acpica/compiler/aslrestype2e.c head/sys/contrib/dev/acpica/compiler/aslrestype2q.c head/sys/contrib/dev/acpica/compiler/aslrestype2s.c head/sys/contrib/dev/acpica/compiler/aslrestype2w.c head/sys/contrib/dev/acpica/compiler/aslstartup.c head/sys/contrib/dev/acpica/compiler/aslstubs.c head/sys/contrib/dev/acpica/compiler/asltransform.c head/sys/contrib/dev/acpica/compiler/asltree.c head/sys/contrib/dev/acpica/compiler/asltypes.h head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/asluuid.c head/sys/contrib/dev/acpica/compiler/aslwalks.c head/sys/contrib/dev/acpica/compiler/dtcompile.c head/sys/contrib/dev/acpica/compiler/dtcompiler.h head/sys/contrib/dev/acpica/compiler/dtexpress.c head/sys/contrib/dev/acpica/compiler/dtfield.c head/sys/contrib/dev/acpica/compiler/dtio.c head/sys/contrib/dev/acpica/compiler/dtparser.l head/sys/contrib/dev/acpica/compiler/dtparser.y head/sys/contrib/dev/acpica/compiler/dtsubtable.c head/sys/contrib/dev/acpica/compiler/dttable.c head/sys/contrib/dev/acpica/compiler/dttemplate.c head/sys/contrib/dev/acpica/compiler/dttemplate.h head/sys/contrib/dev/acpica/compiler/dtutils.c 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/debugger/dbfileio.c head/sys/contrib/dev/acpica/debugger/dbhistry.c head/sys/contrib/dev/acpica/debugger/dbinput.c head/sys/contrib/dev/acpica/debugger/dbmethod.c head/sys/contrib/dev/acpica/debugger/dbnames.c head/sys/contrib/dev/acpica/debugger/dbstats.c head/sys/contrib/dev/acpica/debugger/dbutils.c head/sys/contrib/dev/acpica/debugger/dbxface.c head/sys/contrib/dev/acpica/disassembler/dmbuffer.c head/sys/contrib/dev/acpica/disassembler/dmnames.c head/sys/contrib/dev/acpica/disassembler/dmobject.c head/sys/contrib/dev/acpica/disassembler/dmopcode.c head/sys/contrib/dev/acpica/disassembler/dmresrc.c head/sys/contrib/dev/acpica/disassembler/dmresrcl.c head/sys/contrib/dev/acpica/disassembler/dmresrcl2.c head/sys/contrib/dev/acpica/disassembler/dmresrcs.c head/sys/contrib/dev/acpica/disassembler/dmutils.c head/sys/contrib/dev/acpica/disassembler/dmwalk.c head/sys/contrib/dev/acpica/dispatcher/dsargs.c head/sys/contrib/dev/acpica/dispatcher/dscontrol.c head/sys/contrib/dev/acpica/dispatcher/dsfield.c head/sys/contrib/dev/acpica/dispatcher/dsinit.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/dsopcode.c head/sys/contrib/dev/acpica/dispatcher/dsutils.c head/sys/contrib/dev/acpica/dispatcher/dswexec.c head/sys/contrib/dev/acpica/dispatcher/dswload.c head/sys/contrib/dev/acpica/dispatcher/dswload2.c head/sys/contrib/dev/acpica/dispatcher/dswscope.c head/sys/contrib/dev/acpica/dispatcher/dswstate.c head/sys/contrib/dev/acpica/events/evevent.c head/sys/contrib/dev/acpica/events/evglock.c head/sys/contrib/dev/acpica/events/evgpe.c head/sys/contrib/dev/acpica/events/evgpeblk.c head/sys/contrib/dev/acpica/events/evgpeinit.c head/sys/contrib/dev/acpica/events/evgpeutil.c head/sys/contrib/dev/acpica/events/evmisc.c head/sys/contrib/dev/acpica/events/evregion.c head/sys/contrib/dev/acpica/events/evrgnini.c head/sys/contrib/dev/acpica/events/evsci.c head/sys/contrib/dev/acpica/events/evxface.c head/sys/contrib/dev/acpica/events/evxfevnt.c head/sys/contrib/dev/acpica/events/evxfgpe.c head/sys/contrib/dev/acpica/events/evxfregn.c head/sys/contrib/dev/acpica/executer/exconfig.c head/sys/contrib/dev/acpica/executer/exconvrt.c head/sys/contrib/dev/acpica/executer/excreate.c head/sys/contrib/dev/acpica/executer/exdebug.c head/sys/contrib/dev/acpica/executer/exdump.c head/sys/contrib/dev/acpica/executer/exfield.c head/sys/contrib/dev/acpica/executer/exfldio.c head/sys/contrib/dev/acpica/executer/exmisc.c head/sys/contrib/dev/acpica/executer/exmutex.c head/sys/contrib/dev/acpica/executer/exnames.c head/sys/contrib/dev/acpica/executer/exoparg1.c head/sys/contrib/dev/acpica/executer/exoparg2.c head/sys/contrib/dev/acpica/executer/exoparg3.c head/sys/contrib/dev/acpica/executer/exoparg6.c head/sys/contrib/dev/acpica/executer/exprep.c head/sys/contrib/dev/acpica/executer/exregion.c head/sys/contrib/dev/acpica/executer/exresnte.c head/sys/contrib/dev/acpica/executer/exresolv.c head/sys/contrib/dev/acpica/executer/exresop.c head/sys/contrib/dev/acpica/executer/exstore.c head/sys/contrib/dev/acpica/executer/exstoren.c head/sys/contrib/dev/acpica/executer/exstorob.c head/sys/contrib/dev/acpica/executer/exsystem.c head/sys/contrib/dev/acpica/executer/exutils.c head/sys/contrib/dev/acpica/hardware/hwacpi.c head/sys/contrib/dev/acpica/hardware/hwgpe.c head/sys/contrib/dev/acpica/hardware/hwpci.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/hwvalid.c head/sys/contrib/dev/acpica/hardware/hwxface.c head/sys/contrib/dev/acpica/include/acapps.h head/sys/contrib/dev/acpica/include/accommon.h 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/acdispat.h head/sys/contrib/dev/acpica/include/acevents.h head/sys/contrib/dev/acpica/include/acexcep.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/acnames.h head/sys/contrib/dev/acpica/include/acnamesp.h head/sys/contrib/dev/acpica/include/acobject.h head/sys/contrib/dev/acpica/include/acopcode.h head/sys/contrib/dev/acpica/include/acoutput.h head/sys/contrib/dev/acpica/include/acparser.h head/sys/contrib/dev/acpica/include/acpi.h head/sys/contrib/dev/acpica/include/acpiosxf.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acpredef.h head/sys/contrib/dev/acpica/include/acresrc.h head/sys/contrib/dev/acpica/include/acrestyp.h head/sys/contrib/dev/acpica/include/acstruct.h head/sys/contrib/dev/acpica/include/actables.h head/sys/contrib/dev/acpica/include/actbl.h head/sys/contrib/dev/acpica/include/actbl1.h head/sys/contrib/dev/acpica/include/actbl2.h head/sys/contrib/dev/acpica/include/actbl3.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/include/amlresrc.h head/sys/contrib/dev/acpica/include/platform/acenv.h head/sys/contrib/dev/acpica/include/platform/acfreebsd.h head/sys/contrib/dev/acpica/include/platform/acgcc.h head/sys/contrib/dev/acpica/namespace/nsaccess.c head/sys/contrib/dev/acpica/namespace/nsalloc.c head/sys/contrib/dev/acpica/namespace/nsdump.c head/sys/contrib/dev/acpica/namespace/nsdumpdv.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/nsnames.c head/sys/contrib/dev/acpica/namespace/nsobject.c head/sys/contrib/dev/acpica/namespace/nsparse.c head/sys/contrib/dev/acpica/namespace/nspredef.c head/sys/contrib/dev/acpica/namespace/nsrepair.c head/sys/contrib/dev/acpica/namespace/nsrepair2.c head/sys/contrib/dev/acpica/namespace/nssearch.c head/sys/contrib/dev/acpica/namespace/nsutils.c head/sys/contrib/dev/acpica/namespace/nswalk.c head/sys/contrib/dev/acpica/namespace/nsxfeval.c head/sys/contrib/dev/acpica/namespace/nsxfname.c head/sys/contrib/dev/acpica/namespace/nsxfobj.c head/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c head/sys/contrib/dev/acpica/parser/psargs.c head/sys/contrib/dev/acpica/parser/psloop.c head/sys/contrib/dev/acpica/parser/psopcode.c head/sys/contrib/dev/acpica/parser/psparse.c head/sys/contrib/dev/acpica/parser/psscope.c head/sys/contrib/dev/acpica/parser/pstree.c head/sys/contrib/dev/acpica/parser/psutils.c head/sys/contrib/dev/acpica/parser/pswalk.c head/sys/contrib/dev/acpica/parser/psxface.c head/sys/contrib/dev/acpica/resources/rsaddr.c head/sys/contrib/dev/acpica/resources/rscalc.c head/sys/contrib/dev/acpica/resources/rscreate.c head/sys/contrib/dev/acpica/resources/rsdump.c head/sys/contrib/dev/acpica/resources/rsinfo.c head/sys/contrib/dev/acpica/resources/rsio.c head/sys/contrib/dev/acpica/resources/rsirq.c head/sys/contrib/dev/acpica/resources/rslist.c head/sys/contrib/dev/acpica/resources/rsmemory.c head/sys/contrib/dev/acpica/resources/rsmisc.c head/sys/contrib/dev/acpica/resources/rsserial.c head/sys/contrib/dev/acpica/resources/rsutils.c head/sys/contrib/dev/acpica/resources/rsxface.c head/sys/contrib/dev/acpica/tables/tbfadt.c head/sys/contrib/dev/acpica/tables/tbfind.c head/sys/contrib/dev/acpica/tables/tbinstal.c head/sys/contrib/dev/acpica/tables/tbutils.c head/sys/contrib/dev/acpica/tables/tbxface.c head/sys/contrib/dev/acpica/tables/tbxfroot.c head/sys/contrib/dev/acpica/utilities/utalloc.c head/sys/contrib/dev/acpica/utilities/utcache.c head/sys/contrib/dev/acpica/utilities/utcopy.c head/sys/contrib/dev/acpica/utilities/utdebug.c head/sys/contrib/dev/acpica/utilities/utdecode.c head/sys/contrib/dev/acpica/utilities/utdelete.c head/sys/contrib/dev/acpica/utilities/uteval.c head/sys/contrib/dev/acpica/utilities/utglobal.c head/sys/contrib/dev/acpica/utilities/utids.c head/sys/contrib/dev/acpica/utilities/utinit.c head/sys/contrib/dev/acpica/utilities/utlock.c head/sys/contrib/dev/acpica/utilities/utmath.c head/sys/contrib/dev/acpica/utilities/utmisc.c head/sys/contrib/dev/acpica/utilities/utmutex.c head/sys/contrib/dev/acpica/utilities/utobject.c head/sys/contrib/dev/acpica/utilities/utosi.c head/sys/contrib/dev/acpica/utilities/utresrc.c head/sys/contrib/dev/acpica/utilities/utstate.c head/sys/contrib/dev/acpica/utilities/uttrack.c head/sys/contrib/dev/acpica/utilities/utxface.c head/sys/contrib/dev/acpica/utilities/utxferror.c head/sys/contrib/dev/acpica/utilities/utxfmutex.c head/sys/modules/acpi/acpi/Makefile head/usr.sbin/acpi/acpidb/Makefile head/usr.sbin/acpi/iasl/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/conf/files Wed Jan 11 23:06:37 2012 (r229989) @@ -267,6 +267,7 @@ contrib/dev/acpica/tables/tbinstal.c op contrib/dev/acpica/tables/tbutils.c optional acpi contrib/dev/acpica/tables/tbxface.c optional acpi contrib/dev/acpica/tables/tbxfroot.c optional acpi +contrib/dev/acpica/utilities/utaddress.c optional acpi contrib/dev/acpica/utilities/utalloc.c optional acpi contrib/dev/acpica/utilities/utcache.c optional acpi contrib/dev/acpica/utilities/utcopy.c optional acpi Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/changes.txt Wed Jan 11 23:06:37 2012 (r229989) @@ -1,8 +1,56 @@ ---------------------------------------- -23 November 2011. Summary of changes for version 20111123: +11 January 2012. Summary of changes for version 20120111: + +This release is available at www.acpica.org/downloads. +The ACPI 5.0 specification is available at www.acpi.info. + +1) ACPICA Core Subsystem: + +Implemented a new mechanism to allow host device drivers to check for address +range conflicts with ACPI Operation Regions. Both SystemMemory and SystemIO +address spaces are supported. A new external interface, AcpiCheckAddressRange, +allows drivers to check an address range against the ACPI namespace. See the +ACPICA reference for additional details. Adds one new file, +utilities/utaddress.c. Lin Ming, Bob Moore. + +Fixed several issues with the ACPI 5.0 FADT support: Add the sleep Control and +Status registers, update the ACPI 5.0 flags, and update internal data +structures to handle an FADT larger than 256 bytes. The size of the ACPI 5.0 +FADT is 268 bytes. + +Updated all ACPICA copyrights and signons to 2012. Added the 2012 copyright to +all module headers and signons, including the standard Linux header. This +affects virtually every file in the ACPICA core subsystem, iASL compiler, and +all ACPICA utilities. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.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: 92.3K Code, 24.9K Data, 117.2K Total + Debug Version: 170.8K Code, 72.6K Data, 243.4K Total + Current Release: + Non-Debug Version: 92.8K Code, 24.9K Data, 117.7K Total + Debug Version: 171.7K Code, 72.9K Data, 244.5K Total + -This release is available at www.acpica.org/downloads -The ACPI 5.0 specification is available at www.acpi.info +2) iASL Compiler/Disassembler and Tools: + +Disassembler: fixed a problem with the automatic resource tag generation +support. Fixes a problem where the resource tags are inadvertently not +constructed if the table being disassembled contains external references to +control methods. Moved the actual construction of the tags to after the final +namespace is constructed (after 2nd parse is invoked due to external control +method references.) ACPICA BZ 941. + +Table Compiler: Make all "generic" operators caseless. These are the operators +like UINT8, String, etc. Making these caseless improves ease-of-use. ACPICA BZ +934. + +---------------------------------------- +23 November 2011. Summary of changes for version 20111123: 0) ACPI 5.0 Support: Modified: head/sys/contrib/dev/acpica/common/adfile.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adfile.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/common/adfile.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adisasm.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/common/adisasm.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -376,7 +376,8 @@ AdAmlDisassemble ( AdDisassemblerHeader (Filename); AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n", Table->Signature); - AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue\n */\n\n"); + AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] " + "FieldName : FieldValue\n */\n\n"); AcpiDmDumpDataTable (Table); fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n", @@ -403,15 +404,17 @@ AdAmlDisassemble ( AcpiOsPrintf ("*****/\n"); } - /* - * Load namespace from names created within control methods - */ - AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId); + /* Load namespace from names created within control methods */ + + AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); /* - * Cross reference the namespace here, in order to generate External() statements + * Cross reference the namespace here, in order to + * generate External() statements */ - AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId); + AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); if (AslCompilerdebug) { @@ -422,24 +425,20 @@ AdAmlDisassemble ( AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot); - /* Convert fixed-offset references to resource descriptors to symbolic references */ - - AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); - /* - * If we found any external control methods, we must reparse the entire - * tree with the new information (namely, the number of arguments per - * method) + * If we found any external control methods, we must reparse + * the entire tree with the new information (namely, the + * number of arguments per method) */ if (AcpiDmGetExternalMethodCount ()) { fprintf (stderr, - "\nFound %u external control methods, reparsing with new information\n", + "\nFound %u external control methods, " + "reparsing with new information\n", AcpiDmGetExternalMethodCount ()); - /* - * Reparse, rebuild namespace. no need to xref namespace - */ + /* Reparse, rebuild namespace. no need to xref namespace */ + AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); @@ -456,7 +455,7 @@ AdAmlDisassemble ( Status = AcpiNsRootInitialize (); AcpiDmAddExternalsToNamespace (); - /* Parse table. No need to reload it, however (FALSE) */ + /* Parse the table again. No need to reload it, however */ Status = AdParseTable (Table, NULL, FALSE, FALSE); if (ACPI_FAILURE (Status)) @@ -477,6 +476,15 @@ AdAmlDisassemble ( } } + /* + * Now that the namespace is finalized, we can perform namespace + * transforms. + * + * 1) Convert fixed-offset references to resource descriptors + * to symbolic references (Note: modifies namespace) + */ + AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); + /* Optional displays */ if (AcpiGbl_DbOpt_disasm) @@ -502,11 +510,12 @@ Cleanup: if (OutToFile && File) { + if (AslCompilerdebug) /* Display final namespace, with transforms */ + { + LsSetupNsList (File); + LsDisplayNamespace (); + } -#ifdef ASL_DISASM_DEBUG - LsSetupNsList (File); - LsDisplayNamespace (); -#endif fclose (File); AcpiOsRedirectOutput (stdout); } Modified: head/sys/contrib/dev/acpica/common/adwalk.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adwalk.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/common/adwalk.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/common/dmextern.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmextern.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/common/dmextern.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/common/dmrestag.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmrestag.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/common/dmrestag.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/common/dmtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtable.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/common/dmtable.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -232,7 +232,7 @@ static const char *AcpiDmIvrsS }; -#define ACPI_FADT_PM_RESERVED 8 +#define ACPI_FADT_PM_RESERVED 9 static const char *AcpiDmFadtProfiles[] = { @@ -244,6 +244,7 @@ static const char *AcpiDmFadtP "SOHO Server", "Appliance PC", "Performance Server", + "Tablet", "Unknown Profile Type" }; Modified: head/sys/contrib/dev/acpica/common/dmtbdump.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/common/dmtbdump.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/common/dmtbinfo.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbinfo.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/common/dmtbinfo.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,123 +78,123 @@ /* * Macros used to generate offsets to specific table fields */ -#define ACPI_FACS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FACS,f) -#define ACPI_GAS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_GENERIC_ADDRESS,f) -#define ACPI_HDR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEADER,f) -#define ACPI_RSDP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_RSDP,f) -#define ACPI_BERT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BERT,f) -#define ACPI_BGRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BGRT,f) -#define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f) -#define ACPI_CPEP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_CPEP,f) -#define ACPI_DBGP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DBGP,f) -#define ACPI_DMAR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DMAR,f) -#define ACPI_DRTM_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DRTM,f) -#define ACPI_ECDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ECDT,f) -#define ACPI_EINJ_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_EINJ,f) -#define ACPI_ERST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ERST,f) -#define ACPI_GTDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_GTDT,f) -#define ACPI_HEST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEST,f) -#define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f) -#define ACPI_IVRS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_IVRS,f) -#define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f) -#define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f) -#define ACPI_MCHI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCHI,f) -#define ACPI_MPST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MPST,f) -#define ACPI_MSCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MSCT,f) -#define ACPI_PCCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_PCCT,f) -#define ACPI_PMTT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_PMTT,f) -#define ACPI_S3PT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_S3PT,f) -#define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f) -#define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f) -#define ACPI_SPCR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPCR,f) -#define ACPI_SPMI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPMI,f) -#define ACPI_SRAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SRAT,f) -#define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f) -#define ACPI_UEFI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_UEFI,f) -#define ACPI_WAET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WAET,f) -#define ACPI_WDAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDAT,f) -#define ACPI_WDDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDDT,f) -#define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f) +#define ACPI_FACS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_FACS,f) +#define ACPI_GAS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GENERIC_ADDRESS,f) +#define ACPI_HDR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HEADER,f) +#define ACPI_RSDP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RSDP,f) +#define ACPI_BERT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BERT,f) +#define ACPI_BGRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BGRT,f) +#define ACPI_BOOT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BOOT,f) +#define ACPI_CPEP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_CPEP,f) +#define ACPI_DBGP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DBGP,f) +#define ACPI_DMAR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DMAR,f) +#define ACPI_DRTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DRTM,f) +#define ACPI_ECDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_ECDT,f) +#define ACPI_EINJ_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_EINJ,f) +#define ACPI_ERST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_ERST,f) +#define ACPI_GTDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_GTDT,f) +#define ACPI_HEST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HEST,f) +#define ACPI_HPET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HPET,f) +#define ACPI_IVRS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IVRS,f) +#define ACPI_MADT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MADT,f) +#define ACPI_MCFG_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MCFG,f) +#define ACPI_MCHI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MCHI,f) +#define ACPI_MPST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MPST,f) +#define ACPI_MSCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MSCT,f) +#define ACPI_PCCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PCCT,f) +#define ACPI_PMTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PMTT,f) +#define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f) +#define ACPI_SBST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SBST,f) +#define ACPI_SLIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIT,f) +#define ACPI_SPCR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPCR,f) +#define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f) +#define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f) +#define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA,f) +#define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f) +#define ACPI_WAET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WAET,f) +#define ACPI_WDAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDAT,f) +#define ACPI_WDDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDDT,f) +#define ACPI_WDRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDRT,f) /* Subtables */ -#define ACPI_ASF0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_INFO,f) -#define ACPI_ASF1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT,f) -#define ACPI_ASF1a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT_DATA,f) -#define ACPI_ASF2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_REMOTE,f) -#define ACPI_ASF2a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f) -#define ACPI_ASF3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_RMCP,f) -#define ACPI_ASF4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ADDRESS,f) -#define ACPI_CPEP0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_CPEP_POLLING,f) -#define ACPI_DMARS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f) -#define ACPI_DMAR0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f) -#define ACPI_DMAR1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f) -#define ACPI_DMAR2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_ATSR,f) -#define ACPI_DMAR3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RHSA,f) -#define ACPI_EINJ0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) -#define ACPI_ERST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) -#define ACPI_FPDTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_FPDT_HEADER,f) -#define ACPI_FPDT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_FPDT_BOOT,f) -#define ACPI_FPDT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_FPDT_S3PT_PTR,f) -#define ACPI_HEST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f) -#define ACPI_HEST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f) -#define ACPI_HEST2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_NMI,f) -#define ACPI_HEST6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_ROOT,f) -#define ACPI_HEST7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER,f) -#define ACPI_HEST8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) -#define ACPI_HEST9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_GENERIC,f) -#define ACPI_HESTN_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) -#define ACPI_HESTB_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) -#define ACPI_IVRSH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HEADER,f) -#define ACPI_IVRS0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) -#define ACPI_IVRS1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) -#define ACPI_IVRSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DE_HEADER,f) -#define ACPI_IVRS8A_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8A,f) -#define ACPI_IVRS8B_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8B,f) -#define ACPI_IVRS8C_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f) -#define ACPI_MADT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) -#define ACPI_MADT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) -#define ACPI_MADT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) -#define ACPI_MADT3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_NMI_SOURCE,f) -#define ACPI_MADT4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f) -#define ACPI_MADT5_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_OVERRIDE,f) -#define ACPI_MADT6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f) -#define ACPI_MADT7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f) -#define ACPI_MADT8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f) -#define ACPI_MADT9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC,f) -#define ACPI_MADT10_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f) -#define ACPI_MADT11_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_GENERIC_INTERRUPT,f) -#define ACPI_MADT12_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_GENERIC_DISTRIBUTOR,f) -#define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) -#define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) -#define ACPI_MPST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_POWER_NODE,f) -#define ACPI_MPST0A_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_POWER_STATE,f) -#define ACPI_MPST0B_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_COMPONENT,f) -#define ACPI_MPST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_DATA_HDR,f) -#define ACPI_MPST2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_POWER_DATA,f) -#define ACPI_MSCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) -#define ACPI_PCCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f) -#define ACPI_PMTT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_SOCKET,f) -#define ACPI_PMTT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f) -#define ACPI_PMTT1A_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_DOMAIN,f) -#define ACPI_PMTT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_PHYSICAL_COMPONENT,f) -#define ACPI_PMTTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_HEADER,f) -#define ACPI_S3PTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_S3PT_HEADER,f) -#define ACPI_S3PT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_S3PT_RESUME,f) -#define ACPI_S3PT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_S3PT_SUSPEND,f) -#define ACPI_SLICH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_HEADER,f) -#define ACPI_SLIC0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_KEY,f) -#define ACPI_SLIC1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_MARKER,f) -#define ACPI_SRATH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) -#define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) -#define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) -#define ACPI_SRAT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) -#define ACPI_WDAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WDAT_ENTRY,f) +#define ACPI_ASF0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_INFO,f) +#define ACPI_ASF1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ALERT,f) +#define ACPI_ASF1a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ALERT_DATA,f) +#define ACPI_ASF2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_REMOTE,f) +#define ACPI_ASF2a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f) +#define ACPI_ASF3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_RMCP,f) +#define ACPI_ASF4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ADDRESS,f) +#define ACPI_CPEP0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CPEP_POLLING,f) +#define ACPI_DMARS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f) +#define ACPI_DMAR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f) +#define ACPI_DMAR1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f) +#define ACPI_DMAR2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_ATSR,f) +#define ACPI_DMAR3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RHSA,f) +#define ACPI_EINJ0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) +#define ACPI_ERST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) +#define ACPI_FPDTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f) +#define ACPI_FPDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_BOOT,f) +#define ACPI_FPDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_S3PT_PTR,f) +#define ACPI_HEST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f) +#define ACPI_HEST1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f) +#define ACPI_HEST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_NMI,f) +#define ACPI_HEST6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER_ROOT,f) +#define ACPI_HEST7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER,f) +#define ACPI_HEST8_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) +#define ACPI_HEST9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC,f) +#define ACPI_HESTN_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) +#define ACPI_HESTB_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) +#define ACPI_IVRSH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HEADER,f) +#define ACPI_IVRS0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) +#define ACPI_IVRS1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) +#define ACPI_IVRSD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DE_HEADER,f) +#define ACPI_IVRS8A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8A,f) +#define ACPI_IVRS8B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8B,f) +#define ACPI_IVRS8C_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f) +#define ACPI_MADT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) +#define ACPI_MADT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) +#define ACPI_MADT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) +#define ACPI_MADT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_NMI_SOURCE,f) +#define ACPI_MADT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f) +#define ACPI_MADT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_OVERRIDE,f) +#define ACPI_MADT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f) +#define ACPI_MADT7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f) +#define ACPI_MADT8_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f) +#define ACPI_MADT9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC,f) +#define ACPI_MADT10_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f) +#define ACPI_MADT11_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_INTERRUPT,f) +#define ACPI_MADT12_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_DISTRIBUTOR,f) +#define ACPI_MADTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) +#define ACPI_MCFG0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) +#define ACPI_MPST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_NODE,f) +#define ACPI_MPST0A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_STATE,f) +#define ACPI_MPST0B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_COMPONENT,f) +#define ACPI_MPST1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_DATA_HDR,f) +#define ACPI_MPST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_DATA,f) +#define ACPI_MSCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) +#define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f) +#define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f) +#define ACPI_PMTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f) +#define ACPI_PMTT1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_DOMAIN,f) +#define ACPI_PMTT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_PHYSICAL_COMPONENT,f) +#define ACPI_PMTTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_HEADER,f) +#define ACPI_S3PTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_HEADER,f) +#define ACPI_S3PT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_RESUME,f) +#define ACPI_S3PT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_SUSPEND,f) +#define ACPI_SLICH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SLIC_HEADER,f) +#define ACPI_SLIC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SLIC_KEY,f) +#define ACPI_SLIC1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SLIC_MARKER,f) +#define ACPI_SRATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) +#define ACPI_SRAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) +#define ACPI_SRAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) +#define ACPI_SRAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) +#define ACPI_WDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f) /* * Simplify access to flag fields by breaking them up into bytes */ -#define ACPI_FLAG_OFFSET(d,f,o) (UINT8) (ACPI_OFFSET (d,f) + o) +#define ACPI_FLAG_OFFSET(d,f,o) (UINT16) (ACPI_OFFSET (d,f) + o) /* Flags */ @@ -384,6 +384,7 @@ ACPI_DMTABLE_INFO AcpiDmTableI {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "VGA Not Present (V4)", 0}, {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "MSI Not Supported (V4)", 0}, {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "PCIe ASPM Not Supported (V4)", 0}, + {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "CMOS RTC Not Present (V5)", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, @@ -417,8 +418,7 @@ ACPI_DMTABLE_INFO AcpiDmTableI {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Cluster Model (V4)", 0}, {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Physical Destination Mode (V4)", 0}, {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,2), "Hardware Reduced (V5)", 0}, - {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,2), "Prefer S0 Idle (V5)", 0}, - {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use Sleep Register (V5)", 0}, + {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,2), "Low Power S0 Idle (V5)", 0}, ACPI_DMT_TERMINATOR }; @@ -456,7 +456,8 @@ ACPI_DMTABLE_INFO AcpiDmTableI ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[] = { - {ACPI_DMT_GAS, ACPI_FADT_OFFSET (SleepRegister), "Sleep Register", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (SleepControl), "Sleep Control Register", 0}, + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (SleepStatus), "Sleep Status Register", 0}, ACPI_DMT_TERMINATOR }; Modified: head/sys/contrib/dev/acpica/common/getopt.c ============================================================================== --- head/sys/contrib/dev/acpica/common/getopt.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/common/getopt.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslanalyze.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslanalyze.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslanalyze.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslbtypes.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslbtypes.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslbtypes.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslcodegen.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcodegen.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslcodegen.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.h Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.h Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.l ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.l Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.l Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.y ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.y Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.y Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asldefine.h Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/asldefine.h Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslerror.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslerror.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslerror.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslfiles.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslfiles.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslfiles.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslfold.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslfold.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslfold.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslglobal.h Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h Wed Jan 11 23:06:37 2012 (r229989) @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/asllength.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asllength.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/asllength.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/asllisting.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asllisting.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/asllisting.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslload.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslload.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslload.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/asllookup.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asllookup.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/asllookup.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslmain.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmain.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslmain.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -879,6 +879,10 @@ AslCommandLine ( if (Gbl_DoSignon) { printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); + if (Gbl_IgnoreErrors) + { + printf ("Ignoring all errors, forcing AML file generation\n\n"); + } } /* Abort if anything went wrong on the command line */ Modified: head/sys/contrib/dev/acpica/compiler/aslmap.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmap.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslmap.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.h Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslopcodes.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslopcodes.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslopcodes.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/asloperands.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asloperands.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/asloperands.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslopt.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslopt.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslopt.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslpredef.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslpredef.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslpredef.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslresource.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslresource.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslresource.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslrestype1.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslrestype1.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslrestype1.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslrestype1i.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslrestype1i.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslrestype1i.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslrestype2.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslrestype2.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslrestype2.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslrestype2d.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslrestype2d.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslrestype2d.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslrestype2e.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslrestype2e.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslrestype2e.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslrestype2q.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslrestype2q.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslrestype2q.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslrestype2s.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslrestype2s.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslrestype2s.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslrestype2w.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslrestype2w.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslrestype2w.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslstartup.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslstartup.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslstartup.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslstubs.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslstubs.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslstubs.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/asltransform.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asltransform.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/asltransform.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/asltree.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asltree.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/asltree.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/asltypes.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asltypes.h Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/asltypes.h Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslutils.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslutils.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslutils.c Wed Jan 11 23:06:37 2012 (r229989) @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/asluuid.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asluuid.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/asluuid.c Wed Jan 11 23:06:37 2012 (r229989) @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2012, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/contrib/dev/acpica/compiler/aslwalks.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslwalks.c Wed Jan 11 22:45:15 2012 (r229988) +++ head/sys/contrib/dev/acpica/compiler/aslwalks.c Wed Jan 11 23:06:37 2012 (r229989) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jan 11 23:52:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 201C51065677; Wed, 11 Jan 2012 23:52:16 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id C352F8FC16; Wed, 11 Jan 2012 23:52:15 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id B506931B; Thu, 12 Jan 2012 00:52:13 +0100 (CET) Date: Thu, 12 Jan 2012 00:51:06 +0100 From: Pawel Jakub Dawidek To: Guy Helmer Message-ID: <20120111235105.GG1695@garage.freebsd.pl> References: <201201111635.q0BGZQmQ067528@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="c7hkjup166d4FzgN" Content-Disposition: inline In-Reply-To: <201201111635.q0BGZQmQ067528@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229966 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 23:52:16 -0000 --c7hkjup166d4FzgN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 11, 2012 at 04:35:26PM +0000, Guy Helmer wrote: > Author: ghelmer > Date: Wed Jan 11 16:35:26 2012 > New Revision: 229966 > URL: http://svn.freebsd.org/changeset/base/229966 >=20 > Log: > jilles pointed out that O_CLOEXEC could be used in the open(2) flags > rather than using fcntl(2) later, and in addition to saving a system > call, removes a possible race with fork/exec from threads or signal > handlers. So now we can remove fcntl() as the source of possible pidfile_open() errnos from the manual page.:) > Modified: > head/lib/libutil/pidfile.c >=20 > Modified: head/lib/libutil/pidfile.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/libutil/pidfile.c Wed Jan 11 15:00:16 2012 (r229965) > +++ head/lib/libutil/pidfile.c Wed Jan 11 16:35:26 2012 (r229966) > @@ -117,7 +117,7 @@ pidfile_open(const char *path, mode_t mo > * pidfile_write() can be called multiple times. > */ > fd =3D flopen(pfh->pf_path, > - O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, mode); > + O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NONBLOCK, mode); > if (fd =3D=3D -1) { > if (errno =3D=3D EWOULDBLOCK && pidptr !=3D NULL) { > count =3D 20; > @@ -139,19 +139,6 @@ pidfile_open(const char *path, mode_t mo > } > =20 > /* > - * Prevent the file descriptor from escaping to other > - * programs via exec(3). > - */ > - if (fcntl(fd, F_SETFD, FD_CLOEXEC) =3D=3D -1) { > - error =3D errno; > - unlink(pfh->pf_path); > - close(fd); > - free(pfh); > - errno =3D error; > - return (NULL); > - } > - > - /* > * Remember file information, so in pidfile_write() we are sure we write > * to the proper descriptor. > */ --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --c7hkjup166d4FzgN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8OIGgACgkQForvXbEpPzRXQwCg5FNVDhxiSmijXULpq0L2J58R GGgAoNxBvH2gmTYnJeMQCoursyuLSUfK =RZlq -----END PGP SIGNATURE----- --c7hkjup166d4FzgN-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 00:16:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CAD01065672; Thu, 12 Jan 2012 00:16:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 166848FC1D; Thu, 12 Jan 2012 00:16:34 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q0C0GVml028453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 Jan 2012 02:16:31 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q0C0GUAF070212; Thu, 12 Jan 2012 02:16:30 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q0C0GUIs070211; Thu, 12 Jan 2012 02:16:30 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 12 Jan 2012 02:16:30 +0200 From: Kostik Belousov To: Guy Helmer Message-ID: <20120112001630.GS31224@deviant.kiev.zoral.com.ua> References: <201201112233.q0BMXfgD079582@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EqTSqAcQCSqN2BXp" Content-Disposition: inline In-Reply-To: <201201112233.q0BMXfgD079582@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229986 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 00:16:35 -0000 --EqTSqAcQCSqN2BXp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 11, 2012 at 10:33:41PM +0000, Guy Helmer wrote: > Author: ghelmer > Date: Wed Jan 11 22:33:41 2012 > New Revision: 229986 > URL: http://svn.freebsd.org/changeset/base/229986 >=20 > Log: > Fix namespace issues with prototype parameter names. > Add missing prototype parameter names. > =20 > Requested by bde. >=20 > Modified: > head/lib/libutil/libutil.h >=20 > Modified: head/lib/libutil/libutil.h > =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/libutil/libutil.h Wed Jan 11 22:12:45 2012 (r229985) > +++ head/lib/libutil/libutil.h Wed Jan 11 22:33:41 2012 (r229986) > @@ -93,7 +93,7 @@ struct termios; > struct winsize; > =20 > __BEGIN_DECLS > -char *auth_getval(const char *name); > +char *auth_getval(const char *_name); The _[a-z].* names are still in the app namespace. Only _[A-Z].* and __[a-z].* are reserved for the implementation. --EqTSqAcQCSqN2BXp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk8OJl0ACgkQC3+MBN1Mb4hDYACfc1cU0SIE4mvEWTzVHvG5ei8r +nkAnA0WVQwewJbUxuL3frjWqu//3h0J =76CG -----END PGP SIGNATURE----- --EqTSqAcQCSqN2BXp-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 00:34:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CBD9106566C; Thu, 12 Jan 2012 00:34:33 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 86C6A8FC0C; Thu, 12 Jan 2012 00:34:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0C0YXwi084188; Thu, 12 Jan 2012 00:34:33 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0C0YXrq084182; Thu, 12 Jan 2012 00:34:33 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201201120034.q0C0YXrq084182@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 12 Jan 2012 00:34: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: r229997 - in head: share/examples/scsi_target sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/ctls... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 00:34:33 -0000 Author: ken Date: Thu Jan 12 00:34:33 2012 New Revision: 229997 URL: http://svn.freebsd.org/changeset/base/229997 Log: Add the CAM Target Layer (CTL). CTL is a disk and processor device emulation subsystem originally written for Copan Systems under Linux starting in 2003. It has been shipping in Copan (now SGI) products since 2005. It was ported to FreeBSD in 2008, and thanks to an agreement between SGI (who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is available under a BSD-style license. The intent behind the agreement was that Spectra would work to get CTL into the FreeBSD tree. Some CTL features: - Disk and processor device emulation. - Tagged queueing - SCSI task attribute support (ordered, head of queue, simple tags) - SCSI implicit command ordering support. (e.g. if a read follows a mode select, the read will be blocked until the mode select completes.) - Full task management support (abort, LUN reset, target reset, etc.) - Support for multiple ports - Support for multiple simultaneous initiators - Support for multiple simultaneous backing stores - Persistent reservation support - Mode sense/select support - Error injection support - High Availability support (1) - All I/O handled in-kernel, no userland context switch overhead. (1) HA Support is just an API stub, and needs much more to be fully functional. ctl.c: The core of CTL. Command handlers and processing, character driver, and HA support are here. ctl.h: Basic function declarations and data structures. ctl_backend.c, ctl_backend.h: The basic CTL backend API. ctl_backend_block.c, ctl_backend_block.h: The block and file backend. This allows for using a disk or a file as the backing store for a LUN. Multiple threads are started to do I/O to the backing device, primarily because the VFS API requires that to get any concurrency. ctl_backend_ramdisk.c: A "fake" ramdisk backend. It only allocates a small amount of memory to act as a source and sink for reads and writes from an initiator. Therefore it cannot be used for any real data, but it can be used to test for throughput. It can also be used to test initiators' support for extremely large LUNs. ctl_cmd_table.c: This is a table with all 256 possible SCSI opcodes, and command handler functions defined for supported opcodes. ctl_debug.h: Debugging support. ctl_error.c, ctl_error.h: CTL-specific wrappers around the CAM sense building functions. ctl_frontend.c, ctl_frontend.h: These files define the basic CTL frontend port API. ctl_frontend_cam_sim.c: This is a CTL frontend port that is also a CAM SIM. This frontend allows for using CTL without any target-capable hardware. So any LUNs you create in CTL are visible in CAM via this port. ctl_frontend_internal.c, ctl_frontend_internal.h: This is a frontend port written for Copan to do some system-specific tasks that required sending commands into CTL from inside the kernel. This isn't entirely relevant to FreeBSD in general, but can perhaps be repurposed. ctl_ha.h: This is a stubbed-out High Availability API. Much more is needed for full HA support. See the comments in the header and the description of what is needed in the README.ctl.txt file for more details. ctl_io.h: This defines most of the core CTL I/O structures. union ctl_io is conceptually very similar to CAM's union ccb. ctl_ioctl.h: This defines all ioctls available through the CTL character device, and the data structures needed for those ioctls. ctl_mem_pool.c, ctl_mem_pool.h: Generic memory pool implementation used by the internal frontend. ctl_private.h: Private data structres (e.g. CTL softc) and function prototypes. This also includes the SCSI vendor and product names used by CTL. ctl_scsi_all.c, ctl_scsi_all.h: CTL wrappers around CAM sense printing functions. ctl_ser_table.c: Command serialization table. This defines what happens when one type of command is followed by another type of command. ctl_util.c, ctl_util.h: CTL utility functions, primarily designed to be used from userland. See ctladm for the primary consumer of these functions. These include CDB building functions. scsi_ctl.c: CAM target peripheral driver and CTL frontend port. This is the path into CTL for commands from target-capable hardware/SIMs. README.ctl.txt: CTL code features, roadmap, to-do list. usr.sbin/Makefile: Add ctladm. ctladm/Makefile, ctladm/ctladm.8, ctladm/ctladm.c, ctladm/ctladm.h, ctladm/util.c: ctladm(8) is the CTL management utility. It fills a role similar to camcontrol(8). It allow configuring LUNs, issuing commands, injecting errors and various other control functions. usr.bin/Makefile: Add ctlstat. ctlstat/Makefile ctlstat/ctlstat.8, ctlstat/ctlstat.c: ctlstat(8) fills a role similar to iostat(8). It reports I/O statistics for CTL. sys/conf/files: Add CTL files. sys/conf/NOTES: Add device ctl. sys/cam/scsi_all.h: To conform to more recent specs, the inquiry CDB length field is now 2 bytes long. Add several mode page definitions for CTL. sys/cam/scsi_all.c: Handle the new 2 byte inquiry length. sys/dev/ciss/ciss.c, sys/dev/ata/atapi-cam.c, sys/cam/scsi/scsi_targ_bh.c, scsi_target/scsi_cmds.c, mlxcontrol/interface.c: Update for 2 byte inquiry length field. scsi_da.h: Add versions of the format and rigid disk pages that are in a more reasonable format for CTL. amd64/conf/GENERIC, i386/conf/GENERIC, ia64/conf/GENERIC, sparc64/conf/GENERIC: Add device ctl. i386/conf/PAE: The CTL frontend SIM at least does not compile cleanly on PAE. Sponsored by: Copan Systems, SGI and Spectra Logic MFC after: 1 month Added: head/sys/cam/ctl/ head/sys/cam/ctl/README.ctl.txt (contents, props changed) head/sys/cam/ctl/ctl.c (contents, props changed) head/sys/cam/ctl/ctl.h (contents, props changed) head/sys/cam/ctl/ctl_backend.c (contents, props changed) head/sys/cam/ctl/ctl_backend.h (contents, props changed) head/sys/cam/ctl/ctl_backend_block.c (contents, props changed) head/sys/cam/ctl/ctl_backend_block.h (contents, props changed) head/sys/cam/ctl/ctl_backend_ramdisk.c (contents, props changed) head/sys/cam/ctl/ctl_cmd_table.c (contents, props changed) head/sys/cam/ctl/ctl_debug.h (contents, props changed) head/sys/cam/ctl/ctl_error.c (contents, props changed) head/sys/cam/ctl/ctl_error.h (contents, props changed) head/sys/cam/ctl/ctl_frontend.c (contents, props changed) head/sys/cam/ctl/ctl_frontend.h (contents, props changed) head/sys/cam/ctl/ctl_frontend_cam_sim.c (contents, props changed) head/sys/cam/ctl/ctl_frontend_internal.c (contents, props changed) head/sys/cam/ctl/ctl_frontend_internal.h (contents, props changed) head/sys/cam/ctl/ctl_ha.h (contents, props changed) head/sys/cam/ctl/ctl_io.h (contents, props changed) head/sys/cam/ctl/ctl_ioctl.h (contents, props changed) head/sys/cam/ctl/ctl_mem_pool.c (contents, props changed) head/sys/cam/ctl/ctl_mem_pool.h (contents, props changed) head/sys/cam/ctl/ctl_private.h (contents, props changed) head/sys/cam/ctl/ctl_scsi_all.c (contents, props changed) head/sys/cam/ctl/ctl_scsi_all.h (contents, props changed) head/sys/cam/ctl/ctl_ser_table.c (contents, props changed) head/sys/cam/ctl/ctl_util.c (contents, props changed) head/sys/cam/ctl/ctl_util.h (contents, props changed) head/sys/cam/ctl/scsi_ctl.c (contents, props changed) head/usr.bin/ctlstat/ head/usr.bin/ctlstat/Makefile (contents, props changed) head/usr.bin/ctlstat/ctlstat.8 (contents, props changed) head/usr.bin/ctlstat/ctlstat.c (contents, props changed) head/usr.sbin/ctladm/ head/usr.sbin/ctladm/Makefile (contents, props changed) head/usr.sbin/ctladm/ctladm.8 (contents, props changed) head/usr.sbin/ctladm/ctladm.c (contents, props changed) head/usr.sbin/ctladm/ctladm.h (contents, props changed) head/usr.sbin/ctladm/util.c (contents, props changed) Modified: head/share/examples/scsi_target/scsi_cmds.c head/sys/amd64/conf/GENERIC head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h head/sys/cam/scsi/scsi_da.h head/sys/cam/scsi/scsi_targ_bh.c head/sys/conf/NOTES head/sys/conf/files head/sys/dev/ata/atapi-cam.c head/sys/dev/ciss/ciss.c head/sys/i386/conf/GENERIC head/sys/i386/conf/PAE head/sys/ia64/conf/GENERIC head/sys/sparc64/conf/GENERIC head/usr.bin/Makefile head/usr.sbin/Makefile head/usr.sbin/mlxcontrol/interface.c Modified: head/share/examples/scsi_target/scsi_cmds.c ============================================================================== --- head/share/examples/scsi_target/scsi_cmds.c Thu Jan 12 00:05:35 2012 (r229996) +++ head/share/examples/scsi_target/scsi_cmds.c Thu Jan 12 00:34:33 2012 (r229997) @@ -328,7 +328,7 @@ tcmd_inquiry(struct ccb_accept_tio *atio bcopy(&inq_data, ctio->data_ptr, sizeof(inq_data)); ctio->dxfer_len = inq_data.additional_length + 4; ctio->dxfer_len = min(ctio->dxfer_len, - SCSI_CDB6_LEN(inq->length)); + scsi_2btoul(inq->length)); ctio->ccb_h.flags |= CAM_DIR_IN | CAM_SEND_STATUS; ctio->scsi_status = SCSI_STATUS_OK; } Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Thu Jan 12 00:05:35 2012 (r229996) +++ head/sys/amd64/conf/GENERIC Thu Jan 12 00:34:33 2012 (r229997) @@ -131,7 +131,8 @@ device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) -device ses # SCSI Environmental Services (and SAF-TE) +device ses # Enclosure Services (SES and SAF-TE) +device ctl # CAM Target Layer # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID Added: head/sys/cam/ctl/README.ctl.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cam/ctl/README.ctl.txt Thu Jan 12 00:34:33 2012 (r229997) @@ -0,0 +1,449 @@ +/* $FreeBSD$ */ + +CTL - CAM Target Layer Description + +Revision 1.4 (December 29th, 2011) +Ken Merry + +Table of Contents: +================= + +Introduction +Features +Configuring and Running CTL +Revision 1.N Changes +To Do List +Code Roadmap +Userland Commands + +Introduction: +============ + +CTL is a disk and processor device emulation subsystem originally written +for Copan Systems under Linux starting in 2003. It has been shipping in +Copan (now SGI) products since 2005. + +It was ported to FreeBSD in 2008, and thanks to an agreement between SGI +(who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is +available under a BSD-style license. The intent behind the agreement was +that Spectra would work to get CTL into the FreeBSD tree. + +Features: +======== + + - Disk and processor device emulation. + - Tagged queueing + - SCSI task attribute support (ordered, head of queue, simple tags) + - SCSI implicit command ordering support. (e.g. if a read follows a mode + select, the read will be blocked until the mode select completes.) + - Full task management support (abort, LUN reset, target reset, etc.) + - Support for multiple ports + - Support for multiple simultaneous initiators + - Support for multiple simultaneous backing stores + - Persistent reservation support + - Mode sense/select support + - Error injection support + - High Availability support (1) + - All I/O handled in-kernel, no userland context switch overhead. + +(1) HA Support is just an API stub, and needs much more to be fully + functional. See the to-do list below. + +Configuring and Running CTL: +=========================== + + - After applying the CTL patchset to your tree, build world and install it + on your target system. + + - Add 'device ctl' to your kernel configuration file. + + - If you're running with a 8Gb or 4Gb Qlogic FC board, add + 'options ISP_TARGET_MODE' to your kernel config file. Keep in mind that + the isp(4) driver can run in target or initiator mode, but not both on + the same machine. 'device ispfw' or loading the ispfw module is also + recommended. + + - Rebuild and install a new kernel. + + - Reboot with the new kernel. + + - To add a LUN with the RAM disk backend: + + ctladm create -b ramdisk -s 10485760000000000000 + ctladm port -o on + + - You should now see the CTL disk LUN through camcontrol devlist: + +scbus6 on ctl2cam0 bus 0: + at scbus6 target 1 lun 0 (da24,pass32) +<> at scbus6 target -1 lun -1 () + + This is visible through the CTL CAM SIM. This allows using CTL without + any physical hardware. You should be able to issue any normal SCSI + commands to the device via the pass(4)/da(4) devices. + + If any target-capable HBAs are in the system (e.g. isp(4)), and have + target mode enabled, you should now also be able to see the CTL LUNs via + that target interface. + + Note that all CTL LUNs are presented to all frontends. There is no + LUN masking, or separate, per-port configuration. + + - Note that the ramdisk backend is a "fake" ramdisk. That is, it is + backed by a small amount of RAM that is used for all I/O requests. This + is useful for performance testing, but not for any data integrity tests. + + - To add a LUN with the block/file backend: + + truncate -s +1T myfile + ctladm create -b block -o file=myfile + ctladm port -o on + + - You can also see a list of LUNs and their backends like this: + +# ctladm devlist +LUN Backend Size (Blocks) BS Serial Number Device ID + 0 block 2147483648 512 MYSERIAL 0 MYDEVID 0 + 1 block 2147483648 512 MYSERIAL 1 MYDEVID 1 + 2 block 2147483648 512 MYSERIAL 2 MYDEVID 2 + 3 block 2147483648 512 MYSERIAL 3 MYDEVID 3 + 4 block 2147483648 512 MYSERIAL 4 MYDEVID 4 + 5 block 2147483648 512 MYSERIAL 5 MYDEVID 5 + 6 block 2147483648 512 MYSERIAL 6 MYDEVID 6 + 7 block 2147483648 512 MYSERIAL 7 MYDEVID 7 + 8 block 2147483648 512 MYSERIAL 8 MYDEVID 8 + 9 block 2147483648 512 MYSERIAL 9 MYDEVID 9 + 10 block 2147483648 512 MYSERIAL 10 MYDEVID 10 + 11 block 2147483648 512 MYSERIAL 11 MYDEVID 11 + + - You can see the LUN type and backing store for block/file backend LUNs + like this: + +# ctladm devlist -v +LUN Backend Size (Blocks) BS Serial Number Device ID + 0 block 2147483648 512 MYSERIAL 0 MYDEVID 0 + lun_type=0 + num_threads=14 + file=testdisk0 + 1 block 2147483648 512 MYSERIAL 1 MYDEVID 1 + lun_type=0 + num_threads=14 + file=testdisk1 + 2 block 2147483648 512 MYSERIAL 2 MYDEVID 2 + lun_type=0 + num_threads=14 + file=testdisk2 + 3 block 2147483648 512 MYSERIAL 3 MYDEVID 3 + lun_type=0 + num_threads=14 + file=testdisk3 + 4 block 2147483648 512 MYSERIAL 4 MYDEVID 4 + lun_type=0 + num_threads=14 + file=testdisk4 + 5 block 2147483648 512 MYSERIAL 5 MYDEVID 5 + lun_type=0 + num_threads=14 + file=testdisk5 + 6 block 2147483648 512 MYSERIAL 6 MYDEVID 6 + lun_type=0 + num_threads=14 + file=testdisk6 + 7 block 2147483648 512 MYSERIAL 7 MYDEVID 7 + lun_type=0 + num_threads=14 + file=testdisk7 + 8 block 2147483648 512 MYSERIAL 8 MYDEVID 8 + lun_type=0 + num_threads=14 + file=testdisk8 + 9 block 2147483648 512 MYSERIAL 9 MYDEVID 9 + lun_type=0 + num_threads=14 + file=testdisk9 + 10 ramdisk 0 0 MYSERIAL 0 MYDEVID 0 + lun_type=3 + 11 ramdisk 204800000000000 512 MYSERIAL 1 MYDEVID 1 + lun_type=0 + + +Revision 1.4 Changes +==================== + - Added in the second HA mode (where CTL does the data transfers instead + of having data transfers done below CTL), and abstracted out the Copan + HA API. + + - Fixed the phantom device problem in the CTL CAM SIM and improved the + CAM SIM to automatically trigger a rescan when the port is enabled and + disabled. + + - Made the number of threads in the block backend configurable via sysctl, + loader tunable and the ctladm command line. (You can now specify + -o num_threads=4 when creating a LUN with ctladm create.) + + - Fixed some LUN selection issues in ctlstat(8) and allowed for selection + of LUN numbers up to 1023. + + - General cleanup. + + - This version intended for public release. + +Revision 1.3 Changes +==================== + - Added descriptor sense support to CTL. It can be enabled through the + control mode page (10), but is disabled by default. + + - Improved error injection support. The number of errors that can be + injected with 'ctladm inject' has been increased, and any arbitrary + sense data may now be injected as well. + + - The port infrastructure has been revamped. Individual ports and types + of ports may now be enabled and disabled from the command line. ctladm + now has the ability to set the WWNN and WWPN for each port. + + - The block backend can now send multiple I/Os to backing files. Multiple + writes are only allowed for ZFS, but multiple readers are allowed for + any filesystem. + + - The block and ramdisk backends now support setting the LUN blocksize. + There are some restrictions when the backing device is a block device, + but otherwise the blocksize may be set to anything. + +Revision 1.2 Changes +==================== + + - CTL initialization process has been revamped. Instead of using an + ad-hoc method, it is now sequenced through SYSINIT() calls. + + - A block/file backend has been added. This allows using arbitrary files + or block devices as a backing store. + + - The userland LUN configuration interface has been completely rewritten. + Configuration is now done out of band. + + - The ctladm(8) command line interface has been revamped, and is now + similar to camcontrol(8). + +To Do List: +========== + + - Make CTL buildable as a module. Work needs to be done on initialization, + and on freeing resources and LUNs when it is built as a module. + + - Use devstat(9) for CTL's statistics collection. CTL uses a home-grown + statistics collection system that is similar to devstat(9). ctlstat + should be retired in favor of iostat, etc., once aggregation modes are + available in iostat to match the behavior of ctlstat -t and dump modes + are available to match the behavior of ctlstat -d/ctlstat -J. + + - ZFS ARC backend for CTL. Since ZFS copies all I/O into the ARC + (Adaptive Replacement Cache), running the block/file backend on top of a + ZFS-backed zdev or file will involve an extra set of copies. The + optimal solution for backing targets served by CTL with ZFS would be to + allocate buffers out of the ARC directly, and DMA to/from them directly. + That would eliminate an extra data buffer allocation and copy. + + - Switch CTL over to using CAM CCBs instead of its own union ctl_io. This + will likely require a significant amount of work, but will eliminate + another data structure in the stack, more memory allocations, etc. This + will also require changes to the CAM CCB structure to support CTL. + + - Full-featured High Availability support. The HA API that is in ctl_ha.h + is essentially a renamed version of Copan's HA API. There is no + substance to it, but it remains in CTL to show what needs to be done to + implement active/active HA from a CTL standpoint. The things that would + need to be done include: + - A kernel level software API for message passing as well as DMA + between at least two nodes. + - Hardware support and drivers for inter-node communication. This + could be as simples as ethernet hardware and drivers. + - A "supervisor", or startup framework to control and coordinate + HA startup, failover (going from active/active to single mode), + and failback (going from single mode to active/active). + - HA support in other components of the stack. The goal behind HA + is that one node can fail and another node can seamlessly take + over handling I/O requests. This requires support from pretty + much every component in the storage stack, from top to bottom. + CTL is one piece of it, but you also need support in the RAID + stack/filesystem/backing store. You also need full configuration + mirroring, and all peer nodes need to be able to talk to the + underlying storage hardware. + +Code Roadmap: +============ + +CTL has the concept of pluggable frontend ports and backends. All +frontends and backends can be active at the same time. You can have a +ramdisk-backed LUN present along side a file backed LUN. + +ctl.c: +----- + +This is the core of CTL, where all of the command handlers and a lot of +other things live. Yes, it is large. It started off small and grew to its +current size over time. Perhaps it can be split into more files at some +point. + +Here is a roadmap of some of the primary functions in ctl.c. Starting here +and following the various leaf functions will show the command flow. + +ctl_queue() This is where commands from the frontend ports come + in. + +ctl_queue_sense() This is only used for non-packetized SCSI. i.e. + parallel SCSI prior to U320 and perhaps U160. + +ctl_work_thread() This is the primary work thread, and everything gets + executed from there. + +ctl_scsiio_precheck() This where all of the initial checks are done, and I/O + is either queued for execution or blocked. + +ctl_scsiio() This is where the command handler is actually + executed. (See ctl_cmd_table.c for the mapping of + SCSI opcode to command handler function.) + +ctl_done() This is the routine called (or ctl_done_lock()) to + initiate the command completion process. + +ctl_process_done() This is where command completion actually happens. + +ctl.h: +----- + +Basic function declarations and data structures. + +ctl_backend.c, +ctl_backend.h: +------------- + +These files define the basic CTL backend API. The comments in the header +explain the API. + +ctl_backend_block.c +ctl_backend_block.h: +------------------- + +The block and file backend. This allows for using a disk or a file as the +backing store for a LUN. Multiple threads are started to do I/O to the +backing device, primarily because the VFS API requires that to get any +concurrency. + +ctl_backend_ramdisk.c: +--------------------- + +A "fake" ramdisk backend. It only allocates a small amount of memory to +act as a source and sink for reads and writes from an initiator. Therefore +it cannot be used for any real data, but it can be used to test for +throughput. It can also be used to test initiators' support for extremely +large LUNs. + +ctl_cmd_table.c: +--------------- + +This is a table with all 256 possible SCSI opcodes, and command handler +functions defined for supported opcodes. It is included in ctl.c. + +ctl_debug.h: +----------- + +Simplistic debugging support. + +ctl_error.c, +ctl_error.h: +----------- + +CTL-specific wrappers around the CAM sense building functions. + +ctl_frontend.c, +ctl_frontend.h: +-------------- + +These files define the basic CTL frontend port API. The comments in the +header explain the API. + +ctl_frontend_cam_sim.c: +---------------------- + +This is a CTL frontend port that is also a CAM SIM. The idea is that this +frontend allows for using CTL without any target-capable hardware. So any +LUNs you create in CTL are visible via this port. + + +ctl_frontend_internal.c +ctl_frontend_internal.h: +----------------------- + +This is a frontend port written for Copan to do some system-specific tasks +that required sending commands into CTL from inside the kernel. This isn't +entirely relevant to FreeBSD in general, but can perhaps be repurposed or +removed later. + +ctl_ha.h: +-------- + +This is a stubbed-out High Availability API. See the comments in the +header and the description of what is needed as far as HA support above. + +ctl_io.h: +-------- + +This defines most of the core CTL I/O structures. union ctl_io is +conceptually very similar to CAM's union ccb. + +ctl_ioctl.h: +----------- + +This defines all ioctls available through the CTL character device, and +the data structures needed for those ioctls. + +ctl_mem_pool.c +ctl_mem_pool.h: +-------------- + +Generic memory pool implementation. This is currently only used by the +internal frontend. The internal frontend can probably be rewritten to use +UMA zones and this can be removed. + +ctl_private.h: +------------- + +Private data structres (e.g. CTL softc) and function prototypes. This also +includes the SCSI vendor and product names used by CTL. + +ctl_scsi_all.c +ctl_scsi_all.h: +-------------- + +CTL wrappers around CAM sense printing functions. + +ctl_ser_table.c: +--------------- + +Command serialization table. This defines what happens when one type of +command is followed by another type of command. e.g., what do you do when +you have a mode select followed by a write? You block the write until the +mode select is complete. That is defined in this table. + +ctl_util.c +ctl_util.h: +---------- + +CTL utility functions, primarily designed to be used from userland. See +ctladm for the primary consumer of these functions. These include CDB +building functions. + +scsi_ctl.c: +---------- + +CAM target peripheral driver and CTL frontend port. This is the path into +CTL for commands from target-capable hardware/SIMs. + +Userland Commands: +================= + +ctladm(8) fills a role similar to camcontrol(8). It allow configuring LUNs, +issuing commands, injecting errors and various other control functions. + +ctlstat(8) fills a role similar to iostat(8). It reports I/O statistics +for CTL. Added: head/sys/cam/ctl/ctl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cam/ctl/ctl.c Thu Jan 12 00:34:33 2012 (r229997) @@ -0,0 +1,13082 @@ +/*- + * Copyright (c) 2003-2009 Silicon Graphics International Corp. + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl.c#8 $ + */ +/* + * CAM Target Layer, a SCSI device emulation subsystem. + * + * Author: Ken Merry + */ + +#define _CTL_C + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct ctl_softc *control_softc = NULL; + +/* + * The default is to run with CTL_DONE_THREAD turned on. Completed + * transactions are queued for processing by the CTL work thread. When + * CTL_DONE_THREAD is not defined, completed transactions are processed in + * the caller's context. + */ +#define CTL_DONE_THREAD + +/* + * * Use the serial number and device ID provided by the backend, rather than + * * making up our own. + * */ +#define CTL_USE_BACKEND_SN + +/* + * Size and alignment macros needed for Copan-specific HA hardware. These + * can go away when the HA code is re-written, and uses busdma for any + * hardware. + */ +#define CTL_ALIGN_8B(target, source, type) \ + if (((uint32_t)source & 0x7) != 0) \ + target = (type)(source + (0x8 - ((uint32_t)source & 0x7)));\ + else \ + target = (type)source; + +#define CTL_SIZE_8B(target, size) \ + if ((size & 0x7) != 0) \ + target = size + (0x8 - (size & 0x7)); \ + else \ + target = size; + +#define CTL_ALIGN_8B_MARGIN 16 + +/* + * Template mode pages. + */ + +/* + * Note that these are default values only. The actual values will be + * filled in when the user does a mode sense. + */ +static struct copan_power_subpage power_page_default = { + /*page_code*/ PWR_PAGE_CODE | SMPH_SPF, + /*subpage*/ PWR_SUBPAGE_CODE, + /*page_length*/ {(sizeof(struct copan_power_subpage) - 4) & 0xff00, + (sizeof(struct copan_power_subpage) - 4) & 0x00ff}, + /*page_version*/ PWR_VERSION, + /* total_luns */ 26, + /* max_active_luns*/ PWR_DFLT_MAX_LUNS, + /*reserved*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0} +}; + +static struct copan_power_subpage power_page_changeable = { + /*page_code*/ PWR_PAGE_CODE | SMPH_SPF, + /*subpage*/ PWR_SUBPAGE_CODE, + /*page_length*/ {(sizeof(struct copan_power_subpage) - 4) & 0xff00, + (sizeof(struct copan_power_subpage) - 4) & 0x00ff}, + /*page_version*/ 0, + /* total_luns */ 0, + /* max_active_luns*/ 0, + /*reserved*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0} +}; + +static struct copan_aps_subpage aps_page_default = { + APS_PAGE_CODE | SMPH_SPF, //page_code + APS_SUBPAGE_CODE, //subpage + {(sizeof(struct copan_aps_subpage) - 4) & 0xff00, + (sizeof(struct copan_aps_subpage) - 4) & 0x00ff}, //page_length + APS_VERSION, //page_version + 0, //lock_active + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0} //reserved +}; + +static struct copan_aps_subpage aps_page_changeable = { + APS_PAGE_CODE | SMPH_SPF, //page_code + APS_SUBPAGE_CODE, //subpage + {(sizeof(struct copan_aps_subpage) - 4) & 0xff00, + (sizeof(struct copan_aps_subpage) - 4) & 0x00ff}, //page_length + 0, //page_version + 0, //lock_active + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0} //reserved +}; + +static struct copan_debugconf_subpage debugconf_page_default = { + DBGCNF_PAGE_CODE | SMPH_SPF, /* page_code */ + DBGCNF_SUBPAGE_CODE, /* subpage */ + {(sizeof(struct copan_debugconf_subpage) - 4) >> 8, + (sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */ + DBGCNF_VERSION, /* page_version */ + {CTL_TIME_IO_DEFAULT_SECS>>8, + CTL_TIME_IO_DEFAULT_SECS>>0}, /* ctl_time_io_secs */ +}; + +static struct copan_debugconf_subpage debugconf_page_changeable = { + DBGCNF_PAGE_CODE | SMPH_SPF, /* page_code */ + DBGCNF_SUBPAGE_CODE, /* subpage */ + {(sizeof(struct copan_debugconf_subpage) - 4) >> 8, + (sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */ + 0, /* page_version */ + {0xff,0xff}, /* ctl_time_io_secs */ +}; + +static struct scsi_format_page format_page_default = { + /*page_code*/SMS_FORMAT_DEVICE_PAGE, + /*page_length*/sizeof(struct scsi_format_page) - 2, + /*tracks_per_zone*/ {0, 0}, + /*alt_sectors_per_zone*/ {0, 0}, + /*alt_tracks_per_zone*/ {0, 0}, + /*alt_tracks_per_lun*/ {0, 0}, + /*sectors_per_track*/ {(CTL_DEFAULT_SECTORS_PER_TRACK >> 8) & 0xff, + CTL_DEFAULT_SECTORS_PER_TRACK & 0xff}, + /*bytes_per_sector*/ {0, 0}, + /*interleave*/ {0, 0}, + /*track_skew*/ {0, 0}, + /*cylinder_skew*/ {0, 0}, + /*flags*/ SFP_HSEC, + /*reserved*/ {0, 0, 0} +}; + +static struct scsi_format_page format_page_changeable = { + /*page_code*/SMS_FORMAT_DEVICE_PAGE, + /*page_length*/sizeof(struct scsi_format_page) - 2, + /*tracks_per_zone*/ {0, 0}, + /*alt_sectors_per_zone*/ {0, 0}, + /*alt_tracks_per_zone*/ {0, 0}, + /*alt_tracks_per_lun*/ {0, 0}, + /*sectors_per_track*/ {0, 0}, + /*bytes_per_sector*/ {0, 0}, + /*interleave*/ {0, 0}, + /*track_skew*/ {0, 0}, + /*cylinder_skew*/ {0, 0}, + /*flags*/ 0, + /*reserved*/ {0, 0, 0} +}; + +static struct scsi_rigid_disk_page rigid_disk_page_default = { + /*page_code*/SMS_RIGID_DISK_PAGE, + /*page_length*/sizeof(struct scsi_rigid_disk_page) - 2, + /*cylinders*/ {0, 0, 0}, + /*heads*/ CTL_DEFAULT_HEADS, + /*start_write_precomp*/ {0, 0, 0}, + /*start_reduced_current*/ {0, 0, 0}, + /*step_rate*/ {0, 0}, + /*landing_zone_cylinder*/ {0, 0, 0}, + /*rpl*/ SRDP_RPL_DISABLED, + /*rotational_offset*/ 0, + /*reserved1*/ 0, + /*rotation_rate*/ {(CTL_DEFAULT_ROTATION_RATE >> 8) & 0xff, + CTL_DEFAULT_ROTATION_RATE & 0xff}, + /*reserved2*/ {0, 0} +}; + +static struct scsi_rigid_disk_page rigid_disk_page_changeable = { + /*page_code*/SMS_RIGID_DISK_PAGE, + /*page_length*/sizeof(struct scsi_rigid_disk_page) - 2, + /*cylinders*/ {0, 0, 0}, + /*heads*/ 0, + /*start_write_precomp*/ {0, 0, 0}, + /*start_reduced_current*/ {0, 0, 0}, + /*step_rate*/ {0, 0}, + /*landing_zone_cylinder*/ {0, 0, 0}, + /*rpl*/ 0, + /*rotational_offset*/ 0, + /*reserved1*/ 0, + /*rotation_rate*/ {0, 0}, + /*reserved2*/ {0, 0} +}; + +static struct scsi_caching_page caching_page_default = { + /*page_code*/SMS_CACHING_PAGE, + /*page_length*/sizeof(struct scsi_caching_page) - 2, + /*flags1*/ SCP_DISC | SCP_WCE, + /*ret_priority*/ 0, + /*disable_pf_transfer_len*/ {0xff, 0xff}, + /*min_prefetch*/ {0, 0}, + /*max_prefetch*/ {0xff, 0xff}, + /*max_pf_ceiling*/ {0xff, 0xff}, + /*flags2*/ 0, + /*cache_segments*/ 0, + /*cache_seg_size*/ {0, 0}, + /*reserved*/ 0, + /*non_cache_seg_size*/ {0, 0, 0} +}; + +static struct scsi_caching_page caching_page_changeable = { + /*page_code*/SMS_CACHING_PAGE, + /*page_length*/sizeof(struct scsi_caching_page) - 2, + /*flags1*/ 0, + /*ret_priority*/ 0, + /*disable_pf_transfer_len*/ {0, 0}, + /*min_prefetch*/ {0, 0}, + /*max_prefetch*/ {0, 0}, + /*max_pf_ceiling*/ {0, 0}, + /*flags2*/ 0, + /*cache_segments*/ 0, + /*cache_seg_size*/ {0, 0}, + /*reserved*/ 0, + /*non_cache_seg_size*/ {0, 0, 0} +}; + +static struct scsi_control_page control_page_default = { + /*page_code*/SMS_CONTROL_MODE_PAGE, + /*page_length*/sizeof(struct scsi_control_page) - 2, + /*rlec*/0, + /*queue_flags*/0, + /*eca_and_aen*/0, + /*reserved*/0, + /*aen_holdoff_period*/{0, 0} +}; + +static struct scsi_control_page control_page_changeable = { + /*page_code*/SMS_CONTROL_MODE_PAGE, + /*page_length*/sizeof(struct scsi_control_page) - 2, + /*rlec*/SCP_DSENSE, + /*queue_flags*/0, + /*eca_and_aen*/0, + /*reserved*/0, + /*aen_holdoff_period*/{0, 0} +}; + +SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); + +/* + * XXX KDM move these into the softc. + */ +static int rcv_sync_msg; +static int persis_offset; +static uint8_t ctl_pause_rtr; +static int ctl_is_single; +static int index_to_aps_page; + + +/* + * Serial number (0x80), device id (0x83), and supported pages (0x00) + */ +#define SCSI_EVPD_NUM_SUPPORTED_PAGES 3 + +static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event, + int param); +static void ctl_copy_sense_data(union ctl_ha_msg *src, union ctl_io *dest); +static void ctl_init(void); +void ctl_shutdown(void); +static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td); +static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td); +static void ctl_ioctl_online(void *arg); +static void ctl_ioctl_offline(void *arg); +static int ctl_ioctl_targ_enable(void *arg, struct ctl_id targ_id); +static int ctl_ioctl_targ_disable(void *arg, struct ctl_id targ_id); +static int ctl_ioctl_lun_enable(void *arg, struct ctl_id targ_id, int lun_id); +static int ctl_ioctl_lun_disable(void *arg, struct ctl_id targ_id, int lun_id); +static int ctl_ioctl_do_datamove(struct ctl_scsiio *ctsio); +static int ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio, int have_lock); +static int ctl_ioctl_submit_wait(union ctl_io *io); +static void ctl_ioctl_datamove(union ctl_io *io); +static void ctl_ioctl_done(union ctl_io *io); +static void ctl_ioctl_hard_startstop_callback(void *arg, + struct cfi_metatask *metatask); +static void ctl_ioctl_bbrread_callback(void *arg,struct cfi_metatask *metatask); +static int ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, + struct ctl_ooa *ooa_hdr); +static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, + struct thread *td); +uint32_t ctl_get_resindex(struct ctl_nexus *nexus); +uint32_t ctl_port_idx(int port_num); +#ifdef unused +static union ctl_io *ctl_malloc_io(ctl_io_type io_type, uint32_t targ_port, + uint32_t targ_target, uint32_t targ_lun, + int can_wait); +static void ctl_kfree_io(union ctl_io *io); +#endif /* unused */ +static void ctl_free_io_internal(union ctl_io *io, int have_lock); +static int ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *lun, + struct ctl_be_lun *be_lun, struct ctl_id target_id); +static int ctl_free_lun(struct ctl_lun *lun); +static void ctl_create_lun(struct ctl_be_lun *be_lun); +/** +static void ctl_failover_change_pages(struct ctl_softc *softc, + struct ctl_scsiio *ctsio, int master); +**/ + +static int ctl_do_mode_select(union ctl_io *io); +static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, + uint64_t res_key, uint64_t sa_res_key, + uint8_t type, uint32_t residx, + struct ctl_scsiio *ctsio, + struct scsi_per_res_out *cdb, + struct scsi_per_res_out_parms* param); +static void ctl_pro_preempt_other(struct ctl_lun *lun, + union ctl_ha_msg *msg); +static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg); +static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len); +static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len); +static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len); +static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio); +static int ctl_inquiry_std(struct ctl_scsiio *ctsio); +static int ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint32_t *len); +static ctl_action ctl_extent_check(union ctl_io *io1, union ctl_io *io2); +static ctl_action ctl_check_for_blockage(union ctl_io *pending_io, + union ctl_io *ooa_io); +static ctl_action ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, + union ctl_io *starting_io); +static int ctl_check_blocked(struct ctl_lun *lun); +static int ctl_scsiio_lun_check(struct ctl_softc *ctl_softc, + struct ctl_lun *lun, + struct ctl_cmd_entry *entry, + struct ctl_scsiio *ctsio); +//static int ctl_check_rtr(union ctl_io *pending_io, struct ctl_softc *softc); +static void ctl_failover(void); +static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc, + struct ctl_scsiio *ctsio); +static int ctl_scsiio(struct ctl_scsiio *ctsio); + +static int ctl_bus_reset(struct ctl_softc *ctl_softc, union ctl_io *io); +static int ctl_target_reset(struct ctl_softc *ctl_softc, union ctl_io *io, + ctl_ua_type ua_type); +static int ctl_lun_reset(struct ctl_lun *lun, union ctl_io *io, + ctl_ua_type ua_type); +static int ctl_abort_task(union ctl_io *io); +static void ctl_run_task_queue(struct ctl_softc *ctl_softc); +#ifdef CTL_IO_DELAY +static void ctl_datamove_timer_wakeup(void *arg); +static void ctl_done_timer_wakeup(void *arg); +#endif /* CTL_IO_DELAY */ + +static void ctl_send_datamove_done(union ctl_io *io, int have_lock); +static void ctl_datamove_remote_write_cb(struct ctl_ha_dt_req *rq); +static int ctl_datamove_remote_dm_write_cb(union ctl_io *io); +static void ctl_datamove_remote_write(union ctl_io *io); +static int ctl_datamove_remote_dm_read_cb(union ctl_io *io); +static void ctl_datamove_remote_read_cb(struct ctl_ha_dt_req *rq); +static int ctl_datamove_remote_sgl_setup(union ctl_io *io); +static int ctl_datamove_remote_xfer(union ctl_io *io, unsigned command, + ctl_ha_dt_cb callback); +static void ctl_datamove_remote_read(union ctl_io *io); +static void ctl_datamove_remote(union ctl_io *io); +static int ctl_process_done(union ctl_io *io, int have_lock); +static void ctl_work_thread(void *arg); + +/* + * Load the serialization table. This isn't very pretty, but is probably + * the easiest way to do it. + */ +#include "ctl_ser_table.c" + +/* + * We only need to define open, close and ioctl routines for this driver. + */ +static struct cdevsw ctl_cdevsw = { + .d_version = D_VERSION, + .d_flags = 0, + .d_open = ctl_open, + .d_close = ctl_close, + .d_ioctl = ctl_ioctl, + .d_name = "ctl", +}; + + +MALLOC_DEFINE(M_CTL, "ctlmem", "Memory used for CTL"); + +/* + * If we have the CAM SIM, we may or may not have another SIM that will + * cause CTL to get initialized. If not, we need to initialize it. + */ +SYSINIT(ctl_init, SI_SUB_CONFIGURE, SI_ORDER_THIRD, ctl_init, NULL); + +static void +ctl_isc_handler_finish_xfer(struct ctl_softc *ctl_softc, + union ctl_ha_msg *msg_info) +{ + struct ctl_scsiio *ctsio; + + if (msg_info->hdr.original_sc == NULL) { + printf("%s: original_sc == NULL!\n", __func__); + /* XXX KDM now what? */ + return; + } + + ctsio = &msg_info->hdr.original_sc->scsiio; + ctsio->io_hdr.flags |= CTL_FLAG_IO_ACTIVE; + ctsio->io_hdr.msg_type = CTL_MSG_FINISH_IO; + ctsio->io_hdr.status = msg_info->hdr.status; + ctsio->scsi_status = msg_info->scsi.scsi_status; + ctsio->sense_len = msg_info->scsi.sense_len; + ctsio->sense_residual = msg_info->scsi.sense_residual; + ctsio->residual = msg_info->scsi.residual; + memcpy(&ctsio->sense_data, &msg_info->scsi.sense_data, + sizeof(ctsio->sense_data)); + memcpy(&ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, + &msg_info->scsi.lbalen, sizeof(msg_info->scsi.lbalen));; + STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, &ctsio->io_hdr, links); + ctl_wakeup_thread(); +} + +static void +ctl_isc_handler_finish_ser_only(struct ctl_softc *ctl_softc, + union ctl_ha_msg *msg_info) +{ + struct ctl_scsiio *ctsio; + + if (msg_info->hdr.serializing_sc == NULL) { + printf("%s: serializing_sc == NULL!\n", __func__); + /* XXX KDM now what? */ + return; + } + + ctsio = &msg_info->hdr.serializing_sc->scsiio; +#if 0 + /* + * Attempt to catch the situation where an I/O has + * been freed, and we're using it again. + */ + if (ctsio->io_hdr.io_type == 0xff) { + union ctl_io *tmp_io; + tmp_io = (union ctl_io *)ctsio; + printf("%s: %p use after free!\n", __func__, + ctsio); + printf("%s: type %d msg %d cdb %x iptl: " + "%d:%d:%d:%d tag 0x%04x " + "flag %#x status %x\n", + __func__, + tmp_io->io_hdr.io_type, + tmp_io->io_hdr.msg_type, + tmp_io->scsiio.cdb[0], + tmp_io->io_hdr.nexus.initid.id, + tmp_io->io_hdr.nexus.targ_port, + tmp_io->io_hdr.nexus.targ_target.id, + tmp_io->io_hdr.nexus.targ_lun, + (tmp_io->io_hdr.io_type == + CTL_IO_TASK) ? + tmp_io->taskio.tag_num : + tmp_io->scsiio.tag_num, + tmp_io->io_hdr.flags, + tmp_io->io_hdr.status); + } +#endif + ctsio->io_hdr.msg_type = CTL_MSG_FINISH_IO; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 00:41:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E4F11065670; Thu, 12 Jan 2012 00:41:48 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C0858FC16; Thu, 12 Jan 2012 00:41:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0C0fmu9084889; Thu, 12 Jan 2012 00:41:48 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0C0fmiF084883; Thu, 12 Jan 2012 00:41:48 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201201120041.q0C0fmiF084883@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 12 Jan 2012 00:41: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: r230000 - in head/sys/cam: . scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 00:41:48 -0000 Author: ken Date: Thu Jan 12 00:41:48 2012 New Revision: 230000 URL: http://svn.freebsd.org/changeset/base/230000 Log: Fix a race condition in CAM peripheral free handling, locking in the CAM XPT bus traversal code, and a number of other periph level issues. cam_periph.h, cam_periph.c: Modify cam_periph_acquire() to test the CAM_PERIPH_INVALID flag prior to allowing a reference count to be gained on a peripheral. Callers of this function will receive CAM_REQ_CMP_ERR status in the situation of attempting to reference an invalidated periph. This guarantees that a peripheral scheduled for a deferred free will not be accessed during its wait for destruction. Panic during attempts to drop a reference count on a peripheral that already has a zero reference count. In cam_periph_list(), use a local sbuf with SBUF_FIXEDLEN set so that mallocs do not occur while the xpt topology lock is held, regardless of the allocation policy of the passed in sbuf. Add a new routine, cam_periph_release_locked_buses(), that can be called when the caller already holds the CAM topology lock. Add some extra debugging for duplicate peripheral allocations in cam_periph_alloc(). Treat CAM_DEV_NOT_THERE much the same as a selection timeout (AC_LOST_DEVICE is emitted), but forgo retries. cam_xpt.c: Revamp the way the EDT traversal code does locking and reference counting. This was broken, since it assumed that the EDT would not change during traversal, but that assumption is no longer valid. So, to prevent devices from going away while we traverse the EDT, make sure we properly lock everything and hold references on devices that we are using. The two peripheral driver traversal routines should be examined. xptpdperiphtraverse() holds the topology lock for the entire time it runs. xptperiphtraverse() is now locked properly, but only holds the topology lock while it is traversing the list, and not while the traversal function is running. The bus locking code in xptbustraverse() should also be revisited at a later time, since it is complex and should probably be simplified. scsi_da.c: Pay attention to the return value from cam_periph_acquire(). Return 0 always from daclose() even if the disk is now gone. Add some rudimentary error injection support. scsi_sg.c: Fix reference counting in the sg(4) driver. The sg driver was calling cam_periph_release() on close, but never called cam_periph_acquire() (which increments the reference count) on open. The periph code correctly complained that the sg(4) driver was trying to decrement the refcount when it was already 0. Sponsored by: Spectra Logic MFC after: 2 weeks Modified: head/sys/cam/cam_periph.c head/sys/cam/cam_periph.h head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_da.c head/sys/cam/scsi/scsi_sg.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Thu Jan 12 00:38:57 2012 (r229999) +++ head/sys/cam/cam_periph.c Thu Jan 12 00:41:48 2012 (r230000) @@ -171,14 +171,16 @@ cam_periph_alloc(periph_ctor_t *periph_c return (CAM_REQ_INPROG); } else { printf("cam_periph_alloc: attempt to re-allocate " - "valid device %s%d rejected\n", - periph->periph_name, periph->unit_number); + "valid device %s%d rejected flags %#x " + "refcount %d\n", periph->periph_name, + periph->unit_number, periph->flags, + periph->refcount); } return (CAM_REQ_INVALID); } periph = (struct cam_periph *)malloc(sizeof(*periph), M_CAMPERIPH, - M_NOWAIT); + M_NOWAIT|M_ZERO); if (periph == NULL) return (CAM_RESRC_UNAVAIL); @@ -190,7 +192,6 @@ cam_periph_alloc(periph_ctor_t *periph_c path_id = xpt_path_path_id(path); target_id = xpt_path_target_id(path); lun_id = xpt_path_lun_id(path); - bzero(periph, sizeof(*periph)); cam_init_pinfo(&periph->pinfo); periph->periph_start = periph_start; periph->periph_dtor = periph_dtor; @@ -305,17 +306,20 @@ cam_periph_find(struct cam_path *path, c } /* - * Find a peripheral structure with the specified path, target, lun, - * and (optionally) type. If the name is NULL, this function will return - * the first peripheral driver that matches the specified path. + * Find peripheral driver instances attached to the specified path. */ int cam_periph_list(struct cam_path *path, struct sbuf *sb) { + struct sbuf local_sb; struct periph_driver **p_drv; struct cam_periph *periph; int count; + int sbuf_alloc_len; + sbuf_alloc_len = 16; +retry: + sbuf_new(&local_sb, NULL, sbuf_alloc_len, SBUF_FIXEDLEN); count = 0; xpt_lock_buses(); for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { @@ -324,49 +328,71 @@ cam_periph_list(struct cam_path *path, s if (xpt_path_comp(periph->path, path) != 0) continue; - if (sbuf_len(sb) != 0) - sbuf_cat(sb, ","); + if (sbuf_len(&local_sb) != 0) + sbuf_cat(&local_sb, ","); - sbuf_printf(sb, "%s%d", periph->periph_name, + sbuf_printf(&local_sb, "%s%d", periph->periph_name, periph->unit_number); + + if (sbuf_error(&local_sb) == ENOMEM) { + sbuf_alloc_len *= 2; + xpt_unlock_buses(); + sbuf_delete(&local_sb); + goto retry; + } count++; } } xpt_unlock_buses(); + sbuf_finish(&local_sb); + sbuf_cpy(sb, sbuf_data(&local_sb)); + sbuf_delete(&local_sb); return (count); } cam_status cam_periph_acquire(struct cam_periph *periph) { + cam_status status; + status = CAM_REQ_CMP_ERR; if (periph == NULL) - return(CAM_REQ_CMP_ERR); + return (status); xpt_lock_buses(); - periph->refcount++; + if ((periph->flags & CAM_PERIPH_INVALID) == 0) { + periph->refcount++; + status = CAM_REQ_CMP; + } xpt_unlock_buses(); - return(CAM_REQ_CMP); + return (status); } void -cam_periph_release_locked(struct cam_periph *periph) +cam_periph_release_locked_buses(struct cam_periph *periph) { - - if (periph == NULL) - return; - - xpt_lock_buses(); if (periph->refcount != 0) { periph->refcount--; } else { - xpt_print(periph->path, "%s: release %p when refcount is zero\n ", __func__, periph); + panic("%s: release of %p when refcount is zero\n ", __func__, + periph); } if (periph->refcount == 0 && (periph->flags & CAM_PERIPH_INVALID)) { camperiphfree(periph); } +} + +void +cam_periph_release_locked(struct cam_periph *periph) +{ + + if (periph == NULL) + return; + + xpt_lock_buses(); + cam_periph_release_locked_buses(periph); xpt_unlock_buses(); } @@ -1812,9 +1838,6 @@ cam_periph_error(union ccb *ccb, cam_fla error = EIO; break; case CAM_SEL_TIMEOUT: - { - struct cam_path *newpath; - if ((camflags & CAM_RETRY_SELTO) != 0) { if (ccb->ccb_h.retry_count > 0 && (periph->flags & CAM_PERIPH_INVALID) == 0) { @@ -1837,6 +1860,11 @@ cam_periph_error(union ccb *ccb, cam_fla } action_string = "Retries exhausted"; } + /* FALLTHROUGH */ + case CAM_DEV_NOT_THERE: + { + struct cam_path *newpath; + error = ENXIO; /* Should we do more if we can't create the path?? */ if (xpt_create_path(&newpath, periph, @@ -1855,7 +1883,6 @@ cam_periph_error(union ccb *ccb, cam_fla } case CAM_REQ_INVALID: case CAM_PATH_INVALID: - case CAM_DEV_NOT_THERE: case CAM_NO_HBA: case CAM_PROVIDE_FAIL: case CAM_REQ_TOO_BIG: Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Thu Jan 12 00:38:57 2012 (r229999) +++ head/sys/cam/cam_periph.h Thu Jan 12 00:41:48 2012 (r230000) @@ -119,6 +119,7 @@ struct cam_periph { #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 #define CAM_PERIPH_SENSE_INPROG 0x40 +#define CAM_PERIPH_FREE 0x80 u_int32_t immediate_priority; u_int32_t refcount; SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ @@ -146,6 +147,7 @@ int cam_periph_list(struct cam_path *, cam_status cam_periph_acquire(struct cam_periph *periph); void cam_periph_release(struct cam_periph *periph); void cam_periph_release_locked(struct cam_periph *periph); +void cam_periph_release_locked_buses(struct cam_periph *periph); int cam_periph_hold(struct cam_periph *periph, int priority); void cam_periph_unhold(struct cam_periph *periph); void cam_periph_invalidate(struct cam_periph *periph); Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Jan 12 00:38:57 2012 (r229999) +++ head/sys/cam/cam_xpt.c Thu Jan 12 00:41:48 2012 (r230000) @@ -2026,12 +2026,24 @@ xptbustraverse(struct cam_eb *start_bus, for (bus = (start_bus ? start_bus : TAILQ_FIRST(&xsoftc.xpt_busses)); bus != NULL; bus = next_bus) { - next_bus = TAILQ_NEXT(bus, links); + bus->refcount++; + + /* + * XXX The locking here is obviously very complex. We + * should work to simplify it. + */ mtx_unlock(&xsoftc.xpt_topo_lock); CAM_SIM_LOCK(bus->sim); retval = tr_func(bus, arg); CAM_SIM_UNLOCK(bus->sim); + + mtx_lock(&xsoftc.xpt_topo_lock); + next_bus = TAILQ_NEXT(bus, links); + mtx_unlock(&xsoftc.xpt_topo_lock); + + xpt_release_bus(bus); + if (retval == 0) return(retval); mtx_lock(&xsoftc.xpt_topo_lock); @@ -2086,10 +2098,14 @@ xpttargettraverse(struct cam_eb *bus, st TAILQ_FIRST(&bus->et_entries)); target != NULL; target = next_target) { - next_target = TAILQ_NEXT(target, links); + target->refcount++; retval = tr_func(target, arg); + next_target = TAILQ_NEXT(target, links); + + xpt_release_target(target); + if (retval == 0) return(retval); } @@ -2110,10 +2126,22 @@ xptdevicetraverse(struct cam_et *target, device != NULL; device = next_device) { - next_device = TAILQ_NEXT(device, links); + /* + * Hold a reference so the current device does not go away + * on us. + */ + device->refcount++; retval = tr_func(device, arg); + /* + * Grab our next pointer before we release the current + * device. + */ + next_device = TAILQ_NEXT(device, links); + + xpt_release_device(device); + if (retval == 0) return(retval); } @@ -2130,18 +2158,57 @@ xptperiphtraverse(struct cam_ed *device, retval = 1; + xpt_lock_buses(); for (periph = (start_periph ? start_periph : SLIST_FIRST(&device->periphs)); periph != NULL; periph = next_periph) { - next_periph = SLIST_NEXT(periph, periph_links); + + /* + * In this case, we want to show peripherals that have been + * invalidated, but not peripherals that are scheduled to + * be freed. So instead of calling cam_periph_acquire(), + * which will fail if the periph has been invalidated, we + * just check for the free flag here. If it is free, we + * skip to the next periph. + */ + if (periph->flags & CAM_PERIPH_FREE) { + next_periph = SLIST_NEXT(periph, periph_links); + continue; + } + + /* + * Acquire a reference to this periph while we call the + * traversal function, so it can't go away. + */ + periph->refcount++; + + xpt_unlock_buses(); retval = tr_func(periph, arg); + + /* + * We need the lock for list traversal. + */ + xpt_lock_buses(); + + /* + * Grab the next peripheral before we release this one, so + * our next pointer is still valid. + */ + next_periph = SLIST_NEXT(periph, periph_links); + + cam_periph_release_locked_buses(periph); + if (retval == 0) - return(retval); + goto bailout_done; } +bailout_done: + + xpt_unlock_buses(); + return(retval); } @@ -2188,15 +2255,48 @@ xptpdperiphtraverse(struct periph_driver TAILQ_FIRST(&(*pdrv)->units)); periph != NULL; periph = next_periph) { - next_periph = TAILQ_NEXT(periph, unit_links); - retval = tr_func(periph, arg); - if (retval == 0) { - xpt_unlock_buses(); - return(retval); + /* + * In this case, we want to show peripherals that have been + * invalidated, but not peripherals that are scheduled to + * be freed. So instead of calling cam_periph_acquire(), + * which will fail if the periph has been invalidated, we + * just check for the free flag here. If it is free, we + * skip to the next periph. + */ + if (periph->flags & CAM_PERIPH_FREE) { + next_periph = TAILQ_NEXT(periph, unit_links); + continue; } + + /* + * Acquire a reference to this periph while we call the + * traversal function, so it can't go away. + */ + periph->refcount++; + + /* + * XXX KDM we have the toplogy lock here, but in + * xptperiphtraverse(), we drop it before calling the + * traversal function. Which is correct? + */ + retval = tr_func(periph, arg); + + /* + * Grab the next peripheral before we release this one, so + * our next pointer is still valid. + */ + next_periph = TAILQ_NEXT(periph, unit_links); + + cam_periph_release_locked_buses(periph); + + if (retval == 0) + goto bailout_done; } +bailout_done: + xpt_unlock_buses(); + return(retval); } Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu Jan 12 00:38:57 2012 (r229999) +++ head/sys/cam/scsi/scsi_da.c Thu Jan 12 00:41:48 2012 (r230000) @@ -127,6 +127,7 @@ struct da_softc { da_flags flags; da_quirks quirks; int minimum_cmd_size; + int error_inject; int ordered_tag_count; int outstanding_cmds; struct disk_params params; @@ -879,7 +880,7 @@ daopen(struct disk *dp) } if (cam_periph_acquire(periph) != CAM_REQ_CMP) { - return(ENXIO); + return (ENXIO); } cam_periph_lock(periph); @@ -940,13 +941,13 @@ daclose(struct disk *dp) periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) - return (ENXIO); + return (0); cam_periph_lock(periph); if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); - return (error); + return (0); } softc = (struct da_softc *)periph->softc; @@ -1214,8 +1215,8 @@ daoninvalidate(struct cam_periph *periph bioq_flush(&softc->bio_queue, NULL, ENXIO); disk_gone(softc->disk); - xpt_print(periph->path, "lost device - %d outstanding\n", - softc->outstanding_cmds); + xpt_print(periph->path, "lost device - %d outstanding, %d refs\n", + softc->outstanding_cmds, periph->refcount); } static void @@ -1361,6 +1362,16 @@ dasysctlinit(void *context, int pending) &softc->minimum_cmd_size, 0, dacmdsizesysctl, "I", "Minimum CDB size"); + SYSCTL_ADD_INT(&softc->sysctl_ctx, + SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, + "error_inject", + CTLFLAG_RW, + &softc->error_inject, + 0, + "error_inject leaf"); + + /* * Add some addressing info. */ @@ -1887,6 +1898,13 @@ dadone(struct cam_periph *periph, union bp->bio_resid = csio->resid; if (csio->resid > 0) bp->bio_flags |= BIO_ERROR; + if (softc->error_inject != 0) { + bp->bio_error = softc->error_inject; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; + softc->error_inject = 0; + } + } /* @@ -2103,13 +2121,20 @@ dadone(struct cam_periph *periph, union } free(csio->data_ptr, M_SCSIDA); if (announce_buf[0] != '\0') { - xpt_announce_periph(periph, announce_buf); /* * Create our sysctl variables, now that we know * we have successfully attached. */ - (void) cam_periph_acquire(periph); /* increase the refcount */ - taskqueue_enqueue(taskqueue_thread,&softc->sysctl_task); + /* increase the refcount */ + if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + taskqueue_enqueue(taskqueue_thread, + &softc->sysctl_task); + xpt_announce_periph(periph, announce_buf); + } else { + xpt_print(periph->path, "fatal error, " + "could not acquire reference count\n"); + } + } softc->state = DA_STATE_NORMAL; /* Modified: head/sys/cam/scsi/scsi_sg.c ============================================================================== --- head/sys/cam/scsi/scsi_sg.c Thu Jan 12 00:38:57 2012 (r229999) +++ head/sys/cam/scsi/scsi_sg.c Thu Jan 12 00:41:48 2012 (r230000) @@ -399,18 +399,24 @@ sgopen(struct cdev *dev, int flags, int if (periph == NULL) return (ENXIO); + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + return (ENXIO); + /* * Don't allow access when we're running at a high securelevel. */ error = securelevel_gt(td->td_ucred, 1); - if (error) + if (error) { + cam_periph_release(periph); return (error); + } cam_periph_lock(periph); softc = (struct sg_softc *)periph->softc; if (softc->flags & SG_FLAG_INVALID) { cam_periph_unlock(periph); + cam_periph_release(periph); return (ENXIO); } From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 05:50:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F3BD1065672; Thu, 12 Jan 2012 05:50:33 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F7348FC0A; Thu, 12 Jan 2012 05:50:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0C5oXdc094720; Thu, 12 Jan 2012 05:50:33 GMT (envelope-from wollman@svn.freebsd.org) Received: (from wollman@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0C5oXEQ094718; Thu, 12 Jan 2012 05:50:33 GMT (envelope-from wollman@svn.freebsd.org) Message-Id: <201201120550.q0C5oXEQ094718@svn.freebsd.org> From: Garrett Wollman Date: Thu, 12 Jan 2012 05:50: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: r230005 - head/usr.sbin/tzsetup X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 05:50:33 -0000 Author: wollman Date: Thu Jan 12 05:50:32 2012 New Revision: 230005 URL: http://svn.freebsd.org/changeset/base/230005 Log: Use a reasonable-sized buffer when formatting error messages about installing zoneinfo. While we're in the vicinity, add some missing error checking to eliminate an unhelpful error message when unlink() fails. /me is embarrassed by the quality of his 16-year-old code. The whole thing is awful and could stand a complete rewrite. PR: 164038 Submitted by: Devin Teske (but implemented differently) Modified: head/usr.sbin/tzsetup/tzsetup.c Modified: head/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- head/usr.sbin/tzsetup/tzsetup.c Thu Jan 12 05:47:28 2012 (r230004) +++ head/usr.sbin/tzsetup/tzsetup.c Thu Jan 12 05:50:32 2012 (r230005) @@ -57,6 +57,13 @@ __FBSDID("$FreeBSD$"); #define _PATH_DB "/var/db/zoneinfo" #define _PATH_WALL_CMOS_CLOCK "/etc/wall_cmos_clock" +#ifdef PATH_MAX +#define SILLY_BUFFER_SIZE 2*PATH_MAX +#else +#warning "Somebody needs to fix this to dynamically size this buffer." +#define SILLY_BUFFER_SIZE 2048 +#endif + /* special return codes for `fire' actions */ #define DITEM_FAILURE 1 @@ -638,7 +645,7 @@ static int install_zoneinfo_file(const char *zoneinfo_file) { char buf[1024]; - char title[64], prompt[64]; + char title[64], prompt[SILLY_BUFFER_SIZE]; struct stat sb; ssize_t len; int fd1, fd2, copymode; @@ -709,7 +716,18 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } - unlink(path_localtime); + if (unlink(path_localtime) < 0) { + snprintf(prompt, sizeof(prompt), + "Could not unlink %s: %s", + path_localtime, strerror(errno)); + if (usedialog) { + snprintf(title, sizeof(title), "Error"); + dialog_msgbox(title, prompt, 8, 72, 1); + } else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); + } + fd2 = open(path_localtime, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IRGRP | S_IROTH); if (fd2 < 0) { @@ -755,7 +773,17 @@ install_zoneinfo_file(const char *zonein fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } - unlink(path_localtime); + if (unlink(path_localtime) < 0) { + snprintf(prompt, sizeof(prompt), + "Could not unlink %s: %s", + path_localtime, strerror(errno)); + if (usedialog) { + snprintf(title, sizeof(title), "Error"); + dialog_msgbox(title, prompt, 8, 72, 1); + } else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); + } if (symlink(zoneinfo_file, path_localtime) < 0) { snprintf(title, sizeof(title), "Error"); snprintf(prompt, sizeof(prompt), From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 06:48:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 386DB106566B; Thu, 12 Jan 2012 06:48:12 +0000 (UTC) (envelope-from rea@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17F3D8FC08; Thu, 12 Jan 2012 06:48:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0C6mBiD096666; Thu, 12 Jan 2012 06:48:11 GMT (envelope-from rea@svn.freebsd.org) Received: (from rea@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0C6mBio096662; Thu, 12 Jan 2012 06:48:11 GMT (envelope-from rea@svn.freebsd.org) Message-Id: <201201120648.q0C6mBio096662@svn.freebsd.org> From: Eygene Ryabinkin Date: Thu, 12 Jan 2012 06:48: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: r230007 - in head: etc etc/rc.d share/man/man8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 06:48:12 -0000 Author: rea (ports committer) Date: Thu Jan 12 06:48:11 2012 New Revision: 230007 URL: http://svn.freebsd.org/changeset/base/230007 Log: rc.d: document 'quiet' prefix and fix dhclient/devd interaction Document the current semantics of the 'quiet' command prefix in the rc.subr(8). Fix dhclient rc.d script: it should not call err() for non-DHCP-enabled interface when it is called from devd, because the latter just blindly calls 'service dhclient quietstart' on each "link up" event. Since the 'quietstart' will silence the message "Cannot 'start' . Set _enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'." and running dhclient on the non-DHCP-enabled interface is the same thing as running the service without _enable set, such modification is in sync with the current semantics of the 'quiet' prefix. Approved by: glebius Reviewed by: freebsd-rc list MFC after: 2 weeks Modified: head/etc/rc.d/dhclient head/etc/rc.subr head/share/man/man8/rc.subr.8 Modified: head/etc/rc.d/dhclient ============================================================================== --- head/etc/rc.d/dhclient Thu Jan 12 05:51:11 2012 (r230006) +++ head/etc/rc.d/dhclient Thu Jan 12 06:48:11 2012 (r230007) @@ -22,7 +22,14 @@ stop_precmd="dhclient_pre_check" dhclient_pre_check() { if [ -z "${rc_force}" ] && ! dhcpif $ifn; then - err 1 "'$ifn' is not a DHCP-enabled interface" + local msg + msg="'$ifn' is not a DHCP-enabled interface" + if [ -z "${rc_quiet}" ]; then + err 1 "$msg" + else + debug "$msg" + exit 1 + fi fi } Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Thu Jan 12 05:51:11 2012 (r230006) +++ head/etc/rc.subr Thu Jan 12 06:48:11 2012 (r230007) @@ -1116,7 +1116,7 @@ load_rc_config_var() # rc_usage() { - echo -n 1>&2 "Usage: $0 [fast|force|one](" + echo -n 1>&2 "Usage: $0 [fast|force|one|quiet](" _sep= for _elem; do Modified: head/share/man/man8/rc.subr.8 ============================================================================== --- head/share/man/man8/rc.subr.8 Thu Jan 12 05:51:11 2012 (r230006) +++ head/share/man/man8/rc.subr.8 Thu Jan 12 06:48:11 2012 (r230007) @@ -339,7 +339,7 @@ with being the list of valid arguments prefixed by .Sm off -.Dq Bq Li fast | force | one . +.Dq Bq Li fast | force | one | quiet . .Sm on .It Ic reverse_list Ar item ... Print the list of @@ -427,6 +427,22 @@ Skip the checks for being set to .Dq Li YES , but performs all the other prerequisite tests. +.It Li quiet +Inhibits some verbose diagnostics. +Currently, this includes messages +.Qq Starting ${name} +(as checked by +.Ic check_startmsgs +inside +.Nm ) +and errors about usage of services that are not enabled in +.Xr rc.conf 5 . +This prefix also sets +.Va rc_quiet Ns = Ns Li YES . +.Em Please, note: +.Va rc_quiet +is not intended to completely mask all debug and warning messages, +but only certain small classes of them. .El .Pp .Ic run_rc_command From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 07:44:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A8DB1065675; Thu, 12 Jan 2012 07:44:46 +0000 (UTC) (envelope-from joel@vnode.se) Received: from mail.vnode.se (mail.vnode.se [62.119.52.80]) by mx1.freebsd.org (Postfix) with ESMTP id AB32D8FC16; Thu, 12 Jan 2012 07:44:45 +0000 (UTC) Received: from mail.vnode.se (localhost [127.0.0.1]) by mail.vnode.se (Postfix) with ESMTP id DE0E3E3F07A; Thu, 12 Jan 2012 08:25:43 +0100 (CET) X-Virus-Scanned: amavisd-new at vnode.se Received: from mail.vnode.se ([127.0.0.1]) by mail.vnode.se (mail.vnode.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oObozPX91KkU; Thu, 12 Jan 2012 08:25:38 +0100 (CET) Received: from goofy01.vnodelab.local (unknown [212.247.52.12]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.vnode.se (Postfix) with ESMTPSA id 04B99E3F079; Thu, 12 Jan 2012 08:25:37 +0100 (CET) Date: Thu, 12 Jan 2012 08:25:36 +0100 From: Joel Dahl To: "Pedro F. Giffuni" Message-ID: <20120112072536.GC2227@goofy01.vnodelab.local> References: <201201112117.q0BLHEck077022@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201112117.q0BLHEck077022@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 07:44:46 -0000 On 11-01-2012 21:17, Pedro F. Giffuni wrote: > Author: pfg > Date: Wed Jan 11 21:17:14 2012 > New Revision: 229981 > URL: http://svn.freebsd.org/changeset/base/229981 > > Log: > Replace GPL'd headers in the emu10kx snd driver code. > > This uses the emuxkireg.h already used in the emu10k1 > snd driver. Special thanks go to Alexander Motin as > he was able to find some errors and reverse engineer > some wrong values in the emuxkireg header. > > The emu10kx driver is now free from the GPL. Thank you for taking care of this. -- Joel From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 08:58:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D765106567B; Thu, 12 Jan 2012 08:58:47 +0000 (UTC) (envelope-from hans.petter.selasky@bitfrost.no) Received: from smtp02-out.isp.tdc.no (smtp02-out.isp.tdc.no [213.236.144.173]) by mx1.freebsd.org (Postfix) with ESMTP id A58758FC14; Thu, 12 Jan 2012 08:58:45 +0000 (UTC) Received: from mail.bitfrost.no (mail.bitfrost.no [85.19.79.136]) by smtp02-out.isp.tdc.no (Postfix) with ESMTP id AAA052304; Thu, 12 Jan 2012 09:58:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bitfrost.no From: =?windows-1252?Q?Hans_Petter_Selasky?= To: =?windows-1252?Q?svn-src-head=40freebsd.org?= , =?windows-1252?Q?svn-src-all=40freebsd.org?= , =?windows-1252?Q?src-committers=40freebsd.org?= , =?windows-1252?Q?Kenneth_D._Merry?= Date: Thu, 12 Jan 2012 09:58:36 +0100 Mime-Version: 1.0 In-Reply-To: <201201120034.q0C0YXrq084182@svn.freebsd.org> References: <201201120034.q0C0YXrq084182@svn.freebsd.org> X-Priority: 3 (Normal) Message-Id: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: RE: svn commit: r229997 - in head: share/examples/scsi_target sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/ctls... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 08:58:47 -0000 Hi,=0D=0A=0D=0A=A0=0D=0A=0D=0ADoes the cam target layer support attach/de= tach of logical units=3F=0D=0A=0D=0A=A0=0D=0A=0D=0ACan it be used with US= B target mode=3F=0D=0A=0D=0A=A0=0D=0A=0D=0A--HPS=0D=0A=A0=0D=0A-----Origi= nal message-----=0D=0ATo:src-committers@freebsd.org; svn-src-all@freebsd.= org; svn-src-head@freebsd.org;=20=0D=0AFrom:Kenneth D. Merry =0D=0ASent:Thu 12-01-2012 01:35=0D=0ASubject:svn commit: r229997 -= in head: share/examples/scsi_target sys/amd64/conf sys/cam/ctl sys/cam/s= csi sys/conf sys/dev/ata sys/dev/ciss sys/i386/conf sys/ia64/conf sys/spa= rc64/conf usr.bin usr.bin/ctls...=0D=0AAuthor: ken=0D=0ADate: Thu Jan 12 = 00:34:33 2012=0D=0ANew Revision: 229997=0D=0AURL: http://svn.freebsd.org/= changeset/base/229997=0D=0A=0D=0ALog:=0D=0A=A0Add the CAM Target Layer (C= TL).=0D=0A=A0=0D=0A=A0CTL is a disk and processor device emulation subsys= tem originally written=0D=0A=A0for Copan Systems under Linux starting in = 2003. =A0It has been shipping in=0D=0A=A0Copan (now SGI) products since 2= 005.=0D=0A=A0=0D=0A=A0It was ported to FreeBSD in 2008, and thanks to an = agreement between SGI=0D=0A=A0(who acquired Copan's assets in 2010) and S= pectra Logic in 2010, CTL is=0D=0A=A0available under a BSD-style license.= =A0The intent behind the agreement was=0D=0A=A0that Spectra would work t= o get CTL into the FreeBSD tree.=0D=0A=A0=0D=0A=A0Some CTL features:=0D=0A= =A0=0D=0A=A0 - Disk and processor device emulation.=0D=0A=A0 - Tagged que= ueing=0D=0A=A0 - SCSI task attribute support (ordered, head of queue, sim= ple tags)=0D=0A=A0 - SCSI implicit command ordering support. =A0(e.g. if = a read follows a mode=0D=0A=A0 =A0 select, the read will be blocked until= the mode select completes.)=0D=0A=A0 - Full task management support (abo= rt, LUN reset, target reset, etc.)=0D=0A=A0 - Support for multiple ports=0D= =0A=A0 - Support for multiple simultaneous initiators=0D=0A=A0 - Support = for multiple simultaneous backing stores=0D=0A=A0 - Persistent reservatio= n support=0D=0A=A0 - Mode sense/select support=0D=0A=A0 - Error injection= support=0D=0A=A0 - High Availability support (1)=0D=0A=A0 - All I/O hand= led in-kernel, no userland context switch overhead.=0D=0A=A0=0D=0A=A0(1) = HA Support is just an API stub, and needs much more to be fully=0D=0A=A0 = =A0 =A0functional.=0D=0A=A0=0D=0A=A0ctl.c:The core of CTL. =A0Command han= dlers and processing,=0D=0A=A0character driver, and HA support are here.=0D= =0A=A0=0D=0A=A0ctl.h:Basic function declarations and data structures.=0D=0A= =A0=0D=0A=A0ctl_backend.c,=0D=0A=A0ctl_backend.h:The basic CTL backend AP= I.=0D=0A=A0=0D=0A=A0ctl_backend_block.c,=0D=0A=A0ctl_backend_block.h:The = block and file backend. =A0This allows for using=0D=0A=A0a disk or a file= as the backing store for a LUN.=0D=0A=A0Multiple threads are started to = do I/O to the=0D=0A=A0backing device, primarily because the VFS API=0D=0A= =A0requires that to get any concurrency.=0D=0A=A0=0D=0A=A0ctl_backend_ram= disk.c:A "fake" ramdisk backend. =A0It only allocates a=0D=0A=A0small amo= unt of memory to act as a source and sink=0D=0A=A0for reads and writes fr= om an initiator. =A0Therefore=0D=0A=A0it cannot be used for any real data= , but it can be=0D=0A=A0used to test for throughput. =A0It can also be us= ed=0D=0A=A0to test initiators' support for extremely large LUNs.=0D=0A=A0= =0D=0A=A0ctl_cmd_table.c:This is a table with all 256 possible SCSI opcod= es,=0D=0A=A0and command handler functions defined for supported=0D=0A=A0o= pcodes.=0D=0A=A0=0D=0A=A0ctl_debug.h:Debugging support.=0D=0A=A0=0D=0A=A0= ctl_error.c,=0D=0A=A0ctl_error.h:CTL-specific wrappers around the CAM sen= se building=0D=0A=A0functions.=0D=0A=A0=0D=0A=A0ctl_frontend.c,=0D=0A=A0c= tl_frontend.h:These files define the basic CTL frontend port API.=0D=0A=A0= =0D=0A=A0ctl_frontend_cam_sim.c:This is a CTL frontend port that is also = a CAM SIM.=0D=0A=A0This frontend allows for using CTL without any=0D=0A=A0= target-capable hardware. =A0So any LUNs you create in=0D=0A=A0CTL are vis= ible in CAM via this port.=0D=0A=A0=0D=0A=A0ctl_frontend_internal.c,=0D=0A= =A0ctl_frontend_internal.h:=0D=0A=A0This is a frontend port written for C= opan to do=0D=0A=A0some system-specific tasks that required sending=0D=0A= =A0commands into CTL from inside the kernel. =A0This=0D=0A=A0isn't entire= ly relevant to FreeBSD in general,=0D=0A=A0but can perhaps be repurposed.= =0D=0A=A0=0D=0A=A0ctl_ha.h:This is a stubbed-out High Availability API. =A0= Much=0D=0A=A0more is needed for full HA support. =A0See the=0D=0A=A0comme= nts in the header and the description of what=0D=0A=A0is needed in the RE= ADME.ctl.txt file for more=0D=0A=A0details.=0D=0A=A0=0D=0A=A0ctl_io.h:Thi= s defines most of the core CTL I/O structures.=0D=0A=A0union ctl_io is co= nceptually very similar to CAM's=0D=0A=A0union ccb.=0D=0A=A0=0D=0A=A0ctl_= ioctl.h:This defines all ioctls available through the CTL=0D=0A=A0charact= er device, and the data structures needed=0D=0A=A0for those ioctls.=0D=0A= =A0=0D=0A=A0ctl_mem_pool.c,=0D=0A=A0ctl_mem_pool.h:Generic memory pool im= plementation used by the=0D=0A=A0internal frontend.=0D=0A=A0=0D=0A=A0ctl_= private.h:Private data structres (e.g. CTL softc) and=0D=0A=A0function pr= ototypes. =A0This also includes the SCSI=0D=0A=A0vendor and product names= used by CTL.=0D=0A=A0=0D=0A=A0ctl_scsi_all.c,=0D=0A=A0ctl_scsi_all.h:CTL= wrappers around CAM sense printing functions.=0D=0A=A0=0D=0A=A0ctl_ser_t= able.c:Command serialization table. =A0This defines what=0D=0A=A0happens = when one type of command is followed by=0D=0A=A0another type of command.=0D= =0A=A0=0D=0A=A0ctl_util.c,=0D=0A=A0ctl_util.h:CTL utility functions, prim= arily designed to be=0D=0A=A0used from userland. =A0See ctladm for the pr= imary=0D=0A=A0consumer of these functions. =A0These include CDB=0D=0A=A0b= uilding functions.=0D=0A=A0=0D=0A=A0scsi_ctl.c:CAM target peripheral driv= er and CTL frontend port.=0D=0A=A0This is the path into CTL for commands = from=0D=0A=A0target-capable hardware/SIMs.=0D=0A=A0=0D=0A=A0README.ctl.tx= t:CTL code features, roadmap, to-do list.=0D=0A=A0=0D=0A=A0usr.sbin/Makef= ile:Add ctladm.=0D=0A=A0=0D=0A=A0ctladm/Makefile,=0D=0A=A0ctladm/ctladm.8= ,=0D=0A=A0ctladm/ctladm.c,=0D=0A=A0ctladm/ctladm.h,=0D=0A=A0ctladm/util.c= :ctladm(8) is the CTL management utility.=0D=0A=A0It fills a role similar= to camcontrol(8).=0D=0A=A0It allow configuring LUNs, issuing commands,=0D= =0A=A0injecting errors and various other control=0D=0A=A0functions.=0D=0A= =A0=0D=0A=A0usr.bin/Makefile:Add ctlstat.=0D=0A=A0=0D=0A=A0ctlstat/Makefi= le=0D=0A=A0ctlstat/ctlstat.8,=0D=0A=A0ctlstat/ctlstat.c:ctlstat(8) fills = a role similar to iostat(8).=0D=0A=A0It reports I/O statistics for CTL.=0D= =0A=A0=0D=0A=A0sys/conf/files:Add CTL files.=0D=0A=A0=0D=0A=A0sys/conf/NO= TES:Add device ctl.=0D=0A=A0=0D=0A=A0sys/cam/scsi_all.h:To conform to mor= e recent specs, the inquiry CDB=0D=0A=A0length field is now 2 bytes long.= =0D=0A=A0=0D=0A=A0Add several mode page definitions for CTL.=0D=0A=A0=0D=0A= =A0sys/cam/scsi_all.c:Handle the new 2 byte inquiry length.=0D=0A=A0=0D=0A= =A0sys/dev/ciss/ciss.c,=0D=0A=A0sys/dev/ata/atapi-cam.c,=0D=0A=A0sys/cam/= scsi/scsi_targ_bh.c,=0D=0A=A0scsi_target/scsi_cmds.c,=0D=0A=A0mlxcontrol/= interface.c:Update for 2 byte inquiry length field.=0D=0A=A0=0D=0A=A0scsi= _da.h:Add versions of the format and rigid disk pages=0D=0A=A0that are in= a more reasonable format for CTL.=0D=0A=A0=0D=0A=A0amd64/conf/GENERIC,=0D= =0A=A0i386/conf/GENERIC,=0D=0A=A0ia64/conf/GENERIC,=0D=0A=A0sparc64/conf/= GENERIC:Add device ctl.=0D=0A=A0=0D=0A=A0i386/conf/PAE:The CTL frontend S= IM at least does not compile=0D=0A=A0cleanly on PAE.=0D=0A=A0=0D=0A=A0Spo= nsored by:Copan Systems, SGI and Spectra Logic=0D=0A=A0MFC after:1 month=0D= =0A=0D=0AAdded:=0D=0A=A0head/sys/cam/ctl/=0D=0A=A0head/sys/cam/ctl/README= =2Ectl.txt =A0 (contents, props changed)=0D=0A=A0head/sys/cam/ctl/ctl.c =A0= (contents, props changed)=0D=0A=A0head/sys/cam/ctl/ctl.h =A0 (contents, = props changed)=0D=0A=A0head/sys/cam/ctl/ctl_backend.c =A0 (contents, prop= s changed)=0D=0A=A0head/sys/cam/ctl/ctl_backend.h =A0 (contents, props ch= anged)=0D=0A=A0head/sys/cam/ctl/ctl_backend_block.c =A0 (contents, props = changed)=0D=0A=A0head/sys/cam/ctl/ctl_backend_block.h =A0 (contents, prop= s changed)=0D=0A=A0head/sys/cam/ctl/ctl_backend_ramdisk.c =A0 (contents, = props changed)=0D=0A=A0head/sys/cam/ctl/ctl_cmd_table.c =A0 (contents, pr= ops changed)=0D=0A=A0head/sys/cam/ctl/ctl_debug.h =A0 (contents, props ch= anged)=0D=0A=A0head/sys/cam/ctl/ctl_error.c =A0 (contents, props changed)= =0D=0A=A0head/sys/cam/ctl/ctl_error.h =A0 (contents, props changed)=0D=0A= =A0head/sys/cam/ctl/ctl_frontend.c =A0 (contents, props changed)=0D=0A=A0= head/sys/cam/ctl/ctl_frontend.h =A0 (contents, props changed)=0D=0A=A0hea= d/sys/cam/ctl/ctl_frontend_cam_sim.c =A0 (contents, props changed)=0D=0A=A0= head/sys/cam/ctl/ctl_frontend_internal.c =A0 (contents, props changed)=0D= =0A=A0head/sys/cam/ctl/ctl_frontend_internal.h =A0 (contents, props chang= ed)=0D=0A=A0head/sys/cam/ctl/ctl_ha.h =A0 (contents, props changed)=0D=0A= =A0head/sys/cam/ctl/ctl_io.h =A0 (contents, props changed)=0D=0A=A0head/s= ys/cam/ctl/ctl_ioctl.h =A0 (contents, props changed)=0D=0A=A0head/sys/cam= /ctl/ctl_mem_pool.c =A0 (contents, props changed)=0D=0A=A0head/sys/cam/ct= l/ctl_mem_pool.h =A0 (contents, props changed)=0D=0A=A0head/sys/cam/ctl/c= tl_private.h =A0 (contents, props changed)=0D=0A=A0head/sys/cam/ctl/ctl_s= csi_all.c =A0 (contents, props changed)=0D=0A=A0head/sys/cam/ctl/ctl_scsi= _all.h =A0 (contents, props changed)=0D=0A=A0head/sys/cam/ctl/ctl_ser_tab= le.c =A0 (contents, props changed)=0D=0A=A0head/sys/cam/ctl/ctl_util.c =A0= (contents, props changed)=0D=0A=A0head/sys/cam/ctl/ctl_util.h =A0 (conte= nts, props changed)=0D=0A=A0head/sys/cam/ctl/scsi_ctl.c =A0 (contents, pr= ops changed)=0D=0A=A0head/usr.bin/ctlstat/=0D=0A=A0head/usr.bin/ctlstat/M= akefile =A0 (contents, props changed)=0D=0A=A0head/usr.bin/ctlstat/ctlsta= t.8 =A0 (contents, props changed)=0D=0A=A0head/usr.bin/ctlstat/ctlstat.c = =A0 (contents, props changed)=0D=0A=A0head/usr.sbin/ctladm/=0D=0A=A0head/= usr.sbin/ctladm/Makefile =A0 (contents, props changed)=0D=0A=A0head/usr.s= bin/ctladm/ctladm.8 =A0 (contents, props changed)=0D=0A=A0head/usr.sbin/c= tladm/ctladm.c =A0 (contents, props changed)=0D=0A=A0head/usr.sbin/ctladm= /ctladm.h =A0 (contents, props changed)=0D=0A=A0head/usr.sbin/ctladm/util= =2Ec =A0 (contents, props changed)=0D=0AModified:=0D=0A=A0head/share/exam= ples/scsi_target/scsi_cmds.c=0D=0A=A0head/sys/amd64/conf/GENERIC=0D=0A=A0= head/sys/cam/scsi/scsi_all.c=0D=0A=A0head/sys/cam/scsi/scsi_all.h=0D=0A=A0= head/sys/cam/scsi/scsi_da.h=0D=0A=A0head/sys/cam/scsi/scsi_targ_bh.c=0D=0A= =A0head/sys/conf/NOTES=0D=0A=A0head/sys/conf/files=0D=0A=A0head/sys/dev/a= ta/atapi-cam.c=0D=0A=A0head/sys/dev/ciss/ciss.c=0D=0A=A0head/sys/i386/con= f/GENERIC=0D=0A=A0head/sys/i386/conf/PAE=0D=0A=A0head/sys/ia64/conf/GENER= IC=0D=0A=A0head/sys/sparc64/conf/GENERIC=0D=0A=A0head/usr.bin/Makefile=0D= =0A=A0head/usr.sbin/Makefile=0D=0A=A0head/usr.sbin/mlxcontrol/interface.c= =0D=0A=0D=0AModified: head/share/examples/scsi_target/scsi_cmds.c=0D=0A=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=0D=0A--- head/share/examples/scsi_target/scsi_cmds.cThu Jan 12 00:= 05:35 2012(r229996)=0D=0A+++ head/share/examples/scsi_target/scsi_cmds.cT= hu Jan 12 00:34:33 2012(r229997)=0D=0A@@ -328,7 +328,7 @@ tcmd_inquiry(st= ruct ccb_accept_tio *atio=0D=0Abcopy(&inq_data, ctio->data_ptr, sizeof(in= q_data));=0D=0Actio->dxfer_len =3D inq_data.additional_length + 4;=0D=0Ac= tio->dxfer_len =3D min(ctio->dxfer_len,=0D=0A- =A0 =A0 =A0SCSI_CDB6_LEN(i= nq->length));=0D=0A+ =A0 =A0 =A0scsi_2btoul(inq->length));=0D=0Actio->ccb= _h.flags |=3D CAM_DIR_IN | CAM_SEND_STATUS;=0D=0Actio->scsi_status =3D SC= SI_STATUS_OK;=0D=0A}=0D=0A=0D=0AModified: head/sys/amd64/conf/GENERIC=0D=0A= =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=0D=0A--- head/sys/amd64/conf/GENERICThu Jan 12 00:05:35 2012(r2= 29996)=0D=0A+++ head/sys/amd64/conf/GENERICThu Jan 12 00:34:33 2012(r2299= 97)=0D=0A@@ -131,7 +131,8 @@ deviceda# Direct Access (disks)=0D=0Adevices= a# Sequential Access (tape etc)=0D=0Adevicecd# CD=0D=0Adevicepass# Passth= rough device (direct ATA/SCSI access)=0D=0A-deviceses# SCSI Environmental= Services (and SAF-TE)=0D=0A+deviceses# Enclosure Services (SES and SAF-T= E)=0D=0A+devicectl# CAM Target Layer=0D=0A=0D=0A# RAID controllers interf= aced to the SCSI subsystem=0D=0Adeviceamr# AMI MegaRAID=0D=0A=0D=0AAdded:= head/sys/cam/ctl/README.ctl.txt=0D=0A=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=0D=0A--- /dev/null00:00:= 00 1970(empty, because file is newly added)=0D=0A+++ head/sys/cam/ctl/REA= DME.ctl.txtThu Jan 12 00:34:33 2012(r229997)=0D=0A@@ -0,0 +1,449 @@=0D=0A= +/* $FreeBSD$ */=0D=0A+=0D=0A+CTL - CAM Target Layer Description=0D=0A+=0D= =0A+Revision 1.4 (December 29th, 2011)=0D=0A+Ken Merry =0D= =0A+=0D=0A+Table of Contents:=0D=0A+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=0D=0A+=0D=0A+Introduction=0D=0A+Features=0D=0A+Configuring a= nd Running CTL=0D=0A+Revision 1.N Changes=0D=0A+To Do List=0D=0A+Code Roa= dmap=0D=0A+Userland Commands=0D=0A+=0D=0A+Introduction:=0D=0A+=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=0D=0A+=0D=0A+CTL is a disk and processor device = emulation subsystem originally written=0D=0A+for Copan Systems under Linu= x starting in 2003. =A0It has been shipping in=0D=0A+Copan (now SGI) prod= ucts since 2005.=0D=0A+=0D=0A+It was ported to FreeBSD in 2008, and thank= s to an agreement between SGI=0D=0A+(who acquired Copan's assets in 2010)= and Spectra Logic in 2010, CTL is=0D=0A+available under a BSD-style lice= nse. =A0The intent behind the agreement was=0D=0A+that Spectra would work= to get CTL into the FreeBSD tree.=0D=0A+=0D=0A+Features:=0D=0A+=3D=3D=3D= =3D=3D=3D=3D=3D=0D=0A+=0D=0A+ - Disk and processor device emulation.=0D=0A= + - Tagged queueing=0D=0A+ - SCSI task attribute support (ordered, head o= f queue, simple tags)=0D=0A+ - SCSI implicit command ordering support. =A0= (e.g. if a read follows a mode=0D=0A+ =A0 select, the read will be blocke= d until the mode select completes.)=0D=0A+ - Full task management support= (abort, LUN reset, target reset, etc.)=0D=0A+ - Support for multiple por= ts=0D=0A+ - Support for multiple simultaneous initiators=0D=0A+ - Support= for multiple simultaneous backing stores=0D=0A+ - Persistent reservation= support=0D=0A+ - Mode sense/select support=0D=0A+ - Error injection supp= ort=0D=0A+ - High Availability support (1)=0D=0A+ - All I/O handled in-ke= rnel, no userland context switch overhead.=0D=0A+=0D=0A+(1) HA Support is= just an API stub, and needs much more to be fully=0D=0A+ =A0 =A0function= al. =A0See the to-do list below.=0D=0A+=0D=0A+Configuring and Running CTL= :=0D=0A+=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=0D=0A+=0D=0A+ - After applying the CTL patchset to your t= ree, build world and install it=0D=0A+ =A0 on your target system.=0D=0A+=0D= =0A+ - Add 'device ctl' to your kernel configuration file.=0D=0A+=0D=0A+ = - If you're running with a 8Gb or 4Gb Qlogic FC board, add=0D=0A+ =A0 'op= tions ISP_TARGET_MODE' to your kernel config file. =A0Keep in mind that=0D= =0A+ =A0 the isp(4) driver can run in target or initiator mode, but not b= oth on=0D=0A+ =A0 the same machine. =A0'device ispfw' or loading the ispf= w module is also=0D=0A+ =A0 recommended.=0D=0A+=0D=0A+ - Rebuild and inst= all a new kernel.=0D=0A+=0D=0A+ - Reboot with the new kernel.=0D=0A+=0D=0A= + - To add a LUN with the RAM disk backend:=0D=0A+=0D=0A+ctladm create -b= ramdisk -s 10485760000000000000=0D=0A+ctladm port -o on=0D=0A+=0D=0A+ - = You should now see the CTL disk LUN through camcontrol devlist:=0D=0A+=0D= =0A+scbus6 on ctl2cam0 bus 0:=0D=0A+ =A0 =A0 =A0 =A0= =A0 =A0 at scbus6 target 1 lun 0 (da24,pass32)=0D=0A+<> =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 at scbus6 target -1 lun -= 1 ()=0D=0A+=0D=0A+ =A0 This is visible through the CTL CAM SIM. =A0This a= llows using CTL without=0D=0A+ =A0 any physical hardware. =A0You should b= e able to issue any normal SCSI=0D=0A+ =A0 commands to the device via the= pass(4)/da(4) devices.=0D=0A+=0D=0A+ =A0 If any target-capable HBAs are = in the system (e.g. isp(4)), and have=0D=0A+ =A0 target mode enabled, you= should now also be able to see the CTL LUNs via=0D=0A+ =A0 that target i= nterface.=0D=0A+=0D=0A+ =A0 Note that all CTL LUNs are presented to all f= rontends. =A0There is no=0D=0A+ =A0 LUN masking, or separate, per-port co= nfiguration.=0D=0A+=0D=0A+ - Note that the ramdisk backend is a "fake" ra= mdisk. =A0That is, it is=0D=0A+ =A0 backed by a small amount of RAM that = is used for all I/O requests. =A0This=0D=0A+ =A0 is useful for performanc= e testing, but not for any data integrity tests.=0D=0A+=0D=0A+ - To add a= LUN with the block/file backend:=0D=0A+=0D=0A+truncate -s +1T myfile=0D=0A= +ctladm create -b block -o file=3Dmyfile=0D=0A+ctladm port -o on=0D=0A+=0D= =0A+ - You can also see a list of LUNs and their backends like this:=0D=0A= +=0D=0A+# ctladm devlist=0D=0A+LUN Backend =A0 =A0 =A0 Size (Blocks) =A0 = BS Serial Number =A0 =A0Device ID =A0 =A0 =A0=20=0D=0A+ =A00 block =A0 =A0= =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A0 0 =A0 =A0 MYDEVID =A0 0 =A0= =A0=20=0D=0A+ =A01 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERI= AL =A0 1 =A0 =A0 MYDEVID =A0 1 =A0 =A0=20=0D=0A+ =A02 block =A0 =A0 =A0 =A0= =A0 =A02147483648 =A0512 MYSERIAL =A0 2 =A0 =A0 MYDEVID =A0 2 =A0 =A0=20= =0D=0A+ =A03 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A0 = 3 =A0 =A0 MYDEVID =A0 3 =A0 =A0=20=0D=0A+ =A04 block =A0 =A0 =A0 =A0 =A0 = =A02147483648 =A0512 MYSERIAL =A0 4 =A0 =A0 MYDEVID =A0 4 =A0 =A0=20=0D=0A= + =A05 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A0 5 =A0 = =A0 MYDEVID =A0 5 =A0 =A0=20=0D=0A+ =A06 block =A0 =A0 =A0 =A0 =A0 =A0214= 7483648 =A0512 MYSERIAL =A0 6 =A0 =A0 MYDEVID =A0 6 =A0 =A0=20=0D=0A+ =A0= 7 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A0 7 =A0 =A0 M= YDEVID =A0 7 =A0 =A0=20=0D=0A+ =A08 block =A0 =A0 =A0 =A0 =A0 =A021474836= 48 =A0512 MYSERIAL =A0 8 =A0 =A0 MYDEVID =A0 8 =A0 =A0=20=0D=0A+ =A09 blo= ck =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A0 9 =A0 =A0 MYDEVI= D =A0 9 =A0 =A0=20=0D=0A+ 10 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A05= 12 MYSERIAL =A010 =A0 =A0 MYDEVID =A010 =A0 =A0=20=0D=0A+ 11 block =A0 =A0= =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A011 =A0 =A0 MYDEVID =A011 =A0= =A0=0D=0A+=0D=0A+ - You can see the LUN type and backing store for block= /file backend LUNs=0D=0A+ =A0 like this:=0D=0A+=0D=0A+# ctladm devlist -v= =0D=0A+LUN Backend =A0 =A0 =A0 Size (Blocks) =A0 BS Serial Number =A0 =A0= Device ID =A0 =A0 =A0=20=0D=0A+ =A00 block =A0 =A0 =A0 =A0 =A0 =A02147483= 648 =A0512 MYSERIAL =A0 0 =A0 =A0 MYDEVID =A0 0 =A0 =A0=20=0D=0A+ =A0 =A0= =A0lun_type=3D0=0D=0A+ =A0 =A0 =A0num_threads=3D14=0D=0A+ =A0 =A0 =A0fil= e=3Dtestdisk0=0D=0A+ =A01 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 = MYSERIAL =A0 1 =A0 =A0 MYDEVID =A0 1 =A0 =A0=20=0D=0A+ =A0 =A0 =A0lun_typ= e=3D0=0D=0A+ =A0 =A0 =A0num_threads=3D14=0D=0A+ =A0 =A0 =A0file=3Dtestdis= k1=0D=0A+ =A02 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A0= 2 =A0 =A0 MYDEVID =A0 2 =A0 =A0=20=0D=0A+ =A0 =A0 =A0lun_type=3D0=0D=0A+= =A0 =A0 =A0num_threads=3D14=0D=0A+ =A0 =A0 =A0file=3Dtestdisk2=0D=0A+ =A0= 3 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A0 3 =A0 =A0 M= YDEVID =A0 3 =A0 =A0=20=0D=0A+ =A0 =A0 =A0lun_type=3D0=0D=0A+ =A0 =A0 =A0= num_threads=3D14=0D=0A+ =A0 =A0 =A0file=3Dtestdisk3=0D=0A+ =A04 block =A0= =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A0 4 =A0 =A0 MYDEVID =A0 = 4 =A0 =A0=20=0D=0A+ =A0 =A0 =A0lun_type=3D0=0D=0A+ =A0 =A0 =A0num_threads= =3D14=0D=0A+ =A0 =A0 =A0file=3Dtestdisk4=0D=0A+ =A05 block =A0 =A0 =A0 =A0= =A0 =A02147483648 =A0512 MYSERIAL =A0 5 =A0 =A0 MYDEVID =A0 5 =A0 =A0=20= =0D=0A+ =A0 =A0 =A0lun_type=3D0=0D=0A+ =A0 =A0 =A0num_threads=3D14=0D=0A+= =A0 =A0 =A0file=3Dtestdisk5=0D=0A+ =A06 block =A0 =A0 =A0 =A0 =A0 =A0214= 7483648 =A0512 MYSERIAL =A0 6 =A0 =A0 MYDEVID =A0 6 =A0 =A0=20=0D=0A+ =A0= =A0 =A0lun_type=3D0=0D=0A+ =A0 =A0 =A0num_threads=3D14=0D=0A+ =A0 =A0 =A0= file=3Dtestdisk6=0D=0A+ =A07 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A05= 12 MYSERIAL =A0 7 =A0 =A0 MYDEVID =A0 7 =A0 =A0=20=0D=0A+ =A0 =A0 =A0lun_= type=3D0=0D=0A+ =A0 =A0 =A0num_threads=3D14=0D=0A+ =A0 =A0 =A0file=3Dtest= disk7=0D=0A+ =A08 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL= =A0 8 =A0 =A0 MYDEVID =A0 8 =A0 =A0=20=0D=0A+ =A0 =A0 =A0lun_type=3D0=0D= =0A+ =A0 =A0 =A0num_threads=3D14=0D=0A+ =A0 =A0 =A0file=3Dtestdisk8=0D=0A= + =A09 block =A0 =A0 =A0 =A0 =A0 =A02147483648 =A0512 MYSERIAL =A0 9 =A0 = =A0 MYDEVID =A0 9 =A0 =A0=20=0D=0A+ =A0 =A0 =A0lun_type=3D0=0D=0A+ =A0 =A0= =A0num_threads=3D14=0D=0A+ =A0 =A0 =A0file=3Dtestdisk9=0D=0A+ 10 ramdisk= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0 =A0 =A00 MYSERIAL =A0 0 =A0 =A0 MY= DEVID =A0 0 =A0 =A0=20=0D=0A+ =A0 =A0 =A0lun_type=3D3=0D=0A+ 11 ramdisk =A0= =A0 204800000000000 =A0512 MYSERIAL =A0 1 =A0 =A0 MYDEVID =A0 1 =A0 =A0=20= =0D=0A+ =A0 =A0 =A0lun_type=3D0=0D=0A+=0D=0A+=0D=0A+Revision 1.4 Changes=0D= =0A+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0D=0A+ -= Added in the second HA mode (where CTL does the data transfers instead=0D= =0A+ =A0 of having data transfers done below CTL), and abstracted out the= Copan=0D=0A+ =A0 HA API.=0D=0A+=0D=0A+ - Fixed the phantom device proble= m in the CTL CAM SIM and improved the=0D=0A+ =A0 CAM SIM to automatically= trigger a rescan when the port is enabled and=0D=0A+ =A0 disabled.=0D=0A= +=20=0D=0A+ - Made the number of threads in the block backend configurabl= e via sysctl,=0D=0A+ =A0 loader tunable and the ctladm command line. =A0(= You can now specify=0D=0A+ =A0 -o num_threads=3D4 when creating a LUN wit= h ctladm create.)=0D=0A+=0D=0A+ - Fixed some LUN selection issues in ctls= tat(8) and allowed for selection=0D=0A+ =A0 of LUN numbers up to 1023.=0D= =0A+=0D=0A+ - General cleanup.=0D=0A+=0D=0A+ - This version intended for = public release.=0D=0A+=0D=0A+Revision 1.3 Changes=0D=0A+=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0D=0A+ - Added descriptor sens= e support to CTL. =A0It can be enabled through the=0D=0A+ =A0 control mod= e page (10), but is disabled by default.=0D=0A+=0D=0A+ - Improved error i= njection support. =A0The number of errors that can be=0D=0A+ =A0 injected= with 'ctladm inject' has been increased, and any arbitrary=0D=0A+ =A0 se= nse data may now be injected as well.=0D=0A+=0D=0A+ - The port infrastruc= ture has been revamped. =A0Individual ports and types=0D=0A+ =A0 of ports= may now be enabled and disabled from the command line. =A0ctladm=0D=0A+ = =A0 now has the ability to set the WWNN and WWPN for each port.=0D=0A+=0D= =0A+ - The block backend can now send multiple I/Os to backing files. =A0= Multiple=0D=0A+ =A0 writes are only allowed for ZFS, but multiple readers= are allowed for=0D=0A+ =A0 any filesystem.=0D=0A+=0D=0A+ - The block and= ramdisk backends now support setting the LUN blocksize.=0D=0A+ =A0 There= are some restrictions when the backing device is a block device,=0D=0A+ = =A0 but otherwise the blocksize may be set to anything.=0D=0A+=0D=0A+Revi= sion 1.2 Changes=0D=0A+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=0D=0A+=0D=0A+ - CTL initialization process has been revamped. =A0= Instead of using an=0D=0A+ =A0 ad-hoc method, it is now sequenced through= SYSINIT() calls.=0D=0A+=0D=0A+ - A block/file backend has been added. =A0= This allows using arbitrary files=0D=0A+ =A0 or block devices as a backin= g store.=0D=0A+=0D=0A+ - The userland LUN configuration interface has bee= n completely rewritten.=0D=0A+ =A0 Configuration is now done out of band.= =0D=0A+=0D=0A+ - The ctladm(8) command line interface has been revamped, = and is now=0D=0A+ =A0 similar to camcontrol(8).=0D=0A+=0D=0A+To Do List:=0D= =0A+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0D=0A+=0D=0A+ - Make CTL buildable as = a module. =A0Work needs to be done on initialization,=0D=0A+ =A0 and on f= reeing resources and LUNs when it is built as a module.=0D=0A+=0D=0A+ - U= se devstat(9) for CTL's statistics collection. =A0CTL uses a home-grown=0D= =0A+ =A0 statistics collection system that is similar to devstat(9). =A0c= tlstat=0D=0A+ =A0 should be retired in favor of iostat, etc., once aggreg= ation modes are=0D=0A+ =A0 available in iostat to match the behavior of c= tlstat -t and dump modes=0D=0A+ =A0 are available to match the behavior o= f ctlstat -d/ctlstat -J.=0D=0A+=0D=0A+ - ZFS ARC backend for CTL. =A0Sinc= e ZFS copies all I/O into the ARC=0D=0A+ =A0 (Adaptive Replacement Cache)= , running the block/file backend on top of a=0D=0A+ =A0 ZFS-backed zdev o= r file will involve an extra set of copies. =A0The=0D=0A+ =A0 optimal sol= ution for backing targets served by CTL with ZFS would be to=0D=0A+ =A0 a= llocate buffers out of the ARC directly, and DMA to/from them directly.=0D= =0A+ =A0 That would eliminate an extra data buffer allocation and copy.=0D= =0A+=0D=0A+ - Switch CTL over to using CAM CCBs instead of its own union = ctl_io. =A0This=0D=0A+ =A0 will likely require a significant amount of wo= rk, but will eliminate=0D=0A+ =A0 another data structure in the stack, mo= re memory allocations, etc. =A0This=0D=0A+ =A0 will also require changes = to the CAM CCB structure to support CTL.=0D=0A+=0D=0A+ - Full-featured Hi= gh Availability support. =A0The HA API that is in ctl_ha.h=0D=0A+ =A0 is = essentially a renamed version of Copan's HA API. =A0There is no=0D=0A+ =A0= substance to it, but it remains in CTL to show what needs to be done to=0D= =0A+ =A0 implement active/active HA from a CTL standpoint. =A0The things = that would=0D=0A+ =A0 need to be done include:=0D=0A+- A kernel level sof= tware API for message passing as well as DMA=0D=0A+ =A0between at least t= wo nodes.=0D=0A+- Hardware support and drivers for inter-node communicati= on. =A0This=0D=0A+ =A0could be as simples as ethernet hardware and driver= s.=0D=0A+- A "supervisor", or startup framework to control and coordinate= =0D=0A+ =A0HA startup, failover (going from active/active to single mode)= ,=0D=0A+ =A0and failback (going from single mode to active/active).=0D=0A= +- HA support in other components of the stack. =A0The goal behind HA=0D=0A= + =A0is that one node can fail and another node can seamlessly take=0D=0A= + =A0over handling I/O requests. =A0This requires support from pretty=0D=0A= + =A0much every component in the storage stack, from top to bottom.=0D=0A= + =A0CTL is one piece of it, but you also need support in the RAID=0D=0A+= =A0stack/filesystem/backing store. =A0You also need full configuration=0D= =0A+ =A0mirroring, and all peer nodes need to be able to talk to the=0D=0A= + =A0underlying storage hardware.=0D=0A+=0D=0A+Code Roadmap:=0D=0A+=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0D=0A+=0D=0A+CTL has the concept of plugga= ble frontend ports and backends. =A0All=0D=0A+frontends and backends can = be active at the same time. =A0You can have a=0D=0A+ramdisk-backed LUN pr= esent along side a file backed LUN.=0D=0A+=0D=0A+ctl.c:=0D=0A+-----=0D=0A= +=0D=0A+This is the core of CTL, where all of the command handlers and a = lot of=0D=0A+other things live. =A0Yes, it is large. =A0It started off sm= all and grew to its=0D=0A+current size over time. =A0Perhaps it can be sp= lit into more files at some=0D=0A+point.=0D=0A+=0D=0A+Here is a roadmap o= f some of the primary functions in ctl.c. =A0Starting here=0D=0A+and foll= owing the various leaf functions will show the command flow.=0D=0A+=0D=0A= +ctl_queue() This is where commands from the frontend ports come=0D=0A+in= =2E=0D=0A+=0D=0A+ctl_queue_sense()This is only used for non-packetized SC= SI. =A0i.e.=0D=0A+parallel SCSI prior to U320 and perhaps U160.=0D=0A+=0D= =0A+ctl_work_thread() This is the primary work thread, and everything get= s=0D=0A+executed from there.=0D=0A+=0D=0A+ctl_scsiio_precheck() This wher= e all of the initial checks are done, and I/O=0D=0A+is either queued for = execution or blocked.=0D=0A+=0D=0A+ctl_scsiio() This is where the command= handler is actually=0D=0A+executed. =A0(See ctl_cmd_table.c for the mapp= ing of=0D=0A+SCSI opcode to command handler function.)=0D=0A+=0D=0A+ctl_d= one()This is the routine called (or ctl_done_lock()) to=0D=0A+initiate th= e command completion process.=0D=0A+=0D=0A+ctl_process_done()This is wher= e command completion actually happens.=0D=0A+=0D=0A+ctl.h:=0D=0A+-----=0D= =0A+=0D=0A+Basic function declarations and data structures.=0D=0A+=0D=0A+= ctl_backend.c,=0D=0A+ctl_backend.h:=0D=0A+-------------=0D=0A+=0D=0A+Thes= e files define the basic CTL backend API. =A0The comments in the header=0D= =0A+explain the API.=0D=0A+=0D=0A+ctl_backend_block.c=0D=0A+ctl_backend_b= lock.h:=0D=0A+-------------------=0D=0A+=0D=0A+The block and file backend= =2E =A0This allows for using a disk or a file as the=0D=0A+backing store = for a LUN. =A0Multiple threads are started to do I/O to the=0D=0A+backing= device, primarily because the VFS API requires that to get any=0D=0A+con= currency.=0D=0A+=0D=0A+ctl_backend_ramdisk.c:=0D=0A+---------------------= =0D=0A+=0D=0A+A "fake" ramdisk backend. =A0It only allocates a small amou= nt of memory to=0D=0A+act as a source and sink for reads and writes from = an initiator. =A0Therefore=0D=0A+it cannot be used for any real data, but= it can be used to test for=0D=0A+throughput. =A0It can also be used to t= est initiators' support for extremely=0D=0A+large LUNs.=0D=0A+=0D=0A+ctl_= cmd_table.c:=0D=0A+---------------=0D=0A+=0D=0A+This is a table with all = 256 possible SCSI opcodes, and command handler=0D=0A+functions defined fo= r supported opcodes. =A0It is included in ctl.c.=0D=0A+=0D=0A+ctl_debug.h= :=0D=0A+-----------=0D=0A+=0D=0A+Simplistic debugging support.=0D=0A+=0D=0A= +ctl_error.c,=0D=0A+ctl_error.h:=0D=0A+-----------=0D=0A+=0D=0A+CTL-speci= fic wrappers around the CAM sense building functions.=0D=0A+=0D=0A+ctl_fr= ontend.c,=0D=0A+ctl_frontend.h:=0D=0A+--------------=0D=0A+=0D=0A+These f= iles define the basic CTL frontend port API. =A0The comments in the=0D=0A= +header explain the API.=0D=0A+=0D=0A+ctl_frontend_cam_sim.c:=0D=0A+-----= -----------------=0D=0A+=0D=0A+This is a CTL frontend port that is also a= CAM SIM. =A0The idea is that this=0D=0A+frontend allows for using CTL wi= thout any target-capable hardware. =A0So any=0D=0A+LUNs you create in CTL= are visible via this port.=0D=0A+=0D=0A+=0D=0A+ctl_frontend_internal.c=0D= =0A+ctl_frontend_internal.h:=0D=0A+-----------------------=0D=0A+=0D=0A+T= his is a frontend port written for Copan to do some system-specific tasks= =0D=0A+that required sending commands into CTL from inside the kernel. =A0= This isn't=0D=0A+entirely relevant to FreeBSD in general, but can perhaps= be repurposed or=0D=0A+removed later.=0D=0A+=0D=0A+ctl_ha.h:=0D=0A+-----= ---=0D=0A+=0D=0A+This is a stubbed-out High Availability API. =A0See the = comments in the=0D=0A+header and the description of what is needed as far= as HA support above.=0D=0A+=0D=0A+ctl_io.h:=0D=0A+--------=0D=0A+=0D=0A+= This defines most of the core CTL I/O structures. =A0union ctl_io is=0D=0A= +conceptually very similar to CAM's union ccb. =A0=0D=0A+=0D=0A+ctl_ioctl= =2Eh:=0D=0A+-----------=0D=0A+=0D=0A+This defines all ioctls available th= rough the CTL character device, and=0D=0A+the data structures needed for = those ioctls.=0D=0A+=0D=0A+ctl_mem_pool.c=0D=0A+ctl_mem_pool.h:=0D=0A+---= -----------=0D=0A+=0D=0A+Generic memory pool implementation. =A0This is c= urrently only used by the=0D=0A+internal frontend. =A0The internal fronte= nd can probably be rewritten to use=0D=0A+UMA zones and this can be remov= ed.=0D=0A+=0D=0A+ctl_private.h:=0D=0A+-------------=0D=0A+=0D=0A+Private = data structres (e.g. CTL softc) and function prototypes. =A0This also=0D=0A= +includes the SCSI vendor and product names used by CTL.=0D=0A+=0D=0A+ctl= _scsi_all.c=0D=0A+ctl_scsi_all.h:=0D=0A+--------------=0D=0A+=0D=0A+CTL w= rappers around CAM sense printing functions.=0D=0A+=0D=0A+ctl_ser_table.c= :=0D=0A+---------------=0D=0A+=0D=0A+Command serialization table. =A0This= defines what happens when one type of=0D=0A+command is followed by anoth= er type of command. =A0e.g., what do you do when=0D=0A+you have a mode se= lect followed by a write=3F =A0You block the write until the=0D=0A+mode s= elect is complete. =A0That is defined in this table.=0D=0A+=0D=0A+ctl_uti= l.c=0D=0A+ctl_util.h:=0D=0A+----------=0D=0A+=0D=0A+CTL utility functions= , primarily designed to be used from userland. =A0See=0D=0A+ctladm for th= e primary consumer of these functions. =A0These include CDB=0D=0A+buildin= g functions.=0D=0A+=0D=0A+scsi_ctl.c:=0D=0A+----------=0D=0A+=0D=0A+CAM t= arget peripheral driver and CTL frontend port. =A0This is the path into=0D= =0A+CTL for commands from target-capable hardware/SIMs.=0D=0A+=0D=0A+User= land Commands:=0D=0A+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0D= =0A+=0D=0A+ctladm(8) fills a role similar to camcontrol(8). =A0It allow c= onfiguring LUNs,=0D=0A+issuing commands, injecting errors and various oth= er control functions.=0D=0A+=0D=0A+ctlstat(8) fills a role similar to ios= tat(8). =A0It reports I/O statistics=0D=0A+for CTL.=0D=0A=0D=0AAdded: hea= d/sys/cam/ctl/ctl.c=0D=0A=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=0D=0A--- /dev/null00:00:00 1970(empt= y, because file is newly added)=0D=0A+++ head/sys/cam/ctl/ctl.cThu Jan 12= 00:34:33 2012(r229997)=0D=0A@@ -0,0 +1,13082 @@=0D=0A+/*-=0D=0A+ * Copyr= ight (c) 2003-2009 Silicon Graphics International Corp.=0D=0A+ * All righ= ts reserved.=0D=0A+ *=0D=0A+ * Redistribution and use in source and binar= y forms, with or without=0D=0A+ * modification, are permitted provided th= at the following conditions=0D=0A+ * are met:=0D=0A+ * 1. Redistributions= of source code must retain the above copyright=0D=0A+ * =A0 =A0notice, t= his list of conditions, and the following disclaimer,=0D=0A+ * =A0 =A0wit= hout modification.=0D=0A+ * 2. Redistributions in binary form must reprod= uce at minimum a disclaimer=0D=0A+ * =A0 =A0substantially similar to the = "NO WARRANTY" disclaimer below=0D=0A+ * =A0 =A0("Disclaimer") and any red= istribution must be conditioned upon=0D=0A+ * =A0 =A0including a substant= ially similar Disclaimer requirement for further=0D=0A+ * =A0 =A0binary r= edistribution.=0D=0A+ *=0D=0A+ * NO WARRANTY=0D=0A+ * THIS SOFTWARE IS PR= OVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS=0D=0A+ * "AS IS" AND ANY= EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT=0D=0A+ * LIMITED TO, T= HE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR=0D=0A+ * A PARTI= CULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT=0D=0A+ * HO= LDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL=0D= =0A+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS=0D=0A+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS IN= TERRUPTION)=0D=0A+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETH= ER IN CONTRACT,=0D=0A+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE = OR OTHERWISE) ARISING=0D=0A+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE= , EVEN IF ADVISED OF THE=0D=0A+ * POSSIBILITY OF SUCH DAMAGES.=0D=0A+ *=0D= =0A+ * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl.c#8 $=0D=0A+= */=0D=0A+/*=0D=0A+ * CAM Target Layer, a SCSI device emulation subsystem= =2E=0D=0A+ *=0D=0A+ * Author: Ken Merry =0D=0A+ */=0D=0A= +=0D=0A+#define _CTL_C=0D=0A+=0D=0A+#include =0D=0A+__FBSDID= ("$FreeBSD$");=0D=0A+=0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#= include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#in= clude =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#= include =0D=0A+#include =0D=0A+#include =0D=0A+=0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include = =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+#include =0D=0A+=0D=0A+str= uct ctl_softc *control_softc =3D NULL;=0D=0A+=0D=0A+/*=0D=0A+ * The defau= lt is to run with CTL_DONE_THREAD turned on. =A0Completed=0D=0A+ * transa= ctions are queued for processing by the CTL work thread. =A0When=0D=0A+ *= CTL_DONE_THREAD is not defined, completed transactions are processed in=0D= =0A+ * the caller's context.=0D=0A+ */=0D=0A+#define CTL_DONE_THREAD=0D=0A= +=0D=0A+/*=0D=0A+ * =A0* Use the serial number and device ID provided by = the backend, rather than=0D=0A+ * =A0 * making up our own.=0D=0A+ * =A0 =A0= */=0D=0A+#define CTL_USE_BACKEND_SN=0D=0A+=0D=0A+/*=0D=0A+ * Size and ali= gnment macros needed for Copan-specific HA hardware. =A0These=0D=0A+ * ca= n go away when the HA code is re-written, and uses busdma for any=0D=0A+ = * hardware.=0D=0A+ */=0D=0A+#defineCTL_ALIGN_8B(target, source, type)\=0D= =0A+if (((uint32_t)source & 0x7) !=3D 0)\=0D=0A+target =3D (type)(source = + (0x8 - ((uint32_t)source & 0x7)));\=0D=0A+else\=0D=0A+target =3D (type)= source;=0D=0A+=0D=0A+#defineCTL_SIZE_8B(target, size)\=0D=0A+if ((size & = 0x7) !=3D 0)\=0D=0A+target =3D size + (0x8 - (size & 0x7));\=0D=0A+else\=0D= =0A+target =3D size;=0D=0A+=0D=0A+#define CTL_ALIGN_8B_MARGIN16=0D=0A+=0D= =0A+/*=0D=0A+ * Template mode pages.=0D=0A+ */=0D=0A+=0D=0A+/*=0D=0A+ * N= ote that these are default values only. =A0The actual values will be=0D=0A= + * filled in when the user does a mode sense.=0D=0A+ */=0D=0A+static str= uct copan_power_subpage power_page_default =3D {=0D=0A+/*page_code*/ PWR_= PAGE_CODE | SMPH_SPF,=0D=0A+/*subpage*/ PWR_SUBPAGE_CODE,=0D=0A+/*page_le= ngth*/ {(sizeof(struct copan_power_subpage) - 4) & 0xff00,=0D=0A+ (sizeof= (struct copan_power_subpage) - 4) & 0x00ff},=0D=0A+/*page_version*/ PWR_V= ERSION,=0D=0A+/* total_luns */ 26,=0D=0A+/* max_active_luns*/ PWR_DFLT_MA= X_LUNS,=0D=0A+/*reserved*/ {0, 0, 0, 0, 0, 0, 0, 0, 0,=0D=0A+ =A0 =A0 =A0= 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,=0D=0A+ =A0 =A0 =A00, 0, 0, 0, 0, 0}=0D=0A+}= ;=0D=0A+=0D=0A+static struct copan_power_subpage power_page_changeable =3D= {=0D=0A+/*page_code*/ PWR_PAGE_CODE | SMPH_SPF,=0D=0A+/*subpage*/ PWR_SU= BPAGE_CODE,=0D=0A+/*page_length*/ {(sizeof(struct copan_power_subpage) - = 4) & 0xff00,=0D=0A+ (sizeof(struct copan_power_subpage) - 4) & 0x00ff},=0D= =0A+/*page_version*/ 0,=0D=0A+/* total_luns */ 0,=0D=0A+/* max_active_lun= s*/ 0,=0D=0A+/*reserved*/ {0, 0, 0, 0, 0, 0, 0, 0, 0,=0D=0A+ =A0 =A0 =A00= , 0, 0, 0, 0, 0, 0, 0, 0, 0,=0D=0A+ =A0 =A0 =A00, 0, 0, 0, 0, 0}=0D=0A+};= =0D=0A+=0D=0A+static struct copan_aps_subpage aps_page_default =3D {=0D=0A= +APS_PAGE_CODE | SMPH_SPF, //page_code=0D=0A+APS_SUBPAGE_CODE, //subpage=0D= =0A+{(sizeof(struct copan_aps_subpage) - 4) & 0xff00,=0D=0A+ (sizeof(stru= ct copan_aps_subpage) - 4) & 0x00ff}, //page_length=0D=0A+APS_VERSION, //= page_version=0D=0A+0, //lock_active=0D=0A+{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, = 0,=0D=0A+0, 0, 0, 0, 0, 0, 0, 0, 0, 0,=0D=0A+0, 0, 0, 0, 0} //reserved=0D= =0A+};=0D=0A+=0D=0A+static struct copan_aps_subpage aps_page_changeable =3D= {=0D=0A+APS_PAGE_CODE | SMPH_SPF, //page_code=0D=0A+APS_SUBPAGE_CODE, //= subpage=0D=0A+{(sizeof(struct copan_aps_subpage) - 4) & 0xff00,=0D=0A+ (s= izeof(struct copan_aps_subpage) - 4) & 0x00ff}, //page_length=0D=0A+0, //= page_version=0D=0A+0, //lock_active=0D=0A+{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, = 0,=0D=0A+0, 0, 0, 0, 0, 0, 0, 0, 0, 0,=0D=0A+0, 0, 0, 0, 0} //reserved=0D= =0A+};=0D=0A+=0D=0A+static struct copan_debugconf_subpage debugconf_page_= default =3D {=0D=0A+DBGCNF_PAGE_CODE | SMPH_SPF,/* page_code */=0D=0A+DBG= CNF_SUBPAGE_CODE,/* subpage */=0D=0A+{(sizeof(struct copan_debugconf_subp= age) - 4) >> 8,=0D=0A+ (sizeof(struct copan_debugconf_subpage) - 4) >> 0}= , /* page_length */=0D=0A+DBGCNF_VERSION,/* page_version */=0D=0A+{CTL_TI= ME_IO_DEFAULT_SECS>>8,=0D=0A+ CTL_TIME_IO_DEFAULT_SECS>>0},/* ctl_time_io= _secs */=0D=0A+};=0D=0A+=0D=0A+static struct copan_debugconf_subpage debu= gconf_page_changeable =3D {=0D=0A+DBGCNF_PAGE_CODE | SMPH_SPF,/* page_cod= e */=0D=0A+DBGCNF_SUBPAGE_CODE,/* subpage */=0D=0A+{(sizeof(struct copan_= debugconf_subpage) - 4) >> 8,=0D=0A+ (sizeof(struct copan_debugconf_subpa= ge) - 4) >> 0}, /* page_length */=0D=0A+0,/* page_version */=0D=0A+{0xff,= 0xff},/* ctl_time_io_secs */=0D=0A+};=0D=0A+=0D=0A+static struct scsi_for= mat_page format_page_default =3D {=0D=0A+/*page_code*/SMS_FORMAT_DEVICE_P= AGE,=0D=0A+/*page_length*/sizeof(struct scsi_format_page) - 2,=0D=0A+/*tr= acks_per_zone*/ {0, 0},=0D=0A+/*alt_sectors_per_zone*/ {0, 0},=0D=0A+/*al= t_tracks_per_zone*/ {0, 0},=0D=0A+/*alt_tracks_per_lun*/ {0, 0},=0D=0A+/*= sectors_per_track*/ {(CTL_DEFAULT_SECTORS_PER_TRACK >> 8) & 0xff,=0D=0A+ = =A0 =A0 =A0 =A0CTL_DEFAULT_SECTORS_PER_TRACK & 0xff},=0D=0A+/*bytes_per_s= ector*/ {0, 0},=0D=0A+/*interleave*/ {0, 0},=0D=0A+/*track_skew*/ {0, 0},= =0D=0A+/*cylinder_skew*/ {0, 0},=0D=0A+/*flags*/ SFP_HSEC,=0D=0A+/*reserv= ed*/ {0, 0, 0}=0D=0A+};=0D=0A+=0D=0A+static struct scsi_format_page forma= t_page_changeable =3D {=0D=0A+/*page_code*/SMS_FORMAT_DEVICE_PAGE,=0D=0A+= /*page_length*/sizeof(struct scsi_format_page) - 2,=0D=0A+/*tracks_per_zo= ne*/ {0, 0},=0D=0A+/*alt_sectors_per_zone*/ {0, 0},=0D=0A+/*alt_tracks_pe= r_zone*/ {0, 0},=0D=0A+/*alt_tracks_per_lun*/ {0, 0},=0D=0A+/*sectors_per= _track*/ {0, 0},=0D=0A+/*bytes_per_sector*/ {0, 0},=0D=0A+/*interleave*/ = {0, 0},=0D=0A+/*track_skew*/ {0, 0},=0D=0A+/*cylinder_skew*/ {0, 0},=0D=0A= +/*flags*/ 0,=0D=0A+/*reserved*/ {0, 0, 0}=0D=0A+};=0D=0A+=0D=0A+static s= truct scsi_rigid_disk_page rigid_disk_page_default =3D {=0D=0A+/*page_cod= e*/SMS_RIGID_DISK_PAGE,=0D=0A+/*page_length*/sizeof(struct scsi_rigid_dis= k_page) - 2,=0D=0A+/*cylinders*/ {0, 0, 0},=0D=0A+/*heads*/ CTL_DEFAULT_H= EADS,=0D=0A+/*start_write_precomp*/ {0, 0, 0},=0D=0A+/*start_reduced_curr= ent*/ {0, 0, 0},=0D=0A+/*step_rate*/ {0, 0},=0D=0A+/*landing_zone_cylinde= r*/ {0, 0, 0},=0D=0A+/*rpl*/ SRDP_RPL_DISABLED,=0D=0A+/*rotational_offset= */ 0,=0D=0A+/*reserved1*/ 0,=0D=0A+/*rotation_rate*/ {(CTL_DEFAULT_ROTATI= ON_RATE >> 8) & 0xff,=0D=0A+ =A0 CTL_DEFAULT_ROTATION_RATE & 0xff},=0D=0A= +/*reserved2*/ {0, 0}=0D=0A+};=0D=0A+=0D=0A+static struct scsi_rigid_disk= _page rigid_disk_page_changeable =3D {=0D=0A+/*page_code*/SMS_RIGID_DISK_= PAGE,=0D=0A+/*page_length*/sizeof(struct scsi_rigid_disk_page) - 2,=0D=0A= +/*cylinders*/ {0, 0, 0},=0D=0A+/*heads*/ 0,=0D=0A+/*start_write_precomp*= / {0, 0, 0},=0D=0A+/*start_reduced_current*/ {0, 0, 0},=0D=0A+/*step_rate= */ {0, 0},=0D=0A+/*landing_zone_cylinder*/ {0, 0, 0},=0D=0A+/*rpl*/ 0,=0D= =0A+/*rotational_offset*/ 0,=0D=0A+/*reserved1*/ 0,=0D=0A+/*rotation_rate= */ {0, 0},=0D=0A+/*reserved2*/ {0, 0}=0D=0A+};=0D=0A+=0D=0A+static struct= scsi_caching_page caching_page_default =3D {=0D=0A+/*page_code*/SMS_CACH= ING_PAGE,=0D=0A+/*page_length*/sizeof(struct scsi_caching_page) - 2,=0D=0A= +/*flags1*/ SCP_DISC | SCP_WCE,=0D=0A+/*ret_priority*/ 0,=0D=0A+/*disable= _pf_transfer_len*/ {0xff, 0xff},=0D=0A+/*min_prefetch*/ {0, 0},=0D=0A+/*m= ax_prefetch*/ {0xff, 0xff},=0D=0A+/*max_pf_ceiling*/ {0xff, 0xff},=0D=0A+= /*flags2*/ 0,=0D=0A+/*cache_segments*/ 0,=0D=0A+/*cache_seg_size*/ {0, 0}= ,=0D=0A+/*reserved*/ 0,=0D=0A+/*non_cache_seg_size*/ {0, 0, 0}=0D=0A+};=0D= =0A+=0D=0A+static struct scsi_caching_page caching_page_changeable =3D {=0D= =0A+/*page_code*/SMS_CACHING_PAGE,=0D=0A+/*page_length*/sizeof(struct scs= i_caching_page) - 2,=0D=0A+/*flags1*/ 0,=0D=0A+/*ret_priority*/ 0,=0D=0A+= /*disable_pf_transfer_len*/ {0, 0},=0D=0A+/*min_prefetch*/ {0, 0},=0D=0A+= /*max_prefetch*/ {0, 0},=0D=0A+/*max_pf_ceiling*/ {0, 0},=0D=0A+/*flags2*= / 0,=0D=0A+/*cache_segments*/ 0,=0D=0A+/*cache_seg_size*/ {0, 0},=0D=0A+/= *reserved*/ 0,=0D=0A+/*non_cache_seg_size*/ {0, 0, 0}=0D=0A+};=0D=0A+=0D=0A= +static struct scsi_control_page control_page_default =3D {=0D=0A+/*page_= code*/SMS_CONTROL_MODE_PAGE,=0D=0A+/*page_length*/sizeof(struct scsi_cont= rol_page) - 2,=0D=0A+/*rlec*/0,=0D=0A+/*queue_flags*/0,=0D=0A+/*eca_and_a= en*/0,=0D=0A+/*reserved*/0,=0D=0A+/*aen_holdoff_period*/{0, 0}=0D=0A+};=0D= =0A+=0D=0A+static struct scsi_control_page control_page_changeable =3D {=0D= =0A+/*page_code*/SMS_CONTROL_MODE_PAGE,=0D=0A+/*page_length*/sizeof(struc= t scsi_control_page) - 2,=0D=0A+/*rlec*/SCP_DSENSE,=0D=0A+/*queue_flags*/= 0,=0D=0A+/*eca_and_aen*/0,=0D=0A+/*reserved*/0,=0D=0A+/*aen_holdoff_perio= d*/{0, 0}=0D=0A+};=0D=0A+=0D=0A+SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTL= FLAG_RD, 0, "CAM Target Layer");=0D=0A+=0D=0A+/*=0D=0A+ * XXX KDM move th= ese into the softc.=0D=0A+ */=0D=0A+static int rcv_sync_msg;=0D=0A+static= int persis_offset;=0D=0A+static uint8_t ctl_pause_rtr;=0D=0A+static int = =A0 =A0 ctl_is_single;=0D=0A+static int =A0 =A0 index_to_aps_page;=0D=0A+= =0D=0A+=0D=0A+/*=0D=0A+ * Serial number (0x80), device id (0x83), and sup= ported pages (0x00)=0D=0A+ */=0D=0A+#define SCSI_EVPD_NUM_SUPPORTED_PAGES= 3=0D=0A+=0D=0A+static void ctl_isc_event_handler(ctl_ha_channel chanel, c= tl_ha_event event,=0D=0A+ =A0int param);=0D=0A+static void ctl_copy_sense= _data(union ctl_ha_msg *src, union ctl_io *dest);=0D=0A+static void ctl_i= nit(void);=0D=0A+void ctl_shutdown(void);=0D=0A+static int ctl_open(struc= t cdev *dev, int flags, int fmt, struct thread *td);=0D=0A+static int ctl= _close(struct cdev *dev, int flags, int fmt, struct thread *td);=0D=0A+st= atic void ctl_ioctl_online(void *arg);=0D=0A+static void ctl_ioctl_offlin= e(void *arg);=0D=0A+static int ctl_ioctl_targ_enable(void *arg, struct ct= l_id targ_id);=0D=0A+static int ctl_ioctl_targ_disable(void *arg, struct = ctl_id targ_id);=0D=0A+static int ctl_ioctl_lun_enable(void *arg, struct = ctl_id targ_id, int lun_id);=0D=0A+static int ctl_ioctl_lun_disable(void = *arg, struct ctl_id targ_id, int lun_id);=0D=0A+static int ctl_ioctl_do_d= atamove(struct ctl_scsiio *ctsio);=0D=0A+static int ctl_serialize_other_s= c_cmd(struct ctl_scsiio *ctsio, int have_lock);=0D=0A+static int ctl_ioct= l_submit_wait(union ctl_io *io);=0D=0A+static void ctl_ioctl_datamove(uni= on ctl_io *io);=0D=0A+static void ctl_ioctl_done(union ctl_io *io);=0D=0A= +static void ctl_ioctl_hard_startstop_callback(void *arg,=0D=0A+ =A0 =A0 = =A0struct cfi_metatask *metatask);=0D=0A+static void ctl_ioctl_bbrread_ca= llback(void *arg,struct cfi_metatask *metatask);=0D=0A+static int ctl_ioc= tl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num,=0D=0A+ =A0 =A0 =A0= struct ctl_ooa *ooa_hdr);=0D=0A+static int ctl_ioctl(struct cdev *dev, u_= long cmd, caddr_t addr, int flag,=0D=0A+ =A0 =A0 struct thread *td);=0D=0A= +uint32_t ctl_get_resindex(struct ctl_nexus *nexus);=0D=0A+uint32_t ctl_p= ort_idx(int port_num);=0D=0A+#ifdef unused=0D=0A+static union ctl_io *ctl= _malloc_io(ctl_io_type io_type, uint32_t targ_port,=0D=0A+ =A0 uint32_t t= arg_target, uint32_t targ_lun,=0D=0A+ =A0 int can_wait);=0D=0A+static voi= d ctl_kfree_io(union ctl_io *io);=0D=0A+#endif /* unused */=0D=0A+static = void ctl_free_io_internal(union ctl_io *io, int have_lock);=0D=0A+static = int ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *lun,=0D=0A= + struct ctl_be_lun *be_lun, struct ctl_id target_id);=0D=0A+static int c= tl_free_lun(struct ctl_lun *lun);=0D=0A+static void ctl_create_lun(struct= ctl_be_lun *be_lun);=0D=0A+/**=0D=0A+static void ctl_failover_change_pag= es(struct ctl_softc *softc,=0D=0A+ =A0 =A0 =A0struct ctl_scsiio *ctsio, i= nt master);=0D=0A+**/=0D=0A+=0D=0A+static int ctl_do_mode_select(union ct= l_io *io);=0D=0A+static int ctl_pro_preempt(struct ctl_softc *softc, stru= ct ctl_lun *lun,=0D=0A+ =A0 uint64_t res_key, uint64_t sa_res_key,=0D=0A+= =A0 uint8_t type, uint32_t residx,=0D=0A+ =A0 struct ctl_scsiio *ctsio,=0D= =0A+ =A0 struct scsi_per_res_out *cdb,=0D=0A+ =A0 struct scsi_per_res_out= _parms* param);=0D=0A+static void ctl_pro_preempt_other(struct ctl_lun *l= un,=0D=0A+ =A0union ctl_ha_msg *msg);=0D=0A+static void ctl_hndl_per_res_= out_on_other_sc(union ctl_ha_msg *msg);=0D=0A+static int ctl_inquiry_evpd= _supported(struct ctl_scsiio *ctsio, int alloc_len);=0D=0A+static int ctl= _inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len);=0D=0A+stat= ic int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len);=0D= =0A+static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio);=0D=0A+static i= nt ctl_inquiry_std(struct ctl_scsiio *ctsio);=0D=0A+static int ctl_get_lb= a_len(union ctl_io *io, uint64_t *lba, uint32_t *len);=0D=0A+static ctl_a= ction ctl_extent_check(union ctl_io *io1, union ctl_io *io2);=0D=0A+stati= c ctl_action ctl_check_for_blockage(union ctl_io *pending_io,=0D=0A+ unio= n ctl_io *ooa_io);=0D=0A+static ctl_action ctl_check_ooa(struct ctl_lun *= lun, union ctl_io *pending_io,=0D=0A+union ctl_io *starting_io);=0D=0A+st= atic int ctl_check_blocked(struct ctl_lun *lun);=0D=0A+static int ctl_scs= iio_lun_check(struct ctl_softc *ctl_softc,=0D=0A+struct ctl_lun *lun,=0D=0A= +struct ctl_cmd_entry *entry,=0D=0A+struct ctl_scsiio *ctsio);=0D=0A+//st= atic int ctl_check_rtr(union ctl_io *pending_io, struct ctl_softc *softc)= ;=0D=0A+static void ctl_failover(void);=0D=0A+static int ctl_scsiio_prech= eck(struct ctl_softc *ctl_softc,=0D=0A+ =A0 =A0 =A0 struct ctl_scsiio *ct= sio);=0D=0A+static int ctl_scsiio(struct ctl_scsiio *ctsio);=0D=0A+=0D=0A= +static int ctl_bus_reset(struct ctl_softc *ctl_softc, union ctl_io *io);= =0D=0A+static int ctl_target_reset(struct ctl_softc *ctl_softc, union ctl= _io *io,=0D=0A+ =A0 =A0ctl_ua_type ua_type);=0D=0A+static int ctl_lun_res= et(struct ctl_lun *lun, union ctl_io *io,=0D=0A+ ctl_ua_type ua_type);=0D= =0A+static int ctl_abort_task(union ctl_io *io);=0D=0A+static void ctl_ru= n_task_queue(struct ctl_softc *ctl_softc);=0D=0A+#ifdef CTL_IO_DELAY=0D=0A= +static void ctl_datamove_timer_wakeup(void *arg);=0D=0A+static void ctl_= done_timer_wakeup(void *arg);=0D=0A+#endif /* CTL_IO_DELAY */=0D=0A+=0D=0A= +static void ctl_send_datamove_done(union ctl_io *io, int have_lock);=0D=0A= +static void ctl_datamove_remote_write_cb(struct ctl_ha_dt_req *rq);=0D=0A= +static int ctl_datamove_remote_dm_write_cb(union ctl_io *io);=0D=0A+stat= ic void ctl_datamove_remote_write(union ctl_io *io);=0D=0A+static int ctl= _datamove_remote_dm_read_cb(union ctl_io *io);=0D=0A+static void ctl_data= move_remote_read_cb(struct ctl_ha_dt_req *rq);=0D=0A+static int ctl_datam= ove_remote_sgl_setup(union ctl_io *io);=0D=0A+static int ctl_datamove_rem= ote_xfer(union ctl_io *io, unsigned command,=0D=0A+ =A0 =A0ctl_ha_dt_cb c= allback);=0D=0A+static void ctl_datamove_remote_read(union ctl_io *io);=0D= =0A+static void ctl_datamove_remote(union ctl_io *io);=0D=0A+static int c= tl_process_done(union ctl_io *io, int have_lock);=0D=0A+static void ctl_w= ork_thread(void *arg);=0D=0A+=0D=0A+/*=0D=0A+ * Load the serialization ta= ble. =A0This isn't very pretty, but is probably=0D=0A+ * the easiest way = to do it.=0D=0A+ */=0D=0A+#include "ctl_ser_table.c"=0D=0A+=0D=0A+/*=0D=0A= + * We only need to define open, close and ioctl routines for this driver= =2E=0D=0A+ */=0D=0A+static struct cdevsw ctl_cdevsw =3D {=0D=0A+.d_versio= n =3DD_VERSION,=0D=0A+.d_flags =3D0,=0D=0A+.d_open =3Dctl_open,=0D=0A+.d_= close =3Dctl_close,=0D=0A+.d_ioctl =3Dctl_ioctl,=0D=0A+.d_name =3D"ctl",=0D= =0A+};=0D=0A+=0D=0A+=0D=0A+MALLOC_DEFINE(M_CTL, "ctlmem", "Memory used fo= r CTL");=0D=0A+=0D=0A+/*=0D=0A+ * If we have the CAM SIM, we may or may n= ot have another SIM that will=0D=0A+ * cause CTL to get initialized. =A0I= f not, we need to initialize it.=0D=0A+ */=0D=0A+SYSINIT(ctl_init, SI_SUB= _CONFIGURE, SI_ORDER_THIRD, ctl_init, NULL);=0D=0A+=0D=0A+static void=0D=0A= +ctl_isc_handler_finish_xfer(struct ctl_softc *ctl_softc,=0D=0A+ =A0 =A0u= nion ctl_ha_msg *msg_info)=0D=0A+{=0D=0A+struct ctl_scsiio *ctsio;=0D=0A+= =0D=0A+if (msg_info->hdr.original_sc =3D=3D NULL) {=0D=0A+printf("%s: ori= ginal_sc =3D=3D NULL!\n", __func__);=0D=0A+/* XXX KDM now what=3F */=0D=0A= +return;=0D=0A+}=0D=0A+=0D=0A+ctsio =3D &msg_info->hdr.original_sc->scsii= o;=0D=0A+ctsio->io_hdr.flags |=3D CTL_FLAG_IO_ACTIVE;=0D=0A+ctsio->io_hdr= =2Emsg_type =3D CTL_MSG_FINISH_IO;=0D=0A+ctsio->io_hdr.status =3D msg_inf= o->hdr.status;=0D=0A+ctsio->scsi_status =3D msg_info->scsi.scsi_status;=0D= =0A+ctsio->sense_len =3D msg_info->scsi.sense_len;=0D=0A+ctsio->sense_res= idual =3D msg_info->scsi.sense_residual;=0D=0A+ctsio->residual =3D msg_in= fo->scsi.residual;=0D=0A+memcpy(&ctsio->sense_data, &msg_info->scsi.sense= _data,=0D=0A+ =A0 =A0 =A0 sizeof(ctsio->sense_data));=0D=0A+memcpy(&ctsio= ->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes,=0D=0A+ =A0 =A0 =A0 &msg_inf= o->scsi.lbalen, sizeof(msg_info->scsi.lbalen));;=0D=0A+STAILQ_INSERT_TAIL= (&ctl_softc->isc_queue, &ctsio->io_hdr, links);=0D=0A+ctl_wakeup_thread()= ;=0D=0A+}=0D=0A+=0D=0A+static void=0D=0A+ctl_isc_handler_finish_ser_only(= struct ctl_softc *ctl_softc,=0D=0A+union ctl_ha_msg *msg_info)=0D=0A+{=0D= =0A+struct ctl_scsiio *ctsio;=0D=0A+=0D=0A+if (msg_info->hdr.serializing_= sc =3D=3D NULL) {=0D=0A+printf("%s: serializing_sc =3D=3D NULL!\n", __fun= c__);=0D=0A+/* XXX KDM now what=3F */=0D=0A+return;=0D=0A+}=0D=0A+=0D=0A+= ctsio =3D &msg_info->hdr.serializing_sc->scsiio;=0D=0A+#if 0=0D=0A+/*=0D=0A= + * Attempt to catch the situation where an I/O has=0D=0A+ * been freed, = and we're using it again.=0D=0A+ */=0D=0A+if (ctsio->io_hdr.io_type =3D=3D= 0xff) {=0D=0A+union ctl_io *tmp_io;=0D=0A+tmp_io =3D (union ctl_io *)cts= io;=0D=0A+printf("%s: %p use after free!\n", __func__,=0D=0A+ =A0 =A0 =A0= ctsio);=0D=0A+printf("%s: type %d msg %d cdb %x iptl: "=0D=0A+ =A0 =A0 =A0= "%d:%d:%d:%d tag 0x%04x "=0D=0A+ =A0 =A0 =A0 "flag %#x status %x\n",=0D=0A= +__func__,=0D=0A+tmp_io->io_hdr.io_type,=0D=0A+tmp_io->io_hdr.msg_type,=0D= =0A+tmp_io->scsiio.cdb[0],=0D=0A+tmp_io->io_hdr.nexus.initid.id,=0D=0A+tm= p_io->io_hdr.nexus.targ_port,=0D=0A+tmp_io->io_hdr.nexus.targ_target.id,=0D= =0A+tmp_io->io_hdr.nexus.targ_lun,=0D=0A+(tmp_io->io_hdr.io_type =3D=3D=0D= =0A+CTL_IO_TASK) =3F=0D=0A+tmp_io->taskio.tag_num :=0D=0A+tmp_io->scsiio.= tag_num,=0D=0A+ =A0 =A0 =A0 =A0tmp_io->io_hdr.flags,=0D=0A+tmp_io->io_hdr= =2Estatus);=0D=0A+}=0D=0A+#endif=0D=0A+ctsio->io_hdr.msg_type =3D CTL_MSG= _FINISH_IO;=0D=0A=0D=0A*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***=0D=0A From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 10:04:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 365F11065670; Thu, 12 Jan 2012 10:04:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id B26E38FC1B; Thu, 12 Jan 2012 10:04:50 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0C9rUAq009034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 Jan 2012 20:54:02 +1100 Date: Thu, 12 Jan 2012 20:53:30 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Guy Helmer In-Reply-To: <201201112245.q0BMjFYr080049@svn.freebsd.org> Message-ID: <20120112205016.X1000@besplex.bde.org> References: <201201112245.q0BMjFYr080049@svn.freebsd.org> 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: r229988 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 10:04:51 -0000 On Wed, 11 Jan 2012, Guy Helmer wrote: > Log: > Fix prototype formatting (indentation, long lines, and continued lines). > > Requested by bde. Thanks. This looks good. Here are a few more fixes (mostly prototype :ormatting, 2 lines struct member formatting and 1 and 1 missing underscore). % Index: libutil.h % =================================================================== % RCS file: /home/ncvs/src/lib/libutil/libutil.h,v % retrieving revision 1.64 % diff -u -r1.64 libutil.h % --- libutil.h 11 Jan 2012 22:45:15 -0000 1.64 % +++ libutil.h 12 Jan 2012 09:49:29 -0000 % @@ -69,8 +69,8 @@ % /* for properties.c */ % typedef struct _property { % struct _property *next; % - char *name; % - char *value; % + char *name; % + char *value; % } *properties; % % #ifdef _SYS_PARAM_H_ % @@ -121,7 +121,7 @@ % void properties_free(properties _list); % char *property_find(properties _list, const char *_name); % properties % - properties_read(int fd); % + properties_read(int _fd); % int realhostname(char *_host, size_t _hsize, const struct in_addr *_ip); % int realhostname_sa(char *_host, size_t _hsize, struct sockaddr *_addr, % int _addrlen); % @@ -139,8 +139,10 @@ % #endif % % #ifdef _PWD_H_ % -int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct passwd *_old_pw); % -struct passwd *pw_dup(const struct passwd *_pw); % +int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, % + struct passwd *_old_pw); % +struct passwd % + *pw_dup(const struct passwd *_pw); % int pw_edit(int _notsetuid); % int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); % void pw_fini(void); % @@ -149,21 +151,26 @@ % char *pw_make_v7(const struct passwd *_pw); % int pw_mkdb(const char *_user); % int pw_lock(void); % -struct passwd *pw_scan(const char *_line, int _flags); % -const char *pw_tempname(void); % +struct passwd % + *pw_scan(const char *_line, int _flags); % +const char % + *pw_tempname(void); % int pw_tmp(int _mfd); % #endif % % #ifdef _GRP_H_ % -int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct group *_old_gr); % -struct group *gr_dup(const struct group *_gr); % +int gr_copy(int __ffd, int _tfd, const struct group *_gr, % + struct group *_old_gr); % +struct group % + *gr_dup(const struct group *_gr); % int gr_equal(const struct group *_gr1, const struct group *_gr2); % void gr_fini(void); % int gr_init(const char *_dir, const char *_master); % int gr_lock(void); % char *gr_make(const struct group *_gr); % int gr_mkdb(void); % -struct group *gr_scan(const char *_line); % +struct group % + *gr_scan(const char *_line); % int gr_tmp(int _mdf); % #endif % Bruce From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 12:43:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20594106564A; Thu, 12 Jan 2012 12:43:44 +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 E642D8FC0A; Thu, 12 Jan 2012 12:43:43 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 9ECC746B09; Thu, 12 Jan 2012 07:43:43 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0C99DB941; Thu, 12 Jan 2012 07:43:43 -0500 (EST) From: John Baldwin To: "Pedro F. Giffuni" Date: Thu, 12 Jan 2012 07:43:41 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201201112117.q0BLHEck077022@svn.freebsd.org> In-Reply-To: <201201112117.q0BLHEck077022@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201201120743.41757.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 12 Jan 2012 07:43:43 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, joel@freebsd.org Subject: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 12:43:44 -0000 On Wednesday, January 11, 2012 4:17:14 pm Pedro F. Giffuni wrote: > Author: pfg > Date: Wed Jan 11 21:17:14 2012 > New Revision: 229981 > URL: http://svn.freebsd.org/changeset/base/229981 > > Log: > Replace GPL'd headers in the emu10kx snd driver code. > > This uses the emuxkireg.h already used in the emu10k1 > snd driver. Special thanks go to Alexander Motin as > he was able to find some errors and reverse engineer > some wrong values in the emuxkireg header. > > The emu10kx driver is now free from the GPL. > > PR: 153901 > Tested by: mav, joel > Approved by: jhb (mentor) > MFC after: 2 weeks Is the emu10kx driver a superset of em10k1 now (meaning does it support all the em10k1 devices and should em10k1 be retired)? Also, it seems we should definitely add 'snd_emu10kx' to GENERIC on x86 and possible 'snd_emu10k1'. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 13:09:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BECCD1065670; Thu, 12 Jan 2012 13:09:23 +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 90C308FC0C; Thu, 12 Jan 2012 13:09:23 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 47A5B46B09; Thu, 12 Jan 2012 08:09:23 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B7F10B91C; Thu, 12 Jan 2012 08:09:22 -0500 (EST) From: John Baldwin To: Eygene Ryabinkin Date: Thu, 12 Jan 2012 07:48:28 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201201120648.q0C6mBio096662@svn.freebsd.org> In-Reply-To: <201201120648.q0C6mBio096662@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201201120748.28564.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 12 Jan 2012 08:09:22 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230007 - in head: etc etc/rc.d share/man/man8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 13:09:23 -0000 On Thursday, January 12, 2012 1:48:11 am Eygene Ryabinkin wrote: > Author: rea (ports committer) > Date: Thu Jan 12 06:48:11 2012 > New Revision: 230007 > URL: http://svn.freebsd.org/changeset/base/230007 > > Log: > rc.d: document 'quiet' prefix and fix dhclient/devd interaction > > Document the current semantics of the 'quiet' command prefix > in the rc.subr(8). > > Fix dhclient rc.d script: it should not call err() for > non-DHCP-enabled interface when it is called from devd, because the > latter just blindly calls 'service dhclient quietstart' on each "link > up" event. > > Since the 'quietstart' will silence the message "Cannot 'start' . > Set _enable to YES in /etc/rc.conf or use 'onestart' instead of > 'start'." and running dhclient on the non-DHCP-enabled interface is > the same thing as running the service without _enable set, > such modification is in sync with the current semantics of the 'quiet' > prefix. Alternatively, devd could have invoked a wrapper script that only ran /etc/rc.d/dhclient if dhcpif was true for the interface. All other uses of /etc/rc.d/dhclient in our system scripts are conditional on that check. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 13:47:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18ABD106566C; Thu, 12 Jan 2012 13:47:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 9EA2D8FC0A; Thu, 12 Jan 2012 13:47:49 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0CDlgGR022689 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jan 2012 00:47:47 +1100 Date: Fri, 13 Jan 2012 00:47:37 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kostik Belousov In-Reply-To: <20120112001630.GS31224@deviant.kiev.zoral.com.ua> Message-ID: <20120112235635.Y1663@besplex.bde.org> References: <201201112233.q0BMXfgD079582@svn.freebsd.org> <20120112001630.GS31224@deviant.kiev.zoral.com.ua> 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, Guy Helmer Subject: Re: svn commit: r229986 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 13:47:51 -0000 On Thu, 12 Jan 2012, Kostik Belousov wrote: > On Wed, Jan 11, 2012 at 10:33:41PM +0000, Guy Helmer wrote: >> Log: >> Fix namespace issues with prototype parameter names. >> Add missing prototype parameter names. >> >> Requested by bde. >> ... >> Modified: head/lib/libutil/libutil.h >> ============================================================================== >> --- head/lib/libutil/libutil.h Wed Jan 11 22:12:45 2012 (r229985) >> +++ head/lib/libutil/libutil.h Wed Jan 11 22:33:41 2012 (r229986) >> @@ -93,7 +93,7 @@ struct termios; >> struct winsize; >> >> __BEGIN_DECLS >> -char *auth_getval(const char *name); >> +char *auth_getval(const char *_name); > The _[a-z].* names are still in the app namespace. > > Only _[A-Z].* and __[a-z].* are reserved for the implementation. No, _[a-z].* is reserved for the implementation in file scope mainly for extern declarations). For example, _exit is reserved for the implementation, and _name is reserved for the implementation in exactly the same contexts as _exit is. This prevents the application #defining _name as '_this is not a C identifier', which would break the above. OTOH, _name is not reserved for the implementation in most other scopes, so applications can do almost anything with it except #define it or use it for a global or file-scope-static variable or function. style(9) even gives the exact rule (it says "an underscore" instead of "a single underscore", but uses only 1 in its example) to inhibit excessive underscoring in prototypes. Other details: - prototypes start a new scope so names in them are not subject to the file scope rules - similarly for struct scope. - the scopes naturally prevent -Wshadow warnings. E.g., names inside file-scope prototypes in implementation headers can't shadow application names, since the application names would have to be in file scope so they cannot have a single leading underscore. I haven't thought about all cases for this. Details from C99 (n869.txt): % 7.1.3 Reserved identifiers % % -- All identifiers that begin with an underscore are % always reserved for use as identifiers with file scope % in both the ordinary and tag name spaces. % ... % [#2] No other identifiers are reserved. If the program % declares or defines an identifier in a context in which it % is reserved (other than as allowed by 7.1.4), or defines a % reserved identifier as a macro name, the behavior is % undefined. I think we only need the reservation of _[a-z]* (actually _[a-z0-9]*) and the anti-definition rule for these to prove that the implementation's use of _[a-z0-9]* in non-file scope cannot conflict with any application use of _[a-z0-9]* any scope (can only be non-file scope). See for old examples of using the precise rules for avoiding excessive underscoring, and complications in macros which require 2 underscores: - struct __sbuf has 2 underscores since it's in file scope - members in this struct and others have only 1 underscore since they are not in file scope - __sgetc() has 2 underscores, since it is used in getc(). getc() is used in function scope where _sgetc is in the application namespace. Thus, the implementation cannot use _sgetc here. - __sgetc() is implemented as an inline function. The names of parameters and local variables in this must have at least 1 underscore so that the application cannot #define them, and 1 is enough and only 1 is used for the same reasons as for parameter names in prototypes. - older implementations had an alternative definition of __sgetc() as a macro. Here no underscores are needed (and none are used) for the parameter names, since macro parameters have their own namespace and so cannot be corrupted by application #define's of their names which are now possible. These use the same single-undescored names for struct members. When I started writing this, I misremembered a complication here. I thought that some struct member names might need 2 underscores for such use. But there is no problem -- (p)->_w is protected enough by the single underscore in _w, in the same way as for inline functioms. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 14:13:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA2401065672; Thu, 12 Jan 2012 14:13:50 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9506D8FC08; Thu, 12 Jan 2012 14:13:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CEDoYo012746; Thu, 12 Jan 2012 14:13:50 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CEDo5A012744; Thu, 12 Jan 2012 14:13:50 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201121413.q0CEDo5A012744@svn.freebsd.org> From: Guy Helmer Date: Thu, 12 Jan 2012 14:13: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: r230010 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 14:13:50 -0000 Author: ghelmer Date: Thu Jan 12 14:13:49 2012 New Revision: 230010 URL: http://svn.freebsd.org/changeset/base/230010 Log: pidfile_open() no longer uses fcntl() to set the close-on-exec flag. Modified: head/lib/libutil/pidfile.3 Modified: head/lib/libutil/pidfile.3 ============================================================================== --- head/lib/libutil/pidfile.3 Thu Jan 12 11:08:21 2012 (r230009) +++ head/lib/libutil/pidfile.3 Thu Jan 12 14:13:49 2012 (r230010) @@ -81,7 +81,7 @@ argument is file will be used. The .Fn pidfile_open -function sets the FD_CLOEXEC close-on-exec flag on the open file descriptor. +function sets the O_CLOEXEC close-on-exec flag when opening the pidfile. .Pp The .Fn pidfile_write @@ -205,7 +205,6 @@ The function may also fail and set .Va errno for any errors specified for the -.Xr fcntl 2 , .Xr fstat 2 , .Xr open 2 , and From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 14:40:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05FFD106566B; Thu, 12 Jan 2012 14:40:26 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB9E08FC12; Thu, 12 Jan 2012 14:40:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CEePIw013614; Thu, 12 Jan 2012 14:40:25 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CEePAo013612; Thu, 12 Jan 2012 14:40:25 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201121440.q0CEePAo013612@svn.freebsd.org> From: Guy Helmer Date: Thu, 12 Jan 2012 14:40: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: r230011 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 14:40:26 -0000 Author: ghelmer Date: Thu Jan 12 14:40:25 2012 New Revision: 230011 URL: http://svn.freebsd.org/changeset/base/230011 Log: More prototype formatting fixes, struct member formatting fixes, and namespace fix for property_find() prototype. Provided by bde. Modified: head/lib/libutil/libutil.h Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Thu Jan 12 14:13:49 2012 (r230010) +++ head/lib/libutil/libutil.h Thu Jan 12 14:40:25 2012 (r230011) @@ -69,8 +69,8 @@ typedef __uid_t uid_t; /* for properties.c */ typedef struct _property { struct _property *next; - char *name; - char *value; + char *name; + char *value; } *properties; #ifdef _SYS_PARAM_H_ @@ -121,7 +121,7 @@ int openpty(int *_amaster, int *_aslave, void properties_free(properties _list); char *property_find(properties _list, const char *_name); properties - properties_read(int fd); + properties_read(int _fd); int realhostname(char *_host, size_t _hsize, const struct in_addr *_ip); int realhostname_sa(char *_host, size_t _hsize, struct sockaddr *_addr, int _addrlen); @@ -139,8 +139,10 @@ char *fparseln(FILE *_fp, size_t *_len, #endif #ifdef _PWD_H_ -int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct passwd *_old_pw); -struct passwd *pw_dup(const struct passwd *_pw); +int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, + struct passwd *_old_pw); +struct passwd + *pw_dup(const struct passwd *_pw); int pw_edit(int _notsetuid); int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); void pw_fini(void); @@ -149,21 +151,26 @@ char *pw_make(const struct passwd *_pw); char *pw_make_v7(const struct passwd *_pw); int pw_mkdb(const char *_user); int pw_lock(void); -struct passwd *pw_scan(const char *_line, int _flags); -const char *pw_tempname(void); +struct passwd + *pw_scan(const char *_line, int _flags); +const char + *pw_tempname(void); int pw_tmp(int _mfd); #endif #ifdef _GRP_H_ -int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct group *_old_gr); -struct group *gr_dup(const struct group *_gr); +int gr_copy(int __ffd, int _tfd, const struct group *_gr, + struct group *_old_gr); +struct group + *gr_dup(const struct group *_gr); int gr_equal(const struct group *_gr1, const struct group *_gr2); void gr_fini(void); int gr_init(const char *_dir, const char *_master); int gr_lock(void); char *gr_make(const struct group *_gr); int gr_mkdb(void); -struct group *gr_scan(const char *_line); +struct group + *gr_scan(const char *_line); int gr_tmp(int _mdf); #endif From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 14:46:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19DFA1065672; Thu, 12 Jan 2012 14:46:23 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 350AC8FC0A; Thu, 12 Jan 2012 14:46:22 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id q0CEMpfp069449; Thu, 12 Jan 2012 07:22:51 -0700 (MST) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id q0CEMpS7069448; Thu, 12 Jan 2012 07:22:51 -0700 (MST) (envelope-from ken) Date: Thu, 12 Jan 2012 07:22:51 -0700 From: "Kenneth D. Merry" To: Hans Petter Selasky Message-ID: <20120112142251.GA68691@nargothrond.kdm.org> References: <201201120034.q0C0YXrq084182@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r229997 - in head: share/examples/scsi_target sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/ctls... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 14:46:23 -0000 On Thu, Jan 12, 2012 at 09:58:36 +0100, Hans Petter Selasky wrote: > Hi, > > ? > > Does the cam target layer support attach/detach of logical units? Yes, you can add and remove LUNs using ctladm. > Can it be used with USB target mode? If the USB driver supports the various CAM target mode CCBs, then it should work. CTL only talks SCSI, so it would be SCSI over USB. The only driver I've tested it with is the isp(4) driver. Ken > -----Original message----- > To:src-committers@freebsd.org; svn-src-all@freebsd.org; svn-src-head@freebsd.org; > From:Kenneth D. Merry > Sent:Thu 12-01-2012 01:35 > Subject:svn commit: r229997 - in head: share/examples/scsi_target sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/ctls... > Author: ken > Date: Thu Jan 12 00:34:33 2012 > New Revision: 229997 > URL: http://svn.freebsd.org/changeset/base/229997 > > Log: > ?Add the CAM Target Layer (CTL). > ? > ?CTL is a disk and processor device emulation subsystem originally written > ?for Copan Systems under Linux starting in 2003. ?It has been shipping in > ?Copan (now SGI) products since 2005. > ? > ?It was ported to FreeBSD in 2008, and thanks to an agreement between SGI > ?(who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is > ?available under a BSD-style license. ?The intent behind the agreement was > ?that Spectra would work to get CTL into the FreeBSD tree. > ? > ?Some CTL features: > ? > ? - Disk and processor device emulation. > ? - Tagged queueing > ? - SCSI task attribute support (ordered, head of queue, simple tags) > ? - SCSI implicit command ordering support. ?(e.g. if a read follows a mode > ? ? select, the read will be blocked until the mode select completes.) > ? - Full task management support (abort, LUN reset, target reset, etc.) > ? - Support for multiple ports > ? - Support for multiple simultaneous initiators > ? - Support for multiple simultaneous backing stores > ? - Persistent reservation support > ? - Mode sense/select support > ? - Error injection support > ? - High Availability support (1) > ? - All I/O handled in-kernel, no userland context switch overhead. > ? > ?(1) HA Support is just an API stub, and needs much more to be fully > ? ? ?functional. > ? > ?ctl.c:The core of CTL. ?Command handlers and processing, > ?character driver, and HA support are here. > ? > ?ctl.h:Basic function declarations and data structures. > ? > ?ctl_backend.c, > ?ctl_backend.h:The basic CTL backend API. > ? > ?ctl_backend_block.c, > ?ctl_backend_block.h:The block and file backend. ?This allows for using > ?a disk or a file as the backing store for a LUN. > ?Multiple threads are started to do I/O to the > ?backing device, primarily because the VFS API > ?requires that to get any concurrency. > ? > ?ctl_backend_ramdisk.c:A "fake" ramdisk backend. ?It only allocates a > ?small amount of memory to act as a source and sink > ?for reads and writes from an initiator. ?Therefore > ?it cannot be used for any real data, but it can be > ?used to test for throughput. ?It can also be used > ?to test initiators' support for extremely large LUNs. > ? > ?ctl_cmd_table.c:This is a table with all 256 possible SCSI opcodes, > ?and command handler functions defined for supported > ?opcodes. > ? > ?ctl_debug.h:Debugging support. > ? > ?ctl_error.c, > ?ctl_error.h:CTL-specific wrappers around the CAM sense building > ?functions. > ? > ?ctl_frontend.c, > ?ctl_frontend.h:These files define the basic CTL frontend port API. > ? > ?ctl_frontend_cam_sim.c:This is a CTL frontend port that is also a CAM SIM. > ?This frontend allows for using CTL without any > ?target-capable hardware. ?So any LUNs you create in > ?CTL are visible in CAM via this port. > ? > ?ctl_frontend_internal.c, > ?ctl_frontend_internal.h: > ?This is a frontend port written for Copan to do > ?some system-specific tasks that required sending > ?commands into CTL from inside the kernel. ?This > ?isn't entirely relevant to FreeBSD in general, > ?but can perhaps be repurposed. > ? > ?ctl_ha.h:This is a stubbed-out High Availability API. ?Much > ?more is needed for full HA support. ?See the > ?comments in the header and the description of what > ?is needed in the README.ctl.txt file for more > ?details. > ? > ?ctl_io.h:This defines most of the core CTL I/O structures. > ?union ctl_io is conceptually very similar to CAM's > ?union ccb. > ? > ?ctl_ioctl.h:This defines all ioctls available through the CTL > ?character device, and the data structures needed > ?for those ioctls. > ? > ?ctl_mem_pool.c, > ?ctl_mem_pool.h:Generic memory pool implementation used by the > ?internal frontend. > ? > ?ctl_private.h:Private data structres (e.g. CTL softc) and > ?function prototypes. ?This also includes the SCSI > ?vendor and product names used by CTL. > ? > ?ctl_scsi_all.c, > ?ctl_scsi_all.h:CTL wrappers around CAM sense printing functions. > ? > ?ctl_ser_table.c:Command serialization table. ?This defines what > ?happens when one type of command is followed by > ?another type of command. > ? > ?ctl_util.c, > ?ctl_util.h:CTL utility functions, primarily designed to be > ?used from userland. ?See ctladm for the primary > ?consumer of these functions. ?These include CDB > ?building functions. > ? > ?scsi_ctl.c:CAM target peripheral driver and CTL frontend port. > ?This is the path into CTL for commands from > ?target-capable hardware/SIMs. > ? > ?README.ctl.txt:CTL code features, roadmap, to-do list. > ? > ?usr.sbin/Makefile:Add ctladm. > ? > ?ctladm/Makefile, > ?ctladm/ctladm.8, > ?ctladm/ctladm.c, > ?ctladm/ctladm.h, > ?ctladm/util.c:ctladm(8) is the CTL management utility. > ?It fills a role similar to camcontrol(8). > ?It allow configuring LUNs, issuing commands, > ?injecting errors and various other control > ?functions. > ? > ?usr.bin/Makefile:Add ctlstat. > ? > ?ctlstat/Makefile > ?ctlstat/ctlstat.8, > ?ctlstat/ctlstat.c:ctlstat(8) fills a role similar to iostat(8). > ?It reports I/O statistics for CTL. > ? > ?sys/conf/files:Add CTL files. > ? > ?sys/conf/NOTES:Add device ctl. > ? > ?sys/cam/scsi_all.h:To conform to more recent specs, the inquiry CDB > ?length field is now 2 bytes long. > ? > ?Add several mode page definitions for CTL. > ? > ?sys/cam/scsi_all.c:Handle the new 2 byte inquiry length. > ? > ?sys/dev/ciss/ciss.c, > ?sys/dev/ata/atapi-cam.c, > ?sys/cam/scsi/scsi_targ_bh.c, > ?scsi_target/scsi_cmds.c, > ?mlxcontrol/interface.c:Update for 2 byte inquiry length field. > ? > ?scsi_da.h:Add versions of the format and rigid disk pages > ?that are in a more reasonable format for CTL. > ? > ?amd64/conf/GENERIC, > ?i386/conf/GENERIC, > ?ia64/conf/GENERIC, > ?sparc64/conf/GENERIC:Add device ctl. > ? > ?i386/conf/PAE:The CTL frontend SIM at least does not compile > ?cleanly on PAE. > ? > ?Sponsored by:Copan Systems, SGI and Spectra Logic > ?MFC after:1 month > > Added: > ?head/sys/cam/ctl/ > ?head/sys/cam/ctl/README.ctl.txt ? (contents, props changed) > ?head/sys/cam/ctl/ctl.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_backend.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_backend.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_backend_block.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_backend_block.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_backend_ramdisk.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_cmd_table.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_debug.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_error.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_error.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_frontend.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_frontend.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_frontend_cam_sim.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_frontend_internal.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_frontend_internal.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_ha.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_io.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_ioctl.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_mem_pool.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_mem_pool.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_private.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_scsi_all.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_scsi_all.h ? (contents, props changed) > ?head/sys/cam/ctl/ctl_ser_table.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_util.c ? (contents, props changed) > ?head/sys/cam/ctl/ctl_util.h ? (contents, props changed) > ?head/sys/cam/ctl/scsi_ctl.c ? (contents, props changed) > ?head/usr.bin/ctlstat/ > ?head/usr.bin/ctlstat/Makefile ? (contents, props changed) > ?head/usr.bin/ctlstat/ctlstat.8 ? (contents, props changed) > ?head/usr.bin/ctlstat/ctlstat.c ? (contents, props changed) > ?head/usr.sbin/ctladm/ > ?head/usr.sbin/ctladm/Makefile ? (contents, props changed) > ?head/usr.sbin/ctladm/ctladm.8 ? (contents, props changed) > ?head/usr.sbin/ctladm/ctladm.c ? (contents, props changed) > ?head/usr.sbin/ctladm/ctladm.h ? (contents, props changed) > ?head/usr.sbin/ctladm/util.c ? (contents, props changed) > Modified: > ?head/share/examples/scsi_target/scsi_cmds.c > ?head/sys/amd64/conf/GENERIC > ?head/sys/cam/scsi/scsi_all.c > ?head/sys/cam/scsi/scsi_all.h > ?head/sys/cam/scsi/scsi_da.h > ?head/sys/cam/scsi/scsi_targ_bh.c > ?head/sys/conf/NOTES > ?head/sys/conf/files > ?head/sys/dev/ata/atapi-cam.c > ?head/sys/dev/ciss/ciss.c > ?head/sys/i386/conf/GENERIC > ?head/sys/i386/conf/PAE > ?head/sys/ia64/conf/GENERIC > ?head/sys/sparc64/conf/GENERIC > ?head/usr.bin/Makefile > ?head/usr.sbin/Makefile > ?head/usr.sbin/mlxcontrol/interface.c > > Modified: head/share/examples/scsi_target/scsi_cmds.c > ============================================================================== > --- head/share/examples/scsi_target/scsi_cmds.cThu Jan 12 00:05:35 2012(r229996) > +++ head/share/examples/scsi_target/scsi_cmds.cThu Jan 12 00:34:33 2012(r229997) > @@ -328,7 +328,7 @@ tcmd_inquiry(struct ccb_accept_tio *atio > bcopy(&inq_data, ctio->data_ptr, sizeof(inq_data)); > ctio->dxfer_len = inq_data.additional_length + 4; > ctio->dxfer_len = min(ctio->dxfer_len, > - ? ? ?SCSI_CDB6_LEN(inq->length)); > + ? ? ?scsi_2btoul(inq->length)); > ctio->ccb_h.flags |= CAM_DIR_IN | CAM_SEND_STATUS; > ctio->scsi_status = SCSI_STATUS_OK; > } > > Modified: head/sys/amd64/conf/GENERIC > ============================================================================== > --- head/sys/amd64/conf/GENERICThu Jan 12 00:05:35 2012(r229996) > +++ head/sys/amd64/conf/GENERICThu Jan 12 00:34:33 2012(r229997) > @@ -131,7 +131,8 @@ deviceda# Direct Access (disks) > devicesa# Sequential Access (tape etc) > devicecd# CD > devicepass# Passthrough device (direct ATA/SCSI access) > -deviceses# SCSI Environmental Services (and SAF-TE) > +deviceses# Enclosure Services (SES and SAF-TE) > +devicectl# CAM Target Layer > > # RAID controllers interfaced to the SCSI subsystem > deviceamr# AMI MegaRAID > > Added: head/sys/cam/ctl/README.ctl.txt > ============================================================================== > --- /dev/null00:00:00 1970(empty, because file is newly added) > +++ head/sys/cam/ctl/README.ctl.txtThu Jan 12 00:34:33 2012(r229997) > @@ -0,0 +1,449 @@ > +/* $FreeBSD$ */ > + > +CTL - CAM Target Layer Description > + > +Revision 1.4 (December 29th, 2011) > +Ken Merry > + > +Table of Contents: > +================= > + > +Introduction > +Features > +Configuring and Running CTL > +Revision 1.N Changes > +To Do List > +Code Roadmap > +Userland Commands > + > +Introduction: > +============ > + > +CTL is a disk and processor device emulation subsystem originally written > +for Copan Systems under Linux starting in 2003. ?It has been shipping in > +Copan (now SGI) products since 2005. > + > +It was ported to FreeBSD in 2008, and thanks to an agreement between SGI > +(who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is > +available under a BSD-style license. ?The intent behind the agreement was > +that Spectra would work to get CTL into the FreeBSD tree. > + > +Features: > +======== > + > + - Disk and processor device emulation. > + - Tagged queueing > + - SCSI task attribute support (ordered, head of queue, simple tags) > + - SCSI implicit command ordering support. ?(e.g. if a read follows a mode > + ? select, the read will be blocked until the mode select completes.) > + - Full task management support (abort, LUN reset, target reset, etc.) > + - Support for multiple ports > + - Support for multiple simultaneous initiators > + - Support for multiple simultaneous backing stores > + - Persistent reservation support > + - Mode sense/select support > + - Error injection support > + - High Availability support (1) > + - All I/O handled in-kernel, no userland context switch overhead. > + > +(1) HA Support is just an API stub, and needs much more to be fully > + ? ?functional. ?See the to-do list below. > + > +Configuring and Running CTL: > +=========================== > + > + - After applying the CTL patchset to your tree, build world and install it > + ? on your target system. > + > + - Add 'device ctl' to your kernel configuration file. > + > + - If you're running with a 8Gb or 4Gb Qlogic FC board, add > + ? 'options ISP_TARGET_MODE' to your kernel config file. ?Keep in mind that > + ? the isp(4) driver can run in target or initiator mode, but not both on > + ? the same machine. ?'device ispfw' or loading the ispfw module is also > + ? recommended. > + > + - Rebuild and install a new kernel. > + > + - Reboot with the new kernel. > + > + - To add a LUN with the RAM disk backend: > + > +ctladm create -b ramdisk -s 10485760000000000000 > +ctladm port -o on > + > + - You should now see the CTL disk LUN through camcontrol devlist: > + > +scbus6 on ctl2cam0 bus 0: > + ? ? ? ? ? ? at scbus6 target 1 lun 0 (da24,pass32) > +<> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? at scbus6 target -1 lun -1 () > + > + ? This is visible through the CTL CAM SIM. ?This allows using CTL without > + ? any physical hardware. ?You should be able to issue any normal SCSI > + ? commands to the device via the pass(4)/da(4) devices. > + > + ? If any target-capable HBAs are in the system (e.g. isp(4)), and have > + ? target mode enabled, you should now also be able to see the CTL LUNs via > + ? that target interface. > + > + ? Note that all CTL LUNs are presented to all frontends. ?There is no > + ? LUN masking, or separate, per-port configuration. > + > + - Note that the ramdisk backend is a "fake" ramdisk. ?That is, it is > + ? backed by a small amount of RAM that is used for all I/O requests. ?This > + ? is useful for performance testing, but not for any data integrity tests. > + > + - To add a LUN with the block/file backend: > + > +truncate -s +1T myfile > +ctladm create -b block -o file=myfile > +ctladm port -o on > + > + - You can also see a list of LUNs and their backends like this: > + > +# ctladm devlist > +LUN Backend ? ? ? Size (Blocks) ? BS Serial Number ? ?Device ID ? ? ? > + ?0 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 0 ? ? MYDEVID ? 0 ? ? > + ?1 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 1 ? ? MYDEVID ? 1 ? ? > + ?2 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 2 ? ? MYDEVID ? 2 ? ? > + ?3 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 3 ? ? MYDEVID ? 3 ? ? > + ?4 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 4 ? ? MYDEVID ? 4 ? ? > + ?5 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 5 ? ? MYDEVID ? 5 ? ? > + ?6 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 6 ? ? MYDEVID ? 6 ? ? > + ?7 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 7 ? ? MYDEVID ? 7 ? ? > + ?8 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 8 ? ? MYDEVID ? 8 ? ? > + ?9 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 9 ? ? MYDEVID ? 9 ? ? > + 10 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ?10 ? ? MYDEVID ?10 ? ? > + 11 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ?11 ? ? MYDEVID ?11 ? ? > + > + - You can see the LUN type and backing store for block/file backend LUNs > + ? like this: > + > +# ctladm devlist -v > +LUN Backend ? ? ? Size (Blocks) ? BS Serial Number ? ?Device ID ? ? ? > + ?0 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 0 ? ? MYDEVID ? 0 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk0 > + ?1 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 1 ? ? MYDEVID ? 1 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk1 > + ?2 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 2 ? ? MYDEVID ? 2 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk2 > + ?3 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 3 ? ? MYDEVID ? 3 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk3 > + ?4 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 4 ? ? MYDEVID ? 4 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk4 > + ?5 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 5 ? ? MYDEVID ? 5 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk5 > + ?6 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 6 ? ? MYDEVID ? 6 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk6 > + ?7 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 7 ? ? MYDEVID ? 7 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk7 > + ?8 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 8 ? ? MYDEVID ? 8 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk8 > + ?9 block ? ? ? ? ? ?2147483648 ?512 MYSERIAL ? 9 ? ? MYDEVID ? 9 ? ? > + ? ? ?lun_type=0 > + ? ? ?num_threads=14 > + ? ? ?file=testdisk9 > + 10 ramdisk ? ? ? ? ? ? ? ? ? 0 ? ?0 MYSERIAL ? 0 ? ? MYDEVID ? 0 ? ? > + ? ? ?lun_type=3 > + 11 ramdisk ? ? 204800000000000 ?512 MYSERIAL ? 1 ? ? MYDEVID ? 1 ? ? > + ? ? ?lun_type=0 > + > + > +Revision 1.4 Changes > +==================== > + - Added in the second HA mode (where CTL does the data transfers instead > + ? of having data transfers done below CTL), and abstracted out the Copan > + ? HA API. > + > + - Fixed the phantom device problem in the CTL CAM SIM and improved the > + ? CAM SIM to automatically trigger a rescan when the port is enabled and > + ? disabled. > + > + - Made the number of threads in the block backend configurable via sysctl, > + ? loader tunable and the ctladm command line. ?(You can now specify > + ? -o num_threads=4 when creating a LUN with ctladm create.) > + > + - Fixed some LUN selection issues in ctlstat(8) and allowed for selection > + ? of LUN numbers up to 1023. > + > + - General cleanup. > + > + - This version intended for public release. > + > +Revision 1.3 Changes > +==================== > + - Added descriptor sense support to CTL. ?It can be enabled through the > + ? control mode page (10), but is disabled by default. > + > + - Improved error injection support. ?The number of errors that can be > + ? injected with 'ctladm inject' has been increased, and any arbitrary > + ? sense data may now be injected as well. > + > + - The port infrastructure has been revamped. ?Individual ports and types > + ? of ports may now be enabled and disabled from the command line. ?ctladm > + ? now has the ability to set the WWNN and WWPN for each port. > + > + - The block backend can now send multiple I/Os to backing files. ?Multiple > + ? writes are only allowed for ZFS, but multiple readers are allowed for > + ? any filesystem. > + > + - The block and ramdisk backends now support setting the LUN blocksize. > + ? There are some restrictions when the backing device is a block device, > + ? but otherwise the blocksize may be set to anything. > + > +Revision 1.2 Changes > +==================== > + > + - CTL initialization process has been revamped. ?Instead of using an > + ? ad-hoc method, it is now sequenced through SYSINIT() calls. > + > + - A block/file backend has been added. ?This allows using arbitrary files > + ? or block devices as a backing store. > + > + - The userland LUN configuration interface has been completely rewritten. > + ? Configuration is now done out of band. > + > + - The ctladm(8) command line interface has been revamped, and is now > + ? similar to camcontrol(8). > + > +To Do List: > +========== > + > + - Make CTL buildable as a module. ?Work needs to be done on initialization, > + ? and on freeing resources and LUNs when it is built as a module. > + > + - Use devstat(9) for CTL's statistics collection. ?CTL uses a home-grown > + ? statistics collection system that is similar to devstat(9). ?ctlstat > + ? should be retired in favor of iostat, etc., once aggregation modes are > + ? available in iostat to match the behavior of ctlstat -t and dump modes > + ? are available to match the behavior of ctlstat -d/ctlstat -J. > + > + - ZFS ARC backend for CTL. ?Since ZFS copies all I/O into the ARC > + ? (Adaptive Replacement Cache), running the block/file backend on top of a > + ? ZFS-backed zdev or file will involve an extra set of copies. ?The > + ? optimal solution for backing targets served by CTL with ZFS would be to > + ? allocate buffers out of the ARC directly, and DMA to/from them directly. > + ? That would eliminate an extra data buffer allocation and copy. > + > + - Switch CTL over to using CAM CCBs instead of its own union ctl_io. ?This > + ? will likely require a significant amount of work, but will eliminate > + ? another data structure in the stack, more memory allocations, etc. ?This > + ? will also require changes to the CAM CCB structure to support CTL. > + > + - Full-featured High Availability support. ?The HA API that is in ctl_ha.h > + ? is essentially a renamed version of Copan's HA API. ?There is no > + ? substance to it, but it remains in CTL to show what needs to be done to > + ? implement active/active HA from a CTL standpoint. ?The things that would > + ? need to be done include: > +- A kernel level software API for message passing as well as DMA > + ?between at least two nodes. > +- Hardware support and drivers for inter-node communication. ?This > + ?could be as simples as ethernet hardware and drivers. > +- A "supervisor", or startup framework to control and coordinate > + ?HA startup, failover (going from active/active to single mode), > + ?and failback (going from single mode to active/active). > +- HA support in other components of the stack. ?The goal behind HA > + ?is that one node can fail and another node can seamlessly take > + ?over handling I/O requests. ?This requires support from pretty > + ?much every component in the storage stack, from top to bottom. > + ?CTL is one piece of it, but you also need support in the RAID > + ?stack/filesystem/backing store. ?You also need full configuration > + ?mirroring, and all peer nodes need to be able to talk to the > + ?underlying storage hardware. > + > +Code Roadmap: > +============ > + > +CTL has the concept of pluggable frontend ports and backends. ?All > +frontends and backends can be active at the same time. ?You can have a > +ramdisk-backed LUN present along side a file backed LUN. > + > +ctl.c: > +----- > + > +This is the core of CTL, where all of the command handlers and a lot of > +other things live. ?Yes, it is large. ?It started off small and grew to its > +current size over time. ?Perhaps it can be split into more files at some > +point. > + > +Here is a roadmap of some of the primary functions in ctl.c. ?Starting here > +and following the various leaf functions will show the command flow. > + > +ctl_queue() This is where commands from the frontend ports come > +in. > + > +ctl_queue_sense()This is only used for non-packetized SCSI. ?i.e. > +parallel SCSI prior to U320 and perhaps U160. > + > +ctl_work_thread() This is the primary work thread, and everything gets > +executed from there. > + > +ctl_scsiio_precheck() This where all of the initial checks are done, and I/O > +is either queued for execution or blocked. > + > +ctl_scsiio() This is where the command handler is actually > +executed. ?(See ctl_cmd_table.c for the mapping of > +SCSI opcode to command handler function.) > + > +ctl_done()This is the routine called (or ctl_done_lock()) to > +initiate the command completion process. > + > +ctl_process_done()This is where command completion actually happens. > + > +ctl.h: > +----- > + > +Basic function declarations and data structures. > + > +ctl_backend.c, > +ctl_backend.h: > +------------- > + > +These files define the basic CTL backend API. ?The comments in the header > +explain the API. > + > +ctl_backend_block.c > +ctl_backend_block.h: > +------------------- > + > +The block and file backend. ?This allows for using a disk or a file as the > +backing store for a LUN. ?Multiple threads are started to do I/O to the > +backing device, primarily because the VFS API requires that to get any > +concurrency. > + > +ctl_backend_ramdisk.c: > +--------------------- > + > +A "fake" ramdisk backend. ?It only allocates a small amount of memory to > +act as a source and sink for reads and writes from an initiator. ?Therefore > +it cannot be used for any real data, but it can be used to test for > +throughput. ?It can also be used to test initiators' support for extremely > +large LUNs. > + > +ctl_cmd_table.c: > +--------------- > + > +This is a table with all 256 possible SCSI opcodes, and command handler > +functions defined for supported opcodes. ?It is included in ctl.c. > + > +ctl_debug.h: > +----------- > + > +Simplistic debugging support. > + > +ctl_error.c, > +ctl_error.h: > +----------- > + > +CTL-specific wrappers around the CAM sense building functions. > + > +ctl_frontend.c, > +ctl_frontend.h: > +-------------- > + > +These files define the basic CTL frontend port API. ?The comments in the > +header explain the API. > + > +ctl_frontend_cam_sim.c: > +---------------------- > + > +This is a CTL frontend port that is also a CAM SIM. ?The idea is that this > +frontend allows for using CTL without any target-capable hardware. ?So any > +LUNs you create in CTL are visible via this port. > + > + > +ctl_frontend_internal.c > +ctl_frontend_internal.h: > +----------------------- > + > +This is a frontend port written for Copan to do some system-specific tasks > +that required sending commands into CTL from inside the kernel. ?This isn't > +entirely relevant to FreeBSD in general, but can perhaps be repurposed or > +removed later. > + > +ctl_ha.h: > +-------- > + > +This is a stubbed-out High Availability API. ?See the comments in the > +header and the description of what is needed as far as HA support above. > + > +ctl_io.h: > +-------- > + > +This defines most of the core CTL I/O structures. ?union ctl_io is > +conceptually very similar to CAM's union ccb. ? > + > +ctl_ioctl.h: > +----------- > + > +This defines all ioctls available through the CTL character device, and > +the data structures needed for those ioctls. > + > +ctl_mem_pool.c > +ctl_mem_pool.h: > +-------------- > + > +Generic memory pool implementation. ?This is currently only used by the > +internal frontend. ?The internal frontend can probably be rewritten to use > +UMA zones and this can be removed. > + > +ctl_private.h: > +------------- > + > +Private data structres (e.g. CTL softc) and function prototypes. ?This also > +includes the SCSI vendor and product names used by CTL. > + > +ctl_scsi_all.c > +ctl_scsi_all.h: > +-------------- > + > +CTL wrappers around CAM sense printing functions. > + > +ctl_ser_table.c: > +--------------- > + > +Command serialization table. ?This defines what happens when one type of > +command is followed by another type of command. ?e.g., what do you do when > +you have a mode select followed by a write? ?You block the write until the > +mode select is complete. ?That is defined in this table. > + > +ctl_util.c > +ctl_util.h: > +---------- > + > +CTL utility functions, primarily designed to be used from userland. ?See > +ctladm for the primary consumer of these functions. ?These include CDB > +building functions. > + > +scsi_ctl.c: > +---------- > + > +CAM target peripheral driver and CTL frontend port. ?This is the path into > +CTL for commands from target-capable hardware/SIMs. > + > +Userland Commands: > +================= > + > +ctladm(8) fills a role similar to camcontrol(8). ?It allow configuring LUNs, > +issuing commands, injecting errors and various other control functions. > + > +ctlstat(8) fills a role similar to iostat(8). ?It reports I/O statistics > +for CTL. > > Added: head/sys/cam/ctl/ctl.c > ============================================================================== > --- /dev/null00:00:00 1970(empty, because file is newly added) > +++ head/sys/cam/ctl/ctl.cThu Jan 12 00:34:33 2012(r229997) > @@ -0,0 +1,13082 @@ > +/*- > + * Copyright (c) 2003-2009 Silicon Graphics International Corp. > + * 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, > + * ? ?without modification. > + * 2. Redistributions in binary form must reproduce at minimum a disclaimer > + * ? ?substantially similar to the "NO WARRANTY" disclaimer below > + * ? ?("Disclaimer") and any redistribution must be conditioned upon > + * ? ?including a substantially similar Disclaimer requirement for further > + * ? ?binary redistribution. > + * > + * NO WARRANTY > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. > + * > + * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl.c#8 $ > + */ > +/* > + * CAM Target Layer, a SCSI device emulation subsystem. > + * > + * Author: Ken Merry > + */ > + > +#define _CTL_C > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +struct ctl_softc *control_softc = NULL; > + > +/* > + * The default is to run with CTL_DONE_THREAD turned on. ?Completed > + * transactions are queued for processing by the CTL work thread. ?When > + * CTL_DONE_THREAD is not defined, completed transactions are processed in > + * the caller's context. > + */ > +#define CTL_DONE_THREAD > + > +/* > + * ?* Use the serial number and device ID provided by the backend, rather than > + * ? * making up our own. > + * ? ?*/ > +#define CTL_USE_BACKEND_SN > + > +/* > + * Size and alignment macros needed for Copan-specific HA hardware. ?These > + * can go away when the HA code is re-written, and uses busdma for any > + * hardware. > + */ > +#defineCTL_ALIGN_8B(target, source, type)\ > +if (((uint32_t)source & 0x7) != 0)\ > +target = (type)(source + (0x8 - ((uint32_t)source & 0x7)));\ > +else\ > +target = (type)source; > + > +#defineCTL_SIZE_8B(target, size)\ > +if ((size & 0x7) != 0)\ > +target = size + (0x8 - (size & 0x7));\ > +else\ > +target = size; > + > +#define CTL_ALIGN_8B_MARGIN16 > + > +/* > + * Template mode pages. > + */ > + > +/* > + * Note that these are default values only. ?The actual values will be > + * filled in when the user does a mode sense. > + */ > +static struct copan_power_subpage power_page_default = { > +/*page_code*/ PWR_PAGE_CODE | SMPH_SPF, > +/*subpage*/ PWR_SUBPAGE_CODE, > +/*page_length*/ {(sizeof(struct copan_power_subpage) - 4) & 0xff00, > + (sizeof(struct copan_power_subpage) - 4) & 0x00ff}, > +/*page_version*/ PWR_VERSION, > +/* total_luns */ 26, > +/* max_active_luns*/ PWR_DFLT_MAX_LUNS, > +/*reserved*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, > + ? ? ?0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > + ? ? ?0, 0, 0, 0, 0, 0} > +}; > + > +static struct copan_power_subpage power_page_changeable = { > +/*page_code*/ PWR_PAGE_CODE | SMPH_SPF, > +/*subpage*/ PWR_SUBPAGE_CODE, > +/*page_length*/ {(sizeof(struct copan_power_subpage) - 4) & 0xff00, > + (sizeof(struct copan_power_subpage) - 4) & 0x00ff}, > +/*page_version*/ 0, > +/* total_luns */ 0, > +/* max_active_luns*/ 0, > +/*reserved*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, > + ? ? ?0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > + ? ? ?0, 0, 0, 0, 0, 0} > +}; > + > +static struct copan_aps_subpage aps_page_default = { > +APS_PAGE_CODE | SMPH_SPF, //page_code > +APS_SUBPAGE_CODE, //subpage > +{(sizeof(struct copan_aps_subpage) - 4) & 0xff00, > + (sizeof(struct copan_aps_subpage) - 4) & 0x00ff}, //page_length > +APS_VERSION, //page_version > +0, //lock_active > +{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > +0, 0, 0, 0, 0} //reserved > +}; > + > +static struct copan_aps_subpage aps_page_changeable = { > +APS_PAGE_CODE | SMPH_SPF, //page_code > +APS_SUBPAGE_CODE, //subpage > +{(sizeof(struct copan_aps_subpage) - 4) & 0xff00, > + (sizeof(struct copan_aps_subpage) - 4) & 0x00ff}, //page_length > +0, //page_version > +0, //lock_active > +{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > +0, 0, 0, 0, 0} //reserved > +}; > + > +static struct copan_debugconf_subpage debugconf_page_default = { > +DBGCNF_PAGE_CODE | SMPH_SPF,/* page_code */ > +DBGCNF_SUBPAGE_CODE,/* subpage */ > +{(sizeof(struct copan_debugconf_subpage) - 4) >> 8, > + (sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */ > +DBGCNF_VERSION,/* page_version */ > +{CTL_TIME_IO_DEFAULT_SECS>>8, > + CTL_TIME_IO_DEFAULT_SECS>>0},/* ctl_time_io_secs */ > +}; > + > +static struct copan_debugconf_subpage debugconf_page_changeable = { > +DBGCNF_PAGE_CODE | SMPH_SPF,/* page_code */ > +DBGCNF_SUBPAGE_CODE,/* subpage */ > +{(sizeof(struct copan_debugconf_subpage) - 4) >> 8, > + (sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */ > +0,/* page_version */ > +{0xff,0xff},/* ctl_time_io_secs */ > +}; > + > +static struct scsi_format_page format_page_default = { > +/*page_code*/SMS_FORMAT_DEVICE_PAGE, > +/*page_length*/sizeof(struct scsi_format_page) - 2, > +/*tracks_per_zone*/ {0, 0}, > +/*alt_sectors_per_zone*/ {0, 0}, > +/*alt_tracks_per_zone*/ {0, 0}, > +/*alt_tracks_per_lun*/ {0, 0}, > +/*sectors_per_track*/ {(CTL_DEFAULT_SECTORS_PER_TRACK >> 8) & 0xff, > + ? ? ? ?CTL_DEFAULT_SECTORS_PER_TRACK & 0xff}, > +/*bytes_per_sector*/ {0, 0}, > +/*interleave*/ {0, 0}, > +/*track_skew*/ {0, 0}, > +/*cylinder_skew*/ {0, 0}, > +/*flags*/ SFP_HSEC, > +/*reserved*/ {0, 0, 0} > +}; > + > +static struct scsi_format_page format_page_changeable = { > +/*page_code*/SMS_FORMAT_DEVICE_PAGE, > +/*page_length*/sizeof(struct scsi_format_page) - 2, > +/*tracks_per_zone*/ {0, 0}, > +/*alt_sectors_per_zone*/ {0, 0}, > +/*alt_tracks_per_zone*/ {0, 0}, > +/*alt_tracks_per_lun*/ {0, 0}, > +/*sectors_per_track*/ {0, 0}, > +/*bytes_per_sector*/ {0, 0}, > +/*interleave*/ {0, 0}, > +/*track_skew*/ {0, 0}, > +/*cylinder_skew*/ {0, 0}, > +/*flags*/ 0, > +/*reserved*/ {0, 0, 0} > +}; > + > +static struct scsi_rigid_disk_page rigid_disk_page_default = { > +/*page_code*/SMS_RIGID_DISK_PAGE, > +/*page_length*/sizeof(struct scsi_rigid_disk_page) - 2, > +/*cylinders*/ {0, 0, 0}, > +/*heads*/ CTL_DEFAULT_HEADS, > +/*start_write_precomp*/ {0, 0, 0}, > +/*start_reduced_current*/ {0, 0, 0}, > +/*step_rate*/ {0, 0}, > +/*landing_zone_cylinder*/ {0, 0, 0}, > +/*rpl*/ SRDP_RPL_DISABLED, > +/*rotational_offset*/ 0, > +/*reserved1*/ 0, > +/*rotation_rate*/ {(CTL_DEFAULT_ROTATION_RATE >> 8) & 0xff, > + ? CTL_DEFAULT_ROTATION_RATE & 0xff}, > +/*reserved2*/ {0, 0} > +}; > + > +static struct scsi_rigid_disk_page rigid_disk_page_changeable = { > +/*page_code*/SMS_RIGID_DISK_PAGE, > +/*page_length*/sizeof(struct scsi_rigid_disk_page) - 2, > +/*cylinders*/ {0, 0, 0}, > +/*heads*/ 0, > +/*start_write_precomp*/ {0, 0, 0}, > +/*start_reduced_current*/ {0, 0, 0}, > +/*step_rate*/ {0, 0}, > +/*landing_zone_cylinder*/ {0, 0, 0}, > +/*rpl*/ 0, > +/*rotational_offset*/ 0, > +/*reserved1*/ 0, > +/*rotation_rate*/ {0, 0}, > +/*reserved2*/ {0, 0} > +}; > + > +static struct scsi_caching_page caching_page_default = { > +/*page_code*/SMS_CACHING_PAGE, > +/*page_length*/sizeof(struct scsi_caching_page) - 2, > +/*flags1*/ SCP_DISC | SCP_WCE, > +/*ret_priority*/ 0, > +/*disable_pf_transfer_len*/ {0xff, 0xff}, > +/*min_prefetch*/ {0, 0}, > +/*max_prefetch*/ {0xff, 0xff}, > +/*max_pf_ceiling*/ {0xff, 0xff}, > +/*flags2*/ 0, > +/*cache_segments*/ 0, > +/*cache_seg_size*/ {0, 0}, > +/*reserved*/ 0, > +/*non_cache_seg_size*/ {0, 0, 0} > +}; > + > +static struct scsi_caching_page caching_page_changeable = { > +/*page_code*/SMS_CACHING_PAGE, > +/*page_length*/sizeof(struct scsi_caching_page) - 2, > +/*flags1*/ 0, > +/*ret_priority*/ 0, > +/*disable_pf_transfer_len*/ {0, 0}, > +/*min_prefetch*/ {0, 0}, > +/*max_prefetch*/ {0, 0}, > +/*max_pf_ceiling*/ {0, 0}, > +/*flags2*/ 0, > +/*cache_segments*/ 0, > +/*cache_seg_size*/ {0, 0}, > +/*reserved*/ 0, > +/*non_cache_seg_size*/ {0, 0, 0} > +}; > + > +static struct scsi_control_page control_page_default = { > +/*page_code*/SMS_CONTROL_MODE_PAGE, > +/*page_length*/sizeof(struct scsi_control_page) - 2, > +/*rlec*/0, > +/*queue_flags*/0, > +/*eca_and_aen*/0, > +/*reserved*/0, > +/*aen_holdoff_period*/{0, 0} > +}; > + > +static struct scsi_control_page control_page_changeable = { > +/*page_code*/SMS_CONTROL_MODE_PAGE, > +/*page_length*/sizeof(struct scsi_control_page) - 2, > +/*rlec*/SCP_DSENSE, > +/*queue_flags*/0, > +/*eca_and_aen*/0, > +/*reserved*/0, > +/*aen_holdoff_period*/{0, 0} > +}; > + > +SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); > + > +/* > + * XXX KDM move these into the softc. > + */ > +static int rcv_sync_msg; > +static int persis_offset; > +static uint8_t ctl_pause_rtr; > +static int ? ? ctl_is_single; > +static int ? ? index_to_aps_page; > + > + > +/* > + * Serial number (0x80), device id (0x83), and supported pages (0x00) > + */ > +#define SCSI_EVPD_NUM_SUPPORTED_PAGES3 > + > +static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event, > + ?int param); > +static void ctl_copy_sense_data(union ctl_ha_msg *src, union ctl_io *dest); > +static void ctl_init(void); > +void ctl_shutdown(void); > +static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td); > +static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td); > +static void ctl_ioctl_online(void *arg); > +static void ctl_ioctl_offline(void *arg); > +static int ctl_ioctl_targ_enable(void *arg, struct ctl_id targ_id); > +static int ctl_ioctl_targ_disable(void *arg, struct ctl_id targ_id); > +static int ctl_ioctl_lun_enable(void *arg, struct ctl_id targ_id, int lun_id); > +static int ctl_ioctl_lun_disable(void *arg, struct ctl_id targ_id, int lun_id); > +static int ctl_ioctl_do_datamove(struct ctl_scsiio *ctsio); > +static int ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio, int have_lock); > +static int ctl_ioctl_submit_wait(union ctl_io *io); > +static void ctl_ioctl_datamove(union ctl_io *io); > +static void ctl_ioctl_done(union ctl_io *io); > +static void ctl_ioctl_hard_startstop_callback(void *arg, > + ? ? ?struct cfi_metatask *metatask); > +static void ctl_ioctl_bbrread_callback(void *arg,struct cfi_metatask *metatask); > +static int ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, > + ? ? ?struct ctl_ooa *ooa_hdr); > +static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, > + ? ? struct thread *td); > +uint32_t ctl_get_resindex(struct ctl_nexus *nexus); > +uint32_t ctl_port_idx(int port_num); > +#ifdef unused > +static union ctl_io *ctl_malloc_io(ctl_io_type io_type, uint32_t targ_port, > + ? uint32_t targ_target, uint32_t targ_lun, > + ? int can_wait); > +static void ctl_kfree_io(union ctl_io *io); > +#endif /* unused */ > +static void ctl_free_io_internal(union ctl_io *io, int have_lock); > +static int ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *lun, > + struct ctl_be_lun *be_lun, struct ctl_id target_id); > +static int ctl_free_lun(struct ctl_lun *lun); > +static void ctl_create_lun(struct ctl_be_lun *be_lun); > +/** > +static void ctl_failover_change_pages(struct ctl_softc *softc, > + ? ? ?struct ctl_scsiio *ctsio, int master); > +**/ > + > +static int ctl_do_mode_select(union ctl_io *io); > +static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, > + ? uint64_t res_key, uint64_t sa_res_key, > + ? uint8_t type, uint32_t residx, > + ? struct ctl_scsiio *ctsio, > + ? struct scsi_per_res_out *cdb, > + ? struct scsi_per_res_out_parms* param); > +static void ctl_pro_preempt_other(struct ctl_lun *lun, > + ?union ctl_ha_msg *msg); > +static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg); > +static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len); > +static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len); > +static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len); > +static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio); > +static int ctl_inquiry_std(struct ctl_scsiio *ctsio); > +static int ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint32_t *len); > +static ctl_action ctl_extent_check(union ctl_io *io1, union ctl_io *io2); > +static ctl_action ctl_check_for_blockage(union ctl_io *pending_io, > + union ctl_io *ooa_io); > +static ctl_action ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, > +union ctl_io *starting_io); > +static int ctl_check_blocked(struct ctl_lun *lun); > +static int ctl_scsiio_lun_check(struct ctl_softc *ctl_softc, > +struct ctl_lun *lun, > +struct ctl_cmd_entry *entry, > +struct ctl_scsiio *ctsio); > +//static int ctl_check_rtr(union ctl_io *pending_io, struct ctl_softc *softc); > +static void ctl_failover(void); > +static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc, > + ? ? ? struct ctl_scsiio *ctsio); > +static int ctl_scsiio(struct ctl_scsiio *ctsio); > + > +static int ctl_bus_reset(struct ctl_softc *ctl_softc, union ctl_io *io); > +static int ctl_target_reset(struct ctl_softc *ctl_softc, union ctl_io *io, > + ? ?ctl_ua_type ua_type); > +static int ctl_lun_reset(struct ctl_lun *lun, union ctl_io *io, > + ctl_ua_type ua_type); > +static int ctl_abort_task(union ctl_io *io); > +static void ctl_run_task_queue(struct ctl_softc *ctl_softc); > +#ifdef CTL_IO_DELAY > +static void ctl_datamove_timer_wakeup(void *arg); > +static void ctl_done_timer_wakeup(void *arg); > +#endif /* CTL_IO_DELAY */ > + > +static void ctl_send_datamove_done(union ctl_io *io, int have_lock); > +static void ctl_datamove_remote_write_cb(struct ctl_ha_dt_req *rq); > +static int ctl_datamove_remote_dm_write_cb(union ctl_io *io); > +static void ctl_datamove_remote_write(union ctl_io *io); > +static int ctl_datamove_remote_dm_read_cb(union ctl_io *io); > +static void ctl_datamove_remote_read_cb(struct ctl_ha_dt_req *rq); > +static int ctl_datamove_remote_sgl_setup(union ctl_io *io); > +static int ctl_datamove_remote_xfer(union ctl_io *io, unsigned command, > + ? ?ctl_ha_dt_cb callback); > +static void ctl_datamove_remote_read(union ctl_io *io); > +static void ctl_datamove_remote(union ctl_io *io); > +static int ctl_process_done(union ctl_io *io, int have_lock); > +static void ctl_work_thread(void *arg); > + > +/* > + * Load the serialization table. ?This isn't very pretty, but is probably > + * the easiest way to do it. > + */ > +#include "ctl_ser_table.c" > + > +/* > + * We only need to define open, close and ioctl routines for this driver. > + */ > +static struct cdevsw ctl_cdevsw = { > +.d_version =D_VERSION, > +.d_flags =0, > +.d_open =ctl_open, > +.d_close =ctl_close, > +.d_ioctl =ctl_ioctl, > +.d_name ="ctl", > +}; > + > + > +MALLOC_DEFINE(M_CTL, "ctlmem", "Memory used for CTL"); > + > +/* > + * If we have the CAM SIM, we may or may not have another SIM that will > + * cause CTL to get initialized. ?If not, we need to initialize it. > + */ > +SYSINIT(ctl_init, SI_SUB_CONFIGURE, SI_ORDER_THIRD, ctl_init, NULL); > + > +static void > +ctl_isc_handler_finish_xfer(struct ctl_softc *ctl_softc, > + ? ?union ctl_ha_msg *msg_info) > +{ > +struct ctl_scsiio *ctsio; > + > +if (msg_info->hdr.original_sc == NULL) { > +printf("%s: original_sc == NULL!\n", __func__); > +/* XXX KDM now what? */ > +return; > +} > + > +ctsio = &msg_info->hdr.original_sc->scsiio; > +ctsio->io_hdr.flags |= CTL_FLAG_IO_ACTIVE; > +ctsio->io_hdr.msg_type = CTL_MSG_FINISH_IO; > +ctsio->io_hdr.status = msg_info->hdr.status; > +ctsio->scsi_status = msg_info->scsi.scsi_status; > +ctsio->sense_len = msg_info->scsi.sense_len; > +ctsio->sense_residual = msg_info->scsi.sense_residual; > +ctsio->residual = msg_info->scsi.residual; > +memcpy(&ctsio->sense_data, &msg_info->scsi.sense_data, > + ? ? ? sizeof(ctsio->sense_data)); > +memcpy(&ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, > + ? ? ? &msg_info->scsi.lbalen, sizeof(msg_info->scsi.lbalen));; > +STAILQ_INSERT_TAIL(&ctl_softc->isc_queue, &ctsio->io_hdr, links); > +ctl_wakeup_thread(); > +} > + > +static void > +ctl_isc_handler_finish_ser_only(struct ctl_softc *ctl_softc, > +union ctl_ha_msg *msg_info) > +{ > +struct ctl_scsiio *ctsio; > + > +if (msg_info->hdr.serializing_sc == NULL) { > +printf("%s: serializing_sc == NULL!\n", __func__); > +/* XXX KDM now what? */ > +return; > +} > + > +ctsio = &msg_info->hdr.serializing_sc->scsiio; > +#if 0 > +/* > + * Attempt to catch the situation where an I/O has > + * been freed, and we're using it again. > + */ > +if (ctsio->io_hdr.io_type == 0xff) { > +union ctl_io *tmp_io; > +tmp_io = (union ctl_io *)ctsio; > +printf("%s: %p use after free!\n", __func__, > + ? ? ? ctsio); > +printf("%s: type %d msg %d cdb %x iptl: " > + ? ? ? "%d:%d:%d:%d tag 0x%04x " > + ? ? ? "flag %#x status %x\n", > +__func__, > +tmp_io->io_hdr.io_type, > +tmp_io->io_hdr.msg_type, > +tmp_io->scsiio.cdb[0], > +tmp_io->io_hdr.nexus.initid.id, > +tmp_io->io_hdr.nexus.targ_port, > +tmp_io->io_hdr.nexus.targ_target.id, > +tmp_io->io_hdr.nexus.targ_lun, > +(tmp_io->io_hdr.io_type == > +CTL_IO_TASK) ? > +tmp_io->taskio.tag_num : > +tmp_io->scsiio.tag_num, > + ? ? ? ?tmp_io->io_hdr.flags, > +tmp_io->io_hdr.status); > +} > +#endif > +ctsio->io_hdr.msg_type = CTL_MSG_FINISH_IO; > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 14:54:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 288D11065670; Thu, 12 Jan 2012 14:54:34 +0000 (UTC) (envelope-from rea@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id BE08F8FC0C; Thu, 12 Jan 2012 14:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codelabs.ru; s=two; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=5V7M0v6mliVOqD1FteA6ERCN/GPDrihFxJ3nMrNpI98=; b=cdA07invHR8i795NGlzahscJAu3xfhILv+mA+CmCzgsnRLJatzlnA2yGkgdkq2fakUN1E7UFRvwvzeTgVpvd6wle0MWIxuznCtm8NXHf/7J2RoeT9QEqMP3oUXFr1+VjoBcY21U5kR6RJgFcS9HbDfDE58g6tFWBYLKH71rLR/QLupDf4h6UotBzq7v4V+F2fhIHEb+QIizWMbD/OV9WvsyF5QWN9pg2zgoD3t9llprhkmGA8IJDPKKAF535izhBRgiR4TObQy37YjcM7s1zVDQhqYoXtjV7XwUrLFOZ/DOYktJ0rZUHrBbQy7Vr/+UOBEEapQ0u1RzCtKtJsxoYSQ==; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1RlLkC-0004CP-5H; Thu, 12 Jan 2012 17:35:08 +0300 Date: Thu, 12 Jan 2012 18:35:05 +0400 From: Eygene Ryabinkin To: John Baldwin Message-ID: References: <201201120648.q0C6mBio096662@svn.freebsd.org> <201201120748.28564.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NDin8bjvE/0mNLFQ" Content-Disposition: inline In-Reply-To: <201201120748.28564.jhb@freebsd.org> Sender: rea@codelabs.ru Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230007 - in head: etc etc/rc.d share/man/man8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 14:54:34 -0000 --NDin8bjvE/0mNLFQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thu, Jan 12, 2012 at 07:48:28AM -0500, John Baldwin wrote: > Alternatively, devd could have invoked a wrapper script that only > ran /etc/rc.d/dhclient if dhcpif was true for the interface. All > other uses of /etc/rc.d/dhclient in our system scripts are > conditional on that check. True, and it was suggested by Doug Barton. But why bother when the 'quiet' keyword is reserved for such cases? --=20 Eygene Ryabinkin ,,,^..^,,, [ Life's unfair - but root password helps! | codelabs.ru ] [ 82FE 06BC D497 C0DE 49EC 4FF0 16AF 9EAE 8152 ECFB | freebsd.org ] --NDin8bjvE/0mNLFQ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk8O75kACgkQFq+eroFS7PsQJgD/VtUhKGjf0PiXeK3/kC8+KvJs 8eNko+Qk99JO4VEPSgcA/1Y2llUCSeOVJJEMv8JmIjRnrSqeqU+DT9XCIb74JgS3 =M6pu -----END PGP SIGNATURE----- --NDin8bjvE/0mNLFQ-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 15:04:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B87EA1065670 for ; Thu, 12 Jan 2012 15:04:38 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm22-vm0.bullet.mail.sp2.yahoo.com (nm22-vm0.bullet.mail.sp2.yahoo.com [98.139.91.222]) by mx1.freebsd.org (Postfix) with SMTP id 6FFCA8FC08 for ; Thu, 12 Jan 2012 15:04:38 +0000 (UTC) Received: from [98.139.91.61] by nm22.bullet.mail.sp2.yahoo.com with NNFMP; 12 Jan 2012 15:04:38 -0000 Received: from [98.139.91.60] by tm1.bullet.mail.sp2.yahoo.com with NNFMP; 12 Jan 2012 15:03:38 -0000 Received: from [127.0.0.1] by omp1060.mail.sp2.yahoo.com with NNFMP; 12 Jan 2012 15:03:38 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 976398.35667.bm@omp1060.mail.sp2.yahoo.com Received: (qmail 2149 invoked by uid 60001); 12 Jan 2012 15:03:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1326380617; bh=L6oypaRGMO36Sz0kdih+wE1FNO35vbPcsnRz1QInTuw=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=TMNUZPkuWdhi356Tno4GxIkPEGB4Nq0/I30KuV465Gt/BP/QoBZIhjeWCHgZWs8RkTMcF5FlbvoOxuvV8jp+zS3Ij+nYJiV3gCXWq7iolW4nckuzE45Er5pmLNDS8rEyYdzQUONZw4nCtk9HwEVSq5ZAgL+QIv5iifkBfoF45DM= X-YMail-OSG: a5Hp83IVM1kA8szzSONljVUCBNZaDxgNOpiW2YkgoCGNE5U JkRQrB_G8tZpwGVXEmk9RhASLcYgVtNLINphA92IYevi.qgXkMI6tEQTH2xH Lb1gdKf2CZRknBhn8kcSfT_7Z.tx0jJBw6NCpb0OTjL3fvQ9UN8EgJPjU9jh j9S4B6hOjE3Sh6e1bBZOGGwRHWTpdnr_WqGdY28NaxWpdx._2QC2vHUj_gdD _me5oZa3n0a6xohnWHWjgv5G_mpen0Oku6ATIAPT6fljITeG6mLRMdKykykY cmC1GmHyEuEhiAHa0sI9S65CbEeWdM5BcIHwrd9_ymKJtw4QMx4dfIzDFB71 Y8DUK2_axKrprKlFq7ifG4_Mz5IMZMIoh4BYJfAbiTBLh_YKlB.yH..H9Iuq NQuUPYt4oR7Cx37ZiIByZJkyVxPS0wKjj7LRLYyMJjilwRjZn8Jbt21S1_km Et5TU.D8Kj8uX_FgcAWN4.Ga.1BRuEVwqhr51pdEYyK7hz5Og5FsvVqtYq1y lLq8PWZhoEYBpa4Nb__r5jI.aCINRKIdPAEYevn4jjhjd9qC4X4qJkUpTnbg IsRRXeSeA2g-- Received: from [200.118.157.7] by web113516.mail.gq1.yahoo.com via HTTP; Thu, 12 Jan 2012 07:03:37 PST X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.115.331698 Message-ID: <1326380617.2028.YahooMailClassic@web113516.mail.gq1.yahoo.com> Date: Thu, 12 Jan 2012 07:03:37 -0800 (PST) From: Pedro Giffuni To: Joel Dahl In-Reply-To: <20120112072536.GC2227@goofy01.vnodelab.local> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 15:04:38 -0000 --- Gio 12/1/12, Joel Dahl ha scritto:=0A...=0A> On 11-01-2= 012 21:17, Pedro F. Giffuni=0A> wrote:=0A> > Author: pfg=0A> > Date: Wed Ja= n 11 21:17:14 2012=0A> > New Revision: 229981=0A> > URL: http://svn.freebsd= .org/changeset/base/229981=0A> > =0A> > Log:=0A> >=A0=A0=A0Replace GPL'd he= aders in the emu10kx snd driver code.=0A> >=A0=A0=A0=0A> >=A0=A0=A0This use= s the emuxkireg.h already used in the emu10k1=0A> >=A0=A0=A0snd driver. Spe= cial thanks go to Alexander Motin as=0A> >=A0=A0=A0he was able to find some= errors and reverse engineer=0A> >=A0=A0=A0some wrong values in the emuxkir= eg header.=0A> >=A0=A0=A0=0A> >=A0=A0=A0The emu10kx driver is now free from= the GPL.=0A> =0A> Thank you for taking care of this.=0A> =0A=0AWelcome ...= two more cards to go!=0A=0AI could use some help with the CS46XX and the h= eader from=0AOSS is nearly identical, in case someone is interested. ;)=0A= =0Acheers,=0A=0APedro.=0A From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 15:45:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B3491065670; Thu, 12 Jan 2012 15:45:09 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30CAB8FC1D; Thu, 12 Jan 2012 15:45:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CFj9OI015961; Thu, 12 Jan 2012 15:45:09 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CFj8fu015959; Thu, 12 Jan 2012 15:45:08 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201121545.q0CFj8fu015959@svn.freebsd.org> From: Guy Helmer Date: Thu, 12 Jan 2012 15: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: r230016 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 15:45:09 -0000 Author: ghelmer Date: Thu Jan 12 15:45:08 2012 New Revision: 230016 URL: http://svn.freebsd.org/changeset/base/230016 Log: Fix disorder in MAN and MLINKS lists. Requested by bde. Modified: head/lib/libutil/Makefile Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Thu Jan 12 15:02:51 2012 (r230015) +++ head/lib/libutil/Makefile Thu Jan 12 15:45:08 2012 (r230016) @@ -25,48 +25,48 @@ CFLAGS+= -DINET6 CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libc/gen/ -MAN+= kld.3 login_auth.3 login_tty.3 pty.3 \ - login_cap.3 login_class.3 login_times.3 login_ok.3 \ - _secure_path.3 uucplock.3 property.3 auth.3 realhostname.3 \ - realhostname_sa.3 trimdomain.3 fparseln.3 humanize_number.3 \ - pidfile.3 flopen.3 expand_number.3 hexdump.3 \ - kinfo_getfile.3 kinfo_getallproc.3 kinfo_getproc.3 \ - kinfo_getvmmap.3 quotafile.3 -MAN+= login.conf.5 auth.conf.5 -MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3 -MLINKS+= property.3 properties_read.3 property.3 properties_free.3 -MLINKS+= property.3 property_find.3 +MAN+= auth.3 expand_number.3 flopen.3 fparseln.3 hexdump.3 \ + humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ + kinfo_getproc.3 kinfo_getvmmap.3 kld.3 login_auth.3 login_cap.3 \ + login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \ + property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \ + _secure_path.3 trimdomain.3 uucplock.3 +MAN+= auth.conf.5 login.conf.5 MLINKS+= auth.3 auth_getval.3 -MLINKS+= pty.3 openpty.3 pty.3 forkpty.3 -MLINKS+=login_cap.3 login_getclassbyname.3 login_cap.3 login_close.3 \ - login_cap.3 login_getclass.3 login_cap.3 login_getuserclass.3 \ - login_cap.3 login_getcapstr.3 login_cap.3 login_getcaplist.3 \ - login_cap.3 login_getstyle.3 login_cap.3 login_getcaptime.3 \ - login_cap.3 login_getcapnum.3 login_cap.3 login_getcapsize.3 \ - login_cap.3 login_getcapbool.3 login_cap.3 login_getpath.3 \ - login_cap.3 login_getpwclass.3 login_cap.3 login_setcryptfmt.3 -MLINKS+=login_class.3 setusercontext.3 login_class.3 setclasscontext.3 \ - login_class.3 setclassenvironment.3 login_class.3 setclassresources.3 -MLINKS+=login_times.3 parse_lt.3 login_times.3 in_ltm.3 \ - login_times.3 in_lt.3 login_times.3 in_ltms.3 \ - login_times.3 in_lts.3 -MLINKS+=login_ok.3 auth_ttyok.3 login_ok.3 auth_hostok.3 \ - login_ok.3 auth_timeok.3 -MLINKS+=login_auth.3 auth_checknologin.3 login_auth.3 auth_cat.3 -MLINKS+=uucplock.3 uu_lock.3 uucplock.3 uu_lock_txfr.3 \ - uucplock.3 uu_unlock.3 uucplock.3 uu_lockerr.3 -MLINKS+=pidfile.3 pidfile_open.3 \ - pidfile.3 pidfile_write.3 \ - pidfile.3 pidfile_close.3 \ +MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3 +MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3 +MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \ + login_cap.3 login_getcaplist.3 login_cap.3 login_getcapnum.3 \ + login_cap.3 login_getcapsize.3 login_cap.3 login_getcapstr.3 \ + login_cap.3 login_getcaptime.3 login_cap.3 login_getclass.3 \ + login_cap.3 login_getclassbyname.3 login_cap.3 login_getpath.3 \ + login_cap.3 login_getpwclass.3 login_cap.3 login_getstyle.3 \ + login_cap.3 login_getuserclass.3 login_cap.3 login_setcryptfmt.3 +MLINKS+=login_class.3 setclasscontext.3 login_class.3 setclassenvironment.3 \ + login_class.3 setclassresources.3 login_class.3 setusercontext.3 +MLINKS+=login_ok.3 auth_hostok.3 login_ok.3 auth_timeok.3 \ + login_ok.3 auth_ttyok.3 +MLINKS+=login_times.3 in_lt.3 login_times.3 in_ltm.3 \ + login_times.3 in_ltms.3 \ + login_times.3 in_lts.3 \ + login_times.3 parse_lt.3 +MLINKS+=pidfile.3 pidfile_close.3 \ + pidfile.3 pidfile_fileno.3 \ + pidfile.3 pidfile_open.3 \ pidfile.3 pidfile_remove.3 \ - pidfile.3 pidfile_fileno.3 -MLINKS+=quotafile.3 quota_open.3 \ + pidfile.3 pidfile_write.3 +MLINKS+= property.3 property_find.3 property.3 properties_free.3 +MLINKS+= property.3 properties_read.3 +MLINKS+= pty.3 forkpty.3 pty.3 openpty.3 +MLINKS+=quotafile.3 quota_close.3 \ quotafile.3 quota_fsname.3 \ + quotafile.3 quota_open.3 \ quotafile.3 quota_qfname.3 \ - quotafile.3 quota_statfs.3 \ quotafile.3 quota_read.3 \ + quotafile.3 quota_statfs.3 \ quotafile.3 quota_write_limits.3 \ - quotafile.3 quota_write_usage.3 \ - quotafile.3 quota_close.3 + quotafile.3 quota_write_usage.3 +MLINKS+=uucplock.3 uu_lock.3 uucplock.3 uu_lock_txfr.3 \ + uucplock.3 uu_lockerr.3 uucplock.3 uu_unlock.3 .include From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 16:51:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A797F106564A; Thu, 12 Jan 2012 16:51:56 +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 885CD8FC19; Thu, 12 Jan 2012 16:51:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CGpugA018312; Thu, 12 Jan 2012 16:51:56 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CGpuww018310; Thu, 12 Jan 2012 16:51:56 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201121651.q0CGpuww018310@svn.freebsd.org> From: Ed Schouten Date: Thu, 12 Jan 2012 16:51: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: r230021 - head/contrib/compiler-rt/lib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 16:51:56 -0000 Author: ed Date: Thu Jan 12 16:51:56 2012 New Revision: 230021 URL: http://svn.freebsd.org/changeset/base/230021 Log: Add a workaround to prevent endless recursion in compiler-rt. SPARC and MIPS CPUs don't have special instructions to count leading/trailing zeroes. The compiler-rt library provides fallback rountines for these. The 64-bit routines, __clzdi2 and __ctzdi2, are implemented as simple wrappers around the compiler built-in __builtin_clz(), assuming these will expand to either 32-bit CPU instructions or calls to __clzsi2 and __ctzsi2. Unfortunately, our GCC 4.2 probably thinks that because the operand is stored in a 64-bit register, it might just be a better idea to invoke its 64-bit equivalent, simply resulting into endless recursion. Fix this by defining __builtin_clz and __builtin_ctz to __clzsi2 and __ctzsi2 explicitly. Modified: head/contrib/compiler-rt/lib/int_lib.h Modified: head/contrib/compiler-rt/lib/int_lib.h ============================================================================== --- head/contrib/compiler-rt/lib/int_lib.h Thu Jan 12 15:57:03 2012 (r230020) +++ head/contrib/compiler-rt/lib/int_lib.h Thu Jan 12 16:51:56 2012 (r230021) @@ -43,4 +43,24 @@ /* Include internal utility function declarations. */ #include "int_util.h" +/* + * Workaround for LLVM bug 11663. Prevent endless recursion in + * __c?zdi2(), where calls to __builtin_c?z() are expanded to + * __c?zdi2() instead of __c?zsi2(). + * + * Instead of placing this workaround in c?zdi2.c, put it in this + * global header to prevent other C files from making the detour + * through __c?zdi2() as well. + * + * This problem has only been observed on FreeBSD for sparc64 and + * mips64 with GCC 4.2.1. + */ +#if defined(__FreeBSD__) && (defined(__sparc64__) || \ + defined(__mips_n64) || defined(__mips_o64)) +si_int __clzsi2(si_int); +si_int __ctzsi2(si_int); +#define __builtin_clz __clzsi2 +#define __builtin_ctz __ctzsi2 +#endif + #endif /* INT_LIB_H */ From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 17:07:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED9F5106567A; Thu, 12 Jan 2012 17:07:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id EF6E68FC1F; Thu, 12 Jan 2012 17:07:32 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:a06e:a9a1:daf:164d] (unknown [IPv6:2001:7b8:3a7:0:a06e:a9a1:daf:164d]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id C10F65C37; Thu, 12 Jan 2012 18:07:31 +0100 (CET) Message-ID: <4F0F1355.2010709@FreeBSD.org> Date: Thu, 12 Jan 2012 18:07:33 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120106 Thunderbird/10.0 MIME-Version: 1.0 To: Jung-uk Kim References: <201010131033.o9DAX1EE080534@svn.freebsd.org> <201010141505.14869.jkim@FreeBSD.org> <201010141523.29842.jkim@FreeBSD.org> In-Reply-To: <201010141523.29842.jkim@FreeBSD.org> Content-Type: multipart/mixed; boundary="------------020707010109000404020808" Cc: src-committers@freebsd.org, Rui Paulo , John Baldwin , svn-src-all@freebsd.org, Dmitry Morozovsky , svn-src-head@freebsd.org, John Nielsen , Peter Grehan Subject: Re: svn commit: r213765 - head/sys/dev/aic7xxx/aicasm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 17:07:34 -0000 This is a multi-part message in MIME format. --------------020707010109000404020808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2010-10-14 21:23, Jung-uk Kim wrote: > On Thursday 14 October 2010 03:11 pm, Dmitry Morozovsky wrote: >> On Thu, 14 Oct 2010, Jung-uk Kim wrote: ... >> cc -O2 -pipe -nostdinc -I/usr/include -I. >> -I/FreeBSD/src.current.svn/sys/dev/aic7xxx/aicasm -std=gnu99 >> -Wsystem-headers -Werror -Wall -Wno-format-y2k -W >> -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes >> -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch >> -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c >> aicasm_scan.c >> cc1: warnings being treated as errors >> /FreeBSD/src.current.svn/sys/dev/aic7xxx/aicasm/aicasm_scan.l:840: >> warning: function declaration isn't a prototype ... > Hmm... That means "make buildkernel" did not pick up newly built lex. > That's bad. :-( I know it's very, very late to respond to this, but I just had an email conversation with Peter Grehan, where he ran into this problem when attempting to build -CURRENT on 8.1-RELEASE. This doesn't have the followup r214779 yet, where the needed update to lex is merged. Of course, I also know that building -CURRENT on 8.1-RELEASE is officially not supported, but if there is a relatively simple fix to make it work, it should not be a problem to apply, right? :) The root of the problem is that, even if buildworld is completed, the "stage 2.3: build tools" (kernel-specific) part of Makefile.inc1 uses lex and yacc from /usr/bin, *not* the ones built under ${WORLDTMP} (usually in /usr/obj/usr/src/tmp/legacy/usr/bin). Therefore, I propose to set PATH to ${BPATH}:${PATH} in this stage, so the "good" versions of lex and yacc are used. As per attached diff. (NOTE: even with this diff applied, doing 'make buildkernel' without first doing 'make buildworld' or 'make kernel-toolchain' will not work, because there will be no copy of lex and yacc in /usr/obj.) --------------020707010109000404020808 Content-Type: text/x-diff; name="fix-aicasm-lex-yacc-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-aicasm-lex-yacc-1.diff" Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 229979) +++ Makefile.inc1 (working copy) @@ -832,6 +832,7 @@ @echo ">>> stage 2.3: build tools" @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${_kernel}; \ + PATH=${BPATH}:${PATH} \ MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \ -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile @@ -839,6 +840,7 @@ .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) .for target in obj depend all cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ + PATH=${BPATH}:${PATH} \ MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target} .endfor --------------020707010109000404020808-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 17:28:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3A18106566B; Thu, 12 Jan 2012 17:28:00 +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 922E18FC15; Thu, 12 Jan 2012 17:28:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CHS0us019460; Thu, 12 Jan 2012 17:28:00 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CHS0HT019458; Thu, 12 Jan 2012 17:28:00 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201121728.q0CHS0HT019458@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 12 Jan 2012 17:28: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: r230023 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 17:28:00 -0000 Author: luigi Date: Thu Jan 12 17:28:00 2012 New Revision: 230023 URL: http://svn.freebsd.org/changeset/base/230023 Log: fix the initialization of the rings when netmap is used, to adapt it to the changes in 228387 . Now the code is similar to the one used in other drivers. Not applicable to stable/9 and stable/8 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Jan 12 17:06:46 2012 (r230022) +++ head/sys/dev/e1000/if_em.c Thu Jan 12 17:28:00 2012 (r230023) @@ -4019,6 +4019,10 @@ em_setup_receive_ring(struct rx_ring *rx struct em_buffer *rxbuf; bus_dma_segment_t seg[1]; int rsize, nsegs, error; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* Clear the ring contents */ @@ -4026,6 +4030,9 @@ em_setup_receive_ring(struct rx_ring *rx rsize = roundup2(adapter->num_rx_desc * sizeof(struct e1000_rx_desc), EM_DBA_ALIGN); bzero((void *)rxr->rx_base, rsize); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_RX, 0, 0); +#endif /* ** Free current RX buffer structs and their mbufs @@ -4043,6 +4050,22 @@ em_setup_receive_ring(struct rx_ring *rx /* Now replenish the mbufs */ for (int j = 0; j != adapter->num_rx_desc; ++j) { rxbuf = &rxr->rx_buffers[j]; +#ifdef DEV_NETMAP + if (slot) { + /* slot si is mapped to the j-th NIC-ring entry */ + int si = j + na->rx_rings[0].nkr_hwofs; + uint64_t paddr; + void *addr; + + if (si > na->num_rx_desc) + si -= na->num_rx_desc; + addr = PNMB(slot + si, &paddr); + netmap_load_map(rxr->rxtag, rxbuf->map, addr); + /* Update descriptor */ + rxr->rx_base[j].buffer_addr = htole64(paddr); + continue; + } +#endif /* DEV_NETMAP */ rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (rxbuf->m_head == NULL) { @@ -4073,63 +4096,6 @@ em_setup_receive_ring(struct rx_ring *rx bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#ifdef DEV_NETMAP - { - /* - * This driver is slightly different from the standard: - * it refills the rings in blocks of 8, so the while() - * above completes any leftover work. Also, after if_init() - * the ring starts at rxr->next_to_check instead of 0. - * - * Currently: we leave the mbufs allocated even in netmap - * mode, and simply make the NIC ring point to the - * correct buffer (netmap_buf or mbuf) depending on - * the mode. To avoid mbuf leaks, when in netmap mode we - * must make sure that next_to_refresh == next_to_check - 1 - * so that the above while() loop is never run on init. - * - * A better way would be to free the mbufs when entering - * netmap mode, and set next_to_refresh/check in - * a way that the mbufs are completely reallocated - * when going back to standard mode. - */ - struct netmap_adapter *na = NA(adapter->ifp); - struct netmap_slot *slot = netmap_reset(na, - NR_RX, rxr->me, rxr->next_to_check); - int sj = slot ? na->rx_rings[rxr->me].nkr_hwofs : 0; - - /* slot sj corresponds to entry j in the NIC ring */ - if (sj < 0) - sj += adapter->num_rx_desc; - - for (int j = 0; j != adapter->num_rx_desc; j++, sj++) { - rxbuf = &rxr->rx_buffers[j]; - /* no mbuf and regular mode -> skip this entry */ - if (rxbuf->m_head == NULL && !slot) - continue; - /* Handle wrap. Cannot use "na" here, could be NULL */ - if (sj >= adapter->num_rx_desc) - sj -= adapter->num_rx_desc; - /* see comment, set slot addr and map */ - if (slot) { - uint64_t paddr; - void *addr = PNMB(slot + sj, &paddr); - netmap_load_map(rxr->rxtag, rxbuf->map, addr); - /* Update descriptor */ - rxr->rx_base[j].buffer_addr = htole64(paddr); - } else { - /* Get the memory mapping */ - bus_dmamap_load_mbuf_sg(rxr->rxtag, - rxbuf->map, rxbuf->m_head, seg, - &nsegs, BUS_DMA_NOWAIT); - /* Update descriptor */ - rxr->rx_base[j].buffer_addr = htole64(seg[0].ds_addr); - } - bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); - } - } -#endif /* DEV_NETMAP */ - fail: EM_RX_UNLOCK(rxr); return (error); @@ -4313,21 +4279,18 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RDBAL(i), (u32)bus_addr); /* Setup the Head and Tail Descriptor Pointers */ E1000_WRITE_REG(hw, E1000_RDH(i), 0); - E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); #ifdef DEV_NETMAP /* * an init() while a netmap client is active must * preserve the rx buffers passed to userspace. * In this driver it means we adjust RDT to - * something different from next_to_refresh. + * something different from na->num_rx_desc - 1. */ if (ifp->if_capenable & IFCAP_NETMAP) { struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->rx_rings[i]; - int t = rxr->next_to_refresh - kring->nr_hwavail; + int t = na->num_rx_desc - 1 - kring->nr_hwavail; - if (t < 0) - t += na->num_rx_desc; E1000_WRITE_REG(hw, E1000_RDT(i), t); } else #endif /* DEV_NETMAP */ From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 17:30:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F0FE1065672; Thu, 12 Jan 2012 17:30:46 +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 3F30C8FC18; Thu, 12 Jan 2012 17:30:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CHUjQk019588; Thu, 12 Jan 2012 17:30:45 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CHUjCw019586; Thu, 12 Jan 2012 17:30:45 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201121730.q0CHUjCw019586@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 12 Jan 2012 17:30: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: r230024 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 17:30:46 -0000 Author: luigi Date: Thu Jan 12 17:30:44 2012 New Revision: 230024 URL: http://svn.freebsd.org/changeset/base/230024 Log: clear the pointer after freeing the mbuf. Without that, we risk a double free if the subsequent mbuf allocation fails. This bug is not netmap-related and was introduced in rev. 228387 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Jan 12 17:28:00 2012 (r230023) +++ head/sys/dev/e1000/if_em.c Thu Jan 12 17:30:44 2012 (r230024) @@ -4044,6 +4044,7 @@ em_setup_receive_ring(struct rx_ring *rx BUS_DMASYNC_POSTREAD); bus_dmamap_unload(rxr->rxtag, rxbuf->map); m_freem(rxbuf->m_head); + rxbuf->m_head = NULL; /* mark as freed */ } } From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 17:55:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFEBB1065672; Thu, 12 Jan 2012 17:55: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 9DB218FC16; Thu, 12 Jan 2012 17:55:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CHtMJ2020350; Thu, 12 Jan 2012 17:55:22 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CHtMA2020344; Thu, 12 Jan 2012 17:55:22 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201121755.q0CHtMA2020344@svn.freebsd.org> From: Ed Schouten Date: Thu, 12 Jan 2012 17:55: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: r230025 - head/contrib/compiler-rt/lib/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 17:55:22 -0000 Author: ed Date: Thu Jan 12 17:55:22 2012 New Revision: 230025 URL: http://svn.freebsd.org/changeset/base/230025 Log: Add SPARC64 version of div/mod written in assembly. This version is similar to the code shipped with libgcc. It is based on the code from the SPARC64 architecture manual, provided without any restrictions. Tested by: flo@ Added: head/contrib/compiler-rt/lib/sparc64/ head/contrib/compiler-rt/lib/sparc64/divmod.m4 head/contrib/compiler-rt/lib/sparc64/divsi3.S head/contrib/compiler-rt/lib/sparc64/generate.sh head/contrib/compiler-rt/lib/sparc64/modsi3.S head/contrib/compiler-rt/lib/sparc64/udivsi3.S head/contrib/compiler-rt/lib/sparc64/umodsi3.S Added: head/contrib/compiler-rt/lib/sparc64/divmod.m4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/sparc64/divmod.m4 Thu Jan 12 17:55:22 2012 (r230025) @@ -0,0 +1,250 @@ +/* + * This m4 code has been taken from The SPARC Architecture Manual Version 8. + */ + +/* + * Division/Remainder + * + * Input is: + * dividend -- the thing being divided + * divisor -- how many ways to divide it + * Important parameters: + * N -- how many bits per iteration we try to get + * as our current guess: define(N, 4) define(TWOSUPN, 16) + * WORDSIZE -- how many bits altogether we're talking about: + * obviously: define(WORDSIZE, 32) + * A derived constant: + * TOPBITS -- how many bits are in the top "decade" of a number: + * define(TOPBITS, eval( WORDSIZE - N*((WORDSIZE-1)/N) ) ) + * Important variables are: + * Q -- the partial quotient under development -- initially 0 + * R -- the remainder so far -- initially == the dividend + * ITER -- number of iterations of the main division loop which will + * be required. Equal to CEIL( lg2(quotient)/N ) + * Note that this is log_base_(2ˆN) of the quotient. + * V -- the current comparand -- initially divisor*2ˆ(ITER*N-1) + * Cost: + * current estimate for non-large dividend is + * CEIL( lg2(quotient) / N ) x ( 10 + 7N/2 ) + C + * a large dividend is one greater than 2ˆ(31-TOPBITS) and takes a + * different path, as the upper bits of the quotient must be developed + * one bit at a time. + * This uses the m4 and cpp macro preprocessors. + */ + +define(dividend, `%o0') +define(divisor,`%o1') +define(Q, `%o2') +define(R, `%o3') +define(ITER, `%o4') +define(V, `%o5') +define(SIGN, `%g3') +define(T, `%g1') +define(SC,`%g2') +/* + * This is the recursive definition of how we develop quotient digits. + * It takes three important parameters: + * $1 -- the current depth, 1<=$1<=N + * $2 -- the current accumulation of quotient bits + * N -- max depth + * We add a new bit to $2 and either recurse or insert the bits in the quotient. + * Dynamic input: + * R -- current remainder + * Q -- current quotient + * V -- current comparand + * cc -- set on current value of R + * Dynamic output: + * R', Q', V', cc' + */ + +#include "../assembly.h" + +.text + .align 4 + +define(DEVELOP_QUOTIENT_BITS, +` !depth $1, accumulated bits $2 + bl L.$1.eval(TWOSUPN+$2) + srl V,1,V + ! remainder is nonnegative + subcc R,V,R + ifelse( $1, N, + ` b 9f + add Q, ($2*2+1), Q + ',` DEVELOP_QUOTIENT_BITS( incr($1), `eval(2*$2+1)') + ') +L.$1.eval(TWOSUPN+$2): + ! remainder is negative + addcc R,V,R + ifelse( $1, N, + ` b 9f + add Q, ($2*2-1), Q + ',` DEVELOP_QUOTIENT_BITS( incr($1), `eval(2*$2-1)') + ') + ifelse( $1, 1, `9:') +') +ifelse( ANSWER, `quotient', ` +DEFINE_COMPILERRT_FUNCTION(__udivsi3) + save %sp,-64,%sp ! do this for debugging + b divide + mov 0,SIGN ! result always nonnegative +DEFINE_COMPILERRT_FUNCTION(__divsi3) + save %sp,-64,%sp ! do this for debugging + orcc divisor,dividend,%g0 ! are either dividend or divisor negative + bge divide ! if not, skip this junk + xor divisor,dividend,SIGN ! record sign of result in sign of SIGN + tst divisor + bge 2f + tst dividend + ! divisor < 0 + bge divide + neg divisor + 2: + ! dividend < 0 + neg dividend + ! FALL THROUGH +',` +DEFINE_COMPILERRT_FUNCTION(__umodsi3) + save %sp,-64,%sp ! do this for debugging + b divide + mov 0,SIGN ! result always nonnegative +DEFINE_COMPILERRT_FUNCTION(__modsi3) + save %sp,-64,%sp ! do this for debugging + orcc divisor,dividend,%g0 ! are either dividend or divisor negative + bge divide ! if not, skip this junk + mov dividend,SIGN ! record sign of result in sign of SIGN + tst divisor + bge 2f + tst dividend + ! divisor < 0 + bge divide + neg divisor + 2: + ! dividend < 0 + neg dividend + ! FALL THROUGH +') + +divide: + ! Compute size of quotient, scale comparand. + orcc divisor,%g0,V ! movcc divisor,V + te 2 ! if divisor = 0 + mov dividend,R + mov 0,Q + sethi %hi(1<<(WORDSIZE-TOPBITS-1)),T + cmp R,T + blu not_really_big + mov 0,ITER + ! + ! Here, the dividend is >= 2ˆ(31-N) or so. We must be careful here, + ! as our usual N-at-a-shot divide step will cause overflow and havoc. + ! The total number of bits in the result here is N*ITER+SC, where + ! SC <= N. + ! Compute ITER in an unorthodox manner: know we need to Shift V into +! the top decade: so don't even bother to compare to R. +1: + cmp V,T + bgeu 3f + mov 1,SC + sll V,N,V + b 1b + inc ITER +! Now compute SC +2: addcc V,V,V + bcc not_too_big + add SC,1,SC + ! We're here if the divisor overflowed when Shifting. + ! This means that R has the high-order bit set. + ! Restore V and subtract from R. + sll T,TOPBITS,T ! high order bit + srl V,1,V ! rest of V + add V,T,V + b do_single_div + dec SC +not_too_big: +3: cmp V,R + blu 2b + nop + be do_single_div + nop +! V > R: went too far: back up 1 step +! srl V,1,V +! dec SC +! do single-bit divide steps +! +! We have to be careful here. We know that R >= V, so we can do the +! first divide step without thinking. BUT, the others are conditional, +! and are only done if R >= 0. Because both R and V may have the high- +! order bit set in the first step, just falling into the regular +! division loop will mess up the first time around. +! So we unroll slightly... +do_single_div: + deccc SC + bl end_regular_divide + nop + sub R,V,R + mov 1,Q + b end_single_divloop + nop +single_divloop: + sll Q,1,Q + bl 1f + srl V,1,V + ! R >= 0 + sub R,V,R + b 2f + inc Q + 1: ! R < 0 + add R,V,R + dec Q + 2: + end_single_divloop: + deccc SC + bge single_divloop + tst R + b end_regular_divide + nop + +not_really_big: +1: + sll V,N,V + cmp V,R + bleu 1b + inccc ITER + be got_result + dec ITER +do_regular_divide: + ! Do the main division iteration + tst R + ! Fall through into divide loop +divloop: + sll Q,N,Q + DEVELOP_QUOTIENT_BITS( 1, 0 ) +end_regular_divide: + deccc ITER + bge divloop + tst R + bge got_result + nop + ! non-restoring fixup here +ifelse( ANSWER, `quotient', +` dec Q +',` add R,divisor,R +') + +got_result: + tst SIGN + bge 1f + restore + ! answer < 0 + retl ! leaf-routine return +ifelse( ANSWER, `quotient', +` neg %o2,%o0 ! quotient <- -Q +',` neg %o3,%o0 ! remainder <- -R +') +1: + retl ! leaf-routine return +ifelse( ANSWER, `quotient', +` mov %o2,%o0 ! quotient <- Q +',` mov %o3,%o0 ! remainder <- R +') Added: head/contrib/compiler-rt/lib/sparc64/divsi3.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/sparc64/divsi3.S Thu Jan 12 17:55:22 2012 (r230025) @@ -0,0 +1,333 @@ +/* + * This m4 code has been taken from The SPARC Architecture Manual Version 8. + */ +/* + * Division/Remainder + * + * Input is: + * dividend -- the thing being divided + * divisor -- how many ways to divide it + * Important parameters: + * N -- how many bits per iteration we try to get + * as our current guess: + * WORDSIZE -- how many bits altogether we're talking about: + * obviously: + * A derived constant: + * TOPBITS -- how many bits are in the top "decade" of a number: + * + * Important variables are: + * Q -- the partial quotient under development -- initially 0 + * R -- the remainder so far -- initially == the dividend + * ITER -- number of iterations of the main division loop which will + * be required. Equal to CEIL( lg2(quotient)/4 ) + * Note that this is log_base_(2ˆ4) of the quotient. + * V -- the current comparand -- initially divisor*2ˆ(ITER*4-1) + * Cost: + * current estimate for non-large dividend is + * CEIL( lg2(quotient) / 4 ) x ( 10 + 74/2 ) + C + * a large dividend is one greater than 2ˆ(31-4 ) and takes a + * different path, as the upper bits of the quotient must be developed + * one bit at a time. + * This uses the m4 and cpp macro preprocessors. + */ +/* + * This is the recursive definition of how we develop quotient digits. + * It takes three important parameters: + * $1 -- the current depth, 1<=$1<=4 + * $2 -- the current accumulation of quotient bits + * 4 -- max depth + * We add a new bit to $2 and either recurse or insert the bits in the quotient. + * Dynamic input: + * %o3 -- current remainder + * %o2 -- current quotient + * %o5 -- current comparand + * cc -- set on current value of %o3 + * Dynamic output: + * %o3', %o2', %o5', cc' + */ +#include "../assembly.h" +.text + .align 4 +DEFINE_COMPILERRT_FUNCTION(__udivsi3) + save %sp,-64,%sp ! do this for debugging + b divide + mov 0,%g3 ! result always nonnegative +DEFINE_COMPILERRT_FUNCTION(__divsi3) + save %sp,-64,%sp ! do this for debugging + orcc %o1,%o0,%g0 ! are either %o0 or %o1 negative + bge divide ! if not, skip this junk + xor %o1,%o0,%g3 ! record sign of result in sign of %g3 + tst %o1 + bge 2f + tst %o0 + ! %o1 < 0 + bge divide + neg %o1 + 2: + ! %o0 < 0 + neg %o0 + ! FALL THROUGH +divide: + ! Compute size of quotient, scale comparand. + orcc %o1,%g0,%o5 ! movcc %o1,%o5 + te 2 ! if %o1 = 0 + mov %o0,%o3 + mov 0,%o2 + sethi %hi(1<<(32-4 -1)),%g1 + cmp %o3,%g1 + blu not_really_big + mov 0,%o4 + ! + ! Here, the %o0 is >= 2ˆ(31-4) or so. We must be careful here, + ! as our usual 4-at-a-shot divide step will cause overflow and havoc. + ! The total number of bits in the result here is 4*%o4+%g2, where + ! %g2 <= 4. + ! Compute %o4 in an unorthodox manner: know we need to Shift %o5 into +! the top decade: so don't even bother to compare to %o3. +1: + cmp %o5,%g1 + bgeu 3f + mov 1,%g2 + sll %o5,4,%o5 + b 1b + inc %o4 +! Now compute %g2 +2: addcc %o5,%o5,%o5 + bcc not_too_big + add %g2,1,%g2 + ! We're here if the %o1 overflowed when Shifting. + ! This means that %o3 has the high-order bit set. + ! Restore %o5 and subtract from %o3. + sll %g1,4 ,%g1 ! high order bit + srl %o5,1,%o5 ! rest of %o5 + add %o5,%g1,%o5 + b do_single_div + dec %g2 +not_too_big: +3: cmp %o5,%o3 + blu 2b + nop + be do_single_div + nop +! %o5 > %o3: went too far: back up 1 step +! srl %o5,1,%o5 +! dec %g2 +! do single-bit divide steps +! +! We have to be careful here. We know that %o3 >= %o5, so we can do the +! first divide step without thinking. BUT, the others are conditional, +! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high- +! order bit set in the first step, just falling into the regular +! division loop will mess up the first time around. +! So we unroll slightly... +do_single_div: + deccc %g2 + bl end_regular_divide + nop + sub %o3,%o5,%o3 + mov 1,%o2 + b end_single_divloop + nop +single_divloop: + sll %o2,1,%o2 + bl 1f + srl %o5,1,%o5 + ! %o3 >= 0 + sub %o3,%o5,%o3 + b 2f + inc %o2 + 1: ! %o3 < 0 + add %o3,%o5,%o3 + dec %o2 + 2: + end_single_divloop: + deccc %g2 + bge single_divloop + tst %o3 + b end_regular_divide + nop +not_really_big: +1: + sll %o5,4,%o5 + cmp %o5,%o3 + bleu 1b + inccc %o4 + be got_result + dec %o4 +do_regular_divide: + ! Do the main division iteration + tst %o3 + ! Fall through into divide loop +divloop: + sll %o2,4,%o2 + !depth 1, accumulated bits 0 + bl L.1.16 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 2, accumulated bits 1 + bl L.2.17 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 3, accumulated bits 3 + bl L.3.19 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 4, accumulated bits 7 + bl L.4.23 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (7*2+1), %o2 +L.4.23: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (7*2-1), %o2 +L.3.19: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 4, accumulated bits 5 + bl L.4.21 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (5*2+1), %o2 +L.4.21: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (5*2-1), %o2 +L.2.17: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 3, accumulated bits 1 + bl L.3.17 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 4, accumulated bits 3 + bl L.4.19 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (3*2+1), %o2 +L.4.19: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (3*2-1), %o2 +L.3.17: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 4, accumulated bits 1 + bl L.4.17 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (1*2+1), %o2 +L.4.17: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (1*2-1), %o2 +L.1.16: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 2, accumulated bits -1 + bl L.2.15 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 3, accumulated bits -1 + bl L.3.15 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 4, accumulated bits -1 + bl L.4.15 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (-1*2+1), %o2 +L.4.15: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (-1*2-1), %o2 +L.3.15: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 4, accumulated bits -3 + bl L.4.13 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (-3*2+1), %o2 +L.4.13: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (-3*2-1), %o2 +L.2.15: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 3, accumulated bits -3 + bl L.3.13 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 4, accumulated bits -5 + bl L.4.11 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (-5*2+1), %o2 +L.4.11: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (-5*2-1), %o2 +L.3.13: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 4, accumulated bits -7 + bl L.4.9 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (-7*2+1), %o2 +L.4.9: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (-7*2-1), %o2 + 9: +end_regular_divide: + deccc %o4 + bge divloop + tst %o3 + bge got_result + nop + ! non-restoring fixup here + dec %o2 +got_result: + tst %g3 + bge 1f + restore + ! answer < 0 + retl ! leaf-routine return + neg %o2,%o0 ! quotient <- -%o2 +1: + retl ! leaf-routine return + mov %o2,%o0 ! quotient <- %o2 Added: head/contrib/compiler-rt/lib/sparc64/generate.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/sparc64/generate.sh Thu Jan 12 17:55:22 2012 (r230025) @@ -0,0 +1,6 @@ +#!/bin/sh + +m4 divmod.m4 | sed -e 's/[[:space:]]*$//' | grep -v '^$' > modsi3.S +m4 -DANSWER=quotient divmod.m4 | sed -e 's/[[:space:]]*$//' | grep -v '^$' > divsi3.S +echo '! This file intentionally left blank' > umodsi3.S +echo '! This file intentionally left blank' > udivsi3.S Added: head/contrib/compiler-rt/lib/sparc64/modsi3.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/sparc64/modsi3.S Thu Jan 12 17:55:22 2012 (r230025) @@ -0,0 +1,333 @@ +/* + * This m4 code has been taken from The SPARC Architecture Manual Version 8. + */ +/* + * Division/Remainder + * + * Input is: + * dividend -- the thing being divided + * divisor -- how many ways to divide it + * Important parameters: + * N -- how many bits per iteration we try to get + * as our current guess: + * WORDSIZE -- how many bits altogether we're talking about: + * obviously: + * A derived constant: + * TOPBITS -- how many bits are in the top "decade" of a number: + * + * Important variables are: + * Q -- the partial quotient under development -- initially 0 + * R -- the remainder so far -- initially == the dividend + * ITER -- number of iterations of the main division loop which will + * be required. Equal to CEIL( lg2(quotient)/4 ) + * Note that this is log_base_(2ˆ4) of the quotient. + * V -- the current comparand -- initially divisor*2ˆ(ITER*4-1) + * Cost: + * current estimate for non-large dividend is + * CEIL( lg2(quotient) / 4 ) x ( 10 + 74/2 ) + C + * a large dividend is one greater than 2ˆ(31-4 ) and takes a + * different path, as the upper bits of the quotient must be developed + * one bit at a time. + * This uses the m4 and cpp macro preprocessors. + */ +/* + * This is the recursive definition of how we develop quotient digits. + * It takes three important parameters: + * $1 -- the current depth, 1<=$1<=4 + * $2 -- the current accumulation of quotient bits + * 4 -- max depth + * We add a new bit to $2 and either recurse or insert the bits in the quotient. + * Dynamic input: + * %o3 -- current remainder + * %o2 -- current quotient + * %o5 -- current comparand + * cc -- set on current value of %o3 + * Dynamic output: + * %o3', %o2', %o5', cc' + */ +#include "../assembly.h" +.text + .align 4 +DEFINE_COMPILERRT_FUNCTION(__umodsi3) + save %sp,-64,%sp ! do this for debugging + b divide + mov 0,%g3 ! result always nonnegative +DEFINE_COMPILERRT_FUNCTION(__modsi3) + save %sp,-64,%sp ! do this for debugging + orcc %o1,%o0,%g0 ! are either %o0 or %o1 negative + bge divide ! if not, skip this junk + mov %o0,%g3 ! record sign of result in sign of %g3 + tst %o1 + bge 2f + tst %o0 + ! %o1 < 0 + bge divide + neg %o1 + 2: + ! %o0 < 0 + neg %o0 + ! FALL THROUGH +divide: + ! Compute size of quotient, scale comparand. + orcc %o1,%g0,%o5 ! movcc %o1,%o5 + te 2 ! if %o1 = 0 + mov %o0,%o3 + mov 0,%o2 + sethi %hi(1<<(32-4 -1)),%g1 + cmp %o3,%g1 + blu not_really_big + mov 0,%o4 + ! + ! Here, the %o0 is >= 2ˆ(31-4) or so. We must be careful here, + ! as our usual 4-at-a-shot divide step will cause overflow and havoc. + ! The total number of bits in the result here is 4*%o4+%g2, where + ! %g2 <= 4. + ! Compute %o4 in an unorthodox manner: know we need to Shift %o5 into +! the top decade: so don't even bother to compare to %o3. +1: + cmp %o5,%g1 + bgeu 3f + mov 1,%g2 + sll %o5,4,%o5 + b 1b + inc %o4 +! Now compute %g2 +2: addcc %o5,%o5,%o5 + bcc not_too_big + add %g2,1,%g2 + ! We're here if the %o1 overflowed when Shifting. + ! This means that %o3 has the high-order bit set. + ! Restore %o5 and subtract from %o3. + sll %g1,4 ,%g1 ! high order bit + srl %o5,1,%o5 ! rest of %o5 + add %o5,%g1,%o5 + b do_single_div + dec %g2 +not_too_big: +3: cmp %o5,%o3 + blu 2b + nop + be do_single_div + nop +! %o5 > %o3: went too far: back up 1 step +! srl %o5,1,%o5 +! dec %g2 +! do single-bit divide steps +! +! We have to be careful here. We know that %o3 >= %o5, so we can do the +! first divide step without thinking. BUT, the others are conditional, +! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high- +! order bit set in the first step, just falling into the regular +! division loop will mess up the first time around. +! So we unroll slightly... +do_single_div: + deccc %g2 + bl end_regular_divide + nop + sub %o3,%o5,%o3 + mov 1,%o2 + b end_single_divloop + nop +single_divloop: + sll %o2,1,%o2 + bl 1f + srl %o5,1,%o5 + ! %o3 >= 0 + sub %o3,%o5,%o3 + b 2f + inc %o2 + 1: ! %o3 < 0 + add %o3,%o5,%o3 + dec %o2 + 2: + end_single_divloop: + deccc %g2 + bge single_divloop + tst %o3 + b end_regular_divide + nop +not_really_big: +1: + sll %o5,4,%o5 + cmp %o5,%o3 + bleu 1b + inccc %o4 + be got_result + dec %o4 +do_regular_divide: + ! Do the main division iteration + tst %o3 + ! Fall through into divide loop +divloop: + sll %o2,4,%o2 + !depth 1, accumulated bits 0 + bl L.1.16 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 2, accumulated bits 1 + bl L.2.17 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 3, accumulated bits 3 + bl L.3.19 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 4, accumulated bits 7 + bl L.4.23 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (7*2+1), %o2 +L.4.23: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (7*2-1), %o2 +L.3.19: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 4, accumulated bits 5 + bl L.4.21 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (5*2+1), %o2 +L.4.21: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (5*2-1), %o2 +L.2.17: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 3, accumulated bits 1 + bl L.3.17 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 4, accumulated bits 3 + bl L.4.19 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (3*2+1), %o2 +L.4.19: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (3*2-1), %o2 +L.3.17: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 4, accumulated bits 1 + bl L.4.17 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (1*2+1), %o2 +L.4.17: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (1*2-1), %o2 +L.1.16: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 2, accumulated bits -1 + bl L.2.15 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 3, accumulated bits -1 + bl L.3.15 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 4, accumulated bits -1 + bl L.4.15 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (-1*2+1), %o2 +L.4.15: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (-1*2-1), %o2 +L.3.15: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 4, accumulated bits -3 + bl L.4.13 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (-3*2+1), %o2 +L.4.13: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (-3*2-1), %o2 +L.2.15: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 3, accumulated bits -3 + bl L.3.13 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + !depth 4, accumulated bits -5 + bl L.4.11 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (-5*2+1), %o2 +L.4.11: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (-5*2-1), %o2 +L.3.13: + ! remainder is negative + addcc %o3,%o5,%o3 + !depth 4, accumulated bits -7 + bl L.4.9 + srl %o5,1,%o5 + ! remainder is nonnegative + subcc %o3,%o5,%o3 + b 9f + add %o2, (-7*2+1), %o2 +L.4.9: + ! remainder is negative + addcc %o3,%o5,%o3 + b 9f + add %o2, (-7*2-1), %o2 + 9: +end_regular_divide: + deccc %o4 + bge divloop + tst %o3 + bge got_result + nop + ! non-restoring fixup here + add %o3,%o1,%o3 +got_result: + tst %g3 + bge 1f + restore + ! answer < 0 + retl ! leaf-routine return + neg %o3,%o0 ! remainder <- -%o3 +1: + retl ! leaf-routine return + mov %o3,%o0 ! remainder <- %o3 Added: head/contrib/compiler-rt/lib/sparc64/udivsi3.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/sparc64/udivsi3.S Thu Jan 12 17:55:22 2012 (r230025) @@ -0,0 +1 @@ +! This file intentionally left blank Added: head/contrib/compiler-rt/lib/sparc64/umodsi3.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/sparc64/umodsi3.S Thu Jan 12 17:55:22 2012 (r230025) @@ -0,0 +1 @@ +! This file intentionally left blank From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 18:39:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6ED63106566B; Thu, 12 Jan 2012 18:39:37 +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 528E58FC08; Thu, 12 Jan 2012 18:39:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CIdb3B021716; Thu, 12 Jan 2012 18:39:37 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CIdbID021713; Thu, 12 Jan 2012 18:39:37 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201201121839.q0CIdbID021713@svn.freebsd.org> From: Robert Watson Date: Thu, 12 Jan 2012 18:39:37 +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: r230026 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 18:39:37 -0000 Author: rwatson Date: Thu Jan 12 18:39:37 2012 New Revision: 230026 URL: http://svn.freebsd.org/changeset/base/230026 Log: Clarify throughout the vlan(4) code the difference between a "tag" (the 802.1q-defined 16-bit VID, CFI, and PCP field in host by order) and a VLAN ID (VID). Tags go in packets. VIDs identify VLANs. No functional change is intended, so this should be safe to MFC. Further cleanup with functional changes will be committed separately (for example, renaming vlan_tag/vlan_tag_p, which modify the KPI and KBI). Reviewed by: bz Sponsored by: ADARA Networks, Inc. MFC after: 3 days Modified: head/sys/net/if_vlan.c head/sys/net/if_vlan_var.h Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Thu Jan 12 17:55:22 2012 (r230025) +++ head/sys/net/if_vlan.c Thu Jan 12 18:39:37 2012 (r230026) @@ -114,7 +114,7 @@ struct ifvlan { #endif }; #define ifv_proto ifv_mib.ifvm_proto -#define ifv_tag ifv_mib.ifvm_tag +#define ifv_vid ifv_mib.ifvm_tag #define ifv_encaplen ifv_mib.ifvm_encaplen #define ifv_mtufudge ifv_mib.ifvm_mtufudge #define ifv_mintu ifv_mib.ifvm_mintu @@ -178,7 +178,7 @@ static int vlan_inshash(struct ifvlantru static int vlan_remhash(struct ifvlantrunk *trunk, struct ifvlan *ifv); static void vlan_growhash(struct ifvlantrunk *trunk, int howmuch); static __inline struct ifvlan * vlan_gethash(struct ifvlantrunk *trunk, - uint16_t tag); + uint16_t vid); #endif static void trunk_destroy(struct ifvlantrunk *trunk); @@ -198,7 +198,7 @@ static void vlan_link_state(struct ifnet static void vlan_capabilities(struct ifvlan *ifv); static void vlan_trunk_capabilities(struct ifnet *ifp); -static struct ifnet *vlan_clone_match_ethertag(struct if_clone *, +static struct ifnet *vlan_clone_match_ethervid(struct if_clone *, const char *, int *); static int vlan_clone_match(struct if_clone *, const char *); static int vlan_clone_create(struct if_clone *, char *, size_t, caddr_t); @@ -266,9 +266,9 @@ vlan_inshash(struct ifvlantrunk *trunk, KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__)); b = 1 << trunk->hwidth; - i = HASH(ifv->ifv_tag, trunk->hmask); + i = HASH(ifv->ifv_vid, trunk->hmask); LIST_FOREACH(ifv2, &trunk->hash[i], ifv_list) - if (ifv->ifv_tag == ifv2->ifv_tag) + if (ifv->ifv_vid == ifv2->ifv_vid) return (EEXIST); /* @@ -278,7 +278,7 @@ vlan_inshash(struct ifvlantrunk *trunk, */ if (trunk->refcnt > (b * b) / 2) { vlan_growhash(trunk, 1); - i = HASH(ifv->ifv_tag, trunk->hmask); + i = HASH(ifv->ifv_vid, trunk->hmask); } LIST_INSERT_HEAD(&trunk->hash[i], ifv, ifv_list); trunk->refcnt++; @@ -296,7 +296,7 @@ vlan_remhash(struct ifvlantrunk *trunk, KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__)); b = 1 << trunk->hwidth; - i = HASH(ifv->ifv_tag, trunk->hmask); + i = HASH(ifv->ifv_vid, trunk->hmask); LIST_FOREACH(ifv2, &trunk->hash[i], ifv_list) if (ifv2 == ifv) { trunk->refcnt--; @@ -348,7 +348,7 @@ vlan_growhash(struct ifvlantrunk *trunk, for (i = 0; i < n; i++) while ((ifv = LIST_FIRST(&trunk->hash[i])) != NULL) { LIST_REMOVE(ifv, ifv_list); - j = HASH(ifv->ifv_tag, n2 - 1); + j = HASH(ifv->ifv_vid, n2 - 1); LIST_INSERT_HEAD(&hash2[j], ifv, ifv_list); } free(trunk->hash, M_VLAN); @@ -362,14 +362,14 @@ vlan_growhash(struct ifvlantrunk *trunk, } static __inline struct ifvlan * -vlan_gethash(struct ifvlantrunk *trunk, uint16_t tag) +vlan_gethash(struct ifvlantrunk *trunk, uint16_t vid) { struct ifvlan *ifv; TRUNK_LOCK_RASSERT(trunk); - LIST_FOREACH(ifv, &trunk->hash[HASH(tag, trunk->hmask)], ifv_list) - if (ifv->ifv_tag == tag) + LIST_FOREACH(ifv, &trunk->hash[HASH(vid, trunk->hmask)], ifv_list) + if (ifv->ifv_vid == vid) return (ifv); return (NULL); } @@ -393,19 +393,19 @@ vlan_dumphash(struct ifvlantrunk *trunk) #else static __inline struct ifvlan * -vlan_gethash(struct ifvlantrunk *trunk, uint16_t tag) +vlan_gethash(struct ifvlantrunk *trunk, uint16_t vid) { - return trunk->vlans[tag]; + return trunk->vlans[vid]; } static __inline int vlan_inshash(struct ifvlantrunk *trunk, struct ifvlan *ifv) { - if (trunk->vlans[ifv->ifv_tag] != NULL) + if (trunk->vlans[ifv->ifv_vid] != NULL) return EEXIST; - trunk->vlans[ifv->ifv_tag] = ifv; + trunk->vlans[ifv->ifv_vid] = ifv; trunk->refcnt++; return (0); @@ -415,7 +415,7 @@ static __inline int vlan_remhash(struct ifvlantrunk *trunk, struct ifvlan *ifv) { - trunk->vlans[ifv->ifv_tag] = NULL; + trunk->vlans[ifv->ifv_vid] = NULL; trunk->refcnt--; return (0); @@ -617,17 +617,21 @@ vlan_trunkdev(struct ifnet *ifp) } /* - * Return the 16bit vlan tag for this interface. + * Return the 12-bit VLAN VID for this interface, for use by external + * components such as Infiniband. + * + * XXXRW: Note that the function name here is historical; it should be named + * vlan_vid(). */ static int -vlan_tag(struct ifnet *ifp, uint16_t *tagp) +vlan_tag(struct ifnet *ifp, uint16_t *vidp) { struct ifvlan *ifv; if (ifp->if_type != IFT_L2VLAN) return (EINVAL); ifv = ifp->if_softc; - *tagp = ifv->ifv_tag; + *vidp = ifv->ifv_vid; return (0); } @@ -663,10 +667,10 @@ vlan_setcookie(struct ifnet *ifp, void * } /* - * Return the vlan device present at the specific tag. + * Return the vlan device present at the specific VID. */ static struct ifnet * -vlan_devat(struct ifnet *ifp, uint16_t tag) +vlan_devat(struct ifnet *ifp, uint16_t vid) { struct ifvlantrunk *trunk; struct ifvlan *ifv; @@ -676,7 +680,7 @@ vlan_devat(struct ifnet *ifp, uint16_t t return (NULL); ifp = NULL; TRUNK_RLOCK(trunk); - ifv = vlan_gethash(trunk, tag); + ifv = vlan_gethash(trunk, vid); if (ifv) ifp = ifv->ifv_ifp; TRUNK_RUNLOCK(trunk); @@ -786,11 +790,11 @@ VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_ #endif static struct ifnet * -vlan_clone_match_ethertag(struct if_clone *ifc, const char *name, int *tag) +vlan_clone_match_ethervid(struct if_clone *ifc, const char *name, int *vidp) { const char *cp; struct ifnet *ifp; - int t; + int vid; /* Check for . style interface names. */ IFNET_RLOCK_NOSLEEP(); @@ -809,13 +813,13 @@ vlan_clone_match_ethertag(struct if_clon continue; if (*cp == '\0') continue; - t = 0; + vid = 0; for(; *cp >= '0' && *cp <= '9'; cp++) - t = (t * 10) + (*cp - '0'); + vid = (vid * 10) + (*cp - '0'); if (*cp != '\0') continue; - if (tag != NULL) - *tag = t; + if (vidp != NULL) + *vidp = vid; break; } IFNET_RUNLOCK_NOSLEEP(); @@ -828,7 +832,7 @@ vlan_clone_match(struct if_clone *ifc, c { const char *cp; - if (vlan_clone_match_ethertag(ifc, name, NULL) != NULL) + if (vlan_clone_match_ethervid(ifc, name, NULL) != NULL) return (1); if (strncmp(VLANNAME, name, strlen(VLANNAME)) != 0) @@ -848,7 +852,7 @@ vlan_clone_create(struct if_clone *ifc, int wildcard; int unit; int error; - int tag; + int vid; int ethertag; struct ifvlan *ifv; struct ifnet *ifp; @@ -866,6 +870,9 @@ vlan_clone_create(struct if_clone *ifc, * must be configured separately. * The first technique is preferred; the latter two are * supported for backwards compatibilty. + * + * XXXRW: Note historic use of the word "tag" here. New ioctls may be + * called for. */ if (params) { error = copyin(params, &vlr, sizeof(vlr)); @@ -875,7 +882,7 @@ vlan_clone_create(struct if_clone *ifc, if (p == NULL) return ENXIO; /* - * Don't let the caller set up a VLAN tag with + * Don't let the caller set up a VLAN VID with * anything except VLID bits. */ if (vlr.vlr_tag & ~EVL_VLID_MASK) @@ -885,18 +892,18 @@ vlan_clone_create(struct if_clone *ifc, return (error); ethertag = 1; - tag = vlr.vlr_tag; + vid = vlr.vlr_tag; wildcard = (unit < 0); - } else if ((p = vlan_clone_match_ethertag(ifc, name, &tag)) != NULL) { + } else if ((p = vlan_clone_match_ethervid(ifc, name, &vid)) != NULL) { ethertag = 1; unit = -1; wildcard = 0; /* - * Don't let the caller set up a VLAN tag with + * Don't let the caller set up a VLAN VID with * anything except VLID bits. */ - if (tag & ~EVL_VLID_MASK) + if (vid & ~EVL_VLID_MASK) return (EINVAL); } else { ethertag = 0; @@ -958,7 +965,7 @@ vlan_clone_create(struct if_clone *ifc, sdl->sdl_type = IFT_L2VLAN; if (ethertag) { - error = vlan_config(ifv, p, tag); + error = vlan_config(ifv, p, vid); if (error != 0) { /* * Since we've partialy failed, we need to back @@ -1068,10 +1075,10 @@ vlan_transmit(struct ifnet *ifp, struct * packet tag that holds it. */ if (p->if_capenable & IFCAP_VLAN_HWTAGGING) { - m->m_pkthdr.ether_vtag = ifv->ifv_tag; + m->m_pkthdr.ether_vtag = ifv->ifv_vid; m->m_flags |= M_VLANTAG; } else { - m = ether_vlanencap(m, ifv->ifv_tag); + m = ether_vlanencap(m, ifv->ifv_vid); if (m == NULL) { if_printf(ifp, "unable to prepend VLAN header\n"); ifp->if_oerrors++; @@ -1105,7 +1112,7 @@ vlan_input(struct ifnet *ifp, struct mbu { struct ifvlantrunk *trunk = ifp->if_vlantrunk; struct ifvlan *ifv; - uint16_t tag; + uint16_t vid; KASSERT(trunk != NULL, ("%s: no trunk", __func__)); @@ -1114,7 +1121,7 @@ vlan_input(struct ifnet *ifp, struct mbu * Packet is tagged, but m contains a normal * Ethernet frame; the tag is stored out-of-band. */ - tag = EVL_VLANOFTAG(m->m_pkthdr.ether_vtag); + vid = EVL_VLANOFTAG(m->m_pkthdr.ether_vtag); m->m_flags &= ~M_VLANTAG; } else { struct ether_vlan_header *evl; @@ -1130,7 +1137,7 @@ vlan_input(struct ifnet *ifp, struct mbu return; } evl = mtod(m, struct ether_vlan_header *); - tag = EVL_VLANOFTAG(ntohs(evl->evl_tag)); + vid = EVL_VLANOFTAG(ntohs(evl->evl_tag)); /* * Remove the 802.1q header by copying the Ethernet @@ -1155,7 +1162,7 @@ vlan_input(struct ifnet *ifp, struct mbu } TRUNK_RLOCK(trunk); - ifv = vlan_gethash(trunk, tag); + ifv = vlan_gethash(trunk, vid); if (ifv == NULL || !UP_AND_RUNNING(ifv->ifv_ifp)) { TRUNK_RUNLOCK(trunk); m_freem(m); @@ -1172,14 +1179,14 @@ vlan_input(struct ifnet *ifp, struct mbu } static int -vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag) +vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid) { struct ifvlantrunk *trunk; struct ifnet *ifp; int error = 0; /* VID numbers 0x0 and 0xFFF are reserved */ - if (tag == 0 || tag == 0xFFF) + if (vid == 0 || vid == 0xFFF) return (EINVAL); if (p->if_type != IFT_ETHER && (p->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) @@ -1211,7 +1218,7 @@ exists: TRUNK_LOCK(trunk); } - ifv->ifv_tag = tag; /* must set this before vlan_inshash() */ + ifv->ifv_vid = vid; /* must set this before vlan_inshash() */ error = vlan_inshash(trunk, ifv); if (error) goto done; @@ -1289,7 +1296,7 @@ exists: done: TRUNK_UNLOCK(trunk); if (error == 0) - EVENTHANDLER_INVOKE(vlan_config, p, ifv->ifv_tag); + EVENTHANDLER_INVOKE(vlan_config, p, ifv->ifv_vid); VLAN_UNLOCK(); return (error); @@ -1377,7 +1384,7 @@ vlan_unconfig_locked(struct ifnet *ifp) * to cleanup anyway. */ if (parent != NULL) - EVENTHANDLER_INVOKE(vlan_unconfig, parent, ifv->ifv_tag); + EVENTHANDLER_INVOKE(vlan_unconfig, parent, ifv->ifv_vid); } /* Handle a reference counted flag that should be set on the parent as well */ @@ -1622,7 +1629,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd break; } /* - * Don't let the caller set up a VLAN tag with + * Don't let the caller set up a VLAN VID with * anything except VLID bits. */ if (vlr.vlr_tag & ~EVL_VLID_MASK) { @@ -1649,7 +1656,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd if (TRUNK(ifv) != NULL) { strlcpy(vlr.vlr_parent, PARENT(ifv)->if_xname, sizeof(vlr.vlr_parent)); - vlr.vlr_tag = ifv->ifv_tag; + vlr.vlr_tag = ifv->ifv_vid; } VLAN_UNLOCK(); error = copyout(&vlr, ifr->ifr_data, sizeof(vlr)); Modified: head/sys/net/if_vlan_var.h ============================================================================== --- head/sys/net/if_vlan_var.h Thu Jan 12 17:55:22 2012 (r230025) +++ head/sys/net/if_vlan_var.h Thu Jan 12 18:39:37 2012 (r230026) @@ -108,7 +108,7 @@ struct vlanreq { * received VLAN tag (containing both vlan and priority information) * into the ether_vtag mbuf packet header field: * - * m->m_pkthdr.ether_vtag = vlan_id; // ntohs()? + * m->m_pkthdr.ether_vtag = vtag; // ntohs()? * m->m_flags |= M_VLANTAG; * * to mark the packet m with the specified VLAN tag. @@ -133,15 +133,15 @@ struct vlanreq { #define VLAN_TRUNKDEV(_ifp) \ (_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL -#define VLAN_TAG(_ifp, _tag) \ - (_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_tag)) : EINVAL +#define VLAN_TAG(_ifp, _vid) \ + (_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL #define VLAN_COOKIE(_ifp) \ (_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL #define VLAN_SETCOOKIE(_ifp, _cookie) \ (_ifp)->if_type == IFT_L2VLAN ? \ (*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL -#define VLAN_DEVAT(_ifp, _tag) \ - (_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_tag)) : NULL +#define VLAN_DEVAT(_ifp, _vid) \ + (_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_vid)) : NULL extern void (*vlan_trunk_cap_p)(struct ifnet *); extern struct ifnet *(*vlan_trunkdev_p)(struct ifnet *); From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 19:33:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A154C106566B for ; Thu, 12 Jan 2012 19:33:24 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm29-vm0.bullet.mail.sp2.yahoo.com (nm29-vm0.bullet.mail.sp2.yahoo.com [98.139.91.236]) by mx1.freebsd.org (Postfix) with SMTP id 5E7408FC14 for ; Thu, 12 Jan 2012 19:33:24 +0000 (UTC) Received: from [98.139.91.66] by nm29.bullet.mail.sp2.yahoo.com with NNFMP; 12 Jan 2012 19:33:23 -0000 Received: from [98.139.91.1] by tm6.bullet.mail.sp2.yahoo.com with NNFMP; 12 Jan 2012 19:33:23 -0000 Received: from [127.0.0.1] by omp1001.mail.sp2.yahoo.com with NNFMP; 12 Jan 2012 19:33:23 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 938541.16925.bm@omp1001.mail.sp2.yahoo.com Received: (qmail 44936 invoked by uid 60001); 12 Jan 2012 19:33:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1326396803; bh=doK6XD9YP7KhNwNvh0iVQM104GGVlwGqCbm6URuH3Qk=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=1W6EjK6dr8affuI6HpHhj3qCCd9ZHbVa/vN4GjkNnf8/FXFrluw8lb9kosojeYBm0jNzGb9DQ8VtwMlydryHtSYrbMMiHFY0CeDDs7JO4bNOYw/3bqBjctEniZV/pEXoHhXLnL7g6oOJYaHP4UPhfRlh7O/jjOmsDhRZhOOWOXo= X-YMail-OSG: 4m6HZiIVM1nWBXvJ5yJwBpoCa6xQ32FmoghyaputhW3E4LI ixBiSLGAMPkpJ_0aRAwodny0n1En0eDHbuYqxEctxCVGmiUHNCSR1xGUR.dT mqBQkaacsEuvid1VOgdU8uxzcncOG0seBZx3XaLNbGDm6kAJ8CFPvSLkH4us diKC0tAAiZHQ2eLaqk6hK7.L1ovHxRxdZ1eB.TLigpjq11p6iE8YTq6f_8GS fJRjnl1T.wx.XPbZVcDpBuYoZQO_Ciyo4IzIt4g06cAWNMc47njzcIqpT6DW rioU12sc.ilj8xg6qm8bEN3W_nfwUlWhc88B0qAzOcIRF9xGQS.Mhd8O48lv teRCEY0cBJYmE6sZ5kAenCJw5ccvHqhXHfP4GhJzVq7jXirmCv3SMlufGv41 yrDgAmA_8mBmTP_C1NuE95AGR6eR0K8CHPiT8CVeNpTs0wOmwrThUUWjr5oa dfaTNrXNhRjSk8b0eTkLporX.5pxtR1ZVAqb5bKmd Received: from [200.118.157.7] by web113506.mail.gq1.yahoo.com via HTTP; Thu, 12 Jan 2012 11:33:23 PST X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.115.331698 Message-ID: <1326396803.27040.YahooMailClassic@web113506.mail.gq1.yahoo.com> Date: Thu, 12 Jan 2012 11:33:23 -0800 (PST) From: Pedro Giffuni To: John Baldwin In-Reply-To: <201201120743.41757.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, joel@freebsd.org Subject: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 19:33:24 -0000 Hello;=0A=0A--- Gio 12/1/12, John Baldwin ha scritto:=0A= =0A> Da: John Baldwin =0A> Oggetto: Re: svn commit: r22998= 1 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/= emu10kx=0A> A: "Pedro F. Giffuni" =0A> Cc: src-committers@= freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, joel@freebs= d.org=0A> Data: Gioved=EC 12 gennaio 2012, 07:43=0A> On Wednesday, January = 11, 2012=0A> 4:17:14 pm Pedro F. Giffuni wrote:=0A> > Author: pfg=0A> > Dat= e: Wed Jan 11 21:17:14 2012=0A> > New Revision: 229981=0A> > URL: http://sv= n.freebsd.org/changeset/base/229981=0A> >=0A...=A0=A0=A0=0A> >=A0=A0=A0The = emu10kx driver is now free from the GPL.=0A> >=A0=A0=A0=0A> >=A0=A0=A0PR:= =A0=A0=A0 =A0=A0=A0 153901=0A> >=A0=A0=A0Tested by:=A0=A0=A0 mav, joel=0A> = >=A0=A0=A0Approved by:=A0=A0=A0 jhb (mentor)=0A> >=A0=A0=A0MFC after:=A0=A0= =A0 2 weeks=0A> =0A> Is the emu10kx driver a superset of em10k1 now (meanin= g=0A> does it support all=0A> the em10k1 devices and should em10k1 be retir= ed)?=0A> =0A=0ABoth device drivers seem to have diverged significantly=0Aan= d while emu10kx seems to be superior, some people still=0Ahave problems wit= h it:=0A=0Ahttp://docs.freebsd.org/cgi/mid.cgi?201201100024.q0A0OF24069073= =0A=0Aso I suggest we keep both at least for a while.=0A=0A> Also, it seems= we should definitely add 'snd_emu10kx' to=0A> GENERIC on x86 and possible = 'snd_emu10k1'.=0A> =0A=0A+1=0A=0APedro. From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 19:37:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B55DF106564A; Thu, 12 Jan 2012 19:37:12 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 319F08FC12; Thu, 12 Jan 2012 19:37:11 +0000 (UTC) Received: by obbta17 with SMTP id ta17so1762944obb.13 for ; Thu, 12 Jan 2012 11:37:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=KXij0YTuK7jwcDz8ACxCxisT0Nmh2uu2giPY+u2O43M=; b=ifWOo2T62Xz+Osb5IsmJBj2F2bMKhlSsLwtl378AoJRVTND0j+xFOLOMHtIYzu68NM 679xyDo3/GrLp4T6cpnJCCIAtbs5cJGnae/nbVsOsCfrao5waKHTJeoPNXkt+xg7/5kj A+cPLuMg/RSC8yxyPtRiN/nrESwpWRrFjcvAY= Received: by 10.50.214.73 with SMTP id ny9mr5826910igc.1.1326397031486; Thu, 12 Jan 2012 11:37:11 -0800 (PST) Received: from kruse-40.4.ixsystems.com (drawbridge.ixsystems.com. [206.40.55.65]) by mx.google.com with ESMTPS id 36sm20344413ibc.6.2012.01.12.11.37.09 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Jan 2012 11:37:10 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=iso-8859-1 From: Garrett Cooper In-Reply-To: <1326396803.27040.YahooMailClassic@web113506.mail.gq1.yahoo.com> Date: Thu, 12 Jan 2012 11:37:13 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <157C90FE-FB2E-4710-881E-70C47A5C08B9@gmail.com> References: <1326396803.27040.YahooMailClassic@web113506.mail.gq1.yahoo.com> To: pfg@freebsd.org X-Mailer: Apple Mail (2.1251.1) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin , joel@freebsd.org Subject: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 19:37:12 -0000 On Jan 12, 2012, at 11:33 AM, Pedro Giffuni wrote: > Hello; >=20 > --- Gio 12/1/12, John Baldwin ha scritto: >=20 >> Da: John Baldwin >> Oggetto: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci = gnu/dev/sound/pci modules/sound/driver/emu10kx >> A: "Pedro F. Giffuni" >> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, = svn-src-head@freebsd.org, joel@freebsd.org >> Data: Gioved=EC 12 gennaio 2012, 07:43 >> On Wednesday, January 11, 2012 >> 4:17:14 pm Pedro F. Giffuni wrote: >>> Author: pfg >>> Date: Wed Jan 11 21:17:14 2012 >>> New Revision: 229981 >>> URL: http://svn.freebsd.org/changeset/base/229981 >>>=20 > ... =20 >>> The emu10kx driver is now free from the GPL. >>> =20 >>> PR: 153901 >>> Tested by: mav, joel >>> Approved by: jhb (mentor) >>> MFC after: 2 weeks >>=20 >> Is the emu10kx driver a superset of em10k1 now (meaning >> does it support all >> the em10k1 devices and should em10k1 be retired)? >>=20 >=20 > Both device drivers seem to have diverged significantly > and while emu10kx seems to be superior, some people still > have problems with it: >=20 > http://docs.freebsd.org/cgi/mid.cgi?201201100024.q0A0OF24069073 >=20 > so I suggest we keep both at least for a while. >=20 >> Also, it seems we should definitely add 'snd_emu10kx' to >> GENERIC on x86 and possible 'snd_emu10k1'. >>=20 SB Audigy chipsets are also treated differently for both cases. = My Audigy 4 card for instance is detected with both drivers, but only = the 10kx driver works with the card; similarly IIRC there are some = things that work with the 10k1 driver that don't work the same with the = 10kx. So while this would be nice to have, I'm not sure if it's an = effective use of FreeBSD's time to invest in as these chipsets are = effectively obsolete. Thanks! -Garrett= From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 19:38:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63A42106566C; Thu, 12 Jan 2012 19:38:20 +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 38C758FC21; Thu, 12 Jan 2012 19:38:20 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id E51FE46B90; Thu, 12 Jan 2012 14:38:19 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 30187B95A; Thu, 12 Jan 2012 14:38:19 -0500 (EST) From: John Baldwin To: Eygene Ryabinkin Date: Thu, 12 Jan 2012 14:38:16 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201201120648.q0C6mBio096662@svn.freebsd.org> <201201120748.28564.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201201121438.16674.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 12 Jan 2012 14:38:19 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230007 - in head: etc etc/rc.d share/man/man8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 19:38:20 -0000 On Thursday, January 12, 2012 9:35:05 am Eygene Ryabinkin wrote: > Thu, Jan 12, 2012 at 07:48:28AM -0500, John Baldwin wrote: > > Alternatively, devd could have invoked a wrapper script that only > > ran /etc/rc.d/dhclient if dhcpif was true for the interface. All > > other uses of /etc/rc.d/dhclient in our system scripts are > > conditional on that check. > > True, and it was suggested by Doug Barton. But why bother when > the 'quiet' keyword is reserved for such cases? Hmm, that's not quite how I see this. Either /etc/rc.d/dhclient should silently exit if dhcpif is not true for the given interface, or it should always whine IMO. Given that everywhere else uses dhcpif to decide if dhclient should be run, it seems that an explicit test of that should be used here as well, even if it means an extra script. In short, this approach is not consisent with all other users of the dhclient script, and this seems a hackish approach whose primary goal is to avoid having devd use a wrapper script. Perhaps that goal is worth the tradeoff, but it's not really clean. By your argument, btw since we use quietstart during boot, ifn_start shouldn't even check dhcpif at all now, but just always run the dhclient script (and if you did make that change, I would protest that it was very wrong). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 20:30:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA1C2106564A; Thu, 12 Jan 2012 20:30:20 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98B2A8FC12; Thu, 12 Jan 2012 20:30:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CKUKMu025107; Thu, 12 Jan 2012 20:30:20 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CKUKiV025105; Thu, 12 Jan 2012 20:30:20 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201122030.q0CKUKiV025105@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 12 Jan 2012 20:30: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: r230027 - head/usr.bin/printf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 20:30:20 -0000 Author: pfg Date: Thu Jan 12 20:30:20 2012 New Revision: 230027 URL: http://svn.freebsd.org/changeset/base/230027 Log: Style cleanups for printf. PR: bin/152934 Approved by: jhb (mentor) Obtained from: Illumos MFC after: 2 weeks Modified: head/usr.bin/printf/printf.c Modified: head/usr.bin/printf/printf.c ============================================================================== --- head/usr.bin/printf/printf.c Thu Jan 12 18:39:37 2012 (r230026) +++ head/usr.bin/printf/printf.c Thu Jan 12 20:30:20 2012 (r230027) @@ -66,21 +66,21 @@ static const char rcsid[] = #include "error.h" #endif -#define PF(f, func) do { \ - char *b = NULL; \ - if (havewidth) \ - if (haveprec) \ +#define PF(f, func) do { \ + char *b = NULL; \ + if (havewidth) \ + if (haveprec) \ (void)asprintf(&b, f, fieldwidth, precision, func); \ - else \ - (void)asprintf(&b, f, fieldwidth, func); \ - else if (haveprec) \ - (void)asprintf(&b, f, precision, func); \ - else \ - (void)asprintf(&b, f, func); \ - if (b) { \ - (void)fputs(b, stdout); \ - free(b); \ - } \ + else \ + (void)asprintf(&b, f, fieldwidth, func); \ + else if (haveprec) \ + (void)asprintf(&b, f, precision, func); \ + else \ + (void)asprintf(&b, f, func); \ + if (b) { \ + (void)fputs(b, stdout); \ + free(b); \ + } \ } while (0) static int asciicode(void); @@ -357,10 +357,10 @@ mknum(char *str, char ch) static int escape(char *fmt, int percent, size_t *len) { - char *save, *store; - int value, c; + char *save, *store, c; + int value; - for (save = store = fmt; (c = *fmt); ++fmt, ++store) { + for (save = store = fmt; ((c = *fmt) != 0); ++fmt, ++store) { if (c != '\\') { *store = c; continue; @@ -414,7 +414,7 @@ escape(char *fmt, int percent, size_t *l *store++ = '%'; *store = '%'; } else - *store = value; + *store = (char)value; break; default: *store = *fmt; From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 21:21:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5D341065676; Thu, 12 Jan 2012 21:21:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3B148FC17; Thu, 12 Jan 2012 21:21:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CLLKmt026962; Thu, 12 Jan 2012 21:21:20 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CLLKig026956; Thu, 12 Jan 2012 21:21:20 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201122121.q0CLLKig026956@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 12 Jan 2012 21:21: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: r230032 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 21:21:20 -0000 Author: hselasky Date: Thu Jan 12 21:21:20 2012 New Revision: 230032 URL: http://svn.freebsd.org/changeset/base/230032 Log: - Try to fix support for USB 3.0 HUBs. - Try to fix support for USB 3.0 suspend and resume. MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/usb.h head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_request.h Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Thu Jan 12 21:12:16 2012 (r230031) +++ head/sys/dev/usb/controller/xhci.c Thu Jan 12 21:21:20 2012 (r230032) @@ -2211,9 +2211,10 @@ xhci_configure_device(struct usb_device struct usb_device *hubdev; uint32_t temp; uint32_t route; + uint32_t rh_port; uint8_t is_hub; uint8_t index; - uint8_t rh_port; + uint8_t depth; index = udev->controller_slot_id; @@ -2235,6 +2236,8 @@ xhci_configure_device(struct usb_device if (hubdev->parent_hub == NULL) break; + depth = hubdev->parent_hub->depth; + /* * NOTE: HS/FS/LS devices and the SS root HUB can have * more than 15 ports @@ -2242,17 +2245,18 @@ xhci_configure_device(struct usb_device rh_port = hubdev->port_no; - if (hubdev->parent_hub->parent_hub == NULL) + if (depth == 0) break; - route *= 16; - if (rh_port > 15) - route |= 15; - else - route |= rh_port; + rh_port = 15; + + if (depth < 6) + route |= rh_port << (4 * (depth - 1)); } + DPRINTF("Route=0x%08x\n", route); + temp = XHCI_SCTX_0_ROUTE_SET(route); switch (sc->sc_hw.devs[index].state) { @@ -3063,6 +3067,7 @@ xhci_roothub_exec(struct usb_device *ude case UHF_C_PORT_CONFIG_ERROR: XWRITE4(sc, oper, port, v | XHCI_PS_CEC); break; + case UHF_C_PORT_SUSPEND: case UHF_C_PORT_LINK_STATE: XWRITE4(sc, oper, port, v | XHCI_PS_PLC); break; @@ -3190,7 +3195,7 @@ xhci_roothub_exec(struct usb_device *ude if (v & XHCI_PS_PR) i |= UPS_RESET; if (v & XHCI_PS_PP) - i |= UPS_PORT_POWER; + i |= UPS_PORT_POWER_SS; USETW(sc->sc_hub_desc.ps.wPortStatus, i); i = 0; Modified: head/sys/dev/usb/usb.h ============================================================================== --- head/sys/dev/usb/usb.h Thu Jan 12 21:12:16 2012 (r230031) +++ head/sys/dev/usb/usb.h Thu Jan 12 21:21:20 2012 (r230032) @@ -688,6 +688,7 @@ struct usb_port_status { #define UPS_PORT_LS_LOOPBACK 0x0B #define UPS_PORT_LS_RESUME 0x0F #define UPS_PORT_POWER 0x0100 +#define UPS_PORT_POWER_SS 0x0200 /* super-speed only */ #define UPS_LOW_SPEED 0x0200 #define UPS_HIGH_SPEED 0x0400 #define UPS_OTHER_SPEED 0x0600 /* currently FreeBSD specific */ Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Thu Jan 12 21:12:16 2012 (r230031) +++ head/sys/dev/usb/usb_hub.c Thu Jan 12 21:21:20 2012 (r230032) @@ -369,10 +369,25 @@ repeat: } /* check if there is no power on the port and print a warning */ - if (!(sc->sc_st.port_status & UPS_PORT_POWER)) { - DPRINTF("WARNING: strange, connected port %d " - "has no power\n", portno); + switch (udev->speed) { + case USB_SPEED_HIGH: + case USB_SPEED_FULL: + case USB_SPEED_LOW: + if (!(sc->sc_st.port_status & UPS_PORT_POWER)) { + DPRINTF("WARNING: strange, connected port %d " + "has no power\n", portno); + } + break; + case USB_SPEED_SUPER: + if (!(sc->sc_st.port_status & UPS_PORT_POWER_SS)) { + DPRINTF("WARNING: strange, connected port %d " + "has no power\n", portno); + } + break; + default: + break; } + /* check if the device is in Host Mode */ if (!(sc->sc_st.port_status & UPS_PORT_MODE_DEVICE)) { @@ -611,6 +626,7 @@ uhub_suspend_resume_port(struct uhub_sof switch (UPS_PORT_LINK_STATE_GET(sc->sc_st.port_status)) { case UPS_PORT_LS_U0: case UPS_PORT_LS_U1: + case UPS_PORT_LS_U2: case UPS_PORT_LS_RESUME: is_suspend = 0; break; @@ -632,8 +648,7 @@ uhub_suspend_resume_port(struct uhub_sof */ if (is_suspend == 0) usb_dev_resume_peer(child); - else if ((child->flags.usb_mode == USB_MODE_DEVICE) || - (usb_device_20_compatible(child) == 0)) + else if (child->flags.usb_mode == USB_MODE_DEVICE) usb_dev_suspend_peer(child); } done: @@ -2064,7 +2079,6 @@ usb_peer_should_wakeup(struct usb_device (udev->pwr_save.write_refs != 0) || ((udev->pwr_save.read_refs != 0) && (udev->flags.usb_mode == USB_MODE_HOST) && - (usb_device_20_compatible(udev) != 0) && (usb_peer_can_wakeup(udev) == 0))); } @@ -2244,6 +2258,14 @@ usb_dev_resume_peer(struct usb_device *u DPRINTFN(0, "Resuming port failed\n"); return; } + } else { + /* resume current port (Valid in Host and Device Mode) */ + err = usbd_req_set_port_link_state(udev->parent_hub, + NULL, udev->port_no, UPS_PORT_LS_U0); + if (err) { + DPRINTFN(0, "Resuming port failed\n"); + return; + } } /* resume settle time */ @@ -2285,8 +2307,7 @@ usb_dev_resume_peer(struct usb_device *u usbd_sr_unlock(udev); /* check if peer has wakeup capability */ - if (usb_peer_can_wakeup(udev) && - usb_device_20_compatible(udev)) { + if (usb_peer_can_wakeup(udev)) { /* clear remote wakeup */ err = usbd_req_clear_device_feature(udev, NULL, UF_DEVICE_REMOTE_WAKEUP); @@ -2347,8 +2368,7 @@ repeat: } } - if (usb_peer_can_wakeup(udev) && - usb_device_20_compatible(udev)) { + if (usb_peer_can_wakeup(udev)) { /* * This request needs to be done before we set * "udev->flags.self_suspended": @@ -2380,8 +2400,7 @@ repeat: USB_BUS_UNLOCK(udev->bus); if (err != 0) { - if (usb_peer_can_wakeup(udev) && - usb_device_20_compatible(udev)) { + if (usb_peer_can_wakeup(udev)) { /* allow device to do remote wakeup */ err = usbd_req_clear_device_feature(udev, NULL, UF_DEVICE_REMOTE_WAKEUP); @@ -2437,6 +2456,14 @@ repeat: DPRINTFN(0, "Suspending port failed\n"); return; } + } else { + /* suspend current port */ + err = usbd_req_set_port_link_state(udev->parent_hub, + NULL, udev->port_no, UPS_PORT_LS_U3); + if (err) { + DPRINTFN(0, "Suspending port failed\n"); + return; + } } udev = udev->parent_hub; Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Thu Jan 12 21:12:16 2012 (r230031) +++ head/sys/dev/usb/usb_request.c Thu Jan 12 21:21:20 2012 (r230032) @@ -2164,3 +2164,27 @@ usbd_req_clear_tt_buffer(struct usb_devi USETW(req.wLength, 0); return (usbd_do_request(udev, mtx, &req, 0)); } + +/*------------------------------------------------------------------------* + * usbd_req_set_port_link_state + * + * USB 3.0 specific request + * + * Returns: + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +usb_error_t +usbd_req_set_port_link_state(struct usb_device *udev, struct mtx *mtx, + uint8_t port, uint8_t link_state) +{ + struct usb_device_request req; + + req.bmRequestType = UT_WRITE_CLASS_OTHER; + req.bRequest = UR_SET_FEATURE; + USETW(req.wValue, UHF_PORT_LINK_STATE); + req.wIndex[0] = port; + req.wIndex[1] = link_state; + USETW(req.wLength, 0); + return (usbd_do_request(udev, mtx, &req, 0)); +} Modified: head/sys/dev/usb/usb_request.h ============================================================================== --- head/sys/dev/usb/usb_request.h Thu Jan 12 21:12:16 2012 (r230031) +++ head/sys/dev/usb/usb_request.h Thu Jan 12 21:21:20 2012 (r230032) @@ -89,5 +89,7 @@ usb_error_t usbd_req_reset_tt(struct usb uint8_t port); usb_error_t usbd_req_clear_tt_buffer(struct usb_device *udev, struct mtx *mtx, uint8_t port, uint8_t addr, uint8_t type, uint8_t endpoint); +usb_error_t usbd_req_set_port_link_state(struct usb_device *udev, + struct mtx *mtx, uint8_t port, uint8_t link_state); #endif /* _USB_REQUEST_H_ */ From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 22:08:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD069106566B; Thu, 12 Jan 2012 22:08:33 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBFD68FC0A; Thu, 12 Jan 2012 22:08:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CM8XPV028507; Thu, 12 Jan 2012 22:08:33 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CM8XhE028505; Thu, 12 Jan 2012 22:08:33 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201201122208.q0CM8XhE028505@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 12 Jan 2012 22:08: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: r230033 - head/sys/cam/ctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 22:08:33 -0000 Author: ken Date: Thu Jan 12 22:08:33 2012 New Revision: 230033 URL: http://svn.freebsd.org/changeset/base/230033 Log: Silence some unnecessary verbosity. Reported by: mav MFC after: 1 month Modified: head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Thu Jan 12 21:21:20 2012 (r230032) +++ head/sys/cam/ctl/scsi_ctl.c Thu Jan 12 22:08:33 2012 (r230033) @@ -305,8 +305,10 @@ ctlfeasync(void *callback_arg, uint32_t /* Don't attach if it doesn't support target mode */ if ((cpi->target_sprt & PIT_PROCESSOR) == 0) { +#ifdef CTLFEDEBUG printf("%s: SIM %s%d doesn't support target mode\n", __func__, cpi->dev_name, cpi->unit_number); +#endif break; } @@ -421,8 +423,10 @@ ctlfeasync(void *callback_arg, uint32_t * XXX KDM need to figure out whether we're the master or * slave. */ +#ifdef CTLFEDEBUG printf("%s: calling ctl_frontend_register() for %s%d\n", __func__, cpi->dev_name, cpi->unit_number); +#endif retval = ctl_frontend_register(fe, /*master_SC*/ 1); if (retval != 0) { printf("%s: ctl_frontend_register() failed with " From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 22:12:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69ADC106564A; Thu, 12 Jan 2012 22:12:42 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58B7B8FC19; Thu, 12 Jan 2012 22:12:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CMCgTV028734; Thu, 12 Jan 2012 22:12:42 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CMCgS7028732; Thu, 12 Jan 2012 22:12:42 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201201122212.q0CMCgS7028732@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 12 Jan 2012 22:12: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: r230034 - head/usr.bin/ctlstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 22:12:42 -0000 Author: ken Date: Thu Jan 12 22:12:42 2012 New Revision: 230034 URL: http://svn.freebsd.org/changeset/base/230034 Log: Fix building ctlstat with clang. Submitted by: Dan McGregor MFC after: 1 month Modified: head/usr.bin/ctlstat/ctlstat.c Modified: head/usr.bin/ctlstat/ctlstat.c ============================================================================== --- head/usr.bin/ctlstat/ctlstat.c Thu Jan 12 22:08:33 2012 (r230033) +++ head/usr.bin/ctlstat/ctlstat.c Thu Jan 12 22:12:42 2012 (r230034) @@ -146,7 +146,7 @@ static void compute_stats(struct ctl_lun static void usage(int error) { - fprintf(error ? stderr : stdout, ctlstat_usage); + fputs(ctlstat_usage, error ? stderr : stdout); } static int From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 22:21:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEDB2106564A; Thu, 12 Jan 2012 22:21:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9289F8FC17; Thu, 12 Jan 2012 22:21:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CMLK9j029037; Thu, 12 Jan 2012 22:21:20 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CMLKqP029035; Thu, 12 Jan 2012 22:21:20 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201201122221.q0CMLKqP029035@svn.freebsd.org> From: Justin Hibbits Date: Thu, 12 Jan 2012 22:21: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: r230035 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 22:21:20 -0000 Author: jhibbits Date: Thu Jan 12 22:21:20 2012 New Revision: 230035 URL: http://svn.freebsd.org/changeset/base/230035 Log: Add PWM monitoring sysctl to G4 MDD (Windtunnel) fan driver. While there, clean up some style nits. Approved by: nwhitehorn (mentor) MFC after: 3 days Modified: head/sys/powerpc/powermac/windtunnel.c Modified: head/sys/powerpc/powermac/windtunnel.c ============================================================================== --- head/sys/powerpc/powermac/windtunnel.c Thu Jan 12 22:12:42 2012 (r230034) +++ head/sys/powerpc/powermac/windtunnel.c Thu Jan 12 22:21:20 2012 (r230035) @@ -59,8 +59,7 @@ struct adm1030_softc { device_t sc_dev; struct intr_config_hook enum_hook; uint32_t sc_addr; - phandle_t sc_thermostat_phandle; - device_t sc_thermostat_dev; + int sc_pwm; }; /* Regular bus attachment functions */ @@ -70,7 +69,8 @@ static int adm1030_attach(device_t); /* Utility functions */ static void adm1030_start(void *xdev); static int adm1030_write_byte(device_t dev, uint32_t addr, uint8_t reg, uint8_t buf); -static int adm1030_set(struct adm1030_softc *fan, int pwm); +static int adm1030_set(struct adm1030_softc *fan, int pwm); +static int adm1030_sysctl(SYSCTL_HANDLER_ARGS); static device_method_t adm1030_methods[] = { /* Device interface */ @@ -151,6 +151,8 @@ static int adm1030_attach(device_t dev) { struct adm1030_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; sc = device_get_softc(dev); @@ -158,17 +160,19 @@ adm1030_attach(device_t dev) sc->enum_hook.ich_arg = dev; /* - * We have to wait until interrupts are enabled. I2C read and write - * only works if the interrupts are available. The unin/i2c is - * controlled by the htpic on unin. But this is not the master. The - * openpic on mac-io is controlling the htpic. This one gets attached - * after the mac-io probing and then the interrupts will be - * available. + * Wait until interrupts are available, which won't be until the openpic is + * intialized. */ if (config_intrhook_establish(&sc->enum_hook) != 0) return (ENOMEM); + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "pwm", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, dev, + 0, adm1030_sysctl, "I", "Fan PWM Rate"); + return (0); } @@ -188,7 +192,7 @@ adm1030_start(void *xdev) /* Use the RPM fields as PWM duty cycles. */ sc->fan.min_rpm = 0; - sc->fan.max_rpm = 15; + sc->fan.max_rpm = 0x0F; sc->fan.default_rpm = 2; strcpy(sc->fan.name, "MDD Case fan"); @@ -211,6 +215,26 @@ static int adm1030_set(struct adm1030_so if (adm1030_write_byte(fan->sc_dev, fan->sc_addr, 0x22, pwm) < 0) return (-1); + fan->sc_pwm = pwm; return (0); } +static int +adm1030_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t adm1030; + struct adm1030_softc *sc; + int pwm, error; + + adm1030 = arg1; + sc = device_get_softc(adm1030); + + pwm = sc->sc_pwm; + + error = sysctl_handle_int(oidp, &pwm, 0, req); + + if (error || !req->newptr) + return (error); + + return (adm1030_set(sc, pwm)); +} From owner-svn-src-head@FreeBSD.ORG Thu Jan 12 22:49:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3963106564A; Thu, 12 Jan 2012 22:49:36 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A84188FC13; Thu, 12 Jan 2012 22:49:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0CMna4t030203; Thu, 12 Jan 2012 22:49:36 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0CMnaZe030200; Thu, 12 Jan 2012 22:49:36 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201122249.q0CMnaZe030200@svn.freebsd.org> From: Guy Helmer Date: Thu, 12 Jan 2012 22:49: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: r230037 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 22:49:36 -0000 Author: ghelmer Date: Thu Jan 12 22:49:36 2012 New Revision: 230037 URL: http://svn.freebsd.org/changeset/base/230037 Log: Move struct pidfh definition into pidfile.c, and leave a forward declaration for pidfh in libutil.h in its place. This allows us to hide the contents of the pidfh structure, and also allowed removal of the "#ifdef _SYS_PARAM_H" guard from around the pidfile_* function prototypes. Suggested by pjd. Modified: head/lib/libutil/libutil.h head/lib/libutil/pidfile.c Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Thu Jan 12 22:30:41 2012 (r230036) +++ head/lib/libutil/libutil.h Thu Jan 12 22:49:36 2012 (r230037) @@ -48,6 +48,11 @@ typedef __gid_t gid_t; #define _GID_T_DECLARED #endif +#ifndef _MODE_T_DECLARED +typedef __mode_t mode_t; +#define _MODE_T_DECLARED +#endif + #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED @@ -73,21 +78,12 @@ typedef struct _property { char *value; } *properties; -#ifdef _SYS_PARAM_H_ -/* for pidfile.c */ -struct pidfh { - int pf_fd; - char pf_path[MAXPATHLEN + 1]; - __dev_t pf_dev; - ino_t pf_ino; -}; -#endif - /* Avoid pulling in all the include files for no need */ struct in_addr; struct kinfo_file; struct kinfo_proc; struct kinfo_vmentry; +struct pidfh; struct sockaddr; struct termios; struct winsize; @@ -174,14 +170,12 @@ struct group int gr_tmp(int _mdf); #endif -#ifdef _SYS_PARAM_H_ int pidfile_close(struct pidfh *_pfh); int pidfile_fileno(const struct pidfh *_pfh); struct pidfh * pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); int pidfile_remove(struct pidfh *_pfh); int pidfile_write(struct pidfh *_pfh); -#endif #ifdef _UFS_UFS_QUOTA_H_ struct fstab; Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Thu Jan 12 22:30:41 2012 (r230036) +++ head/lib/libutil/pidfile.c Thu Jan 12 22:49:36 2012 (r230037) @@ -41,6 +41,13 @@ __FBSDID("$FreeBSD$"); #include #include +struct pidfh { + int pf_fd; + char pf_path[MAXPATHLEN + 1]; + dev_t pf_dev; + ino_t pf_ino; +}; + static int _pidfile_remove(struct pidfh *pfh, int freeit); static int From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 00:00:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9DA9106566C; Fri, 13 Jan 2012 00:00:59 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 7DD178FC18; Fri, 13 Jan 2012 00:00:58 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q0D00wat055981; Fri, 13 Jan 2012 01:00:58 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q0D00wk6055980; Fri, 13 Jan 2012 01:00:58 +0100 (CET) (envelope-from marius) Date: Fri, 13 Jan 2012 01:00:57 +0100 From: Marius Strobl To: Ed Schouten Message-ID: <20120113000057.GA23960@alchemy.franken.de> References: <201201121755.q0CHtMA2020344@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201121755.q0CHtMA2020344@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230025 - head/contrib/compiler-rt/lib/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 00:01:00 -0000 On Thu, Jan 12, 2012 at 05:55:22PM +0000, Ed Schouten wrote: > Author: ed > Date: Thu Jan 12 17:55:22 2012 > New Revision: 230025 > URL: http://svn.freebsd.org/changeset/base/230025 > > Log: > Add SPARC64 version of div/mod written in assembly. > > This version is similar to the code shipped with libgcc. It is based on > the code from the SPARC64 architecture manual, provided without any > restrictions. > > Tested by: flo@ > > +#include "../assembly.h" > + > +.text > + .align 4 > + <...> > +ifelse( ANSWER, `quotient', ` > +DEFINE_COMPILERRT_FUNCTION(__udivsi3) > + save %sp,-64,%sp ! do this for debugging Uhm, these are V8-specific, for V9 the C compiler frame size should be 192 instead of 64 and the function alignment should be 32 instead of 4 bytes (at least with GCC and US1-optimizations enabled as we default to on sparc64), see . However, given that these functions only seem to obtain new register window for debugging purposes you probably alternatively could just remove the saves and the corresponding restores completely. Marius From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 02:33:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E112D1065670; Fri, 13 Jan 2012 02:33:55 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFE328FC0C; Fri, 13 Jan 2012 02:33:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0D2XtPb037277; Fri, 13 Jan 2012 02:33:55 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0D2XtWR037275; Fri, 13 Jan 2012 02:33:55 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201201130233.q0D2XtWR037275@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 13 Jan 2012 02:33: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: r230040 - head/sys/contrib/octeon-sdk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 02:33:56 -0000 Author: gonzo Date: Fri Jan 13 02:33:55 2012 New Revision: 230040 URL: http://svn.freebsd.org/changeset/base/230040 Log: - Do not enumerate PCIe bus on CN56XX Pass 1 devices to avoid hard hang. There is known issue with this hardware. Submitted by: Andrew Duane Modified: head/sys/contrib/octeon-sdk/cvmx-pcie.c Modified: head/sys/contrib/octeon-sdk/cvmx-pcie.c ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-pcie.c Fri Jan 13 00:38:35 2012 (r230039) +++ head/sys/contrib/octeon-sdk/cvmx-pcie.c Fri Jan 13 02:33:55 2012 (r230040) @@ -501,6 +501,12 @@ retry: } } + /* Make sure a CN56XX pass 1 isn't trying to do anything; errata for PASS 1 */ + if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)) { + cvmx_dprintf ("PCIe port %d: CN56XX_PASS_1, skipping\n", pcie_port); + return -1; + } + /* PCIe switch arbitration mode. '0' == fixed priority NPEI, PCIe0, then PCIe1. '1' == round robin. */ npei_ctl_status.s.arb = 1; /* Allow up to 0x20 config retries */ From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 03:21:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EE8C1065670; Fri, 13 Jan 2012 03:21:47 +0000 (UTC) (envelope-from rea@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 1CA098FC0A; Fri, 13 Jan 2012 03:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codelabs.ru; s=two; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=VcPf7tYrA2tYOgYDkCjNGKkgnQyhgZ2O4Mifid9YUhI=; b=aWPZ228ZiqrxybmeqqM8SOW3zRy9N6t2sHkb8XP1sGs+IvsExjgckL3DBrLVgH2ilaa3FqIyIp5gfQ5IFLr2cD+JKM42pmoNZgRmFEYpHchw0qHDP41mMGjKKZNobWeU1DoIeqoMcYDmeDa3nlcOECNn6+mpLPbJSoKtkzACeEkg3OmWVkmFUtSr5TEACLyD6nW22a8ylv6+yKstKl+TffDu6CYA5VQ4b+v4QNU7nWBSLzhiSf0SV5tGQ3Q9Z8zuGyuM5OrnUurZvXCVx2y5+W/746xYLMXdIi5g4Hp08LBQrEkIAM1cygSjNILHklNeCKVmSsMuwVQYHXiLIeN9uQ==; Received: from phoenix.codelabs.ru (ppp91-77-166-241.pppoe.mtu-net.ru [91.77.166.241]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1RlXi5-000O5W-TP; Fri, 13 Jan 2012 06:21:46 +0300 Date: Fri, 13 Jan 2012 11:21:48 +0400 From: Eygene Ryabinkin To: John Baldwin Message-ID: References: <201201120648.q0C6mBio096662@svn.freebsd.org> <201201120748.28564.jhb@freebsd.org> <201201121438.16674.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wac7ysb48OaltWcw" Content-Disposition: inline In-Reply-To: <201201121438.16674.jhb@freebsd.org> Sender: rea@codelabs.ru Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230007 - in head: etc etc/rc.d share/man/man8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 03:21:47 -0000 --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thu, Jan 12, 2012 at 02:38:16PM -0500, John Baldwin wrote: > On Thursday, January 12, 2012 9:35:05 am Eygene Ryabinkin wrote: > > True, and it was suggested by Doug Barton. But why bother when > > the 'quiet' keyword is reserved for such cases? >=20 > Hmm, that's not quite how I see this. Either /etc/rc.d/dhclient > should silently exit if dhcpif is not true for the given interface, > or it should always whine IMO. It should tell one why it won't start DHCP on the interface, so it should whine at least for the ordinary usage (service dhclient start ), otherwise it will be hard to understand what's going on. > Given that everywhere else uses dhcpif to decide if dhclient should > be run, it seems that an explicit test of that should be used here > as well, even if it means an extra script. In short, this approach > is not consisent with all other users of the dhclient script, As I see, the only other conditional consumer of the dhclient script is /etc/network.subr, procedure ifconfig_up. And it has the other reason to invoke dhcpif: it determines if dhclient should be run synchronously and invokes it explicitely only in this case; for the asynchronous dhclient it relies on the devd to do the work once the interface will come up. > and this seems a hackish approach whose primary goal is to avoid > having devd use a wrapper script. Perhaps that goal is worth the > tradeoff, but it's not really clean. Well, partly my reasoning for suppressing the error message was the following one: 'quiet' will silence the messages about non-enabled service (via _enabled) that is set via rc.conf and in DHCP case we also have rc.conf knob (per-interface 'dhcp' keyword), so that's not a different case. But seems like the whole problem is that I used the err() function instead of doing 'echo $errmsg; exit 1'. Such code shouldn't be conditionalized for the devd, since it is only syslog message that worried people; devd doesn't care what is written to the standard output or the standard error by the scripts it invokes once it become the daemon, since everything goes to /dev/null after calling daemon(3). So, seems like that the following dhclient_pre_check() will make everyone happy: {{{ dhclient_pre_check() { if [ -z "${rc_force}" ] && ! dhcpif $ifn; then echo "'$ifn' is not a DHCP-enabled interface" exit 1 fi } }}} Hadn't tested it yet, but will do it today. > By your argument, btw since we use quietstart during boot, ifn_start > shouldn't even check dhcpif at all now, but just always run the > dhclient script (and if you did make that change, I would protest that > it was very wrong). Well, ifn_start (ifconfig_up to be precise) calls 'dhclient start' and not the 'quietstart'. Moreover, as I had explained, there is other dance with syncdhcpif there, so it can't just invoke dhclient unconditionally. The related topic: in the process of grepping for dhclient within /etc, I had found that /etc/netstart still wants to invoke it. But it will do a lone '/etc/rc.d/dhclient quietstart' and this will never be useful in the current state of dhclient: it will refuse to process any commands without the interface being specified. And since we have the invocation of /etc/rc.d/netif just two lines above, I think that it will be good to remove call to dhclient from /etc/netstart. At the time of the original addition of call to dhclient to /etc/netstart (r114213), dhclient script had another form, http://svnweb.freebsd.org/base/head/etc/rc.d/dhclient?revision=3D113759&v= iew=3Dmarkup&pathrev=3D114213 and it was really a normal rc.d script that requires only one argument. Now it is more of a helper-type script. =2E Am I missing something important here or the removal can really be done? Thanks. --=20 Eygene Ryabinkin ,,,^..^,,, [ Life's unfair - but root password helps! | codelabs.ru ] [ 82FE 06BC D497 C0DE 49EC 4FF0 16AF 9EAE 8152 ECFB | freebsd.org ] --wac7ysb48OaltWcw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk8P24wACgkQFq+eroFS7Ps6BQD/aS/GbOO736pyJAJm65/9JHgr eJfcNb4fH9Pox+UQzqIBAIYx6ryjgBrxGTHt1dy8GQqsGal+lGk3tjEWdqtj55K1 =7gDJ -----END PGP SIGNATURE----- --wac7ysb48OaltWcw-- From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 05:37:32 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DA4F106564A; Fri, 13 Jan 2012 05:37:32 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 213808FC0C; Fri, 13 Jan 2012 05:37:31 +0000 (UTC) Received: from lstewart.caia.swin.edu.au (lstewart.caia.swin.edu.au [136.186.229.95]) by lauren.room52.net (Postfix) with ESMTPSA id EF2FF7E8DD; Fri, 13 Jan 2012 16:37:29 +1100 (EST) Message-ID: <4F0FC319.7050305@freebsd.org> Date: Fri, 13 Jan 2012 16:37:29 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111127 Thunderbird/8.0 MIME-Version: 1.0 To: Garrett Wollman References: <201201120550.q0C5oXEQ094718@svn.freebsd.org> In-Reply-To: <201201120550.q0C5oXEQ094718@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r230005 - head/usr.sbin/tzsetup X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 05:37:32 -0000 On 01/12/12 16:50, Garrett Wollman wrote: > Author: wollman > Date: Thu Jan 12 05:50:32 2012 > New Revision: 230005 > URL: http://svn.freebsd.org/changeset/base/230005 > > Log: > Use a reasonable-sized buffer when formatting error messages about > installing zoneinfo. While we're in the vicinity, add some missing > error checking to eliminate an unhelpful error message when unlink() > fails. > > /me is embarrassed by the quality of his 16-year-old code. > The whole thing is awful and could stand a complete rewrite. > > PR: 164038 > Submitted by: Devin Teske (but implemented differently) > > Modified: > head/usr.sbin/tzsetup/tzsetup.c > > Modified: head/usr.sbin/tzsetup/tzsetup.c > ============================================================================== > --- head/usr.sbin/tzsetup/tzsetup.c Thu Jan 12 05:47:28 2012 (r230004) > +++ head/usr.sbin/tzsetup/tzsetup.c Thu Jan 12 05:50:32 2012 (r230005) > @@ -57,6 +57,13 @@ __FBSDID("$FreeBSD$"); > #define _PATH_DB "/var/db/zoneinfo" > #define _PATH_WALL_CMOS_CLOCK "/etc/wall_cmos_clock" > > +#ifdef PATH_MAX > +#define SILLY_BUFFER_SIZE 2*PATH_MAX > +#else > +#warning "Somebody needs to fix this to dynamically size this buffer." > +#define SILLY_BUFFER_SIZE 2048 > +#endif > Would use of sbuf(9) (which is also built as a library for use by userspace code) solve the problem? When used with the SBUF_AUTOEXTEND flag, it's perfectly suited for this kind of use. Cheers, Lawrence From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 06:14:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4415106566B; Fri, 13 Jan 2012 06:14:03 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C32F48FC17; Fri, 13 Jan 2012 06:14:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0D6E3TX045038; Fri, 13 Jan 2012 06:14:03 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0D6E3IA045036; Fri, 13 Jan 2012 06:14:03 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201201130614.q0D6E3IA045036@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 13 Jan 2012 06:14: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: r230042 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 06:14:03 -0000 Author: maxim Date: Fri Jan 13 06:14:03 2012 New Revision: 230042 URL: http://svn.freebsd.org/changeset/base/230042 Log: o Mac OS X 10.7 added (belatedly). FreeBSD 9.0-RELEASE added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Fri Jan 13 03:38:08 2012 (r230041) +++ head/share/misc/bsd-family-tree Fri Jan 13 06:14:03 2012 (r230042) @@ -247,11 +247,14 @@ FreeBSD 5.2 | | | FreeBSD FreeBSD | | | | | 8.2 7.4 | | | DragonFly 2.10.1 | v | | OpenBSD 4.9 | - | | | | | - | | | | | + | Mac OS X | | | + | 10.7 | | | | | | OpenBSD 5.0 | + +--FreeBSD | | | | + | 9.0 | | | | + | v | | | | | | | | | -FreeBSD 9 -current | NetBSD -current OpenBSD -current | +FreeBSD 10 -current | NetBSD -current OpenBSD -current | | | | | | v v v v v @@ -537,7 +540,9 @@ FreeBSD 7.4 2011-02-24 [FBD] FreeBSD 8.2 2011-02-24 [FBD] DragonFly 2.10.1 2011-04-26 [DFB] OpenBSD 4.9 2011-05-01 [OBD] +Mac OS X 10.7 2011-07-20 [APL] OpenBSD 5.0 2011-11-01 [OBD] +FreeBSD 9.0 2012-01-12 [FBD] Bibliography ------------------------ From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 06:18:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C05C106564A; Fri, 13 Jan 2012 06:18:24 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B0708FC08; Fri, 13 Jan 2012 06:18:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0D6IOe6045195; Fri, 13 Jan 2012 06:18:24 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0D6IOhL045193; Fri, 13 Jan 2012 06:18:24 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201201130618.q0D6IOhL045193@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 13 Jan 2012 06:18: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: r230043 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 06:18:24 -0000 Author: maxim Date: Fri Jan 13 06:18:23 2012 New Revision: 230043 URL: http://svn.freebsd.org/changeset/base/230043 Log: Copyright years updated. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Fri Jan 13 06:14:03 2012 (r230042) +++ head/share/misc/bsd-family-tree Fri Jan 13 06:18:23 2012 (r230043) @@ -600,7 +600,7 @@ original BSD announcements from Usenet o Steven M. Schultz for providing 2.8BSD, 2.10BSD, 2.11BSD manual pages. -- -Copyright (c) 1997-2007 Wolfram Schneider +Copyright (c) 1997-2012 Wolfram Schneider URL: http://cvsweb.freebsd.org/src/share/misc/bsd-family-tree $FreeBSD$ From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 06:51:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03926106566B; Fri, 13 Jan 2012 06:51:16 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB5598FC14; Fri, 13 Jan 2012 06:51:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0D6pFwU046748; Fri, 13 Jan 2012 06:51:15 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0D6pF0l046741; Fri, 13 Jan 2012 06:51:15 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201130651.q0D6pF0l046741@svn.freebsd.org> From: Kevin Lo Date: Fri, 13 Jan 2012 06:51: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: r230044 - in head: usr.bin/mail usr.bin/tftp usr.bin/unzip usr.sbin/config usr.sbin/lpr/lpc usr.sbin/timed/timedc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 06:51:16 -0000 Author: kevlo Date: Fri Jan 13 06:51:15 2012 New Revision: 230044 URL: http://svn.freebsd.org/changeset/base/230044 Log: fgets(3) returns a pointer, so compare against NULL, not integer 0. Modified: head/usr.bin/mail/edit.c head/usr.bin/tftp/main.c head/usr.bin/unzip/unzip.c head/usr.sbin/config/mkmakefile.c head/usr.sbin/lpr/lpc/lpc.c head/usr.sbin/timed/timedc/timedc.c Modified: head/usr.bin/mail/edit.c ============================================================================== --- head/usr.bin/mail/edit.c Fri Jan 13 06:18:23 2012 (r230043) +++ head/usr.bin/mail/edit.c Fri Jan 13 06:51:15 2012 (r230044) @@ -89,7 +89,7 @@ edit1(int *msgvec, int type) char *p; printf("Edit message %d [ynq]? ", msgvec[i]); - if (fgets(buf, sizeof(buf), stdin) == 0) + if (fgets(buf, sizeof(buf), stdin) == NULL) break; for (p = buf; *p == ' ' || *p == '\t'; p++) ; Modified: head/usr.bin/tftp/main.c ============================================================================== --- head/usr.bin/tftp/main.c Fri Jan 13 06:18:23 2012 (r230043) +++ head/usr.bin/tftp/main.c Fri Jan 13 06:51:15 2012 (r230044) @@ -734,7 +734,7 @@ command(void) history(hist, &he, H_ENTER, bp); } else { line[0] = 0; - if (fgets(line, sizeof line , stdin) == 0) { + if (fgets(line, sizeof line , stdin) == NULL) { if (feof(stdin)) { exit(txrx_error); } else { Modified: head/usr.bin/unzip/unzip.c ============================================================================== --- head/usr.bin/unzip/unzip.c Fri Jan 13 06:18:23 2012 (r230043) +++ head/usr.bin/unzip/unzip.c Fri Jan 13 06:51:15 2012 (r230044) @@ -422,7 +422,7 @@ handle_existing_file(char **path) fprintf(stderr, "replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", *path); - if (fgets(buf, sizeof(buf), stdin) == 0) { + if (fgets(buf, sizeof(buf), stdin) == NULL) { clearerr(stdin); printf("NULL\n(EOF or read error, " "treating as \"[N]one\"...)\n"); Modified: head/usr.sbin/config/mkmakefile.c ============================================================================== --- head/usr.sbin/config/mkmakefile.c Fri Jan 13 06:18:23 2012 (r230043) +++ head/usr.sbin/config/mkmakefile.c Fri Jan 13 06:51:15 2012 (r230044) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1993, 19801990 + * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -154,7 +154,7 @@ makefile(void) fprintf(ofp, "PROFLEVEL=%d\n", profiling); if (*srcdir != '\0') fprintf(ofp,"S=%s\n", srcdir); - while (fgets(line, BUFSIZ, ifp) != 0) { + while (fgets(line, BUFSIZ, ifp) != NULL) { if (*line != '%') { fprintf(ofp, "%s", line); continue; @@ -204,7 +204,7 @@ makehints(void) ifp = fopen(hint->hint_name, "r"); if (ifp == NULL) err(1, "%s", hint->hint_name); - while (fgets(line, BUFSIZ, ifp) != 0) { + while (fgets(line, BUFSIZ, ifp) != NULL) { /* zap trailing CR and/or LF */ while ((s = strrchr(line, '\n')) != NULL) *s = '\0'; @@ -266,7 +266,7 @@ makeenv(void) fprintf(ofp, "int envmode = %d;\n", envmode); fprintf(ofp, "char static_env[] = {\n"); if (ifp) { - while (fgets(line, BUFSIZ, ifp) != 0) { + while (fgets(line, BUFSIZ, ifp) != NULL) { /* zap trailing CR and/or LF */ while ((s = strrchr(line, '\n')) != NULL) *s = '\0'; Modified: head/usr.sbin/lpr/lpc/lpc.c ============================================================================== --- head/usr.sbin/lpr/lpc/lpc.c Fri Jan 13 06:18:23 2012 (r230043) +++ head/usr.sbin/lpr/lpc/lpc.c Fri Jan 13 06:51:15 2012 (r230044) @@ -188,7 +188,7 @@ cmdscanner(void) history(hist, &he, H_ENTER, bp); } else { - if (fgets(cmdline, MAX_CMDLINE, stdin) == 0) + if (fgets(cmdline, MAX_CMDLINE, stdin) == NULL) quit(0, NULL); if (cmdline[0] == 0 || cmdline[0] == '\n') break; Modified: head/usr.sbin/timed/timedc/timedc.c ============================================================================== --- head/usr.sbin/timed/timedc/timedc.c Fri Jan 13 06:18:23 2012 (r230043) +++ head/usr.sbin/timed/timedc/timedc.c Fri Jan 13 06:51:15 2012 (r230044) @@ -105,7 +105,7 @@ main(argc, argv) printf("timedc> "); (void) fflush(stdout); } - if (fgets(cmdline, sizeof(cmdline), stdin) == 0) + if (fgets(cmdline, sizeof(cmdline), stdin) == NULL) quit(); if (cmdline[0] == 0) break; From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 06:57:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EEFE106564A; Fri, 13 Jan 2012 06:57:00 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EEB218FC13; Fri, 13 Jan 2012 06:56:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0D6uxvf046977; Fri, 13 Jan 2012 06:56:59 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0D6uxxW046975; Fri, 13 Jan 2012 06:56:59 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201130656.q0D6uxxW046975@svn.freebsd.org> From: Kevin Lo Date: Fri, 13 Jan 2012 06:56: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: r230045 - head/sbin/routed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 06:57:00 -0000 Author: kevlo Date: Fri Jan 13 06:56:59 2012 New Revision: 230045 URL: http://svn.freebsd.org/changeset/base/230045 Log: Fix a style bug Modified: head/sbin/routed/parms.c Modified: head/sbin/routed/parms.c ============================================================================== --- head/sbin/routed/parms.c Fri Jan 13 06:51:15 2012 (r230044) +++ head/sbin/routed/parms.c Fri Jan 13 06:56:59 2012 (r230045) @@ -188,7 +188,7 @@ gwkludge(void) } for (lnum = 1; ; lnum++) { - if (0 == fgets(lbuf, sizeof(lbuf), fp)) + if (fgets(lbuf, sizeof(lbuf), fp) == NULL) break; lptr = lbuf; while (*lptr == ' ') From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 07:00:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60769106566C; Fri, 13 Jan 2012 07:00:48 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FA828FC1C; Fri, 13 Jan 2012 07:00:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0D70m86047155; Fri, 13 Jan 2012 07:00:48 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0D70meY047153; Fri, 13 Jan 2012 07:00:48 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201201130700.q0D70meY047153@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 13 Jan 2012 07:00: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: r230046 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 07:00:48 -0000 Author: gonzo Date: Fri Jan 13 07:00:47 2012 New Revision: 230046 URL: http://svn.freebsd.org/changeset/base/230046 Log: - Fix .rela case of R_MIPS_26 relocation. Addednds save diferently for .rel and .rela sections. It's shifted right two bits for former but saved as-is for latter. Modified: head/sys/mips/mips/elf_machdep.c Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Fri Jan 13 06:56:59 2012 (r230045) +++ head/sys/mips/mips/elf_machdep.c Fri Jan 13 07:00:47 2012 (r230046) @@ -227,7 +227,11 @@ elf_reloc_internal(linker_file_t lf, Elf return (-1); addend &= 0x03ffffff; - addend <<= 2; + /* + * Addendum for .rela R_MIPS_26 is not shifted right + */ + if (rela == NULL) + addend <<= 2; addr += ((Elf_Addr)where & 0xf0000000) | addend; addr >>= 2; From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 07:28:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B3281065670; Fri, 13 Jan 2012 07:28:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F7B08FC13; Fri, 13 Jan 2012 07:28:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0D7SZpZ048512; Fri, 13 Jan 2012 07:28:35 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0D7SZmU048509; Fri, 13 Jan 2012 07:28:35 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201130728.q0D7SZmU048509@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 13 Jan 2012 07:28: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: r230050 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 07:28:35 -0000 Author: hselasky Date: Fri Jan 13 07:28:34 2012 New Revision: 230050 URL: http://svn.freebsd.org/changeset/base/230050 Log: Correct use of USB 3.0 POWER bit in the port status register, hence it was overlapping the USB 3.0 root HUB's speed bits. Reported by: Kohji Okuno MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Fri Jan 13 07:19:02 2012 (r230049) +++ head/sys/dev/usb/controller/xhci.c Fri Jan 13 07:28:34 2012 (r230050) @@ -3194,8 +3194,13 @@ xhci_roothub_exec(struct usb_device *ude i |= UPS_OVERCURRENT_INDICATOR; if (v & XHCI_PS_PR) i |= UPS_RESET; - if (v & XHCI_PS_PP) - i |= UPS_PORT_POWER_SS; + if (v & XHCI_PS_PP) { + /* + * The USB 3.0 RH is using the + * USB 2.0's power bit + */ + i |= UPS_PORT_POWER; + } USETW(sc->sc_hub_desc.ps.wPortStatus, i); i = 0; Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Fri Jan 13 07:19:02 2012 (r230049) +++ head/sys/dev/usb/usb_hub.c Fri Jan 13 07:28:34 2012 (r230050) @@ -327,6 +327,7 @@ uhub_reattach_port(struct uhub_softc *sc enum usb_dev_speed speed; enum usb_hc_mode mode; usb_error_t err; + uint16_t power_mask; uint8_t timeout; DPRINTF("reattaching port %d\n", portno); @@ -373,20 +374,22 @@ repeat: case USB_SPEED_HIGH: case USB_SPEED_FULL: case USB_SPEED_LOW: - if (!(sc->sc_st.port_status & UPS_PORT_POWER)) { - DPRINTF("WARNING: strange, connected port %d " - "has no power\n", portno); - } + power_mask = UPS_PORT_POWER; break; case USB_SPEED_SUPER: - if (!(sc->sc_st.port_status & UPS_PORT_POWER_SS)) { - DPRINTF("WARNING: strange, connected port %d " - "has no power\n", portno); - } + if (udev->parent_hub == NULL) + power_mask = UPS_PORT_POWER; + else + power_mask = UPS_PORT_POWER_SS; break; default: + power_mask = 0; break; } + if (!(sc->sc_st.port_status & power_mask)) { + DPRINTF("WARNING: strange, connected port %d " + "has no power\n", portno); + } /* check if the device is in Host Mode */ From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 07:57:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D796106564A; Fri, 13 Jan 2012 07:57:37 +0000 (UTC) (envelope-from joel@vnode.se) Received: from mail.vnode.se (mail.vnode.se [62.119.52.80]) by mx1.freebsd.org (Postfix) with ESMTP id 8E6AA8FC08; Fri, 13 Jan 2012 07:57:36 +0000 (UTC) Received: from mail.vnode.se (localhost [127.0.0.1]) by mail.vnode.se (Postfix) with ESMTP id AC724E3F07A; Fri, 13 Jan 2012 08:57:34 +0100 (CET) X-Virus-Scanned: amavisd-new at vnode.se Received: from mail.vnode.se ([127.0.0.1]) by mail.vnode.se (mail.vnode.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eD-5VlHdIY7G; Fri, 13 Jan 2012 08:57:29 +0100 (CET) Received: from goofy01.vnodelab.local (unknown [212.247.52.12]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.vnode.se (Postfix) with ESMTPSA id 7246FE3F079; Fri, 13 Jan 2012 08:57:28 +0100 (CET) Date: Fri, 13 Jan 2012 08:57:26 +0100 From: Joel Dahl To: Pedro Giffuni Message-ID: <20120113075726.GA11137@goofy01.vnodelab.local> References: <201201120743.41757.jhb@freebsd.org> <1326396803.27040.YahooMailClassic@web113506.mail.gq1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1326396803.27040.YahooMailClassic@web113506.mail.gq1.yahoo.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin , joel@freebsd.org Subject: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 07:57:37 -0000 On 12-01-2012 11:33, Pedro Giffuni wrote: > Hello; > > --- Gio 12/1/12, John Baldwin ha scritto: > > > Da: John Baldwin > > Oggetto: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx > > A: "Pedro F. Giffuni" > > Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, joel@freebsd.org > > Data: Giovedì 12 gennaio 2012, 07:43 > > On Wednesday, January 11, 2012 > > 4:17:14 pm Pedro F. Giffuni wrote: > > > Author: pfg > > > Date: Wed Jan 11 21:17:14 2012 > > > New Revision: 229981 > > > URL: http://svn.freebsd.org/changeset/base/229981 > > > > ...    > > >   The emu10kx driver is now free from the GPL. > > >    > > >   PR:        153901 > > >   Tested by:    mav, joel > > >   Approved by:    jhb (mentor) > > >   MFC after:    2 weeks > > > > Is the emu10kx driver a superset of em10k1 now (meaning > > does it support all > > the em10k1 devices and should em10k1 be retired)? > > > > Both device drivers seem to have diverged significantly > and while emu10kx seems to be superior, some people still > have problems with it: > > http://docs.freebsd.org/cgi/mid.cgi?201201100024.q0A0OF24069073 This has already been fixed and MFC'd, AFAIK. -- Joel From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 08:24:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C2D11065673; Fri, 13 Jan 2012 08:24:53 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 274508FC15; Fri, 13 Jan 2012 08:24:52 +0000 (UTC) Received: by obbta17 with SMTP id ta17so2857915obb.13 for ; Fri, 13 Jan 2012 00:24:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=MhwV+R7WPiwOEm2BQufYh5TzrBYbSgG5LQP26QmPZJw=; b=alVZVwn/M2BL/pjRj+K2cERS9Pkc/vN0njTehT+YjZgEpxrEUNEWpRBpc84lET5bpx 2QgcA8WOE3nC99xuv6r4GJ82bjeztZDyjVGWiXkSVBSIyhp6jvrN8lrphKlcikUx1R2+ OkAIRUiBBTi2dLqf9TimmBV/gDcU/4NHnYX1Q= MIME-Version: 1.0 Received: by 10.182.122.5 with SMTP id lo5mr34238obb.13.1326443092530; Fri, 13 Jan 2012 00:24:52 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Fri, 13 Jan 2012 00:24:52 -0800 (PST) In-Reply-To: <201201130651.q0D6pF0l046741@svn.freebsd.org> References: <201201130651.q0D6pF0l046741@svn.freebsd.org> Date: Fri, 13 Jan 2012 11:24:52 +0300 X-Google-Sender-Auth: LQhhVbGnHd5kNsVGkK6xdDvlG9Y Message-ID: From: Sergey Kandaurov To: Kevin Lo Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230044 - in head: usr.bin/mail usr.bin/tftp usr.bin/unzip usr.sbin/config usr.sbin/lpr/lpc usr.sbin/timed/timedc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 08:24:53 -0000 On 13 January 2012 10:51, Kevin Lo wrote: > Author: kevlo > Date: Fri Jan 13 06:51:15 2012 > New Revision: 230044 > URL: http://svn.freebsd.org/changeset/base/230044 > > Log: > =A0fgets(3) returns a pointer, so compare against NULL, not integer 0. > [...] > Modified: head/usr.sbin/config/mkmakefile.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/usr.sbin/config/mkmakefile.c =A0 Fri Jan 13 06:18:23 2012 =A0 = =A0 =A0 =A0(r230043) > +++ head/usr.sbin/config/mkmakefile.c =A0 Fri Jan 13 06:51:15 2012 =A0 = =A0 =A0 =A0(r230044) > @@ -1,5 +1,5 @@ > =A0/* > - * Copyright (c) 1993, 19801990 > + * Copyright (c) 1980, 1993 This should be rather "Copyright (c) 1980, 1990, 1993" It was "1980,1990" until 4.4BSD-Alpha (and i386bsd), then changed to "1993, 19801990" in 4.4BSD-Lite. --=20 wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 09:08:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B872106566B; Fri, 13 Jan 2012 09:08:42 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2AA038FC08; Fri, 13 Jan 2012 09:08:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0D98gS3052403; Fri, 13 Jan 2012 09:08:42 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0D98fhr052401; Fri, 13 Jan 2012 09:08:41 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201130908.q0D98fhr052401@svn.freebsd.org> From: Kevin Lo Date: Fri, 13 Jan 2012 09:08: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: r230051 - head/usr.sbin/config X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 09:08:42 -0000 Author: kevlo Date: Fri Jan 13 09:08:41 2012 New Revision: 230051 URL: http://svn.freebsd.org/changeset/base/230051 Log: Fix copyright year Spotted by: pluknet Modified: head/usr.sbin/config/mkmakefile.c Modified: head/usr.sbin/config/mkmakefile.c ============================================================================== --- head/usr.sbin/config/mkmakefile.c Fri Jan 13 07:28:34 2012 (r230050) +++ head/usr.sbin/config/mkmakefile.c Fri Jan 13 09:08:41 2012 (r230051) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1980, 1993 + * Copyright (c) 1980, 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 09:10:59 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B877106566C; Fri, 13 Jan 2012 09:10:59 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id B97758FC1B; Fri, 13 Jan 2012 09:10:57 +0000 (UTC) Received: from [127.0.0.1] (kevlo@kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.3/8.14.3) with ESMTP id q0D9AuRv009970; Fri, 13 Jan 2012 17:10:56 +0800 (CST) From: Kevin Lo To: Sergey Kandaurov In-Reply-To: References: <201201130651.q0D6pF0l046741@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Fri, 13 Jan 2012 17:10:56 +0800 Message-ID: <1326445856.1878.1.camel@esl.kevlo.org> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r230044 - in head: usr.bin/mail usr.bin/tftp usr.bin/unzip usr.sbin/config usr.sbin/lpr/lpc usr.sbin/timed/timedc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 09:10:59 -0000 On Fri, 2012-01-13 at 11:24 +0300, Sergey Kandaurov wrote: > On 13 January 2012 10:51, Kevin Lo wrote: > > Author: kevlo > > Date: Fri Jan 13 06:51:15 2012 > > New Revision: 230044 > > URL: http://svn.freebsd.org/changeset/base/230044 > > > > Log: > > fgets(3) returns a pointer, so compare against NULL, not integer 0. > > > [...] > > Modified: head/usr.sbin/config/mkmakefile.c > > ============================================================================== > > --- head/usr.sbin/config/mkmakefile.c Fri Jan 13 06:18:23 2012 (r230043) > > +++ head/usr.sbin/config/mkmakefile.c Fri Jan 13 06:51:15 2012 (r230044) > > @@ -1,5 +1,5 @@ > > /* > > - * Copyright (c) 1993, 19801990 > > + * Copyright (c) 1980, 1993 > > This should be rather "Copyright (c) 1980, 1990, 1993" > It was "1980,1990" until 4.4BSD-Alpha (and i386bsd), > then changed to "1993, 19801990" in 4.4BSD-Lite. My bad. This change should be done in a separate commit. Just committed the fix to HEAD, thanks for pointing that out. Kevin From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 10:21:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6579E106566B; Fri, 13 Jan 2012 10:21:16 +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 462C98FC1C; Fri, 13 Jan 2012 10:21:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DALGml055212; Fri, 13 Jan 2012 10:21:16 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DALGXU055209; Fri, 13 Jan 2012 10:21:16 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201131021.q0DALGXU055209@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 13 Jan 2012 10:21: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: r230052 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 10:21:16 -0000 Author: luigi Date: Fri Jan 13 10:21:15 2012 New Revision: 230052 URL: http://svn.freebsd.org/changeset/base/230052 Log: Two performance-related fixes: 1. as reported by Alexander Fiveg, the allocator was reporting half of the allocated memory. Fix this by exiting from the loop earlier (not too critical because this code is going away soon). 2. following a discussion on freebsd-current http://lists.freebsd.org/pipermail/freebsd-current/2012-January/031144.html turns out that (re)loading the dmamap was expensive and not optimized. This operation is in the critical path when doing zero-copy forwarding between interfaces. At least on netmap and i386/amd64, the bus_dmamap_load can be completely bypassed if the map is NULL, so we do it. The latter change gives an almost 3x improvement in forwarding performance, from the previous 9.5Mpps at 2.9GHz to the current line rate (14.2Mpps) at 1.733GHz. (this is for 64+4 byte packets, in other configurations the PCIe bus is a bottleneck). Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Fri Jan 13 09:08:41 2012 (r230051) +++ head/sys/dev/netmap/netmap.c Fri Jan 13 10:21:15 2012 (r230052) @@ -426,7 +426,6 @@ netmap_dtor(void *data) } - /* * Create and return a new ``netmap_if`` object, and possibly also * rings and packet buffors. @@ -1393,30 +1392,6 @@ netmap_reset(struct netmap_adapter *na, return kring->ring->slot; } -static void -ns_dmamap_cb(__unused void *arg, __unused bus_dma_segment_t * segs, - __unused int nseg, __unused int error) -{ -} - -/* unload a bus_dmamap and create a new one. Used when the - * buffer in the slot is changed. - * XXX buflen is probably not needed, buffers have constant size. - */ -void -netmap_reload_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf) -{ - bus_dmamap_unload(tag, map); - bus_dmamap_load(tag, map, buf, NETMAP_BUF_SIZE, ns_dmamap_cb, - NULL, BUS_DMA_NOWAIT); -} - -void -netmap_load_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf) -{ - bus_dmamap_load(tag, map, buf, NETMAP_BUF_SIZE, ns_dmamap_cb, - NULL, BUS_DMA_NOWAIT); -} /*------ netmap memory allocator -------*/ /* @@ -1541,7 +1516,7 @@ netmap_memory_init(void) int i, n, sz = NETMAP_MEMORY_SIZE; int extra_sz = 0; // space for rings and two spare buffers - for (; !buf && sz >= 1<<20; sz >>=1) { + for (; sz >= 1<<20; sz >>=1) { extra_sz = sz/200; extra_sz = (extra_sz + 2*PAGE_SIZE - 1) & ~(PAGE_SIZE-1); buf = contigmalloc(sz + extra_sz, @@ -1552,6 +1527,8 @@ netmap_memory_init(void) PAGE_SIZE, /* alignment */ 0 /* boundary */ ); + if (buf) + break; } if (buf == NULL) return (ENOMEM); Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Fri Jan 13 09:08:41 2012 (r230051) +++ head/sys/dev/netmap/netmap_kern.h Fri Jan 13 10:21:15 2012 (r230052) @@ -169,16 +169,8 @@ int netmap_start(struct ifnet *, struct enum txrx { NR_RX = 0, NR_TX = 1 }; struct netmap_slot *netmap_reset(struct netmap_adapter *na, enum txrx tx, int n, u_int new_cur); -void netmap_load_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf); -void netmap_reload_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf); int netmap_ring_reinit(struct netmap_kring *); -/* - * XXX eventually, get rid of netmap_total_buffers and netmap_buffer_base - * in favour of the structure - */ -// struct netmap_buf_pool; -// extern struct netmap_buf_pool nm_buf_pool; extern u_int netmap_total_buffers; extern char *netmap_buffer_base; extern int netmap_verbose; // XXX debugging @@ -203,6 +195,35 @@ enum { #define NA(_ifp) ((struct netmap_adapter *)WNA(_ifp)) +/* Callback invoked by the dma machinery after a successfull dmamap_load */ +static void netmap_dmamap_cb(__unused void *arg, + __unused bus_dma_segment_t * segs, __unused int nseg, __unused int error) +{ +} + +/* bus_dmamap_load wrapper: call aforementioned function if map != NULL. + * XXX can we do it without a callback ? + */ +static inline void +netmap_load_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf) +{ + if (map) + bus_dmamap_load(tag, map, buf, NETMAP_BUF_SIZE, + netmap_dmamap_cb, NULL, BUS_DMA_NOWAIT); +} + +/* update the map when a buffer changes. */ +static inline void +netmap_reload_map(bus_dma_tag_t tag, bus_dmamap_t map, void *buf) +{ + if (map) { + bus_dmamap_unload(tag, map); + bus_dmamap_load(tag, map, buf, NETMAP_BUF_SIZE, + netmap_dmamap_cb, NULL, BUS_DMA_NOWAIT); + } +} + + /* * NMB return the virtual address of a buffer (buffer 0 on bad index) * PNMB also fills the physical address From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 10:21:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E49CC106567A; Fri, 13 Jan 2012 10:21:17 +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 CE61D8FC27; Fri, 13 Jan 2012 10:21:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DALHAb055248; Fri, 13 Jan 2012 10:21:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DALH1m055244; Fri, 13 Jan 2012 10:21:17 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201131021.q0DALH1m055244@svn.freebsd.org> From: Alexander Motin Date: Fri, 13 Jan 2012 10:21: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: r230053 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 10:21:18 -0000 Author: mav Date: Fri Jan 13 10:21:17 2012 New Revision: 230053 URL: http://svn.freebsd.org/changeset/base/230053 Log: Add BIO_DELETE support for SCSI Direct Access devices (da). Depending on device capabilities use different methods to implement it. Currently used method can be read/set via kern.cam.da.X.delete_method sysctls. Possible values are: NONE - no provisioning support reported by the device; DISABLE - provisioning support was disabled because of errors; ZERO - use WRITE SAME (10) command to write zeroes; WS10 - use WRITE SAME (10) command with UNMAP bit set; WS16 - use WRITE SAME (16) command with UNMAP bit set; UNMAP - use UNMAP command (equivalent of the ATA DSM TRIM command). The last two methods (UNMAP and WS16) are defined by SBC specification and the UNMAP method is the most advanced one. The rest of methods I've found supported in Linux, and as soon as they were trivial to implement, then why not? Hope they will be useful in some cases. Unluckily I have no devices properly reporting parameters of the logical block provisioning support via respective VPD pages (0xB0 and 0xB2). So all info I have/use now is the flag telling whether logical block provisioning is supported or not. As result, specific methods chosen now by trying different ones in order (UNMAP, WS16, DISABLE) and checking completion status to fallback if needed. I don't expect problems from this, as if something go wrong, it should just disable itself. It may disable even too aggressively if only some command parameter misfit. Unlike Linux, which executes each delete with separate request, I've implemented here the same request aggregation as implemented in ada driver. Tests on SSDs I have show much better results doing it this way: above 8GB/s of the linear delete on Intel SATA SSD on LSI SAS HBA (mps). Reviewed by: silence on scsi@ MFC after: 2 month Sponsored by: iXsystems, Inc. Modified: head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Fri Jan 13 10:21:15 2012 (r230052) +++ head/sys/cam/scsi/scsi_all.c Fri Jan 13 10:21:17 2012 (r230053) @@ -364,6 +364,8 @@ static struct op_table_entry scsi_op_cod { 0x40, D | T | L | P | W | R | O | M | S | C, "CHANGE DEFINITION" }, /* 41 O WRITE SAME(10) */ { 0x41, D, "WRITE SAME(10)" }, + /* 42 O UNMAP */ + { 0x42, D, "UNMAP" }, /* 42 O READ SUB-CHANNEL */ { 0x42, R, "READ SUB-CHANNEL" }, /* 43 O READ TOC/PMA/ATIP */ @@ -5570,6 +5572,104 @@ scsi_read_write(struct ccb_scsiio *csio, } void +scsi_write_same(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + int minimum_cmd_size, u_int64_t lba, u_int32_t block_count, + u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + u_int8_t cdb_len; + if ((minimum_cmd_size < 16) && + ((block_count & 0xffff) == block_count) && + ((lba & 0xffffffff) == lba)) { + /* + * Need a 10 byte cdb. + */ + struct scsi_write_same_10 *scsi_cmd; + + scsi_cmd = (struct scsi_write_same_10 *)&csio->cdb_io.cdb_bytes; + scsi_cmd->opcode = WRITE_SAME_10; + scsi_cmd->byte2 = byte2; + scsi_ulto4b(lba, scsi_cmd->addr); + scsi_cmd->group = 0; + scsi_ulto2b(block_count, scsi_cmd->length); + scsi_cmd->control = 0; + cdb_len = sizeof(*scsi_cmd); + + CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, + ("10byte: %x%x%x%x:%x%x: %d\n", scsi_cmd->addr[0], + scsi_cmd->addr[1], scsi_cmd->addr[2], + scsi_cmd->addr[3], scsi_cmd->length[0], + scsi_cmd->length[1], dxfer_len)); + } else { + /* + * 16 byte CDB. We'll only get here if the LBA is larger + * than 2^32, or if the user asks for a 16 byte command. + */ + struct scsi_write_same_16 *scsi_cmd; + + scsi_cmd = (struct scsi_write_same_16 *)&csio->cdb_io.cdb_bytes; + scsi_cmd->opcode = WRITE_SAME_16; + scsi_cmd->byte2 = byte2; + scsi_u64to8b(lba, scsi_cmd->addr); + scsi_ulto4b(block_count, scsi_cmd->length); + scsi_cmd->group = 0; + scsi_cmd->control = 0; + cdb_len = sizeof(*scsi_cmd); + + CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, + ("16byte: %x%x%x%x%x%x%x%x:%x%x%x%x: %d\n", + scsi_cmd->addr[0], scsi_cmd->addr[1], + scsi_cmd->addr[2], scsi_cmd->addr[3], + scsi_cmd->addr[4], scsi_cmd->addr[5], + scsi_cmd->addr[6], scsi_cmd->addr[7], + scsi_cmd->length[0], scsi_cmd->length[1], + scsi_cmd->length[2], scsi_cmd->length[3], + dxfer_len)); + } + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_OUT, + tag_action, + data_ptr, + dxfer_len, + sense_len, + cdb_len, + timeout); +} + +void +scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + u_int8_t *data_ptr, u_int16_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + struct scsi_unmap *scsi_cmd; + + scsi_cmd = (struct scsi_unmap *)&csio->cdb_io.cdb_bytes; + scsi_cmd->opcode = UNMAP; + scsi_cmd->byte2 = byte2; + scsi_ulto4b(0, scsi_cmd->reserved); + scsi_cmd->group = 0; + scsi_ulto2b(dxfer_len, scsi_cmd->length); + scsi_cmd->control = 0; + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_OUT, + tag_action, + data_ptr, + dxfer_len, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + +void scsi_receive_diagnostic_results(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), uint8_t tag_action, int pcv, uint8_t page_code, Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Fri Jan 13 10:21:15 2012 (r230052) +++ head/sys/cam/scsi/scsi_all.h Fri Jan 13 10:21:17 2012 (r230053) @@ -819,6 +819,41 @@ struct scsi_rw_16 u_int8_t control; }; +struct scsi_write_same_10 +{ + uint8_t opcode; + uint8_t byte2; +#define SWS_LBDATA 0x02 +#define SWS_PBDATA 0x04 +#define SWS_UNMAP 0x08 +#define SWS_ANCHOR 0x10 + uint8_t addr[4]; + uint8_t group; + uint8_t length[2]; + uint8_t control; +}; + +struct scsi_write_same_16 +{ + uint8_t opcode; + uint8_t byte2; + uint8_t addr[8]; + uint8_t length[4]; + uint8_t group; + uint8_t control; +}; + +struct scsi_unmap +{ + uint8_t opcode; + uint8_t byte2; +#define SU_ANCHOR 0x01 + uint8_t reserved[4]; + uint8_t group; + uint8_t length[2]; + uint8_t control; +}; + struct scsi_write_verify_10 { uint8_t opcode; @@ -957,6 +992,8 @@ struct ata_pass_16 { #define WRITE_BUFFER 0x3B #define READ_BUFFER 0x3C #define CHANGE_DEFINITION 0x40 +#define WRITE_SAME_10 0x41 +#define UNMAP 0x42 #define LOG_SELECT 0x4C #define LOG_SENSE 0x4D #define MODE_SELECT_10 0x55 @@ -970,6 +1007,7 @@ struct ata_pass_16 { #define WRITE_16 0x8A #define WRITE_VERIFY_16 0x8E #define SYNCHRONIZE_CACHE_16 0x91 +#define WRITE_SAME_16 0x93 #define SERVICE_ACTION_IN 0x9E #define REPORT_LUNS 0xA0 #define ATA_PASS_12 0xA1 @@ -2312,6 +2350,20 @@ void scsi_read_write(struct ccb_scsiio * u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); +void scsi_write_same(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + int minimum_cmd_size, u_int64_t lba, + u_int32_t block_count, u_int8_t *data_ptr, + u_int32_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout); + +void scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + u_int8_t *data_ptr, u_int16_t dxfer_len, + u_int8_t sense_len, u_int32_t timeout); + void scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int start, int load_eject, Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Jan 13 10:21:15 2012 (r230052) +++ head/sys/cam/scsi/scsi_da.c Fri Jan 13 10:21:17 2012 (r230053) @@ -83,8 +83,7 @@ typedef enum { DA_FLAG_RETRY_UA = 0x080, DA_FLAG_OPEN = 0x100, DA_FLAG_SCTX_INIT = 0x200, - DA_FLAG_CAN_RC16 = 0x400, - DA_FLAG_CAN_LBPME = 0x800 + DA_FLAG_CAN_RC16 = 0x400 } da_flags; typedef enum { @@ -101,10 +100,24 @@ typedef enum { DA_CCB_BUFFER_IO = 0x03, DA_CCB_WAITING = 0x04, DA_CCB_DUMP = 0x05, + DA_CCB_DELETE = 0x06, DA_CCB_TYPE_MASK = 0x0F, DA_CCB_RETRY_UA = 0x10 } da_ccb_state; +typedef enum { + DA_DELETE_NONE, + DA_DELETE_DISABLE, + DA_DELETE_ZERO, + DA_DELETE_WS10, + DA_DELETE_WS16, + DA_DELETE_UNMAP, + DA_DELETE_MAX = DA_DELETE_UNMAP +} da_delete_methods; + +static const char *da_delete_method_names[] = + { "NONE", "DISABLE", "ZERO", "WS10", "WS16", "UNMAP" }; + /* Offsets into our private area for storing information */ #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 @@ -119,8 +132,12 @@ struct disk_params { u_int stripeoffset; }; +#define UNMAP_MAX_RANGES 512 + struct da_softc { struct bio_queue_head bio_queue; + struct bio_queue_head delete_queue; + struct bio_queue_head delete_run_queue; SLIST_ENTRY(da_softc) links; LIST_HEAD(, ccb_hdr) pending_ccbs; da_state state; @@ -130,6 +147,10 @@ struct da_softc { int error_inject; int ordered_tag_count; int outstanding_cmds; + int unmap_max_ranges; + int unmap_max_lba; + int delete_running; + da_delete_methods delete_method; struct disk_params params; struct disk *disk; union ccb saved_ccb; @@ -138,6 +159,7 @@ struct da_softc { struct sysctl_oid *sysctl_tree; struct callout sendordered_c; uint64_t wwpn; + uint8_t unmap_buf[UNMAP_MAX_RANGES * 16 + 8]; }; struct da_quirk_entry { @@ -796,6 +818,7 @@ static void daasync(void *callback_arg, struct cam_path *path, void *arg); static void dasysctlinit(void *context, int pending); static int dacmdsizesysctl(SYSCTL_HANDLER_ARGS); +static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS); static periph_ctor_t daregister; static periph_dtor_t dacleanup; static periph_start_t dastart; @@ -916,6 +939,10 @@ daopen(struct disk *dp) softc->disk->d_fwheads = softc->params.heads; softc->disk->d_devstat->block_size = softc->params.secsize; softc->disk->d_devstat->flags &= ~DEVSTAT_BS_UNAVAILABLE; + if (softc->delete_method > DA_DELETE_DISABLE) + softc->disk->d_flags |= DISKFLAG_CANDELETE; + else + softc->disk->d_flags &= ~DISKFLAG_CANDELETE; if ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0 && (softc->quirks & DA_Q_NO_PREVENT) == 0) @@ -1013,6 +1040,26 @@ daclose(struct disk *dp) return (0); } +static void +daschedule(struct cam_periph *periph) +{ + struct da_softc *softc = (struct da_softc *)periph->softc; + uint32_t prio; + + /* Check if cam_periph_getccb() was called. */ + prio = periph->immediate_priority; + + /* Check if we have more work to do. */ + if (bioq_first(&softc->bio_queue) || + (!softc->delete_running && bioq_first(&softc->delete_queue))) { + prio = CAM_PRIORITY_NORMAL; + } + + /* Schedule CCB if any of above is true. */ + if (prio != CAM_PRIORITY_NONE) + xpt_schedule(periph, prio); +} + /* * Actually translate the requested transfer into one the physical driver * can understand. The transfer is described by a buf and will include @@ -1045,12 +1092,18 @@ dastrategy(struct bio *bp) /* * Place it in the queue of disk activities for this disk */ - bioq_disksort(&softc->bio_queue, bp); + if (bp->bio_cmd == BIO_DELETE) { + if (bp->bio_bcount == 0) + biodone(bp); + else + bioq_disksort(&softc->delete_queue, bp); + } else + bioq_disksort(&softc->bio_queue, bp); /* * Schedule ourselves for performing the work. */ - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + daschedule(periph); cam_periph_unlock(periph); return; @@ -1213,6 +1266,7 @@ daoninvalidate(struct cam_periph *periph * with XPT_ABORT_CCB. */ bioq_flush(&softc->bio_queue, NULL, ENXIO); + bioq_flush(&softc->delete_queue, NULL, ENXIO); disk_gone(softc->disk); xpt_print(periph->path, "lost device - %d outstanding, %d refs\n", @@ -1358,6 +1412,10 @@ dasysctlinit(void *context, int pending) * the fly. */ SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "delete_method", CTLTYPE_STRING | CTLFLAG_RW, + &softc->delete_method, 0, dadeletemethodsysctl, "A", + "BIO_DELETE execution method"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW, &softc->minimum_cmd_size, 0, dacmdsizesysctl, "I", "Minimum CDB size"); @@ -1431,6 +1489,32 @@ dacmdsizesysctl(SYSCTL_HANDLER_ARGS) return (0); } +static int +dadeletemethodsysctl(SYSCTL_HANDLER_ARGS) +{ + char buf[16]; + int error; + const char *p; + int i, value; + + value = *(int *)arg1; + if (value < 0 || value > DA_DELETE_MAX) + p = "UNKNOWN"; + else + p = da_delete_method_names[value]; + strncpy(buf, p, sizeof(buf)); + error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + if (error != 0 || req->newptr == NULL) + return (error); + for (i = 0; i <= DA_DELETE_MAX; i++) { + if (strcmp(buf, da_delete_method_names[i]) != 0) + continue; + *(int *)arg1 = i; + return (0); + } + return (EINVAL); +} + static cam_status daregister(struct cam_periph *periph, void *arg) { @@ -1463,10 +1547,14 @@ daregister(struct cam_periph *periph, vo LIST_INIT(&softc->pending_ccbs); softc->state = DA_STATE_PROBE; bioq_init(&softc->bio_queue); + bioq_init(&softc->delete_queue); + bioq_init(&softc->delete_run_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= DA_FLAG_PACK_REMOVABLE; if ((cgd->inq_data.flags & SID_CmdQue) != 0) softc->flags |= DA_FLAG_TAGGED_QUEUING; + softc->unmap_max_ranges = UNMAP_MAX_RANGES; + softc->unmap_max_lba = 1024*1024*2; periph->softc = softc; @@ -1621,13 +1709,10 @@ dastart(struct cam_periph *periph, union switch (softc->state) { case DA_STATE_NORMAL: { - /* Pull a buffer from the queue and get going on it */ - struct bio *bp; + struct bio *bp, *bp1; + uint8_t tag_code; - /* - * See if there is a buf with work for us to do.. - */ - bp = bioq_first(&softc->bio_queue); + /* Execute immediate CCB if waiting. */ if (periph->immediate_priority <= periph->pinfo.priority) { CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); @@ -1636,84 +1721,186 @@ dastart(struct cam_periph *periph, union periph_links.sle); periph->immediate_priority = CAM_PRIORITY_NONE; wakeup(&periph->ccb_list); - } else if (bp == NULL) { - xpt_release_ccb(start_ccb); - } else { - u_int8_t tag_code; + /* May have more work to do, so ensure we stay scheduled */ + daschedule(periph); + break; + } - bioq_remove(&softc->bio_queue, bp); + /* Run BIO_DELETE if not running yet. */ + if (!softc->delete_running && + (bp = bioq_first(&softc->delete_queue)) != NULL) { + uint64_t lba; + u_int count; + + if (softc->delete_method == DA_DELETE_UNMAP) { + uint8_t *buf = softc->unmap_buf; + uint64_t lastlba = (uint64_t)-1; + uint32_t lastcount = 0; + int blocks = 0, off, ranges = 0; + + softc->delete_running = 1; + bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + lba = bp1->bio_pblkno; + count = bp1->bio_bcount / softc->params.secsize; + + /* Try to extend the previous range. */ + if (lba == lastlba) { + lastcount += count; + off = (ranges - 1) * 16 + 8; + scsi_ulto4b(lastcount, &buf[off + 8]); + } else if (count > 0) { + off = ranges * 16 + 8; + scsi_u64to8b(lba, &buf[off + 0]); + scsi_ulto4b(count, &buf[off + 8]); + lastcount = count; + ranges++; + } + blocks += count; + lastlba = lba + count; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || + ranges >= softc->unmap_max_ranges || + blocks + bp1->bio_bcount / + softc->params.secsize > softc->unmap_max_lba) + break; + } while (1); + scsi_ulto2b(count * 16 + 6, &buf[0]); + scsi_ulto2b(count * 16, &buf[2]); + + scsi_unmap(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*byte2*/0, + /*data_ptr*/ buf, + /*dxfer_len*/ count * 16 + 8, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; + goto out; + } else if (softc->delete_method == DA_DELETE_ZERO || + softc->delete_method == DA_DELETE_WS10 || + softc->delete_method == DA_DELETE_WS16) { + softc->delete_running = 1; + lba = bp->bio_pblkno; + count = 0; + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + count += bp1->bio_bcount / softc->params.secsize; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || + lba + count != bp1->bio_pblkno || + count + bp1->bio_bcount / + softc->params.secsize > 0xffff) + break; + } while (1); + + scsi_write_same(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*byte2*/softc->delete_method == + DA_DELETE_ZERO ? 0 : SWS_UNMAP, + softc->delete_method == + DA_DELETE_WS16 ? 16 : 10, + /*lba*/lba, + /*block_count*/count, + /*data_ptr*/ __DECONST(void *, + zero_region), + /*dxfer_len*/ softc->params.secsize, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; + goto out; + } else { + bioq_flush(&softc->delete_queue, NULL, 0); + /* FALLTHROUGH */ + } + } - if ((bp->bio_flags & BIO_ORDERED) != 0 - || (softc->flags & DA_FLAG_NEED_OTAG) != 0) { - softc->flags &= ~DA_FLAG_NEED_OTAG; - softc->ordered_tag_count++; - tag_code = MSG_ORDERED_Q_TAG; - } else { - tag_code = MSG_SIMPLE_Q_TAG; - } - switch (bp->bio_cmd) { - case BIO_READ: - case BIO_WRITE: - scsi_read_write(&start_ccb->csio, - /*retries*/da_retry_count, - /*cbfcnp*/dadone, - /*tag_action*/tag_code, - /*read_op*/bp->bio_cmd - == BIO_READ, - /*byte2*/0, - softc->minimum_cmd_size, - /*lba*/bp->bio_pblkno, - /*block_count*/bp->bio_bcount / - softc->params.secsize, - /*data_ptr*/ bp->bio_data, - /*dxfer_len*/ bp->bio_bcount, - /*sense_len*/SSD_FULL_SIZE, - da_default_timeout * 1000); - break; - case BIO_FLUSH: - /* - * BIO_FLUSH doesn't currently communicate - * range data, so we synchronize the cache - * over the whole disk. We also force - * ordered tag semantics the flush applies - * to all previously queued I/O. - */ - scsi_synchronize_cache(&start_ccb->csio, - /*retries*/1, - /*cbfcnp*/dadone, - MSG_ORDERED_Q_TAG, - /*begin_lba*/0, - /*lb_count*/0, - SSD_FULL_SIZE, - da_default_timeout*1000); - break; - } - start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; + /* Run regular command. */ + bp = bioq_takefirst(&softc->bio_queue); + if (bp == NULL) { + xpt_release_ccb(start_ccb); + break; + } + + if ((bp->bio_flags & BIO_ORDERED) != 0 || + (softc->flags & DA_FLAG_NEED_OTAG) != 0) { + softc->flags &= ~DA_FLAG_NEED_OTAG; + softc->ordered_tag_count++; + tag_code = MSG_ORDERED_Q_TAG; + } else { + tag_code = MSG_SIMPLE_Q_TAG; + } + switch (bp->bio_cmd) { + case BIO_READ: + case BIO_WRITE: + scsi_read_write(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/tag_code, + /*read_op*/bp->bio_cmd + == BIO_READ, + /*byte2*/0, + softc->minimum_cmd_size, + /*lba*/bp->bio_pblkno, + /*block_count*/bp->bio_bcount / + softc->params.secsize, + /*data_ptr*/ bp->bio_data, + /*dxfer_len*/ bp->bio_bcount, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + break; + case BIO_FLUSH: /* - * Block out any asyncronous callbacks - * while we touch the pending ccb list. + * BIO_FLUSH doesn't currently communicate + * range data, so we synchronize the cache + * over the whole disk. We also force + * ordered tag semantics the flush applies + * to all previously queued I/O. */ - LIST_INSERT_HEAD(&softc->pending_ccbs, - &start_ccb->ccb_h, periph_links.le); - softc->outstanding_cmds++; - - /* We expect a unit attention from this device */ - if ((softc->flags & DA_FLAG_RETRY_UA) != 0) { - start_ccb->ccb_h.ccb_state |= DA_CCB_RETRY_UA; - softc->flags &= ~DA_FLAG_RETRY_UA; - } - - start_ccb->ccb_h.ccb_bp = bp; - bp = bioq_first(&softc->bio_queue); - - xpt_action(start_ccb); + scsi_synchronize_cache(&start_ccb->csio, + /*retries*/1, + /*cbfcnp*/dadone, + MSG_ORDERED_Q_TAG, + /*begin_lba*/0, + /*lb_count*/0, + SSD_FULL_SIZE, + da_default_timeout*1000); + break; } - - if (bp != NULL) { - /* Have more work to do, so ensure we stay scheduled */ - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; + +out: + /* + * Block out any asyncronous callbacks + * while we touch the pending ccb list. + */ + LIST_INSERT_HEAD(&softc->pending_ccbs, + &start_ccb->ccb_h, periph_links.le); + softc->outstanding_cmds++; + + /* We expect a unit attention from this device */ + if ((softc->flags & DA_FLAG_RETRY_UA) != 0) { + start_ccb->ccb_h.ccb_state |= DA_CCB_RETRY_UA; + softc->flags &= ~DA_FLAG_RETRY_UA; } + + start_ccb->ccb_h.ccb_bp = bp; + xpt_action(start_ccb); + + /* May have more work to do, so ensure we stay scheduled */ + daschedule(periph); break; } case DA_STATE_PROBE: @@ -1779,9 +1966,42 @@ cmd6workaround(union ccb *ccb) struct scsi_rw_10 *cmd10; struct da_softc *softc; u_int8_t *cdb; + struct bio *bp; int frozen; cdb = ccb->csio.cdb_io.cdb_bytes; + softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc; + + if (ccb->ccb_h.ccb_state == DA_CCB_DELETE) { + if (softc->delete_method == DA_DELETE_UNMAP) { + xpt_print(ccb->ccb_h.path, "UNMAP is not supported, " + "switching to WRITE SAME(16) with UNMAP.\n"); + softc->delete_method = DA_DELETE_WS16; + } else if (softc->delete_method == DA_DELETE_WS16) { + xpt_print(ccb->ccb_h.path, + "WRITE SAME(16) with UNMAP is not supported, " + "disabling BIO_DELETE.\n"); + softc->delete_method = DA_DELETE_DISABLE; + } else if (softc->delete_method == DA_DELETE_WS10) { + xpt_print(ccb->ccb_h.path, + "WRITE SAME(10) with UNMAP is not supported, " + "disabling BIO_DELETE.\n"); + softc->delete_method = DA_DELETE_DISABLE; + } else if (softc->delete_method == DA_DELETE_ZERO) { + xpt_print(ccb->ccb_h.path, + "WRITE SAME(10) is not supported, " + "disabling BIO_DELETE.\n"); + softc->delete_method = DA_DELETE_DISABLE; + } else + softc->delete_method = DA_DELETE_DISABLE; + while ((bp = bioq_takefirst(&softc->delete_run_queue)) + != NULL) + bioq_disksort(&softc->delete_queue, bp); + bioq_insert_tail(&softc->delete_queue, + (struct bio *)ccb->ccb_h.ccb_bp); + ccb->ccb_h.ccb_bp = NULL; + return (0); + } /* Translation only possible if CDB is an array and cmd is R/W6 */ if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0 || @@ -1790,8 +2010,7 @@ cmd6workaround(union ccb *ccb) xpt_print(ccb->ccb_h.path, "READ(6)/WRITE(6) not supported, " "increasing minimum_cmd_size to 10.\n"); - softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc; - softc->minimum_cmd_size = 10; + softc->minimum_cmd_size = 10; bcopy(cdb, &cmd6, sizeof(struct scsi_rw_6)); cmd10 = (struct scsi_rw_10 *)cdb; @@ -1829,8 +2048,9 @@ dadone(struct cam_periph *periph, union csio = &done_ccb->csio; switch (csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) { case DA_CCB_BUFFER_IO: + case DA_CCB_DELETE: { - struct bio *bp; + struct bio *bp, *bp1; bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { @@ -1850,6 +2070,7 @@ dadone(struct cam_periph *periph, union */ return; } + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if (error != 0) { int queued_error; @@ -1877,10 +2098,12 @@ dadone(struct cam_periph *periph, union } bioq_flush(&softc->bio_queue, NULL, queued_error); - bp->bio_error = error; - bp->bio_resid = bp->bio_bcount; - bp->bio_flags |= BIO_ERROR; - } else { + if (bp != NULL) { + bp->bio_error = error; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; + } + } else if (bp != NULL) { bp->bio_resid = csio->resid; bp->bio_error = 0; if (bp->bio_resid != 0) @@ -1892,7 +2115,7 @@ dadone(struct cam_periph *periph, union /*reduction*/0, /*timeout*/0, /*getcount_only*/0); - } else { + } else if (bp != NULL) { if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) panic("REQ_CMP with QFRZN"); bp->bio_resid = csio->resid; @@ -1921,7 +2144,22 @@ dadone(struct cam_periph *periph, union softc->outstanding_cmds); } - biodone(bp); + if ((csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) == + DA_CCB_DELETE) { + while ((bp1 = bioq_takefirst(&softc->delete_run_queue)) + != NULL) { + bp1->bio_resid = bp->bio_resid; + bp1->bio_error = bp->bio_error; + if (bp->bio_flags & BIO_ERROR) + bp1->bio_flags |= BIO_ERROR; + biodone(bp1); + } + softc->delete_running = 0; + if (bp != NULL) + biodone(bp); + daschedule(periph); + } else if (bp != NULL) + biodone(bp); break; } case DA_CCB_PROBE: @@ -1991,10 +2229,9 @@ dadone(struct cam_periph *periph, union } else { dasetgeom(periph, block_size, maxsector, lbppbe, lalba & SRC16_LALBA); - if (lalba & SRC16_LBPME) - softc->flags |= DA_FLAG_CAN_LBPME; - else - softc->flags &= ~DA_FLAG_CAN_LBPME; + if ((lalba & SRC16_LBPME) && + softc->delete_method == DA_DELETE_NONE) + softc->delete_method = DA_DELETE_UNMAP; dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), "%juMB (%ju %u byte sectors: %dH %dS/T " @@ -2381,10 +2618,9 @@ done: } else { dasetgeom(periph, block_len, maxsector, lbppbe, lalba & SRC16_LALBA); - if (lalba & SRC16_LBPME) - softc->flags |= DA_FLAG_CAN_LBPME; - else - softc->flags &= ~DA_FLAG_CAN_LBPME; + if ((lalba & SRC16_LBPME) && + softc->delete_method == DA_DELETE_NONE) + softc->delete_method = DA_DELETE_UNMAP; } } From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 11:01:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48F68106567F; Fri, 13 Jan 2012 11:01:24 +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 3409A8FC18; Fri, 13 Jan 2012 11:01:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DB1O1p059378; Fri, 13 Jan 2012 11:01:24 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DB1OqS059376; Fri, 13 Jan 2012 11:01:24 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201131101.q0DB1OqS059376@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 13 Jan 2012 11:01: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: r230055 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 11:01:24 -0000 Author: luigi Date: Fri Jan 13 11:01:23 2012 New Revision: 230055 URL: http://svn.freebsd.org/changeset/base/230055 Log: fix indentation Modified: head/sys/dev/netmap/if_re_netmap.h Modified: head/sys/dev/netmap/if_re_netmap.h ============================================================================== --- head/sys/dev/netmap/if_re_netmap.h Fri Jan 13 10:54:26 2012 (r230054) +++ head/sys/dev/netmap/if_re_netmap.h Fri Jan 13 11:01:23 2012 (r230055) @@ -25,7 +25,7 @@ /* * $FreeBSD$ - * $Id: if_re_netmap.h 9802 2011-12-02 18:42:37Z luigi $ + * $Id: if_re_netmap.h 10075 2011-12-25 22:55:48Z luigi $ * * netmap support for if_re */ @@ -409,7 +409,7 @@ re_netmap_rx_init(struct rl_softc *sc) addr = PNMB(slot + l, &paddr); netmap_reload_map(sc->rl_ldata.rl_rx_mtag, - sc->rl_ldata.rl_rx_desc[i].rx_dmamap, addr); + sc->rl_ldata.rl_rx_desc[i].rx_dmamap, addr); bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag, sc->rl_ldata.rl_rx_desc[i].rx_dmamap, BUS_DMASYNC_PREREAD); desc[i].rl_bufaddr_lo = htole32(RL_ADDR_LO(paddr)); From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 11:58:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71EB7106567A; Fri, 13 Jan 2012 11:58:07 +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 51A738FC16; Fri, 13 Jan 2012 11:58:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DBw7pi061747; Fri, 13 Jan 2012 11:58:07 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DBw7pn061744; Fri, 13 Jan 2012 11:58:07 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201131158.q0DBw7pn061744@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 13 Jan 2012 11:58: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: r230058 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 11:58:07 -0000 Author: luigi Date: Fri Jan 13 11:58:06 2012 New Revision: 230058 URL: http://svn.freebsd.org/changeset/base/230058 Log: indentation and whitespace fixes Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Fri Jan 13 11:10:17 2012 (r230057) +++ head/sys/dev/netmap/netmap.c Fri Jan 13 11:58:06 2012 (r230058) @@ -1056,6 +1056,7 @@ netmap_poll(__unused struct cdev *dev, i struct netmap_kring *kring; u_int core_lock, i, check_all, want_tx, want_rx, revents = 0; void *adapter; + enum {NO_CL, NEED_CL, LOCKED_CL }; /* see below */ if (devfs_get_cdevpriv((void **)&priv) != 0 || priv == NULL) return POLLERR; @@ -1130,8 +1131,7 @@ netmap_poll(__unused struct cdev *dev, i * to remember to release the lock once done. * LOCKED_CL core lock is set, so we need to release it. */ - enum {NO_CL, NEED_CL, LOCKED_CL }; - core_lock = (check_all || !na->separate_locks) ? NEED_CL:NO_CL; + core_lock = (check_all || !na->separate_locks) ? NEED_CL : NO_CL; /* * We start with a lock free round which is good if we have * data available. If this fails, then lock and call the sync Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Fri Jan 13 11:10:17 2012 (r230057) +++ head/sys/dev/netmap/netmap_kern.h Fri Jan 13 11:58:06 2012 (r230058) @@ -39,13 +39,13 @@ MALLOC_DECLARE(M_NETMAP); #endif #define ND(format, ...) -#define D(format, ...) \ - do { \ - struct timeval __xxts; \ +#define D(format, ...) \ + do { \ + struct timeval __xxts; \ microtime(&__xxts); \ - printf("%03d.%06d %s [%d] " format "\n",\ - (int)__xxts.tv_sec % 1000, (int)__xxts.tv_usec, \ - __FUNCTION__, __LINE__, ##__VA_ARGS__); \ + printf("%03d.%06d %s [%d] " format "\n", \ + (int)__xxts.tv_sec % 1000, (int)__xxts.tv_usec, \ + __FUNCTION__, __LINE__, ##__VA_ARGS__); \ } while (0) struct netmap_adapter; @@ -197,7 +197,7 @@ enum { /* Callback invoked by the dma machinery after a successfull dmamap_load */ static void netmap_dmamap_cb(__unused void *arg, - __unused bus_dma_segment_t * segs, __unused int nseg, __unused int error) + __unused bus_dma_segment_t * segs, __unused int nseg, __unused int error) { } @@ -209,7 +209,7 @@ netmap_load_map(bus_dma_tag_t tag, bus_d { if (map) bus_dmamap_load(tag, map, buf, NETMAP_BUF_SIZE, - netmap_dmamap_cb, NULL, BUS_DMA_NOWAIT); + netmap_dmamap_cb, NULL, BUS_DMA_NOWAIT); } /* update the map when a buffer changes. */ @@ -219,7 +219,7 @@ netmap_reload_map(bus_dma_tag_t tag, bus if (map) { bus_dmamap_unload(tag, map); bus_dmamap_load(tag, map, buf, NETMAP_BUF_SIZE, - netmap_dmamap_cb, NULL, BUS_DMA_NOWAIT); + netmap_dmamap_cb, NULL, BUS_DMA_NOWAIT); } } @@ -227,7 +227,6 @@ netmap_reload_map(bus_dma_tag_t tag, bus /* * NMB return the virtual address of a buffer (buffer 0 on bad index) * PNMB also fills the physical address - * XXX this is a special version with hardwired 2k bufs */ static inline void * NMB(struct netmap_slot *slot) From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 12:40:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F1EE1065676; Fri, 13 Jan 2012 12:40:34 +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 2FFF88FC0A; Fri, 13 Jan 2012 12:40:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DCeYFo063075; Fri, 13 Jan 2012 12:40:34 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DCeXhu063073; Fri, 13 Jan 2012 12:40:33 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201201131240.q0DCeXhu063073@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 13 Jan 2012 12:40: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: r230059 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 12:40:34 -0000 Author: des Date: Fri Jan 13 12:40:33 2012 New Revision: 230059 URL: http://svn.freebsd.org/changeset/base/230059 Log: Provide a better explanation for the sizing of the boot partition, and reduce the size of the partition in the example from 128 blocks to 94 blocks so it will end on a 128-block boundary. Also remove the -b option from the next example. MFC after: 3 weeks Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Fri Jan 13 11:58:06 2012 (r230058) +++ head/sbin/geom/class/part/gpart.8 Fri Jan 13 12:40:33 2012 (r230059) @@ -960,17 +960,21 @@ partition that can boot from a .Cm freebsd-ufs partition, and install bootstrap code into it. -This partition must be larger than -.Pa /boot/gptboot , -or the GPT boot you are planning to write, but smaller than 545 KB. -A size of 15 blocks (7680 bytes) would be sufficient for -booting from UFS but 128 blocks (64 KB) is used in -this example to reserve some space for potential -future need (e.g.\& a larger +This partition must be larger than the bootstrap code +.Po +usually either +.Pa /boot/gptboot +or .Pa /boot/gptzfsboot -for booting from a ZFS partition). +.Pc , +but smaller than 545 kB since the first-stage loader will load the +entire partition into memory during boot, regardless of how much data +it actually contains. +This example uses 94 blocks (47 kB) so the next partition will be +aligned on a 64 kB boundary without the need to specify an explicit +offset or alignment. .Bd -literal -offset indent -/sbin/gpart add -b 34 -s 128 -t freebsd-boot ad0 +/sbin/gpart add -b 34 -s 94 -t freebsd-boot ad0 /sbin/gpart bootcode -p /boot/gptboot -i 1 ad0 .Ed .Pp @@ -978,7 +982,7 @@ Create a 512MB-sized .Cm freebsd-ufs partition to contain a UFS filesystem from which the system can boot. .Bd -literal -offset indent -/sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0 +/sbin/gpart add -s 512M -t freebsd-ufs ad0 .Ed .Pp Create an MBR scheme on From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 15:40:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EF7B106566C; Fri, 13 Jan 2012 15:40:50 +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 6E9E68FC14; Fri, 13 Jan 2012 15:40:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DFeoYv068551; Fri, 13 Jan 2012 15:40:50 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DFeoe8068546; Fri, 13 Jan 2012 15:40:50 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201131540.q0DFeoe8068546@svn.freebsd.org> From: Ed Schouten Date: Fri, 13 Jan 2012 15:40: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: r230060 - in head: . lib/libc/gen tools/build/options usr.bin usr.bin/wtmpcvt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 15:40:50 -0000 Author: ed Date: Fri Jan 13 15:40:49 2012 New Revision: 230060 URL: http://svn.freebsd.org/changeset/base/230060 Log: Remove wtmpcvt(1). The wtmpcvt(1) utility converts wtmp files to the new format used by utmpx(3). Now that HEAD has been branched to stable/9 and 9.0 is released, there is no need for it in HEAD. MFC after: never Deleted: head/usr.bin/wtmpcvt/ Modified: head/ObsoleteFiles.inc head/lib/libc/gen/getutxent.3 head/tools/build/options/WITHOUT_UTMPX head/usr.bin/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Jan 13 12:40:33 2012 (r230059) +++ head/ObsoleteFiles.inc Fri Jan 13 15:40:49 2012 (r230060) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20120113: removal of wtmpcvt(1) +OLD_FILES+=usr/bin/wtmpcvt +OLD_FILES+=usr/share/man/man1/wtmpcvt.1.gz # 20111214: eventtimers(7) moved to eventtimers(4) OLD_FILES+=usr/share/man/man7/eventtimers.7.gz # 20111125: amd(4) removed Modified: head/lib/libc/gen/getutxent.3 ============================================================================== --- head/lib/libc/gen/getutxent.3 Fri Jan 13 12:40:33 2012 (r230059) +++ head/lib/libc/gen/getutxent.3 Fri Jan 13 15:40:49 2012 (r230060) @@ -418,7 +418,6 @@ The file format is invalid. .Sh SEE ALSO .Xr last 1 , .Xr write 1 , -.Xr wtmpcvt 1 , .Xr getpid 2 , .Xr gettimeofday 2 , .Xr tty 4 , Modified: head/tools/build/options/WITHOUT_UTMPX ============================================================================== --- head/tools/build/options/WITHOUT_UTMPX Fri Jan 13 12:40:33 2012 (r230059) +++ head/tools/build/options/WITHOUT_UTMPX Fri Jan 13 15:40:49 2012 (r230060) @@ -3,7 +3,6 @@ Set to not build user accounting tools s .Xr last 1 , .Xr users 1 , .Xr who 1 , -.Xr wtmpcvt 1 , .Xr ac 8 , .Xr lastlogin 8 and Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Fri Jan 13 12:40:33 2012 (r230059) +++ head/usr.bin/Makefile Fri Jan 13 15:40:49 2012 (r230060) @@ -340,7 +340,6 @@ SUBDIR+= usbhidctl SUBDIR+= last SUBDIR+= users SUBDIR+= who -SUBDIR+= wtmpcvt .endif .include From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 15:43:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9864F1065673; Fri, 13 Jan 2012 15:43: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 6C8568FC15; Fri, 13 Jan 2012 15:43:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DFh277068653; Fri, 13 Jan 2012 15:43:02 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DFh2qn068651; Fri, 13 Jan 2012 15:43:02 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201131543.q0DFh2qn068651@svn.freebsd.org> From: Ed Schouten Date: Fri, 13 Jan 2012 15:43: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: r230061 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 15:43:02 -0000 Author: ed Date: Fri Jan 13 15:43:01 2012 New Revision: 230061 URL: http://svn.freebsd.org/changeset/base/230061 Log: Regenerate src.conf(5). Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Fri Jan 13 15:40:49 2012 (r230060) +++ head/share/man/man5/src.conf.5 Fri Jan 13 15:43:01 2012 (r230061) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru .\" $FreeBSD$ -.Dd December 30, 2011 +.Dd January 13, 2012 .Dt SRC.CONF 5 .Os .Sh NAME @@ -252,7 +252,7 @@ Set to build some programs without optio Set to not build .Xr calendar 1 . .It Va WITHOUT_CAPSICUM -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITHOUT_CAPSICUM 229319 2012-01-02 21:57:58Z rwatson Set to not build Capsicum support into system programs. .It Va WITHOUT_CDDL .\" from FreeBSD: head/tools/build/options/WITHOUT_CDDL 163861 2006-11-01 09:02:11Z jb @@ -930,12 +930,11 @@ When set, it also enforces the following .\" from FreeBSD: head/tools/build/options/WITHOUT_USB 156932 2006-03-21 07:50:50Z ru Set to not build USB-related programs and libraries. .It Va WITHOUT_UTMPX -.\" from FreeBSD: head/tools/build/options/WITHOUT_UTMPX 223209 2011-06-17 21:30:21Z ed +.\" from FreeBSD: head/tools/build/options/WITHOUT_UTMPX 230060 2012-01-13 15:40:49Z ed Set to not build user accounting tools such as .Xr last 1 , .Xr users 1 , .Xr who 1 , -.Xr wtmpcvt 1 , .Xr ac 8 , .Xr lastlogin 8 and From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 16:01:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16FBA106566B; Fri, 13 Jan 2012 16:01:35 +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 0292C8FC1A; Fri, 13 Jan 2012 16:01:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DG1Y7N069297; Fri, 13 Jan 2012 16:01:34 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DG1YdV069295; Fri, 13 Jan 2012 16:01:34 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201131601.q0DG1YdV069295@svn.freebsd.org> From: Ed Schouten Date: Fri, 13 Jan 2012 16:01: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: r230062 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 16:01:36 -0000 Author: ed Date: Fri Jan 13 16:01:34 2012 New Revision: 230062 URL: http://svn.freebsd.org/changeset/base/230062 Log: Correct mistake in atomic_flag macros. The _explicit versions only have two parameters, namely the object and the order. There is no need to pass the values of the atomic variable. Modified: head/include/stdatomic.h Modified: head/include/stdatomic.h ============================================================================== --- head/include/stdatomic.h Fri Jan 13 15:43:01 2012 (r230061) +++ head/include/stdatomic.h Fri Jan 13 16:01:34 2012 (r230062) @@ -325,9 +325,8 @@ typedef atomic_bool atomic_flag; atomic_compare_exchange_strong_explicit(object, 0, 1, order, order) #define atomic_flag_clear(object) \ - atomic_flag_clear_explicit(object, 0, memory_order_seq_cst) + atomic_flag_clear_explicit(object, memory_order_seq_cst) #define atomic_flag_test_and_set(object) \ - atomic_flag_test_and_set_explicit(object, 0, 1, \ - memory_order_seq_cst, memory_order_seq_cst) + atomic_flag_test_and_set_explicit(object, memory_order_seq_cst) #endif /* !_STDATOMIC_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 17:13:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57ACE1065675; Fri, 13 Jan 2012 17:13:47 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41D318FC13; Fri, 13 Jan 2012 17:13:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DHDlig071606; Fri, 13 Jan 2012 17:13:47 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DHDlBf071603; Fri, 13 Jan 2012 17:13:47 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201201131713.q0DHDlBf071603@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 13 Jan 2012 17:13: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: r230063 - head/sys/dev/hwpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 17:13:47 -0000 Author: gnn Date: Fri Jan 13 17:13:46 2012 New Revision: 230063 URL: http://svn.freebsd.org/changeset/base/230063 Log: Clean up a switch statement for uncore events on Westmere processors. Submitted by: Davide Italiano Reviewed by: gnn MFC after: 1 week Modified: head/sys/dev/hwpmc/hwpmc_uncore.c head/sys/dev/hwpmc/hwpmc_uncore.h Modified: head/sys/dev/hwpmc/hwpmc_uncore.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_uncore.c Fri Jan 13 16:01:34 2012 (r230062) +++ head/sys/dev/hwpmc/hwpmc_uncore.c Fri Jan 13 17:13:46 2012 (r230063) @@ -974,26 +974,18 @@ ucp_start_pmc(int cpu, int ri) /* Event specific configuration. */ switch (pm->pm_event) { case PMC_EV_UCP_EVENT_0CH_04H_E: + case PMC_EV_UCP_EVENT_0CH_08H_E: wrmsr(MSR_GQ_SNOOP_MESF,0x2); break; case PMC_EV_UCP_EVENT_0CH_04H_F: + case PMC_EV_UCP_EVENT_0CH_08H_F: wrmsr(MSR_GQ_SNOOP_MESF,0x8); break; case PMC_EV_UCP_EVENT_0CH_04H_M: - wrmsr(MSR_GQ_SNOOP_MESF,0x1); - break; - case PMC_EV_UCP_EVENT_0CH_04H_S: - wrmsr(MSR_GQ_SNOOP_MESF,0x4); - break; - case PMC_EV_UCP_EVENT_0CH_08H_E: - wrmsr(MSR_GQ_SNOOP_MESF,0x2); - break; - case PMC_EV_UCP_EVENT_0CH_08H_F: - wrmsr(MSR_GQ_SNOOP_MESF,0x8); - break; case PMC_EV_UCP_EVENT_0CH_08H_M: wrmsr(MSR_GQ_SNOOP_MESF,0x1); break; + case PMC_EV_UCP_EVENT_0CH_04H_S: case PMC_EV_UCP_EVENT_0CH_08H_S: wrmsr(MSR_GQ_SNOOP_MESF,0x4); break; Modified: head/sys/dev/hwpmc/hwpmc_uncore.h ============================================================================== --- head/sys/dev/hwpmc/hwpmc_uncore.h Fri Jan 13 16:01:34 2012 (r230062) +++ head/sys/dev/hwpmc/hwpmc_uncore.h Fri Jan 13 17:13:46 2012 (r230063) @@ -87,7 +87,6 @@ struct pmc_md_ucp_op_pmcallocate { #define UC_GLOBAL_CTRL 0x391 #define UC_GLOBAL_OVF_CTRL 0x393 - #define UC_GLOBAL_STATUS_FLAG_CLRCHG (1ULL << 63) #define UC_GLOBAL_STATUS_FLAG_OVFPMI (1ULL << 61) #define UC_GLOBAL_CTRL_FLAG_FRZ (1ULL << 63) From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 18:32:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6901F106564A; Fri, 13 Jan 2012 18:32:56 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 532678FC15; Fri, 13 Jan 2012 18:32:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DIWuRM074059; Fri, 13 Jan 2012 18:32:56 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DIWuK0074056; Fri, 13 Jan 2012 18:32:56 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201201131832.q0DIWuK0074056@svn.freebsd.org> From: Don Lewis Date: Fri, 13 Jan 2012 18:32: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: r230064 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 18:32:56 -0000 Author: truckman Date: Fri Jan 13 18:32:56 2012 New Revision: 230064 URL: http://svn.freebsd.org/changeset/base/230064 Log: Allow an MBR primary or extended Linux swap partition to be specified as the system dump device. This was already allowed for GPT. The Linux swap metadata at the beginning of the partition should not be disturbed because the crash dump is written at the end. Reviewed by: alfred, pjd, marcel MFC after: 2 weeks Modified: head/sys/geom/part/g_part_ebr.c head/sys/geom/part/g_part_mbr.c Modified: head/sys/geom/part/g_part_ebr.c ============================================================================== --- head/sys/geom/part/g_part_ebr.c Fri Jan 13 17:13:46 2012 (r230063) +++ head/sys/geom/part/g_part_ebr.c Fri Jan 13 18:32:56 2012 (r230064) @@ -333,9 +333,10 @@ g_part_ebr_dumpto(struct g_part_table *t { struct g_part_ebr_entry *entry; - /* Allow dumping to a FreeBSD partition only. */ + /* Allow dumping to a FreeBSD partition or Linux swap partition only. */ entry = (struct g_part_ebr_entry *)baseentry; - return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0); + return ((entry->ent.dp_typ == DOSPTYP_386BSD || + entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0); } #if defined(GEOM_PART_EBR_COMPAT) Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Fri Jan 13 17:13:46 2012 (r230063) +++ head/sys/geom/part/g_part_mbr.c Fri Jan 13 18:32:56 2012 (r230064) @@ -304,9 +304,10 @@ g_part_mbr_dumpto(struct g_part_table *t { struct g_part_mbr_entry *entry; - /* Allow dumping to a FreeBSD partition only. */ + /* Allow dumping to a FreeBSD partition or Linux swap partition only. */ entry = (struct g_part_mbr_entry *)baseentry; - return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0); + return ((entry->ent.dp_typ == DOSPTYP_386BSD || + entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0); } static int From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 22:16:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDC6D106566B; Fri, 13 Jan 2012 22:16:47 +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 B203E8FC08; Fri, 13 Jan 2012 22:16:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DMGlib082561; Fri, 13 Jan 2012 22:16:47 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DMGlFO082558; Fri, 13 Jan 2012 22:16:47 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201201132216.q0DMGlFO082558@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 13 Jan 2012 22:16: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: r230089 - in head/usr.sbin/acpi: acpidb iasl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 22:16:48 -0000 Author: jkim Date: Fri Jan 13 22:16:47 2012 New Revision: 230089 URL: http://svn.freebsd.org/changeset/base/230089 Log: Remove unused ACPICA sources from userland makefiles. Modified: head/usr.sbin/acpi/acpidb/Makefile head/usr.sbin/acpi/iasl/Makefile Modified: head/usr.sbin/acpi/acpidb/Makefile ============================================================================== --- head/usr.sbin/acpi/acpidb/Makefile Fri Jan 13 20:50:18 2012 (r230088) +++ head/usr.sbin/acpi/acpidb/Makefile Fri Jan 13 22:16:47 2012 (r230089) @@ -15,7 +15,7 @@ SRCS+= dmbuffer.c dmnames.c dmobject.c d # events SRCS+= evevent.c evglock.c evgpe.c evgpeblk.c evgpeinit.c \ evgpeutil.c evmisc.c evregion.c evrgnini.c evsci.c \ - evxface.c evxfevnt.c evxfgpe.c evxfregn.c + evxface.c evxfevnt.c evxfregn.c # hardware SRCS+= hwacpi.c hwgpe.c hwpci.c hwregs.c hwsleep.c hwvalid.c \ @@ -52,8 +52,7 @@ SRCS+= rsaddr.c rscalc.c rscreate.c rsdu rsserial.c rsutils.c rsxface.c # tables -SRCS+= tbfadt.c tbfind.c tbinstal.c tbutils.c tbxface.c \ - tbxfroot.c +SRCS+= tbfadt.c tbfind.c tbinstal.c tbutils.c tbxface.c # utilities SRCS+= utaddress.c utalloc.c utcache.c utcopy.c utdebug.c \ Modified: head/usr.sbin/acpi/iasl/Makefile ============================================================================== --- head/usr.sbin/acpi/iasl/Makefile Fri Jan 13 20:50:18 2012 (r230088) +++ head/usr.sbin/acpi/iasl/Makefile Fri Jan 13 22:16:47 2012 (r230089) @@ -26,8 +26,8 @@ SRCS+= aslanalyze.c aslbtypes.c aslcodeg SRCS+= dbfileio.c # disassembler -SRCS+= dmbuffer.c dmnames.c dmobject.c dmopcode.c dmresrc.c \ - dmresrcl.c dmresrcl2.c dmresrcs.c dmutils.c dmwalk.c +SRCS+= dmbuffer.c dmnames.c dmopcode.c dmresrc.c dmresrcl.c \ + dmresrcl2.c dmresrcs.c dmutils.c dmwalk.c # interpreter/dispatcher SRCS+= dsargs.c dscontrol.c dsfield.c dsobject.c dsopcode.c \ @@ -37,8 +37,8 @@ SRCS+= dsargs.c dscontrol.c dsfield.c ds # interpreter/executer SRCS+= exconvrt.c excreate.c exdump.c exmisc.c exmutex.c \ exnames.c exoparg1.c exoparg2.c exoparg3.c exoparg6.c \ - exprep.c exregion.c exresnte.c exresolv.c exresop.c \ - exstore.c exstoren.c exstorob.c exsystem.c exutils.c + exprep.c exresnte.c exresolv.c exresop.c exstore.c \ + exstoren.c exstorob.c exsystem.c exutils.c # interpreter/parser SRCS+= psargs.c psloop.c psopcode.c psparse.c psscope.c \ @@ -46,7 +46,7 @@ SRCS+= psargs.c psloop.c psopcode.c pspa # namespace SRCS+= nsaccess.c nsalloc.c nsdump.c nsnames.c nsobject.c \ - nsparse.c nssearch.c nsutils.c nswalk.c nsxfobj.c + nsparse.c nssearch.c nsutils.c nswalk.c # os_specific/service_layers SRCS+= osunixxf.c @@ -57,8 +57,8 @@ SRCS+= tbfadt.c tbinstal.c tbutils.c tbx # utilities SRCS+= utaddress.c utalloc.c utcache.c utcopy.c utdebug.c \ utdecode.c utdelete.c utglobal.c utinit.c utlock.c \ - utmath.c utmisc.c utmutex.c utobject.c utosi.c \ - utresrc.c utstate.c utxface.c utxferror.c + utmath.c utmisc.c utmutex.c utobject.c utresrc.c \ + utstate.c utxface.c utxferror.c WARNS?= 2 From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 22:19:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06AA41065672; Fri, 13 Jan 2012 22:19:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E99CD8FC13; Fri, 13 Jan 2012 22:19:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DMJEKl082667; Fri, 13 Jan 2012 22:19:14 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DMJEKo082665; Fri, 13 Jan 2012 22:19:14 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201132219.q0DMJEKo082665@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 13 Jan 2012 22:19:14 +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: r230090 - head/sys/dev/usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 22:19:15 -0000 Author: hselasky Date: Fri Jan 13 22:19:14 2012 New Revision: 230090 URL: http://svn.freebsd.org/changeset/base/230090 Log: Bugfix: Make sure the XHCI driver doesn't clear the route string field. Else USB 3.0 HUBs won't work. MFC after: 5 days Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Fri Jan 13 22:16:47 2012 (r230089) +++ head/sys/dev/usb/controller/xhci.c Fri Jan 13 22:19:14 2012 (r230090) @@ -2264,7 +2264,7 @@ xhci_configure_device(struct usb_device temp |= XHCI_SCTX_0_CTX_NUM_SET(XHCI_MAX_ENDPOINTS - 1); break; default: - temp = XHCI_SCTX_0_CTX_NUM_SET(1); + temp |= XHCI_SCTX_0_CTX_NUM_SET(1); break; } From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 22:26:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27E84106564A; Fri, 13 Jan 2012 22:26:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B4D78FC08; Fri, 13 Jan 2012 22:26:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DMQDGB082919; Fri, 13 Jan 2012 22:26:13 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DMQDZC082916; Fri, 13 Jan 2012 22:26:13 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201132226.q0DMQDZC082916@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 13 Jan 2012 22:26: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: r230091 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 22:26:14 -0000 Author: hselasky Date: Fri Jan 13 22:26:13 2012 New Revision: 230091 URL: http://svn.freebsd.org/changeset/base/230091 Log: Improve support for USB 3.0 HUBs. In certain states we should do a warm reset instead of the default reset. MFC after: 5 days Modified: head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_request.c Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Fri Jan 13 22:19:14 2012 (r230090) +++ head/sys/dev/usb/usb_hub.c Fri Jan 13 22:26:13 2012 (r230091) @@ -627,14 +627,15 @@ uhub_suspend_resume_port(struct uhub_sof } } else { switch (UPS_PORT_LINK_STATE_GET(sc->sc_st.port_status)) { - case UPS_PORT_LS_U0: - case UPS_PORT_LS_U1: - case UPS_PORT_LS_U2: - case UPS_PORT_LS_RESUME: + case UPS_PORT_LS_U3: + is_suspend = 1; + break; + case UPS_PORT_LS_SS_INA: + usbd_req_warm_reset_port(udev, NULL, portno); is_suspend = 0; break; default: - is_suspend = 1; + is_suspend = 0; break; } } @@ -793,7 +794,8 @@ uhub_explore(struct usb_device *udev) break; } } - if (sc->sc_st.port_change & (UPS_C_SUSPEND | UPS_C_PORT_LINK_STATE)) { + if (sc->sc_st.port_change & (UPS_C_SUSPEND | + UPS_C_PORT_LINK_STATE)) { err = uhub_suspend_resume_port(sc, portno); if (err) { /* most likely the HUB is gone */ Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Fri Jan 13 22:19:14 2012 (r230090) +++ head/sys/dev/usb/usb_request.c Fri Jan 13 22:26:13 2012 (r230091) @@ -785,12 +785,17 @@ usbd_req_reset_port(struct usb_device *u struct usb_port_status ps; usb_error_t err; uint16_t n; + uint16_t status; + uint16_t change; #ifdef USB_DEBUG uint16_t pr_poll_delay; uint16_t pr_recovery_delay; #endif + + DPRINTF("\n"); + /* clear any leftover port reset changes first */ usbd_req_clear_port_feature( udev, mtx, port, UHF_C_PORT_RESET); @@ -817,9 +822,6 @@ usbd_req_reset_port(struct usb_device *u #endif n = 0; while (1) { - uint16_t status; - uint16_t change; - #ifdef USB_DEBUG /* wait for the device to recover from reset */ usb_pause_mtx(mtx, USB_MS_TO_TICKS(pr_poll_delay)); @@ -830,9 +832,9 @@ usbd_req_reset_port(struct usb_device *u n += USB_PORT_RESET_DELAY; #endif err = usbd_req_get_port_status(udev, mtx, &ps, port); - if (err) { + if (err) goto done; - } + status = UGETW(ps.wPortStatus); change = UGETW(ps.wPortChange); @@ -862,9 +864,9 @@ usbd_req_reset_port(struct usb_device *u /* clear port reset first */ err = usbd_req_clear_port_feature( udev, mtx, port, UHF_C_PORT_RESET); - if (err) { + if (err) goto done; - } + /* check for timeout */ if (n == 0) { err = USB_ERR_TIMEOUT; @@ -898,21 +900,50 @@ done: * disabled. *------------------------------------------------------------------------*/ usb_error_t -usbd_req_warm_reset_port(struct usb_device *udev, struct mtx *mtx, uint8_t port) +usbd_req_warm_reset_port(struct usb_device *udev, struct mtx *mtx, + uint8_t port) { struct usb_port_status ps; usb_error_t err; uint16_t n; + uint16_t status; + uint16_t change; #ifdef USB_DEBUG uint16_t pr_poll_delay; uint16_t pr_recovery_delay; #endif - err = usbd_req_set_port_feature(udev, mtx, port, UHF_BH_PORT_RESET); - if (err) { + + DPRINTF("\n"); + + err = usbd_req_get_port_status(udev, mtx, &ps, port); + if (err) goto done; + + status = UGETW(ps.wPortStatus); + + switch (UPS_PORT_LINK_STATE_GET(status)) { + case UPS_PORT_LS_U3: + case UPS_PORT_LS_COMP_MODE: + case UPS_PORT_LS_LOOPBACK: + case UPS_PORT_LS_SS_INA: + break; + default: + DPRINTF("Wrong state for warm reset\n"); + return (0); } + + /* clear any leftover warm port reset changes first */ + usbd_req_clear_port_feature(udev, mtx, + port, UHF_C_BH_PORT_RESET); + + /* set warm port reset */ + err = usbd_req_set_port_feature(udev, mtx, + port, UHF_BH_PORT_RESET); + if (err) + goto done; + #ifdef USB_DEBUG /* range check input parameters */ pr_poll_delay = usb_pr_poll_delay; @@ -938,17 +969,20 @@ usbd_req_warm_reset_port(struct usb_devi n += USB_PORT_RESET_DELAY; #endif err = usbd_req_get_port_status(udev, mtx, &ps, port); - if (err) { + if (err) goto done; - } + + status = UGETW(ps.wPortStatus); + change = UGETW(ps.wPortChange); + /* if the device disappeared, just give up */ - if (!(UGETW(ps.wPortStatus) & UPS_CURRENT_CONNECT_STATUS)) { + if (!(status & UPS_CURRENT_CONNECT_STATUS)) goto done; - } + /* check if reset is complete */ - if (UGETW(ps.wPortChange) & UPS_C_BH_PORT_RESET) { + if (change & UPS_C_BH_PORT_RESET) break; - } + /* check for timeout */ if (n > 1000) { n = 0; @@ -959,9 +993,9 @@ usbd_req_warm_reset_port(struct usb_devi /* clear port reset first */ err = usbd_req_clear_port_feature( udev, mtx, port, UHF_C_BH_PORT_RESET); - if (err) { + if (err) goto done; - } + /* check for timeout */ if (n == 0) { err = USB_ERR_TIMEOUT; @@ -2004,6 +2038,10 @@ retry: } } + /* Try to warm reset first */ + if (parent_hub->speed == USB_SPEED_SUPER) + usbd_req_warm_reset_port(parent_hub, mtx, udev->port_no); + /* Try to reset the parent HUB port. */ err = usbd_req_reset_port(parent_hub, mtx, udev->port_no); if (err) { From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 22:48:48 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67AD6106566B; Fri, 13 Jan 2012 22:48:48 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id D6FEF8FC15; Fri, 13 Jan 2012 22:48:47 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q0DMmkgZ015908; Sat, 14 Jan 2012 02:48:46 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q0DMmkqi015907; Sat, 14 Jan 2012 02:48:46 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sat, 14 Jan 2012 02:48:46 +0400 From: Gleb Smirnoff To: Ermal Lu?i Message-ID: <20120113224846.GR74141@FreeBSD.org> References: <201201090850.q098oNme031479@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229850 - in head: etc/rc.d sys/contrib/pf/net sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 22:48:48 -0000 On Fri, Jan 13, 2012 at 11:34:15PM +0100, Ermal Lu?i wrote: E> You ARE testing this right? Sure. E> Since you removed code that you do not actually mention at all in the E> commit message!!! What code are you worried about? E> On Mon, Jan 9, 2012 at 9:50 AM, Gleb Smirnoff wrote: E> E> > Author: glebius E> > Date: Mon Jan 9 08:50:22 2012 E> > New Revision: 229850 E> > URL: http://svn.freebsd.org/changeset/base/229850 E> > E> > Log: E> > Bunch of fixes to pfsync(4) module load/unload: E> > E> > o Make the pfsync.ko actually usable. Before this change loading it E> > didn't register protosw, so was a nop. However, a module /boot/kernel E> > did confused users. E> > o Rewrite the way we are joining multicast group: E> > - Move multicast initialization/destruction to separate functions. E> > - Don't allocate memory if we aren't going to join a multicast group. E> > - Use modern API for joining/leaving multicast group. E> > - Now the utterly wrong pfsync_ifdetach() isn't needed. E> > o Move module initialization from SYSINIT(9) to moduledata_t method. E> > o Refuse to unload module, unless asked forcibly. E> > o Improve a bit some FreeBSD porting code: E> > - Use separate malloc type. E> > - Simplify swi sheduling. E> > E> > This change is probably wrong from VIMAGE viewpoint, however pfsync E> > wasn't VIMAGE-correct before this change, too. E> > E> > Glanced at by: bz -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 22:57:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41FB61065680; Fri, 13 Jan 2012 22:57:44 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id E21CD8FC17; Fri, 13 Jan 2012 22:57:43 +0000 (UTC) Received: by iagz16 with SMTP id z16so290501iag.13 for ; Fri, 13 Jan 2012 14:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=MsdiUp0jx5jjF9au0Vjf5qb4fYmuEwD+ZIPf/l7KDDU=; b=Yq7cWZPCghj8nxLPn7zYYCWJkWCb6XT1fpo/BjDCOYQT3PbMHeYLNWc4Cyh8ZWRjE+ xe+U+wXnzTJ10gA9KZ7P1mFaBdAl3LCZLzFbrxCNv4l4TncXP7Q6exigXEDNKQTB/vCV nQ1d4DZH9h5D9f90XqF+oowjo0/UU54j9qilI= MIME-Version: 1.0 Received: by 10.50.153.133 with SMTP id vg5mr1633745igb.8.1326494055055; Fri, 13 Jan 2012 14:34:15 -0800 (PST) Sender: ermal.luci@gmail.com Received: by 10.231.119.82 with HTTP; Fri, 13 Jan 2012 14:34:15 -0800 (PST) In-Reply-To: <201201090850.q098oNme031479@svn.freebsd.org> References: <201201090850.q098oNme031479@svn.freebsd.org> Date: Fri, 13 Jan 2012 23:34:15 +0100 X-Google-Sender-Auth: WqD_QL8-BrVQESl6r_Ki2fYJFBI Message-ID: From: =?ISO-8859-1?Q?Ermal_Lu=E7i?= To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229850 - in head: etc/rc.d sys/contrib/pf/net sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 22:57:44 -0000 You ARE testing this right? Since you removed code that you do not actually mention at all in the commit message!!! On Mon, Jan 9, 2012 at 9:50 AM, Gleb Smirnoff wrote: > Author: glebius > Date: Mon Jan 9 08:50:22 2012 > New Revision: 229850 > URL: http://svn.freebsd.org/changeset/base/229850 > > Log: > Bunch of fixes to pfsync(4) module load/unload: > > o Make the pfsync.ko actually usable. Before this change loading it > didn't register protosw, so was a nop. However, a module /boot/kernel > did confused users. > o Rewrite the way we are joining multicast group: > - Move multicast initialization/destruction to separate functions. > - Don't allocate memory if we aren't going to join a multicast group. > - Use modern API for joining/leaving multicast group. > - Now the utterly wrong pfsync_ifdetach() isn't needed. > o Move module initialization from SYSINIT(9) to moduledata_t method. > o Refuse to unload module, unless asked forcibly. > o Improve a bit some FreeBSD porting code: > - Use separate malloc type. > - Simplify swi sheduling. > > This change is probably wrong from VIMAGE viewpoint, however pfsync > wasn't VIMAGE-correct before this change, too. > > Glanced at by: bz > > Modified: > head/etc/rc.d/pfsync > head/sys/contrib/pf/net/if_pfsync.c > head/sys/netinet/in_proto.c > > Modified: head/etc/rc.d/pfsync > > ============================================================================== > --- head/etc/rc.d/pfsync Mon Jan 9 08:36:12 2012 (r229849) > +++ head/etc/rc.d/pfsync Mon Jan 9 08:50:22 2012 (r229850) > @@ -18,13 +18,6 @@ required_modules="pf" > > pfsync_prestart() > { > - # XXX Currently pfsync cannot be a module as it must register > - # a network protocol in a static kernel table. > - if ! kldstat -q -m pfsync; then > - warn "pfsync(4) must be statically compiled in the kernel." > - return 1 > - fi > - > case "$pfsync_syncdev" in > '') > warn "pfsync_syncdev is not set." > > Modified: head/sys/contrib/pf/net/if_pfsync.c > > ============================================================================== > --- head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 08:36:12 2012 > (r229849) > +++ head/sys/contrib/pf/net/if_pfsync.c Mon Jan 9 08:50:22 2012 > (r229850) > @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #else > #include > #include > @@ -295,21 +296,25 @@ struct pfsync_softc { > #else > struct timeout sc_tmo; > #endif > -#ifdef __FreeBSD__ > - eventhandler_tag sc_detachtag; > -#endif > - > }; > > #ifdef __FreeBSD__ > +static MALLOC_DEFINE(M_PFSYNC, "pfsync", "pfsync data"); > static VNET_DEFINE(struct pfsync_softc *, pfsyncif) = NULL; > #define V_pfsyncif VNET(pfsyncif) > - > +static VNET_DEFINE(void *, pfsync_swi_cookie) = NULL; > +#define V_pfsync_swi_cookie VNET(pfsync_swi_cookie) > static VNET_DEFINE(struct pfsyncstats, pfsyncstats); > #define V_pfsyncstats VNET(pfsyncstats) > static VNET_DEFINE(int, pfsync_carp_adj) = CARP_MAXSKEW; > #define V_pfsync_carp_adj VNET(pfsync_carp_adj) > > +static void pfsyncintr(void *); > +static int pfsync_multicast_setup(struct pfsync_softc *); > +static void pfsync_multicast_cleanup(struct pfsync_softc *); > +static int pfsync_init(void); > +static void pfsync_uninit(void); > + > SYSCTL_NODE(_net, OID_AUTO, pfsync, CTLFLAG_RW, 0, "PFSYNC"); > SYSCTL_VNET_STRUCT(_net_pfsync, OID_AUTO, stats, CTLFLAG_RW, > &VNET_NAME(pfsyncstats), pfsyncstats, > @@ -322,16 +327,6 @@ struct pfsyncstats pfsyncstats; > #define V_pfsyncstats pfsyncstats > #endif > > -#ifdef __FreeBSD__ > -static void pfsyncintr(void *); > -struct pfsync_swi { > - void * pfsync_swi_cookie; > -}; > -static struct pfsync_swi pfsync_swi; > -#define schednetisr(p) swi_sched(pfsync_swi.pfsync_swi_cookie, 0) > -#define NETISR_PFSYNC > -#endif > - > void pfsyncattach(int); > #ifdef __FreeBSD__ > int pfsync_clone_create(struct if_clone *, int, caddr_t); > @@ -377,8 +372,6 @@ void pfsync_bulk_update(void *); > void pfsync_bulk_fail(void *); > > #ifdef __FreeBSD__ > -void pfsync_ifdetach(void *, struct ifnet *); > - > /* XXX: ugly */ > #define betoh64 (unsigned long long)be64toh > #define timeout_del callout_stop > @@ -390,6 +383,10 @@ int pfsync_sync_ok; > #endif > > #ifdef __FreeBSD__ > +VNET_DEFINE(struct ifc_simple_data, pfsync_cloner_data); > +VNET_DEFINE(struct if_clone, pfsync_cloner); > +#define V_pfsync_cloner_data VNET(pfsync_cloner_data) > +#define V_pfsync_cloner VNET(pfsync_cloner) > IFC_SIMPLE_DECLARE(pfsync, 1); > #else > struct if_clone pfsync_cloner = > @@ -415,25 +412,20 @@ pfsync_clone_create(struct if_clone *ifc > if (unit != 0) > return (EINVAL); > > -#ifndef __FreeBSD__ > +#ifdef __FreeBSD__ > + sc = malloc(sizeof(struct pfsync_softc), M_PFSYNC, M_WAITOK | > M_ZERO); > + sc->pfsync_sync_ok = 1; > +#else > pfsync_sync_ok = 1; > + sc = malloc(sizeof(*pfsyncif), M_DEVBUF, M_NOWAIT | M_ZERO); > #endif > > - sc = malloc(sizeof(struct pfsync_softc), M_DEVBUF, M_NOWAIT | > M_ZERO); > - if (sc == NULL) > - return (ENOMEM); > - > for (q = 0; q < PFSYNC_S_COUNT; q++) > TAILQ_INIT(&sc->sc_qs[q]); > > #ifdef __FreeBSD__ > - sc->pfsync_sync_ok = 1; > - sc->sc_pool = uma_zcreate("pfsync", PFSYNC_PLSIZE, > - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); > - if (sc->sc_pool == NULL) { > - free(sc, M_DEVBUF); > - return (ENOMEM); > - } > + sc->sc_pool = uma_zcreate("pfsync", PFSYNC_PLSIZE, NULL, NULL, > NULL, > + NULL, UMA_ALIGN_PTR, 0); > #else > pool_init(&sc->sc_pool, PFSYNC_PLSIZE, 0, 0, 0, "pfsync", NULL); > #endif > @@ -446,13 +438,7 @@ pfsync_clone_create(struct if_clone *ifc > sc->sc_len = PFSYNC_MINPKT; > sc->sc_maxupdates = 128; > > -#ifdef __FreeBSD__ > - sc->sc_imo.imo_membership = (struct in_multi **)malloc( > - (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_DEVBUF, > - M_NOWAIT | M_ZERO); > - sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS; > - sc->sc_imo.imo_multicast_vif = -1; > -#else > +#ifndef __FreeBSD__ > sc->sc_imo.imo_membership = (struct in_multi **)malloc( > (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS, > M_WAITOK | M_ZERO); > @@ -462,26 +448,11 @@ pfsync_clone_create(struct if_clone *ifc > #ifdef __FreeBSD__ > ifp = sc->sc_ifp = if_alloc(IFT_PFSYNC); > if (ifp == NULL) { > - free(sc->sc_imo.imo_membership, M_DEVBUF); > uma_zdestroy(sc->sc_pool); > - free(sc, M_DEVBUF); > + free(sc, M_PFSYNC); > return (ENOSPC); > } > if_initname(ifp, ifc->ifc_name, unit); > - > - sc->sc_detachtag = EVENTHANDLER_REGISTER(ifnet_departure_event, > -#ifdef __FreeBSD__ > - pfsync_ifdetach, V_pfsyncif, EVENTHANDLER_PRI_ANY); > -#else > - pfsync_ifdetach, pfsyncif, EVENTHANDLER_PRI_ANY); > -#endif > - if (sc->sc_detachtag == NULL) { > - if_free(ifp); > - free(sc->sc_imo.imo_membership, M_DEVBUF); > - uma_zdestroy(sc->sc_pool); > - free(sc, M_DEVBUF); > - return (ENOSPC); > - } > #else > ifp = &sc->sc_if; > snprintf(ifp->if_xname, sizeof ifp->if_xname, "pfsync%d", unit); > @@ -540,7 +511,6 @@ pfsync_clone_destroy(struct ifnet *ifp) > struct pfsync_softc *sc = ifp->if_softc; > > #ifdef __FreeBSD__ > - EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->sc_detachtag); > PF_LOCK(); > #endif > timeout_del(&sc->sc_bulkfail_tmo); > @@ -573,11 +543,13 @@ pfsync_clone_destroy(struct ifnet *ifp) > #endif > #ifdef __FreeBSD__ > if_free(ifp); > - free(sc->sc_imo.imo_membership, M_DEVBUF); > + if (sc->sc_imo.imo_membership) > + pfsync_multicast_cleanup(sc); > + free(sc, M_PFSYNC); > #else > free(sc->sc_imo.imo_membership, M_IPMOPTS); > -#endif > free(sc, M_DEVBUF); > +#endif > > #ifdef __FreeBSD__ > V_pfsyncif = NULL; > @@ -1886,12 +1858,15 @@ pfsyncioctl(struct ifnet *ifp, u_long cm > sc->sc_sync_if = NULL; > #ifdef __FreeBSD__ > PF_UNLOCK(); > -#endif > + if (imo->imo_membership) > + pfsync_multicast_cleanup(sc); > +#else > if (imo->imo_num_memberships > 0) { > in_delmulti(imo->imo_membership[ > --imo->imo_num_memberships]); > imo->imo_multicast_ifp = NULL; > } > +#endif > break; > } > > @@ -1916,57 +1891,53 @@ pfsyncioctl(struct ifnet *ifp, u_long cm > pfsync_sendout(); > sc->sc_sync_if = sifp; > > - if (imo->imo_num_memberships > 0) { > #ifdef __FreeBSD__ > + if (imo->imo_membership) { > PF_UNLOCK(); > -#endif > - > in_delmulti(imo->imo_membership[--imo->imo_num_memberships]); > -#ifdef __FreeBSD__ > + pfsync_multicast_cleanup(sc); > PF_LOCK(); > -#endif > + } > +#else > + if (imo->imo_num_memberships > 0) { > + > in_delmulti(imo->imo_membership[--imo->imo_num_memberships]); > imo->imo_multicast_ifp = NULL; > } > +#endif > > - if (sc->sc_sync_if && > #ifdef __FreeBSD__ > + if (sc->sc_sync_if && > sc->sc_sync_peer.s_addr == htonl(INADDR_PFSYNC_GROUP)) { > + PF_UNLOCK(); > + error = pfsync_multicast_setup(sc); > + if (error) > + return (error); > + PF_LOCK(); > + } > #else > + if (sc->sc_sync_if && > sc->sc_sync_peer.s_addr == INADDR_PFSYNC_GROUP) { > -#endif > struct in_addr addr; > > if (!(sc->sc_sync_if->if_flags & IFF_MULTICAST)) { > sc->sc_sync_if = NULL; > -#ifdef __FreeBSD__ > - PF_UNLOCK(); > -#endif > splx(s); > return (EADDRNOTAVAIL); > } > > -#ifdef __FreeBSD__ > - addr.s_addr = htonl(INADDR_PFSYNC_GROUP); > -#else > addr.s_addr = INADDR_PFSYNC_GROUP; > -#endif > > -#ifdef __FreeBSD__ > - PF_UNLOCK(); > -#endif > if ((imo->imo_membership[0] = > in_addmulti(&addr, sc->sc_sync_if)) == NULL) { > sc->sc_sync_if = NULL; > splx(s); > return (ENOBUFS); > } > -#ifdef __FreeBSD__ > - PF_LOCK(); > -#endif > imo->imo_num_memberships++; > imo->imo_multicast_ifp = sc->sc_sync_if; > imo->imo_multicast_ttl = PFSYNC_DFLTTL; > imo->imo_multicast_loop = 0; > } > +#endif /* !__FreeBSD__ */ > > ip = &sc->sc_template; > bzero(ip, sizeof(*ip)); > @@ -2365,7 +2336,7 @@ pfsync_sendout(void) > sc->sc_len = PFSYNC_MINPKT; > > IFQ_ENQUEUE(&sc->sc_ifp->if_snd, m, dummy_error); > - schednetisr(NETISR_PFSYNC); > + swi_sched(V_pfsync_swi_cookie, 0); > #else > sc->sc_if.if_opackets++; > sc->sc_if.if_obytes += m->m_pkthdr.len; > @@ -3342,54 +3313,91 @@ pfsync_sysctl(int *name, u_int namelen, > } > > #ifdef __FreeBSD__ > -void > -pfsync_ifdetach(void *arg, struct ifnet *ifp) > +static int > +pfsync_multicast_setup(struct pfsync_softc *sc) > { > - struct pfsync_softc *sc = (struct pfsync_softc *)arg; > - struct ip_moptions *imo; > - > - if (sc == NULL || sc->sc_sync_if != ifp) > - return; /* not for us; unlocked read */ > + struct ip_moptions *imo = &sc->sc_imo; > + int error; > > - CURVNET_SET(sc->sc_ifp->if_vnet); > + if (!(sc->sc_sync_if->if_flags & IFF_MULTICAST)) { > + sc->sc_sync_if = NULL; > + return (EADDRNOTAVAIL); > + } > > - PF_LOCK(); > + imo->imo_membership = (struct in_multi **)malloc( > + (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_PFSYNC, > + M_WAITOK | M_ZERO); > + imo->imo_max_memberships = IP_MIN_MEMBERSHIPS; > + imo->imo_multicast_vif = -1; > > - /* Deal with a member interface going away from under us. */ > - sc->sc_sync_if = NULL; > - imo = &sc->sc_imo; > - if (imo->imo_num_memberships > 0) { > - KASSERT(imo->imo_num_memberships == 1, > - ("%s: imo_num_memberships != 1", __func__)); > - /* > - * Our event handler is always called after protocol > - * domains have been detached from the underlying ifnet. > - * Do not call in_delmulti(); we held a single reference > - * which the protocol domain has purged in > in_purgemaddrs(). > - */ > - PF_UNLOCK(); > - imo->imo_membership[--imo->imo_num_memberships] = NULL; > - PF_LOCK(); > - imo->imo_multicast_ifp = NULL; > - } > + if ((error = in_joingroup(sc->sc_sync_if, &sc->sc_sync_peer, NULL, > + &imo->imo_membership[0])) != 0) { > + free(imo->imo_membership, M_PFSYNC); > + return (error); > + } > + imo->imo_num_memberships++; > + imo->imo_multicast_ifp = sc->sc_sync_if; > + imo->imo_multicast_ttl = PFSYNC_DFLTTL; > + imo->imo_multicast_loop = 0; > > - PF_UNLOCK(); > - > - CURVNET_RESTORE(); > + return (0); > } > > +static void > +pfsync_multicast_cleanup(struct pfsync_softc *sc) > +{ > + struct ip_moptions *imo = &sc->sc_imo; > + > + in_leavegroup(imo->imo_membership[0], NULL); > + free(imo->imo_membership, M_PFSYNC); > + imo->imo_membership = NULL; > + imo->imo_multicast_ifp = NULL; > +} > + > +#ifdef INET > +extern struct domain inetdomain; > +static struct protosw in_pfsync_protosw = { > + .pr_type = SOCK_RAW, > + .pr_domain = &inetdomain, > + .pr_protocol = IPPROTO_PFSYNC, > + .pr_flags = PR_ATOMIC|PR_ADDR, > + .pr_input = pfsync_input, > + .pr_output = (pr_output_t *)rip_output, > + .pr_ctloutput = rip_ctloutput, > + .pr_usrreqs = &rip_usrreqs > +}; > +#endif > + > static int > -vnet_pfsync_init(const void *unused) > +pfsync_init() > { > + VNET_ITERATOR_DECL(vnet_iter); > int error = 0; > > - pfsyncattach(0); > - > - error = swi_add(NULL, "pfsync", pfsyncintr, V_pfsyncif, > - SWI_NET, INTR_MPSAFE, &pfsync_swi.pfsync_swi_cookie); > + VNET_LIST_RLOCK(); > + VNET_FOREACH(vnet_iter) { > + CURVNET_SET(vnet_iter); > + V_pfsync_cloner = pfsync_cloner; > + V_pfsync_cloner_data = pfsync_cloner_data; > + V_pfsync_cloner.ifc_data = &V_pfsync_cloner_data; > + if_clone_attach(&V_pfsync_cloner); > + error = swi_add(NULL, "pfsync", pfsyncintr, V_pfsyncif, > + SWI_NET, INTR_MPSAFE, &V_pfsync_swi_cookie); > + CURVNET_RESTORE(); > + if (error) > + goto fail_locked; > + } > + VNET_LIST_RUNLOCK(); > +#ifdef INET > + error = pf_proto_register(PF_INET, &in_pfsync_protosw); > if (error) > - panic("%s: swi_add %d", __func__, error); > - > + goto fail; > + error = ipproto_register(IPPROTO_PFSYNC); > + if (error) { > + pf_proto_unregister(PF_INET, IPPROTO_PFSYNC, SOCK_RAW); > + goto fail; > + } > +#endif > PF_LOCK(); > pfsync_state_import_ptr = pfsync_state_import; > pfsync_up_ptr = pfsync_up; > @@ -3402,13 +3410,27 @@ vnet_pfsync_init(const void *unused) > PF_UNLOCK(); > > return (0); > + > +fail: > + VNET_LIST_RLOCK(); > +fail_locked: > + VNET_FOREACH(vnet_iter) { > + CURVNET_SET(vnet_iter); > + if (V_pfsync_swi_cookie) { > + swi_remove(V_pfsync_swi_cookie); > + if_clone_detach(&V_pfsync_cloner); > + } > + CURVNET_RESTORE(); > + } > + VNET_LIST_RUNLOCK(); > + > + return (error); > } > > -static int > -vnet_pfsync_uninit(const void *unused) > +static void > +pfsync_uninit() > { > - > - swi_remove(pfsync_swi.pfsync_swi_cookie); > + VNET_ITERATOR_DECL(vnet_iter); > > PF_LOCK(); > pfsync_state_import_ptr = NULL; > @@ -3421,30 +3443,18 @@ vnet_pfsync_uninit(const void *unused) > pfsync_defer_ptr = NULL; > PF_UNLOCK(); > > - if_clone_detach(&pfsync_cloner); > - > - return (0); > + ipproto_unregister(IPPROTO_PFSYNC); > + pf_proto_unregister(PF_INET, IPPROTO_PFSYNC, SOCK_RAW); > + VNET_LIST_RLOCK(); > + VNET_FOREACH(vnet_iter) { > + CURVNET_SET(vnet_iter); > + swi_remove(V_pfsync_swi_cookie); > + if_clone_detach(&V_pfsync_cloner); > + CURVNET_RESTORE(); > + } > + VNET_LIST_RUNLOCK(); > } > > -/* Define startup order. */ > -#define PFSYNC_SYSINIT_ORDER SI_SUB_PROTO_IF > -#define PFSYNC_MODEVENT_ORDER (SI_ORDER_FIRST) /* On boot slot > in here. */ > -#define PFSYNC_VNET_ORDER (PFSYNC_MODEVENT_ORDER + 2) /* > Later still. */ > - > -/* > - * Starting up. > - * VNET_SYSINIT is called for each existing vnet and each new vnet. > - */ > -VNET_SYSINIT(vnet_pfsync_init, PFSYNC_SYSINIT_ORDER, PFSYNC_VNET_ORDER, > - vnet_pfsync_init, NULL); > - > -/* > - * Closing up shop. These are done in REVERSE ORDER, > - * Not called on reboot. > - * VNET_SYSUNINIT is called for each exiting vnet as it exits. > - */ > -VNET_SYSUNINIT(vnet_pfsync_uninit, PFSYNC_SYSINIT_ORDER, > PFSYNC_VNET_ORDER, > - vnet_pfsync_uninit, NULL); > static int > pfsync_modevent(module_t mod, int type, void *data) > { > @@ -3452,21 +3462,23 @@ pfsync_modevent(module_t mod, int type, > > switch (type) { > case MOD_LOAD: > -#ifndef __FreeBSD__ > - pfsyncattach(0); > -#endif > + error = pfsync_init(); > + break; > + case MOD_QUIESCE: > + /* > + * Module should not be unloaded due to race conditions. > + */ > + error = EPERM; > break; > case MOD_UNLOAD: > -#ifndef __FreeBSD__ > - if_clone_detach(&pfsync_cloner); > -#endif > + pfsync_uninit(); > break; > default: > error = EINVAL; > break; > } > > - return error; > + return (error); > } > > static moduledata_t pfsync_mod = { > @@ -3477,7 +3489,7 @@ static moduledata_t pfsync_mod = { > > #define PFSYNC_MODVER 1 > > -DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); > +DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); > MODULE_VERSION(pfsync, PFSYNC_MODVER); > MODULE_DEPEND(pfsync, pf, PF_MODVER, PF_MODVER, PF_MODVER); > #endif /* __FreeBSD__ */ > > Modified: head/sys/netinet/in_proto.c > > ============================================================================== > --- head/sys/netinet/in_proto.c Mon Jan 9 08:36:12 2012 (r229849) > +++ head/sys/netinet/in_proto.c Mon Jan 9 08:50:22 2012 (r229850) > @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); > #include "opt_ipsec.h" > #include "opt_inet.h" > #include "opt_inet6.h" > -#include "opt_pf.h" > #include "opt_sctp.h" > #include "opt_mpath.h" > > @@ -101,11 +100,6 @@ static struct pr_usrreqs nousrreqs; > #include > #endif /* SCTP */ > > -#ifdef DEV_PFSYNC > -#include > -#include > -#endif > - > FEATURE(inet, "Internet Protocol version 4"); > > extern struct domain inetdomain; > @@ -317,17 +311,6 @@ struct protosw inetsw[] = { > .pr_ctloutput = rip_ctloutput, > .pr_usrreqs = &rip_usrreqs > }, > -#ifdef DEV_PFSYNC > -{ > - .pr_type = SOCK_RAW, > - .pr_domain = &inetdomain, > - .pr_protocol = IPPROTO_PFSYNC, > - .pr_flags = PR_ATOMIC|PR_ADDR, > - .pr_input = pfsync_input, > - .pr_ctloutput = rip_ctloutput, > - .pr_usrreqs = &rip_usrreqs > -}, > -#endif /* DEV_PFSYNC */ > /* Spacer n-times for loadable protocols. */ > IPPROTOSPACER, > IPPROTOSPACER, > @@ -397,6 +380,3 @@ SYSCTL_NODE(_net_inet, IPPROTO_IPCOMP, i > SYSCTL_NODE(_net_inet, IPPROTO_IPIP, ipip, CTLFLAG_RW, 0, "IPIP"); > #endif /* IPSEC */ > SYSCTL_NODE(_net_inet, IPPROTO_RAW, raw, CTLFLAG_RW, 0, "RAW"); > -#ifdef DEV_PFSYNC > -SYSCTL_NODE(_net_inet, IPPROTO_PFSYNC, pfsync, CTLFLAG_RW, 0, "PFSYNC"); > -#endif > -- Ermal From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 23:25:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10539106564A; Fri, 13 Jan 2012 23:25:36 +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 D91928FC13; Fri, 13 Jan 2012 23:25:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DNPZpi084912; Fri, 13 Jan 2012 23:25:35 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DNPZXM084910; Fri, 13 Jan 2012 23:25:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201132325.q0DNPZXM084910@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 13 Jan 2012 23:25: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: r230092 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 23:25:36 -0000 Author: pjd Date: Fri Jan 13 23:25:35 2012 New Revision: 230092 URL: http://svn.freebsd.org/changeset/base/230092 Log: Style cleanups. MFC after: 3 days Modified: head/sbin/hastd/secondary.c Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Fri Jan 13 22:26:13 2012 (r230091) +++ head/sbin/hastd/secondary.c Fri Jan 13 23:25:35 2012 (r230092) @@ -282,8 +282,10 @@ init_remote(struct hast_resource *res, s (uintmax_t)resuid, (uintmax_t)res->hr_resuid); pjdlog_error("%s", errmsg); nv_add_string(nvout, errmsg, "errmsg"); - if (hast_proto_send(res, res->hr_remotein, nvout, NULL, 0) == -1) { - pjdlog_exit(EX_TEMPFAIL, "Unable to send response to %s", + if (hast_proto_send(res, res->hr_remotein, nvout, + NULL, 0) == -1) { + pjdlog_exit(EX_TEMPFAIL, + "Unable to send response to %s", res->hr_remoteaddr); } nv_free(nvout); @@ -327,8 +329,10 @@ init_remote(struct hast_resource *res, s free(map); pjdlog_error("Split-brain detected, exiting."); nv_add_string(nvout, "Split-brain condition!", "errmsg"); - if (hast_proto_send(res, res->hr_remotein, nvout, NULL, 0) == -1) { - pjdlog_exit(EX_TEMPFAIL, "Unable to send response to %s", + if (hast_proto_send(res, res->hr_remotein, nvout, + NULL, 0) == -1) { + pjdlog_exit(EX_TEMPFAIL, + "Unable to send response to %s", res->hr_remoteaddr); } nv_free(nvout); @@ -475,7 +479,8 @@ hastd_secondary(struct hast_resource *re } static void -reqlog(int loglevel, int debuglevel, int error, struct hio *hio, const char *fmt, ...) +reqlog(int loglevel, int debuglevel, int error, struct hio *hio, + const char *fmt, ...) { char msg[1024]; va_list ap; @@ -838,7 +843,7 @@ send_thread(void *arg) nv_add_int16(nvout, hio->hio_error, "error"); if (hast_proto_send(res, res->hr_remoteout, nvout, data, length) == -1) { - secondary_exit(EX_TEMPFAIL, "Unable to send reply."); + secondary_exit(EX_TEMPFAIL, "Unable to send reply"); } nv_free(nvout); pjdlog_debug(2, "send: (%p) Moving request to the free queue.", From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 23:31:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF261106564A; Fri, 13 Jan 2012 23:31:36 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B415E8FC0C; Fri, 13 Jan 2012 23:31:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DNVakj085156; Fri, 13 Jan 2012 23:31:36 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DNVaQo085152; Fri, 13 Jan 2012 23:31:36 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201201132331.q0DNVaQo085152@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 13 Jan 2012 23:31: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: r230094 - in head/sys/mips: include mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 23:31:37 -0000 Author: gonzo Date: Fri Jan 13 23:31:36 2012 New Revision: 230094 URL: http://svn.freebsd.org/changeset/base/230094 Log: Fix backtrace for MIPS64: - Properly print 64-bit addresses - Get whole 64 bits of address using kdbpeekd - Make check for kernel address compatible with MIPS64 Modified: head/sys/mips/include/db_machdep.h head/sys/mips/mips/db_trace.c head/sys/mips/mips/support.S Modified: head/sys/mips/include/db_machdep.h ============================================================================== --- head/sys/mips/include/db_machdep.h Fri Jan 13 23:25:58 2012 (r230093) +++ head/sys/mips/include/db_machdep.h Fri Jan 13 23:31:36 2012 (r230094) @@ -93,6 +93,7 @@ db_addr_t next_instr_address(db_addr_t, int db_inst_type(int); db_addr_t branch_taken(int inst, db_addr_t pc); void stacktrace_subr(register_t pc, register_t sp, register_t ra, int (*)(const char *, ...)); -int kdbpeek(int *); +int32_t kdbpeek(int *); +int64_t kdbpeekd(int *); #endif /* !_MIPS_DB_MACHDEP_H_ */ Modified: head/sys/mips/mips/db_trace.c ============================================================================== --- head/sys/mips/mips/db_trace.c Fri Jan 13 23:25:58 2012 (r230093) +++ head/sys/mips/mips/db_trace.c Fri Jan 13 23:31:36 2012 (r230094) @@ -49,10 +49,13 @@ extern char edata[]; */ #define MIPS_END_OF_FUNCTION(ins) ((ins) == 0x03e00008) -/* - * kdbpeekD(addr) - skip one word starting at 'addr', then read the second word - */ -#define kdbpeekD(addr) kdbpeek(((int *)(addr)) + 1) +#if defined(__mips_n64) +# define MIPS_IS_VALID_KERNELADDR(reg) ((((reg) & 3) == 0) && \ + ((vm_offset_t)(reg) >= MIPS_XKPHYS_START)) +#else +# define MIPS_IS_VALID_KERNELADDR(reg) ((((reg) & 3) == 0) && \ + ((vm_offset_t)(reg) >= MIPS_KSEG0_START)) +#endif /* * Functions ``special'' enough to print by name @@ -141,8 +144,8 @@ loop: } /* check for bad SP: could foul up next frame */ /*XXX MIPS64 bad: this hard-coded SP is lame */ - if (sp & 3 || (uintptr_t)sp < 0x80000000u) { - (*printfn) ("SP 0x%x: not in kernel\n", sp); + if (!MIPS_IS_VALID_KERNELADDR(sp)) { + (*printfn) ("SP 0x%jx: not in kernel\n", sp); ra = 0; subr = 0; goto done; @@ -182,8 +185,8 @@ loop: } /* check for bad PC */ /*XXX MIPS64 bad: These hard coded constants are lame */ - if (pc & 3 || pc < (uintptr_t)0x80000000) { - (*printfn) ("PC 0x%x: not in kernel\n", pc); + if (!MIPS_IS_VALID_KERNELADDR(pc)) { + (*printfn) ("PC 0x%jx: not in kernel\n", pc); ra = 0; goto done; } @@ -304,27 +307,27 @@ loop: mask |= (1 << i.IType.rt); switch (i.IType.rt) { case 4:/* a0 */ - args[0] = kdbpeekD((int *)(sp + (short)i.IType.imm)); + args[0] = kdbpeekd((int *)(sp + (short)i.IType.imm)); valid_args[0] = 1; break; case 5:/* a1 */ - args[1] = kdbpeekD((int *)(sp + (short)i.IType.imm)); + args[1] = kdbpeekd((int *)(sp + (short)i.IType.imm)); valid_args[1] = 1; break; case 6:/* a2 */ - args[2] = kdbpeekD((int *)(sp + (short)i.IType.imm)); + args[2] = kdbpeekd((int *)(sp + (short)i.IType.imm)); valid_args[2] = 1; break; case 7:/* a3 */ - args[3] = kdbpeekD((int *)(sp + (short)i.IType.imm)); + args[3] = kdbpeekd((int *)(sp + (short)i.IType.imm)); valid_args[3] = 1; break; case 31: /* ra */ - ra = kdbpeekD((int *)(sp + (short)i.IType.imm)); + ra = kdbpeekd((int *)(sp + (short)i.IType.imm)); } break; @@ -350,7 +353,7 @@ done: (*printfn)("?"); } - (*printfn) (") ra %x sp %x sz %d\n", ra, sp, stksize); + (*printfn) (") ra %jx sp %jx sz %d\n", ra, sp, stksize); if (ra) { if (pc == ra && stksize == 0) Modified: head/sys/mips/mips/support.S ============================================================================== --- head/sys/mips/mips/support.S Fri Jan 13 23:25:58 2012 (r230093) +++ head/sys/mips/mips/support.S Fri Jan 13 23:31:36 2012 (r230094) @@ -1340,6 +1340,25 @@ LEAF(kdbpeek) PTR_S zero, U_PCB_ONFAULT(t1) END(kdbpeek) +LEAF(kdbpeekd) + PTR_LA v1, ddberr + and v0, a0, 3 # unaligned ? + GET_CPU_PCPU(t1) + PTR_L t1, PC_CURPCB(t1) + bne v0, zero, 1f + PTR_S v1, U_PCB_ONFAULT(t1) + + ld v0, (a0) + jr ra + PTR_S zero, U_PCB_ONFAULT(t1) + +1: + REG_LHI v0, 0(a0) + REG_LLO v0, 7(a0) + jr ra + PTR_S zero, U_PCB_ONFAULT(t1) +END(kdbpeekd) + ddberr: jr ra nop From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 23:32:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AD6D106564A; Fri, 13 Jan 2012 23:32:27 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7940C8FC08; Fri, 13 Jan 2012 23:32:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0DNWRJ6085218; Fri, 13 Jan 2012 23:32:27 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0DNWRYw085215; Fri, 13 Jan 2012 23:32:27 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201132332.q0DNWRYw085215@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 13 Jan 2012 23:32: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: r230095 - in head: bin/sh tools/regression/bin/sh/builtins X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 23:32:27 -0000 Author: jilles Date: Fri Jan 13 23:32:27 2012 New Revision: 230095 URL: http://svn.freebsd.org/changeset/base/230095 Log: sh: Properly show "Not a directory" error in cd builtin. The errno message display added in r222292 did not take attempting to cd to a non-directory or something that cannot be stat()ed into account. PR: bin/164070 MFC after: 10 days Added: head/tools/regression/bin/sh/builtins/cd8.0 (contents, props changed) Modified: head/bin/sh/cd.c Modified: head/bin/sh/cd.c ============================================================================== --- head/bin/sh/cd.c Fri Jan 13 23:31:36 2012 (r230094) +++ head/bin/sh/cd.c Fri Jan 13 23:32:27 2012 (r230095) @@ -130,7 +130,12 @@ cdcmd(int argc, char **argv) (path = bltinlookup("CDPATH", 1)) == NULL) path = nullstr; while ((p = padvance(&path, dest)) != NULL) { - if (stat(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) { + if (stat(p, &statb) < 0) { + if (errno != ENOENT) + errno1 = errno; + } else if (!S_ISDIR(statb.st_mode)) + errno1 = ENOTDIR; + else { if (!print) { /* * XXX - rethink Added: head/tools/regression/bin/sh/builtins/cd8.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/cd8.0 Fri Jan 13 23:32:27 2012 (r230095) @@ -0,0 +1,26 @@ +# $FreeBSD$ + +# The exact wording of the error message is not standardized, but giving +# a description of the errno is useful. + +LC_ALL=C +export LC_ALL +r=0 + +t() { + exec 3>&1 + errmsg=`cd "$1" 2>&1 >&3 3>&-` + exec 3>&- + case $errmsg in + *[Nn]ot\ a\ directory*) + ;; + *) + printf "Wrong error message for %s: %s\n" "$1" "$errmsg" + r=3 + ;; + esac +} + +t /dev/tty +t /dev/tty/x +exit $r From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 00:36:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A57A9106566B; Sat, 14 Jan 2012 00:36:07 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94A1E8FC0C; Sat, 14 Jan 2012 00:36:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0E0a7m4087277; Sat, 14 Jan 2012 00:36:07 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0E0a7lx087275; Sat, 14 Jan 2012 00:36:07 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201201140036.q0E0a7lx087275@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sat, 14 Jan 2012 00:36: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: r230097 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 00:36:07 -0000 Author: gonzo Date: Sat Jan 14 00:36:07 2012 New Revision: 230097 URL: http://svn.freebsd.org/changeset/base/230097 Log: Fix kernel modules loading for MIPS64 kernel: On amd64, link_elf_obj.c must specify KERNBASE rather than VM_MIN_KERNEL_ADDRESS to vm_map_find() because kernel loadable modules must be mapped for execution in the same upper region of the kernel map as the kernel code and data segments. For MIPS32 KERNBASE lies below KVA area (it's less than VM_MIN_KERNEL_ADDRESS) so basically vm_map_find got whole KVA to look through. On MIPS64 it's not the case because KERNBASE is set to the very end of XKSEG, well out of KVA bounds, so vm_map_find always fails. We should use VM_MIN_KERNEL_ADDRESS as a base for vm_map_find. Details obtained from: alc@ Modified: head/sys/kern/link_elf_obj.c Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Sat Jan 14 00:28:02 2012 (r230096) +++ head/sys/kern/link_elf_obj.c Sat Jan 14 00:36:07 2012 (r230097) @@ -684,7 +684,11 @@ link_elf_load_file(linker_class_t cls, c * location of code and data in the kernel's address space, request a * mapping that is above the kernel. */ +#ifdef __amd64__ mapbase = KERNBASE; +#else + mapbase = VM_MIN_KERNEL_ADDRESS; +#endif error = vm_map_find(kernel_map, ef->object, 0, &mapbase, round_page(mapsize), TRUE, VM_PROT_ALL, VM_PROT_ALL, FALSE); if (error) { From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 02:18:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 651EF106566B; Sat, 14 Jan 2012 02:18:43 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 532798FC0C; Sat, 14 Jan 2012 02:18:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0E2IhLr090620; Sat, 14 Jan 2012 02:18:43 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0E2Igad090552; Sat, 14 Jan 2012 02:18:42 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201140218.q0E2Igad090552@svn.freebsd.org> From: Doug Barton Date: Sat, 14 Jan 2012 02:18: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: r230099 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 02:18:43 -0000 Author: dougb Date: Sat Jan 14 02:18:41 2012 New Revision: 230099 URL: http://svn.freebsd.org/changeset/base/230099 Log: Prepare for the removal of set_rcvar() by changing the rcvar= assignments to the literal values it would have returned. The concept of set_rcvar() was nice in theory, but the forks it creates are a drag on the startup process, which is especially noticeable on slower systems, such as embedded ones. During the discussion on freebsd-rc@ a preference was expressed for using ${name}_enable instead of the literal values. However the code portability concept doesn't really apply since there are so many other places where the literal name has to be searched for and replaced. Also, using the literal value is also a tiny bit faster than dereferencing the variables, and every little bit helps. Modified: head/etc/rc.d/accounting head/etc/rc.d/amd head/etc/rc.d/apm head/etc/rc.d/apmd head/etc/rc.d/bootparams head/etc/rc.d/bsnmpd head/etc/rc.d/bthidd head/etc/rc.d/cleanvar head/etc/rc.d/cleartmp head/etc/rc.d/cron head/etc/rc.d/ddb head/etc/rc.d/devd head/etc/rc.d/dmesg head/etc/rc.d/ftp-proxy head/etc/rc.d/ftpd head/etc/rc.d/gptboot head/etc/rc.d/hastd head/etc/rc.d/hcsecd head/etc/rc.d/hostapd head/etc/rc.d/inetd head/etc/rc.d/ip6addrctl head/etc/rc.d/ipfilter head/etc/rc.d/ipfs head/etc/rc.d/ipmon head/etc/rc.d/ipnat head/etc/rc.d/ipsec head/etc/rc.d/ipxrouted head/etc/rc.d/jail head/etc/rc.d/keyserv head/etc/rc.d/lpd head/etc/rc.d/mountd head/etc/rc.d/moused head/etc/rc.d/mroute6d head/etc/rc.d/mrouted head/etc/rc.d/natd head/etc/rc.d/netwait head/etc/rc.d/newsyslog head/etc/rc.d/nfscbd head/etc/rc.d/nfsd head/etc/rc.d/nfsuserd head/etc/rc.d/nscd head/etc/rc.d/ntpd head/etc/rc.d/ntpdate head/etc/rc.d/pf head/etc/rc.d/pflog head/etc/rc.d/pfsync head/etc/rc.d/powerd head/etc/rc.d/ppp head/etc/rc.d/pppoed head/etc/rc.d/quota head/etc/rc.d/rarpd head/etc/rc.d/rfcomm_pppd_server head/etc/rc.d/route6d head/etc/rc.d/routed head/etc/rc.d/rpcbind head/etc/rc.d/rtadvd head/etc/rc.d/rtsold head/etc/rc.d/rwho head/etc/rc.d/sdpd head/etc/rc.d/sendmail head/etc/rc.d/sshd head/etc/rc.d/syslogd head/etc/rc.d/timed head/etc/rc.d/ubthidhci head/etc/rc.d/virecover head/etc/rc.d/watchdogd Modified: head/etc/rc.d/accounting ============================================================================== --- head/etc/rc.d/accounting Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/accounting Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="accounting" -rcvar=`set_rcvar` +rcvar="accounting_enable" accounting_command="/usr/sbin/accton" accounting_file="/var/account/acct" Modified: head/etc/rc.d/amd ============================================================================== --- head/etc/rc.d/amd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/amd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="amd" -rcvar=`set_rcvar` +rcvar="amd_enable" command="/usr/sbin/${name}" start_precmd="amd_precmd" command_args="&" Modified: head/etc/rc.d/apm ============================================================================== --- head/etc/rc.d/apm Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/apm Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="apm" -rcvar=`set_rcvar` +rcvar="apm_enable" start_precmd="apm_precmd" command="/usr/sbin/${name}" start_cmd="${command} -e enable" Modified: head/etc/rc.d/apmd ============================================================================== --- head/etc/rc.d/apmd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/apmd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="apmd" -rcvar=`set_rcvar` +rcvar="apmd_enable" command="/usr/sbin/${name}" start_precmd="apmd_prestart" Modified: head/etc/rc.d/bootparams ============================================================================== --- head/etc/rc.d/bootparams Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/bootparams Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="bootparamd" -rcvar=`set_rcvar` +rcvar="bootparamd_enable" required_files="/etc/bootparams" command="/usr/sbin/${name}" Modified: head/etc/rc.d/bsnmpd ============================================================================== --- head/etc/rc.d/bsnmpd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/bsnmpd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="bsnmpd" -rcvar=`set_rcvar` +rcvar="bsnmpd_enable" command="/usr/sbin/${name}" pidfile="/var/run/snmpd.pid" Modified: head/etc/rc.d/bthidd ============================================================================== --- head/etc/rc.d/bthidd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/bthidd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,9 +11,9 @@ . /etc/rc.subr name="bthidd" +rcvar="bthidd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" -rcvar=`set_rcvar` start_precmd="bthidd_prestart" bthidd_prestart() Modified: head/etc/rc.d/cleanvar ============================================================================== --- head/etc/rc.d/cleanvar Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/cleanvar Sat Jan 14 02:18:41 2012 (r230099) @@ -9,7 +9,7 @@ . /etc/rc.subr name="cleanvar" -rcvar=`set_rcvar` +rcvar="cleanvar_enable" start_precmd="${name}_prestart" start_cmd="${name}_start" Modified: head/etc/rc.d/cleartmp ============================================================================== --- head/etc/rc.d/cleartmp Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/cleartmp Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ name="cleartmp" # Disguise rcvar for the start method to run irrespective of its setting. -rcvar1=`set_rcvar clear_tmp` +rcvar1="clear_tmp_enable" start_cmd="${name}_start" stop_cmd=":" Modified: head/etc/rc.d/cron ============================================================================== --- head/etc/rc.d/cron Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/cron Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="cron" -rcvar="`set_rcvar`" +rcvar="cron_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" Modified: head/etc/rc.d/ddb ============================================================================== --- head/etc/rc.d/ddb Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ddb Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ddb" -rcvar=`set_rcvar` +rcvar="ddb_enable" command="/sbin/${name}" start_precmd="ddb_prestart" stop_cmd=":" Modified: head/etc/rc.d/devd ============================================================================== --- head/etc/rc.d/devd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/devd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="devd" -rcvar=`set_rcvar` +rcvar="devd_enable" command="/sbin/${name}" start_precmd=${name}_prestart Modified: head/etc/rc.d/dmesg ============================================================================== --- head/etc/rc.d/dmesg Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/dmesg Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="dmesg" -rcvar=`set_rcvar` +rcvar="dmesg_enable" dmesg_file="/var/run/dmesg.boot" start_cmd="do_dmesg" stop_cmd=":" Modified: head/etc/rc.d/ftp-proxy ============================================================================== --- head/etc/rc.d/ftp-proxy Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ftp-proxy Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ftpproxy" -rcvar=`set_rcvar` +rcvar="ftpproxy_enable" command="/usr/sbin/ftp-proxy" load_rc_config $name Modified: head/etc/rc.d/ftpd ============================================================================== --- head/etc/rc.d/ftpd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ftpd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ftpd" -rcvar=`set_rcvar` +rcvar="ftpd_enable" command="/usr/libexec/${name}" pidfile="/var/run/${name}.pid" start_precmd=ftpd_prestart Modified: head/etc/rc.d/gptboot ============================================================================== --- head/etc/rc.d/gptboot Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/gptboot Sat Jan 14 02:18:41 2012 (r230099) @@ -34,7 +34,7 @@ . /etc/rc.subr name="gptboot" -rcvar=`set_rcvar` +rcvar="gptboot_enable" start_cmd="gptboot_report" gptboot_report() Modified: head/etc/rc.d/hastd ============================================================================== --- head/etc/rc.d/hastd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/hastd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="hastd" -rcvar=`set_rcvar` +rcvar="hastd_enable" pidfile="/var/run/${name}.pid" command="/sbin/${name}" hastctl="/sbin/hastctl" Modified: head/etc/rc.d/hcsecd ============================================================================== --- head/etc/rc.d/hcsecd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/hcsecd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,9 +11,9 @@ . /etc/rc.subr name="hcsecd" +rcvar="hcsecd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" -rcvar=`set_rcvar` required_modules="ng_btsocket" load_rc_config $name Modified: head/etc/rc.d/hostapd ============================================================================== --- head/etc/rc.d/hostapd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/hostapd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,8 +10,8 @@ . /etc/rc.subr name="hostapd" +rcvar="hostapd_enable" command="/usr/sbin/${name}" -rcvar=`set_rcvar` conf_file="/etc/${name}.conf" pidfile="/var/run/${name}.pid" Modified: head/etc/rc.d/inetd ============================================================================== --- head/etc/rc.d/inetd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/inetd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="inetd" -rcvar=`set_rcvar` +rcvar="inetd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/${name}.conf" Modified: head/etc/rc.d/ip6addrctl ============================================================================== --- head/etc/rc.d/ip6addrctl Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ip6addrctl Sat Jan 14 02:18:41 2012 (r230099) @@ -12,7 +12,7 @@ . /etc/network.subr name="ip6addrctl" -rcvar=`set_rcvar` +rcvar="ip6addrctl_enable" start_cmd="ip6addrctl_start" stop_cmd="ip6addrctl_stop" extra_commands="status prefer_ipv6 prefer_ipv4" Modified: head/etc/rc.d/ipfilter ============================================================================== --- head/etc/rc.d/ipfilter Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ipfilter Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ipfilter" -rcvar=`set_rcvar` +rcvar="ipfilter_enable" load_rc_config $name stop_precmd="test -f ${ipfilter_rules} -o -f ${ipv6_ipfilter_rules}" Modified: head/etc/rc.d/ipfs ============================================================================== --- head/etc/rc.d/ipfs Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ipfs Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ipfs" -rcvar=`set_rcvar` +rcvar="ipfs_enable" start_cmd="ipfs_start" stop_cmd="ipfs_stop" start_precmd="ipfs_prestart" Modified: head/etc/rc.d/ipmon ============================================================================== --- head/etc/rc.d/ipmon Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ipmon Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ipmon" -rcvar=`set_rcvar` +rcvar="ipmon_enable" command="/sbin/${name}" start_precmd="ipmon_precmd" Modified: head/etc/rc.d/ipnat ============================================================================== --- head/etc/rc.d/ipnat Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ipnat Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ipnat" -rcvar=`set_rcvar` +rcvar="ipnat_enable" load_rc_config $name start_cmd="ipnat_start" stop_cmd="${ipnat_program} -F -C" Modified: head/etc/rc.d/ipsec ============================================================================== --- head/etc/rc.d/ipsec Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ipsec Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ipsec" -rcvar=`set_rcvar` +rcvar="ipsec_enable" start_precmd="ipsec_prestart" start_cmd="ipsec_start" stop_precmd="test -f $ipsec_file" Modified: head/etc/rc.d/ipxrouted ============================================================================== --- head/etc/rc.d/ipxrouted Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ipxrouted Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ipxrouted" -rcvar=`set_rcvar` +rcvar="ipxrouted_enable" command="/usr/sbin/IPXrouted" command_args="> /dev/null 2>&1" Modified: head/etc/rc.d/jail ============================================================================== --- head/etc/rc.d/jail Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/jail Sat Jan 14 02:18:41 2012 (r230099) @@ -17,7 +17,7 @@ . /etc/rc.subr name="jail" -rcvar=`set_rcvar` +rcvar="jail_enable" start_precmd="jail_prestart" start_cmd="jail_start" Modified: head/etc/rc.d/keyserv ============================================================================== --- head/etc/rc.d/keyserv Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/keyserv Sat Jan 14 02:18:41 2012 (r230099) @@ -13,7 +13,7 @@ . /etc/rc.subr name="keyserv" -rcvar=`set_rcvar` +rcvar="keyserv_enable" command="/usr/sbin/${name}" start_precmd="keyserv_prestart" Modified: head/etc/rc.d/lpd ============================================================================== --- head/etc/rc.d/lpd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/lpd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="lpd" -rcvar=`set_rcvar` +rcvar="lpd_enable" command="/usr/sbin/${name}" required_files="/etc/printcap" start_precmd="chkprintcap" Modified: head/etc/rc.d/mountd ============================================================================== --- head/etc/rc.d/mountd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/mountd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="mountd" -rcvar=`set_rcvar` +rcvar="mountd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/exports" Modified: head/etc/rc.d/moused ============================================================================== --- head/etc/rc.d/moused Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/moused Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="moused" -rcvar=`set_rcvar` +rcvar="moused_enable" command="/usr/sbin/${name}" start_cmd="moused_start" pidprefix="/var/run/moused" @@ -23,7 +23,7 @@ load_rc_config $name # if [ -n "$2" ]; then eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}} - rcvar=`set_rcvar moused_$2` + rcvar="moused_${2}_enable" pidfile="${pidprefix}.$2.pid" pidarg="-I $pidfile" fi Modified: head/etc/rc.d/mroute6d ============================================================================== --- head/etc/rc.d/mroute6d Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/mroute6d Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="mroute6d" -rcvar=`set_rcvar` +rcvar="mroute6d_enable" command="/usr/local/sbin/pim6dd" load_rc_config $name Modified: head/etc/rc.d/mrouted ============================================================================== --- head/etc/rc.d/mrouted Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/mrouted Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="mrouted" -rcvar=`set_rcvar` +rcvar="mrouted_enable" command="/usr/local/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/${name}.conf" Modified: head/etc/rc.d/natd ============================================================================== --- head/etc/rc.d/natd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/natd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/network.subr name="natd" -rcvar=`set_rcvar` +rcvar="natd_enable" command="/sbin/${name}" pidfile="/var/run/${name}.pid" start_precmd="natd_precmd" Modified: head/etc/rc.d/netwait ============================================================================== --- head/etc/rc.d/netwait Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/netwait Sat Jan 14 02:18:41 2012 (r230099) @@ -14,7 +14,7 @@ . /etc/rc.subr name="netwait" -rcvar=`set_rcvar` +rcvar="netwait_enable" start_cmd="${name}_start" stop_cmd=":" Modified: head/etc/rc.d/newsyslog ============================================================================== --- head/etc/rc.d/newsyslog Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/newsyslog Sat Jan 14 02:18:41 2012 (r230099) @@ -9,7 +9,7 @@ . /etc/rc.subr name="newsyslog" -rcvar=`set_rcvar` +rcvar="newsyslog_enable" required_files="/etc/newsyslog.conf" command="/usr/sbin/${name}" start_cmd="newsyslog_start" Modified: head/etc/rc.d/nfscbd ============================================================================== --- head/etc/rc.d/nfscbd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/nfscbd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="nfscbd" -rcvar=`set_rcvar` +rcvar="nfscbd_enable" command="/usr/sbin/${name}" sig_stop="USR1" Modified: head/etc/rc.d/nfsd ============================================================================== --- head/etc/rc.d/nfsd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/nfsd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="nfsd" -rcvar=`set_rcvar nfs_server` +rcvar="nfs_server_enable" command="/usr/sbin/${name}" load_rc_config $name Modified: head/etc/rc.d/nfsuserd ============================================================================== --- head/etc/rc.d/nfsuserd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/nfsuserd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="nfsuserd" -rcvar=`set_rcvar` +rcvar="nfsuserd_enable" command="/usr/sbin/${name}" sig_stop="USR1" Modified: head/etc/rc.d/nscd ============================================================================== --- head/etc/rc.d/nscd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/nscd Sat Jan 14 02:18:41 2012 (r230099) @@ -19,7 +19,7 @@ . /etc/rc.subr name="nscd" -rcvar=`set_rcvar` +rcvar="nscd_enable" command=/usr/sbin/nscd extra_commands="flush" Modified: head/etc/rc.d/ntpd ============================================================================== --- head/etc/rc.d/ntpd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ntpd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ntpd" -rcvar=`set_rcvar` +rcvar="ntpd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" start_precmd="ntpd_precmd" Modified: head/etc/rc.d/ntpdate ============================================================================== --- head/etc/rc.d/ntpdate Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ntpdate Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ntpdate" -rcvar=`set_rcvar` +rcvar="ntpdate_enable" stop_cmd=":" start_cmd="ntpdate_start" Modified: head/etc/rc.d/pf ============================================================================== --- head/etc/rc.d/pf Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/pf Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="pf" -rcvar=`set_rcvar` +rcvar="pf_enable" load_rc_config $name start_cmd="pf_start" stop_cmd="pf_stop" Modified: head/etc/rc.d/pflog ============================================================================== --- head/etc/rc.d/pflog Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/pflog Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="pflog" -rcvar=`set_rcvar` +rcvar="pflog_enable" command="/sbin/pflogd" pidfile="/var/run/pflogd.pid" start_precmd="pflog_prestart" Modified: head/etc/rc.d/pfsync ============================================================================== --- head/etc/rc.d/pfsync Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/pfsync Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="pfsync" -rcvar=`set_rcvar` +rcvar="pfsync_enable" start_precmd="pfsync_prestart" start_cmd="pfsync_start" stop_cmd="pfsync_stop" Modified: head/etc/rc.d/powerd ============================================================================== --- head/etc/rc.d/powerd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/powerd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="powerd" -rcvar=`set_rcvar` +rcvar="powerd_enable" command="/usr/sbin/${name}" stop_postcmd=powerd_poststop Modified: head/etc/rc.d/ppp ============================================================================== --- head/etc/rc.d/ppp Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ppp Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ppp" -rcvar=`set_rcvar` +rcvar="ppp_enable" command="/usr/sbin/${name}" start_cmd="ppp_start" stop_cmd="ppp_stop" Modified: head/etc/rc.d/pppoed ============================================================================== --- head/etc/rc.d/pppoed Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/pppoed Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="pppoed" -rcvar="`set_rcvar`" +rcvar="pppoed_enable" start_cmd="pppoed_start" # XXX stop_cmd will not be straightforward stop_cmd=":" Modified: head/etc/rc.d/quota ============================================================================== --- head/etc/rc.d/quota Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/quota Sat Jan 14 02:18:41 2012 (r230099) @@ -13,7 +13,7 @@ . /etc/rc.subr name="quota" -rcvar=`set_rcvar` +rcvar="quota_enable" load_rc_config $name start_cmd="quota_start" stop_cmd="/usr/sbin/quotaoff ${quotaoff_flags}" Modified: head/etc/rc.d/rarpd ============================================================================== --- head/etc/rc.d/rarpd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/rarpd Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="rarpd" -rcvar=`set_rcvar` +rcvar="rarpd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/ethers" Modified: head/etc/rc.d/rfcomm_pppd_server ============================================================================== --- head/etc/rc.d/rfcomm_pppd_server Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/rfcomm_pppd_server Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="rfcomm_pppd_server" -rcvar=`set_rcvar` +rcvar="rfcomm_pppd_server_enable" command="/usr/sbin/rfcomm_pppd" start_cmd="rfcomm_pppd_server_start" stop_cmd="rfcomm_pppd_server_stop" Modified: head/etc/rc.d/route6d ============================================================================== --- head/etc/rc.d/route6d Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/route6d Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="route6d" -rcvar=`set_rcvar` +rcvar="route6d_enable" set_rcvar_obsolete ipv6_router_enable route6d_enable set_rcvar_obsolete ipv6_router route6d_program Modified: head/etc/rc.d/routed ============================================================================== --- head/etc/rc.d/routed Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/routed Sat Jan 14 02:18:41 2012 (r230099) @@ -10,8 +10,8 @@ . /etc/rc.subr name="routed" +rcvar="routed_enable" desc="network RIP and router discovery routing daemon" -rcvar=`set_rcvar` set_rcvar_obsolete router_enable routed_enable set_rcvar_obsolete router routed_program Modified: head/etc/rc.d/rpcbind ============================================================================== --- head/etc/rc.d/rpcbind Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/rpcbind Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="rpcbind" -rcvar=`set_rcvar` +rcvar="rpcbind_enable" command="/usr/sbin/${name}" stop_postcmd='/bin/rm -f /var/run/rpcbind.*' Modified: head/etc/rc.d/rtadvd ============================================================================== --- head/etc/rc.d/rtadvd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/rtadvd Sat Jan 14 02:18:41 2012 (r230099) @@ -12,7 +12,7 @@ . /etc/network.subr name="rtadvd" -rcvar=`set_rcvar` +rcvar="rtadvd_enable" command="/usr/sbin/${name}" start_precmd="rtadvd_precmd" Modified: head/etc/rc.d/rtsold ============================================================================== --- head/etc/rc.d/rtsold Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/rtsold Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="rtsold" -rcvar=`set_rcvar` +rcvar="rtsold_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" start_postcmd="rtsold_poststart" Modified: head/etc/rc.d/rwho ============================================================================== --- head/etc/rc.d/rwho Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/rwho Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="rwhod" -rcvar="`set_rcvar`" +rcvar="rwhod_enable" command="/usr/sbin/${name}" load_rc_config $name Modified: head/etc/rc.d/sdpd ============================================================================== --- head/etc/rc.d/sdpd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/sdpd Sat Jan 14 02:18:41 2012 (r230099) @@ -12,7 +12,7 @@ name="sdpd" command="/usr/sbin/${name}" -rcvar=`set_rcvar` +rcvar="sdpd_enable" required_modules="ng_btsocket" load_rc_config $name Modified: head/etc/rc.d/sendmail ============================================================================== --- head/etc/rc.d/sendmail Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/sendmail Sat Jan 14 02:18:41 2012 (r230099) @@ -15,7 +15,7 @@ . /etc/rc.subr name="sendmail" -rcvar=`set_rcvar` +rcvar="sendmail_enable" required_files="/etc/mail/${name}.cf" start_precmd="sendmail_precmd" @@ -79,14 +79,14 @@ required_files= if checkyesno sendmail_submit_enable; then name="sendmail_submit" - rcvar=`set_rcvar` + rcvar="sendmail_submit_enable" start_cmd="${command} ${sendmail_submit_flags}" run_rc_command "$1" fi if checkyesno sendmail_outbound_enable; then name="sendmail_outbound" - rcvar=`set_rcvar` + rcvar="sendmail_outbound_enable" start_cmd="${command} ${sendmail_outbound_flags}" run_rc_command "$1" fi Modified: head/etc/rc.d/sshd ============================================================================== --- head/etc/rc.d/sshd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/sshd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="sshd" -rcvar=`set_rcvar` +rcvar="sshd_enable" command="/usr/sbin/${name}" keygen_cmd="sshd_keygen" start_precmd="sshd_precmd" Modified: head/etc/rc.d/syslogd ============================================================================== --- head/etc/rc.d/syslogd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/syslogd Sat Jan 14 02:18:41 2012 (r230099) @@ -10,7 +10,7 @@ . /etc/rc.subr name="syslogd" -rcvar=`set_rcvar` +rcvar="syslogd_enable" pidfile="/var/run/syslog.pid" command="/usr/sbin/${name}" required_files="/etc/syslog.conf" @@ -41,7 +41,7 @@ syslogd_precmd() # for _l in $altlog_proglist; do eval _ldir=\$${_l}_chrootdir - if checkyesno `set_rcvar $_l` && [ -n "$_ldir" ]; then + if checkyesno ${_l}_enable && [ -n "$_ldir" ]; then echo "${_ldir}/var/run/log" >> $sockfile fi done Modified: head/etc/rc.d/timed ============================================================================== --- head/etc/rc.d/timed Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/timed Sat Jan 14 02:18:41 2012 (r230099) @@ -11,7 +11,7 @@ . /etc/rc.subr name="timed" -rcvar=`set_rcvar` +rcvar="timed_enable" command="/usr/sbin/${name}" load_rc_config $name Modified: head/etc/rc.d/ubthidhci ============================================================================== --- head/etc/rc.d/ubthidhci Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/ubthidhci Sat Jan 14 02:18:41 2012 (r230099) @@ -11,8 +11,8 @@ . /etc/rc.subr name="ubthidhci" +rcvar="ubthidhci_enable" command="/usr/sbin/usbconfig" -rcvar=`set_rcvar` start_precmd="ubthidhci_prestart" ubthidhci_prestart() Modified: head/etc/rc.d/virecover ============================================================================== --- head/etc/rc.d/virecover Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/virecover Sat Jan 14 02:18:41 2012 (r230099) @@ -12,7 +12,7 @@ . /etc/rc.subr name="virecover" -rcvar="`set_rcvar`" +rcvar="virecover_enable" stop_cmd=":" start_cmd="virecover_start" Modified: head/etc/rc.d/watchdogd ============================================================================== --- head/etc/rc.d/watchdogd Sat Jan 14 00:53:26 2012 (r230098) +++ head/etc/rc.d/watchdogd Sat Jan 14 02:18:41 2012 (r230099) @@ -34,7 +34,7 @@ . /etc/rc.subr name="watchdogd" -rcvar="`set_rcvar`" +rcvar="watchdogd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 04:04:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 351D41065675; Sat, 14 Jan 2012 04:04:59 +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 245098FC08; Sat, 14 Jan 2012 04:04:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0E44xbS093998; Sat, 14 Jan 2012 04:04:59 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0E44wFa093996; Sat, 14 Jan 2012 04:04:58 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201140404.q0E44wFa093996@svn.freebsd.org> From: Rick Macklem Date: Sat, 14 Jan 2012 04:04: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: r230100 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 04:04:59 -0000 Author: rmacklem Date: Sat Jan 14 04:04:58 2012 New Revision: 230100 URL: http://svn.freebsd.org/changeset/base/230100 Log: Tai Horgan reported via email that there were two places in the new NFSv4 server where the code follows the wrong list. Fortunately, for these fairly rare cases, the lc_stateid[] lists are normally empty. This patch fixes the code to follow the correct list. Reported by: tai.horgan at isilon.com Discussed with: zack MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Sat Jan 14 02:18:41 2012 (r230099) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Sat Jan 14 04:04:58 2012 (r230100) @@ -315,7 +315,7 @@ nfsrv_setclient(struct nfsrv_descript *n for (i = 0; i < NFSSTATEHASHSIZE; i++) { LIST_NEWHEAD(&new_clp->lc_stateid[i], &clp->lc_stateid[i], ls_hash); - LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_list) + LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_hash) tstp->ls_clp = new_clp; } LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp, @@ -369,7 +369,7 @@ nfsrv_setclient(struct nfsrv_descript *n for (i = 0; i < NFSSTATEHASHSIZE; i++) { LIST_NEWHEAD(&new_clp->lc_stateid[i], &clp->lc_stateid[i], ls_hash); - LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_list) + LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_hash) tstp->ls_clp = new_clp; } LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp, From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 07:26:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFB63106564A; Sat, 14 Jan 2012 07:26:17 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AA5D8FC08; Sat, 14 Jan 2012 07:26:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0E7QHAB000338; Sat, 14 Jan 2012 07:26:17 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0E7QHv9000336; Sat, 14 Jan 2012 07:26:17 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201201140726.q0E7QHv9000336@svn.freebsd.org> From: Kirk McKusick Date: Sat, 14 Jan 2012 07:26: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: r230101 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 07:26:18 -0000 Author: mckusick Date: Sat Jan 14 07:26:16 2012 New Revision: 230101 URL: http://svn.freebsd.org/changeset/base/230101 Log: Convert FFS mount error messages from kernel printf's to using the vfs_mount_error error message facility provided by the nmount interface. Clean up formatting of mount warnings which still need to use kernel printf's since they do not return errors. Requested by: Craig Rodrigues MFC after: 2 weeks Modified: head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Sat Jan 14 04:04:58 2012 (r230100) +++ head/sys/ufs/ffs/ffs_vfsops.c Sat Jan 14 07:26:16 2012 (r230101) @@ -196,11 +196,13 @@ ffs_mount(struct mount *mp) if (mp->mnt_flag & MNT_UPDATE) { if (VFSTOUFS(mp)->um_fs->fs_ronly == 0 && vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - printf("Checker enable: Must be read-only\n"); + vfs_mount_error(mp, + "Checker enable: Must be read-only"); return (EINVAL); } } else if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - printf("Checker enable: Must be read-only\n"); + vfs_mount_error(mp, + "Checker enable: Must be read-only"); return (EINVAL); } /* Set to -1 if we are done */ @@ -210,8 +212,9 @@ ffs_mount(struct mount *mp) if (vfs_getopt(mp->mnt_optnew, "nfsv4acls", NULL, NULL) == 0) { if (mntorflags & MNT_ACLS) { - printf("WARNING: \"acls\" and \"nfsv4acls\" " - "options are mutually exclusive\n"); + vfs_mount_error(mp, + "\"acls\" and \"nfsv4acls\" options " + "are mutually exclusive"); return (EINVAL); } mntorflags |= MNT_NFS4ACLS; @@ -292,8 +295,8 @@ ffs_mount(struct mount *mp) } if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: %s: blocks %jd files %d\n", - fs->fs_fsmnt, "update error", + printf("WARNING: %s Update error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; @@ -336,7 +339,8 @@ ffs_mount(struct mount *mp) * If we are running a checker, do not allow upgrade. */ if (ump->um_fsckpid > 0) { - printf("Active checker, cannot rw upgrade\n"); + vfs_mount_error(mp, + "Active checker, cannot upgrade to write"); return (EINVAL); } /* @@ -360,15 +364,16 @@ ffs_mount(struct mount *mp) ((fs->fs_flags & (FS_SUJ | FS_NEEDSFSCK)) == 0 && (fs->fs_flags & FS_DOSOFTDEP))) { - printf("WARNING: %s was not %s\n", - fs->fs_fsmnt, "properly dismounted"); + printf("WARNING: %s was not properly " + "dismounted\n", fs->fs_fsmnt); } else { - printf( -"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n", - fs->fs_fsmnt); - if (fs->fs_flags & FS_SUJ) - printf( -"WARNING: Forced mount will invalidate journal contents\n"); + vfs_mount_error(mp, + "R/W mount of %s denied. %s.%s", + fs->fs_fsmnt, + "Filesystem is not clean - run fsck", + (fs->fs_flags & FS_SUJ) == 0 ? "" : + " Forced mount will invalidate" + " journal contents"); return (EPERM); } } @@ -439,7 +444,8 @@ ffs_mount(struct mount *mp) */ if (fsckpid > 0) { if (ump->um_fsckpid != 0) { - printf("Active checker already running on %s\n", + vfs_mount_error(mp, + "Active checker already running on %s", fs->fs_fsmnt); return (EINVAL); } @@ -454,7 +460,8 @@ ffs_mount(struct mount *mp) g_topology_unlock(); PICKUP_GIANT(); if (error) { - printf("Checker activation failed on %s\n", + vfs_mount_error(mp, + "Checker activation failed on %s", fs->fs_fsmnt); return (error); } @@ -543,8 +550,8 @@ ffs_mount(struct mount *mp) g_topology_unlock(); PICKUP_GIANT(); if (error) { - printf("Checker activation failed on %s\n", - fs->fs_fsmnt); + printf("WARNING: %s: Checker activation " + "failed\n", fs->fs_fsmnt); } else { ump->um_fsckpid = fsckpid; if (fs->fs_snapinum[0] != 0) @@ -655,8 +662,8 @@ ffs_reload(struct mount *mp, struct thre ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc); UFS_LOCK(ump); if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: reload pending error: blocks %jd files %d\n", - fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, + printf("WARNING: %s: reload pending error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; @@ -822,27 +829,25 @@ ffs_mountfs(devvp, mp, td) printf("WARNING: %s was not properly dismounted\n", fs->fs_fsmnt); } else { - printf( -"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n", - fs->fs_fsmnt); - if (fs->fs_flags & FS_SUJ) - printf( -"WARNING: Forced mount will invalidate journal contents\n"); + vfs_mount_error(mp, "R/W mount of %s denied. %s%s", + fs->fs_fsmnt, "Filesystem is not clean - run fsck.", + (fs->fs_flags & FS_SUJ) == 0 ? "" : + " Forced mount will invalidate journal contents"); error = EPERM; goto out; } if ((fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) && (mp->mnt_flag & MNT_FORCE)) { - printf("%s: lost blocks %jd files %d\n", fs->fs_fsmnt, - (intmax_t)fs->fs_pendingblocks, + printf("WARNING: %s: lost blocks %jd files %d\n", + fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; } } if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: mount pending error: blocks %jd files %d\n", - fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, + printf("WARNING: %s: mount pending error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; @@ -862,16 +867,15 @@ ffs_mountfs(devvp, mp, td) mp->mnt_flag |= MNT_GJOURNAL; MNT_IUNLOCK(mp); } else { - printf( -"WARNING: %s: GJOURNAL flag on fs but no gjournal provider below\n", + printf("WARNING: %s: GJOURNAL flag on fs " + "but no gjournal provider below\n", mp->mnt_stat.f_mntonname); free(mp->mnt_gjprovider, M_UFSMNT); mp->mnt_gjprovider = NULL; } #else - printf( -"WARNING: %s: GJOURNAL flag on fs but no UFS_GJOURNAL support\n", - mp->mnt_stat.f_mntonname); + printf("WARNING: %s: GJOURNAL flag on fs but no " + "UFS_GJOURNAL support\n", mp->mnt_stat.f_mntonname); #endif } else { mp->mnt_gjprovider = NULL; @@ -955,9 +959,8 @@ ffs_mountfs(devvp, mp, td) mp->mnt_flag |= MNT_MULTILABEL; MNT_IUNLOCK(mp); #else - printf( -"WARNING: %s: multilabel flag on fs but no MAC support\n", - mp->mnt_stat.f_mntonname); + printf("WARNING: %s: multilabel flag on fs but " + "no MAC support\n", mp->mnt_stat.f_mntonname); #endif } if ((fs->fs_flags & FS_ACLS) != 0) { @@ -965,8 +968,9 @@ ffs_mountfs(devvp, mp, td) MNT_ILOCK(mp); if (mp->mnt_flag & MNT_NFS4ACLS) - printf("WARNING: ACLs flag on fs conflicts with " - "\"nfsv4acls\" mount option; option ignored\n"); + printf("WARNING: %s: ACLs flag on fs conflicts with " + "\"nfsv4acls\" mount option; option ignored\n", + mp->mnt_stat.f_mntonname); mp->mnt_flag &= ~MNT_NFS4ACLS; mp->mnt_flag |= MNT_ACLS; @@ -981,16 +985,16 @@ ffs_mountfs(devvp, mp, td) MNT_ILOCK(mp); if (mp->mnt_flag & MNT_ACLS) - printf("WARNING: NFSv4 ACLs flag on fs conflicts with " - "\"acls\" mount option; option ignored\n"); + printf("WARNING: %s: NFSv4 ACLs flag on fs conflicts " + "with \"acls\" mount option; option ignored\n", + mp->mnt_stat.f_mntonname); mp->mnt_flag &= ~MNT_ACLS; mp->mnt_flag |= MNT_NFS4ACLS; MNT_IUNLOCK(mp); #else - printf( -"WARNING: %s: NFSv4 ACLs flag on fs but no ACLs support\n", - mp->mnt_stat.f_mntonname); + printf("WARNING: %s: NFSv4 ACLs flag on fs but no " + "ACLs support\n", mp->mnt_stat.f_mntonname); #endif } if ((fs->fs_flags & FS_TRIM) != 0) { @@ -998,12 +1002,12 @@ ffs_mountfs(devvp, mp, td) if (g_io_getattr("GEOM::candelete", cp, &size, &ump->um_candelete) == 0) { if (!ump->um_candelete) - printf( -"WARNING: %s: TRIM flag on fs but disk does not support TRIM\n", + printf("WARNING: %s: TRIM flag on fs but disk " + "does not support TRIM\n", mp->mnt_stat.f_mntonname); } else { - printf( -"WARNING: %s: TRIM flag on fs but cannot get whether disk supports TRIM\n", + printf("WARNING: %s: TRIM flag on fs but disk does " + "not confirm that it supports TRIM\n", mp->mnt_stat.f_mntonname); ump->um_candelete = 0; } @@ -1210,15 +1214,16 @@ ffs_unmount(mp, mntflags) flags = 0; td = curthread; fs = ump->um_fs; + susp = 0; if (mntflags & MNT_FORCE) { flags |= FORCECLOSE; susp = fs->fs_ronly != 0; - } else - susp = 0; + } #ifdef UFS_EXTATTR if ((error = ufs_extattr_stop(mp, td))) { if (error != EOPNOTSUPP) - printf("ffs_unmount: ufs_extattr_stop returned %d\n", + printf("WARNING: unmount %s: ufs_extattr_stop " + "returned errno %d\n", mp->mnt_stat.f_mntonname, error); e_restart = 0; } else { @@ -1256,8 +1261,8 @@ ffs_unmount(mp, mntflags) UFS_LOCK(ump); if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: unmount pending error: blocks %jd files %d\n", - fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, + printf("WARNING: unmount %s: pending error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; @@ -1433,10 +1438,9 @@ ffs_sync(mp, waitfor) td = curthread; fs = ump->um_fs; - if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0) { - printf("fs = %s\n", fs->fs_fsmnt); - panic("ffs_sync: rofs mod"); - } + if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0) + panic("%s: ffs_sync: modification on read-only filesystem", + fs->fs_fsmnt); /* * Write back each (modified) inode. */ @@ -1844,13 +1848,13 @@ ffs_sbupdate(ump, waitfor, suspended) bp = sbbp; if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_sblockloc != SBLOCK_UFS1 && (fs->fs_flags & FS_FLAGS_UPDATED) == 0) { - printf("%s: correcting fs_sblockloc from %jd to %d\n", + printf("WARNING: %s: correcting fs_sblockloc from %jd to %d\n", fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS1); fs->fs_sblockloc = SBLOCK_UFS1; } if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_sblockloc != SBLOCK_UFS2 && (fs->fs_flags & FS_FLAGS_UPDATED) == 0) { - printf("%s: correcting fs_sblockloc from %jd to %d\n", + printf("WARNING: %s: correcting fs_sblockloc from %jd to %d\n", fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS2); fs->fs_sblockloc = SBLOCK_UFS2; } From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 08:11:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 663A91065672; Sat, 14 Jan 2012 08:11:41 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 552A38FC0C; Sat, 14 Jan 2012 08:11:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0E8Bf5g001856; Sat, 14 Jan 2012 08:11:41 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0E8BfFw001854; Sat, 14 Jan 2012 08:11:41 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201201140811.q0E8BfFw001854@svn.freebsd.org> From: David Schultz Date: Sat, 14 Jan 2012 08:11: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: r230102 - head/tools/regression/lib/msun X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 08:11:41 -0000 Author: das Date: Sat Jan 14 08:11:40 2012 New Revision: 230102 URL: http://svn.freebsd.org/changeset/base/230102 Log: Fix a test that doesn't work on architectures where long double is no wider than double. Thanks to Ian Lepore for catching the bug. Modified: head/tools/regression/lib/msun/test-next.c Modified: head/tools/regression/lib/msun/test-next.c ============================================================================== --- head/tools/regression/lib/msun/test-next.c Sat Jan 14 07:26:16 2012 (r230101) +++ head/tools/regression/lib/msun/test-next.c Sat Jan 14 08:11:40 2012 (r230102) @@ -211,7 +211,9 @@ main(int argc, char *argv[]) test(idd(nextafter(DBL_MAX, INFINITY)), INFINITY, ex_over); test(idd(nextafter(INFINITY, 0.0)), DBL_MAX, 0); test(idd(nexttoward(DBL_MAX, DBL_MAX * 2.0L)), INFINITY, ex_over); +#if LDBL_MANT_DIG > 53 test(idd(nexttoward(INFINITY, DBL_MAX * 2.0L)), DBL_MAX, 0); +#endif testf(idf(nextafterf(FLT_MAX, INFINITY)), INFINITY, ex_over); testf(idf(nextafterf(INFINITY, 0.0)), FLT_MAX, 0); From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 08:59:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D599C106564A; Sat, 14 Jan 2012 08:59:02 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA5E08FC16; Sat, 14 Jan 2012 08:59:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0E8x2Op003417; Sat, 14 Jan 2012 08:59:02 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0E8x2gV003415; Sat, 14 Jan 2012 08:59:02 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201140859.q0E8x2gV003415@svn.freebsd.org> From: Doug Barton Date: Sat, 14 Jan 2012 08: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: r230103 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 08:59:02 -0000 Author: dougb Date: Sat Jan 14 08:59:02 2012 New Revision: 230103 URL: http://svn.freebsd.org/changeset/base/230103 Log: Now that its callers have been udpated, remove set_rcvar(). The concept of set_rcvar() was nice in theory, but the forks it creates are a drag on the startup process, which is especially noticeable on slower systems, such as embedded ones. Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Jan 14 08:11:40 2012 (r230102) +++ head/etc/rc.subr Sat Jan 14 08:59:02 2012 (r230103) @@ -54,47 +54,6 @@ JID=`$PS -p $$ -o jid=` # functions # --------- -# set_rcvar [var] [defval] [desc] -# -# 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() -{ - case $# in - 0) - echo ${name}_enable - ;; - 1) - echo ${1}_enable - ;; - *) - 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. @@ -856,8 +815,8 @@ $command $rc_flags $command_args" echo "" fi echo "#" - # Get unique vars in $rcvar $rcvars - for _v in $rcvar $rcvars; do + # Get unique vars in $rcvar + for _v in $rcvar; do case $v in $_v\ *|\ *$_v|*\ $_v\ *) ;; *) v="${v# } $_v" ;; @@ -1003,7 +962,7 @@ run_rc_script() unset name command command_args command_interpreter \ extra_commands pidfile procname \ - rcvar rcvars rcvars_obsolete required_dirs required_files \ + rcvar rcvars_obsolete required_dirs required_files \ required_vars eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd @@ -1035,7 +994,7 @@ run_rc_script() # load_rc_config() { - local _name _var _defval _v _msg _new + local _name _rcvar_val _var _defval _v _msg _new _name=$1 if [ -z "$_name" ]; then err 3 'USAGE: load_rc_config name' @@ -1060,7 +1019,7 @@ load_rc_config() fi # Set defaults if defined. - for _var in $rcvar $rcvars; do + for _var in $rcvar; do eval _defval=\$${_var}_defval if [ -n "$_defval" ]; then eval : \${$_var:=\$${_var}_defval} From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 09:10:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46867106564A; Sat, 14 Jan 2012 09:10:21 +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 355B48FC15; Sat, 14 Jan 2012 09:10:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0E9ALXc003805; Sat, 14 Jan 2012 09:10:21 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0E9AKdG003803; Sat, 14 Jan 2012 09:10:20 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201201140910.q0E9AKdG003803@svn.freebsd.org> From: Michael Tuexen Date: Sat, 14 Jan 2012 09:10: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: r230104 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:10:21 -0000 Author: tuexen Date: Sat Jan 14 09:10:20 2012 New Revision: 230104 URL: http://svn.freebsd.org/changeset/base/230104 Log: Fix two bugs, which result in a panic when calling getsockopt() using SCTP_RECVINFO or SCTP_NXTINFO. Reported by Clement Lecigne and forwarded to us by zi@. MFC after: 3 days. Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sat Jan 14 08:59:02 2012 (r230103) +++ head/sys/netinet/sctp_usrreq.c Sat Jan 14 09:10:20 2012 (r230104) @@ -3019,7 +3019,7 @@ flags_out: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } else { - SCTP_INP_RUNLOCK(inp); + SCTP_INP_RLOCK(inp); onoff = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVRCVINFO); SCTP_INP_RUNLOCK(inp); } @@ -3038,7 +3038,7 @@ flags_out: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } else { - SCTP_INP_RUNLOCK(inp); + SCTP_INP_RLOCK(inp); onoff = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVNXTINFO); SCTP_INP_RUNLOCK(inp); } From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 09:10:54 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6425F1065670; Sat, 14 Jan 2012 09:10:54 +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 1EEE68FC1F; Sat, 14 Jan 2012 09:10:52 +0000 (UTC) Received: from porto.starpoint.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 LAA29090; Sat, 14 Jan 2012 11:10:51 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1RlzdS-000Lbs-VZ; Sat, 14 Jan 2012 11:10:50 +0200 Message-ID: <4F114699.2090008@FreeBSD.org> Date: Sat, 14 Jan 2012 11:10:49 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Doug Barton References: <201201140859.q0E8x2gV003415@svn.freebsd.org> In-Reply-To: <201201140859.q0E8x2gV003415@svn.freebsd.org> X-Enigmail-Version: undefined 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: r230103 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:10:54 -0000 on 14/01/2012 10:59 Doug Barton said the following: > Author: dougb > Date: Sat Jan 14 08:59:02 2012 > New Revision: 230103 > URL: http://svn.freebsd.org/changeset/base/230103 > > Log: > Now that its callers have been udpated, remove set_rcvar(). > > The concept of set_rcvar() was nice in theory, but the forks > it creates are a drag on the startup process, which is especially > noticeable on slower systems, such as embedded ones. Will this break ports that install rc.d scripts? -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 09:17:11 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id D146A106564A; Sat, 14 Jan 2012 09:17:11 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id ACA3B150992; Sat, 14 Jan 2012 09:17:10 +0000 (UTC) Message-ID: <4F114815.1080001@FreeBSD.org> Date: Sat, 14 Jan 2012 01:17:09 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Andriy Gapon References: <201201140859.q0E8x2gV003415@svn.freebsd.org> <4F114699.2090008@FreeBSD.org> In-Reply-To: <4F114699.2090008@FreeBSD.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r230103 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:17:11 -0000 On 01/14/2012 01:10, Andriy Gapon wrote: > on 14/01/2012 10:59 Doug Barton said the following: >> Author: dougb >> Date: Sat Jan 14 08:59:02 2012 >> New Revision: 230103 >> URL: http://svn.freebsd.org/changeset/base/230103 >> >> Log: >> Now that its callers have been udpated, remove set_rcvar(). >> >> The concept of set_rcvar() was nice in theory, but the forks >> it creates are a drag on the startup process, which is especially >> noticeable on slower systems, such as embedded ones. > > Will this break ports that install rc.d scripts? Please see my HEADS UP message to -current. -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 09:18:05 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24CFE106564A; Sat, 14 Jan 2012 09:18:05 +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 D0A918FC08; Sat, 14 Jan 2012 09:18:03 +0000 (UTC) Received: from porto.starpoint.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 LAA29165; Sat, 14 Jan 2012 11:18:02 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1RlzkQ-000LcP-0V; Sat, 14 Jan 2012 11:18:02 +0200 Message-ID: <4F114849.2030809@FreeBSD.org> Date: Sat, 14 Jan 2012 11:18:01 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Doug Barton References: <201201140859.q0E8x2gV003415@svn.freebsd.org> <4F114699.2090008@FreeBSD.org> <4F114815.1080001@FreeBSD.org> In-Reply-To: <4F114815.1080001@FreeBSD.org> X-Enigmail-Version: undefined Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r230103 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:18:05 -0000 on 14/01/2012 11:17 Doug Barton said the following: > On 01/14/2012 01:10, Andriy Gapon wrote: >> on 14/01/2012 10:59 Doug Barton said the following: >>> Author: dougb >>> Date: Sat Jan 14 08:59:02 2012 >>> New Revision: 230103 >>> URL: http://svn.freebsd.org/changeset/base/230103 >>> >>> Log: >>> Now that its callers have been udpated, remove set_rcvar(). >>> >>> The concept of set_rcvar() was nice in theory, but the forks >>> it creates are a drag on the startup process, which is especially >>> noticeable on slower systems, such as embedded ones. >> >> Will this break ports that install rc.d scripts? > > Please see my HEADS UP message to -current. Thank you. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 09:26:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99915106566B; Sat, 14 Jan 2012 09:26:28 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2913C8FC0A; Sat, 14 Jan 2012 09:26:28 +0000 (UTC) Received: by iagz16 with SMTP id z16so1230349iag.13 for ; Sat, 14 Jan 2012 01:26:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=mH2V1ItPgnpdahmjx9X2ndYayyUWXG1SNV19G06ZqoA=; b=nKGREmB47rYGk90+7tH5SbT2MswZtD5d7KZg+L0DgB5KQ3HyHh4ad8oYU4JGdj2s64 tK0E3L9BZWgAt4q6ILC3B0gyLEIyxPPd9wsymwNwW6Ef1NcAqped5xqNoE6oVgK8dRYi xQAErhcR5EglfyLY3n1F9YLrV1rZzFrDs00EQ= Received: by 10.50.104.163 with SMTP id gf3mr1555054igb.26.1326533187667; Sat, 14 Jan 2012 01:26:27 -0800 (PST) Received: from fuji-wireless.local (c-24-6-49-154.hsd1.ca.comcast.net. [24.6.49.154]) by mx.google.com with ESMTPS id bj3sm11674220igb.4.2012.01.14.01.26.26 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 14 Jan 2012 01:26:26 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=windows-1252 From: Garrett Cooper In-Reply-To: <4F114849.2030809@FreeBSD.org> Date: Sat, 14 Jan 2012 01:26:24 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <2DED097D-FA2E-46A9-B316-5FF130524E84@gmail.com> References: <201201140859.q0E8x2gV003415@svn.freebsd.org> <4F114699.2090008@FreeBSD.org> <4F114815.1080001@FreeBSD.org> <4F114849.2030809@FreeBSD.org> To: Andriy Gapon X-Mailer: Apple Mail (2.1251.1) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Doug Barton , src-committers@FreeBSD.org Subject: Re: svn commit: r230103 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:26:28 -0000 On Jan 14, 2012, at 1:18 AM, Andriy Gapon wrote: > on 14/01/2012 11:17 Doug Barton said the following: >> On 01/14/2012 01:10, Andriy Gapon wrote: >>> on 14/01/2012 10:59 Doug Barton said the following: >>>> Author: dougb >>>> Date: Sat Jan 14 08:59:02 2012 >>>> New Revision: 230103 >>>> URL: http://svn.freebsd.org/changeset/base/230103 >>>>=20 >>>> Log: >>>> Now that its callers have been udpated, remove set_rcvar(). >>>>=20 >>>> The concept of set_rcvar() was nice in theory, but the forks >>>> it creates are a drag on the startup process, which is especially >>>> noticeable on slower systems, such as embedded ones. >>>=20 >>> Will this break ports that install rc.d scripts? >>=20 >> Please see my HEADS UP message to -current. >=20 > Thank you. Adding an entry to UPDATING would be appreciated though=85 Thanks, -Garrett= From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 09:31:22 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id EBC4D106564A; Sat, 14 Jan 2012 09:31:22 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id E49DF1521D0; Sat, 14 Jan 2012 09:31:21 +0000 (UTC) Message-ID: <4F114B69.3070404@FreeBSD.org> Date: Sat, 14 Jan 2012 01:31:21 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Garrett Cooper References: <201201140859.q0E8x2gV003415@svn.freebsd.org> <4F114699.2090008@FreeBSD.org> <4F114815.1080001@FreeBSD.org> <4F114849.2030809@FreeBSD.org> <2DED097D-FA2E-46A9-B316-5FF130524E84@gmail.com> In-Reply-To: <2DED097D-FA2E-46A9-B316-5FF130524E84@gmail.com> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andriy Gapon Subject: Re: svn commit: r230103 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:31:23 -0000 On 01/14/2012 01:26, Garrett Cooper wrote: > Adding an entry to UPDATING would be appreciated though… Good point. It's done now. :) Doug -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 09:32:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74DBE1065670; Sat, 14 Jan 2012 09:32:59 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 641E08FC0A; Sat, 14 Jan 2012 09:32:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0E9Wx8d004501; Sat, 14 Jan 2012 09:32:59 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0E9WxS0004499; Sat, 14 Jan 2012 09:32:59 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201140932.q0E9WxS0004499@svn.freebsd.org> From: Doug Barton Date: Sat, 14 Jan 2012 09:32: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: r230105 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:32:59 -0000 Author: dougb Date: Sat Jan 14 09:32:58 2012 New Revision: 230105 URL: http://svn.freebsd.org/changeset/base/230105 Log: Add an entry detailing the removal of set_rcvar() from /etc/rc.subr Requested by: Garrett Cooper Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Jan 14 09:10:20 2012 (r230104) +++ head/UPDATING Sat Jan 14 09:32:58 2012 (r230105) @@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20120114: + The set_rcvar() function has been removed from /etc/rc.subr. All + base and ports rc.d scripts have been updated, so if you have a + port installed with a script in /usr/local/etc/rc.d you can either + hand-edit the rcvar= line, or reinstall the port. + 20120109: panic(9) now stops other CPUs in the SMP systems, disables interrupts on the current CPU and prevents other threads from running. From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 09:42:05 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D68E1065781; Sat, 14 Jan 2012 09:42:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 8F6258FC15; Sat, 14 Jan 2012 09:42:03 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0E9fxcX014140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 14 Jan 2012 20:42:01 +1100 Date: Sat, 14 Jan 2012 20:41:59 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Guy Helmer In-Reply-To: <201201121545.q0CFj8fu015959@svn.freebsd.org> Message-ID: <20120114204053.N1458@besplex.bde.org> References: <201201121545.q0CFj8fu015959@svn.freebsd.org> 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: r230016 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:42:05 -0000 On Thu, 12 Jan 2012, Guy Helmer wrote: > Log: > Fix disorder in MAN and MLINKS lists. > > Requested by bde. Thanks. This completes fixing all the old style bugs that I noticed in libutil.h and the Makefile. I noticed some new ones... Bruce From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 09:57:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82A23106574A; Sat, 14 Jan 2012 09:57:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 711FE8FC13; Sat, 14 Jan 2012 09:57:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0E9vEHi005254; Sat, 14 Jan 2012 09:57:14 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0E9vEZL005252; Sat, 14 Jan 2012 09:57:14 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201140957.q0E9vEZL005252@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 14 Jan 2012 09:57:14 +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: r230106 - head/release X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:57:14 -0000 Author: glebius Date: Sat Jan 14 09:57:13 2012 New Revision: 230106 URL: http://svn.freebsd.org/changeset/base/230106 Log: - Add possibility to build release from a certain revision, supplied via -r. - To ease adding new features, roll out a getopt loop here. Reviewed by: nwhitehorn Modified: head/release/generate-release.sh Modified: head/release/generate-release.sh ============================================================================== --- head/release/generate-release.sh Sat Jan 14 09:32:58 2012 (r230105) +++ head/release/generate-release.sh Sat Jan 14 09:57:13 2012 (r230106) @@ -3,7 +3,7 @@ # generate-release.sh: check out source trees, and build release components with # totally clean, fresh trees. # -# Usage: generate-release.sh svn-branch scratch-dir +# Usage: generate-release.sh [-r revision] svn-branch scratch-dir # # Environment variables: # CVSUP_HOST: Host of a cvsup server to obtain the ports and documentation @@ -21,10 +21,38 @@ # $FreeBSD$ # +usage() +{ + echo "Usage: $0 [-r revision] svn-branch scratch-dir" + exit 1 +} + +args=`getopt r: $*` +if [ $? -ne 0 ]; then + usage +fi +set -- $args +REVISION= +while true; do + case "$1" in + -r) + REVISION="-r $2" + shift; shift + ;; + --) + shift; break + ;; + esac +done + +if [ $# -lt 2 ]; then + usage +fi + mkdir -p $2/usr/src set -e # Everything must succeed -svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src +svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src $REVISION if [ ! -z $CVSUP_HOST ]; then cat > $2/docports-supfile << EOF *default host=$CVSUP_HOST From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 10:59:33 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63880106566B; Sat, 14 Jan 2012 10:59:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 95F438FC0C; Sat, 14 Jan 2012 10:59:32 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0EAxRMf010903 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 14 Jan 2012 21:59:28 +1100 Date: Sat, 14 Jan 2012 21:59:27 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Guy Helmer In-Reply-To: <201201122249.q0CMnaZe030200@svn.freebsd.org> Message-ID: <20120114204720.Q1458@besplex.bde.org> References: <201201122249.q0CMnaZe030200@svn.freebsd.org> 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: r230037 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 10:59:33 -0000 On Thu, 12 Jan 2012, Guy Helmer wrote: > Log: > Move struct pidfh definition into pidfile.c, and leave a forward declaration > for pidfh in libutil.h in its place. > This allows us to hide the contents of the pidfh structure, and also > allowed removal of the "#ifdef _SYS_PARAM_H" guard from around the > pidfile_* function prototypes. > > Suggested by pjd. This has some new style bugs, and I noticed some more old ones: > Modified: head/lib/libutil/libutil.h > ============================================================================== > --- head/lib/libutil/libutil.h Thu Jan 12 22:30:41 2012 (r230036) > +++ head/lib/libutil/libutil.h Thu Jan 12 22:49:36 2012 (r230037) > @@ -48,6 +48,11 @@ typedef __gid_t gid_t; > #define _GID_T_DECLARED > #endif > > +#ifndef _MODE_T_DECLARED > +typedef __mode_t mode_t; > +#define _MODE_T_DECLARED > +#endif > + It's good to declare mode_t, since pidfile_open() uses it and we want to remove the dependency on . However, this definition doesn't follow KNF or the style of all the other typedef declarations in the file, since all the others follow KNF and thus have a space instead of a tab after #define and also after typedef. There are many other misfomatted spaces after #define's in this file: - for the defines for the property API (PROPERTY*). This API is ugly. I think it was mainly for sysinstall. Maybe it can be removed. Other bugs in it include its man page source being named property.3 but calling itself properties(3). There is no link from property(3), so properties(3) doesn't exist. - for the defines of UU*. These have secondary style bugs: - space instead of tab[s] after the macro name. This is worse, since it results in the macro bodies not being lined up. - bogus parentheses around macro bodies. Such parentheses are ugly enough when they are necessary, but they are not necessary for 2 of 9 cases here, since the macro body consists of a single token. - there is no comment before the UU* defines, unlike for all other groups of defines in the file. - for the defines of UU*. These have secondary style bugs: - bogus parentheses around macro bodies. As above, but worse since none of the 4 macro bodies needs them. - for the defines of PWSCAN*. - for the defines of HN*. The grouping for the 2 HN* sections is unclear The comment for the first group applies to both groups, while the comment for the second group is just unclear). This is described clearly in the man page: the 2 groups are for 2 parameters. In the header file, one of the parameters is misnamed and the other is not named. - the defines for the idempotency ifdef and for FPARSELN* and HD* are actually formatted normally. The section headers for flags definitions could be more uniform and complete. I like the style "/* Flags for : */". No need to mention the function name if the parameter name is unique and/or if the macro names indicate the function or API name like they should. > -#ifdef _SYS_PARAM_H_ > -/* for pidfile.c */ > -struct pidfh { > - int pf_fd; > - char pf_path[MAXPATHLEN + 1]; > - __dev_t pf_dev; > - ino_t pf_ino; > -}; > -#endif After moving this to pidfile.c, the man page seems to be bogus. It still says that is a prerequisite, but I think that header was only needed for MAXPATHLEN here. I checked that still compiles by itself (you had to add this typedef for that), and that most or all of its manpages except pidfile(3) only say to include it. properties(3) still says that is a prerequisite, but that hasn't been the case for 9 years or more, since other typedefs like the one for mode_t were added in 2002. realhostname(3) still says that and are prerequisites, buf obviously they aren't, since compiles by itself. was also cleaned up in 2002, so is not a prerequisite for it. realhostname() uses struct in_addr, but this doesn't make a prerequsite for using realhostname(), since you can always use it with a null pointer, or more usefully, with a pointer constructed somewhere else that knows the complete struct in_addr. pw_*(3) and PWSCAN* seem to be undocumented. Almost everything else in libutil.h is documented. > - > /* Avoid pulling in all the include files for no need */ > struct in_addr; > struct kinfo_file; > struct kinfo_proc; > struct kinfo_vmentry; The last 3 declarations are bogus. The kinfo* structs aren't used in parameter lists. Thus forward-declaring them has no effect. > +struct pidfh; struct pidfh is a return type for one of the prototypes. Unfortunately, alphabetical ordering results other prototypes being declared first. Thus this forward declaration is needed. > @@ -174,14 +170,12 @@ struct group > int gr_tmp(int _mdf); > #endif > > -#ifdef _SYS_PARAM_H_ > int pidfile_close(struct pidfh *_pfh); > int pidfile_fileno(const struct pidfh *_pfh); > struct pidfh * > pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); > int pidfile_remove(struct pidfh *_pfh); > int pidfile_write(struct pidfh *_pfh); > -#endif Now these are unsorted, since a separate section to hold them is not needed. It was used just to make the ifdef easier to read (we don't want to split up the main list with blank lines around each ifdef, and without such blank lines the ifdefs are harder to read). Bruce From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 12:11:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25CED106564A; Sat, 14 Jan 2012 12:11:38 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C69E88FC08; Sat, 14 Jan 2012 12:11:37 +0000 (UTC) Received: by obbta17 with SMTP id ta17so4796517obb.13 for ; Sat, 14 Jan 2012 04:11:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=bEd6xCEw/Fe3wA1UwLdE0RuY5viqrjqBpf1ebatnF1c=; b=clWTTYeFsJwOJ06qBFzq/NAVQJL0RERepvhDr4fTaziH1vvP7L0YV7Ai76RuUM7Si9 F8prMCQ9SfUqVkw/7DHHhLZTOO4A4kAOfkzUubJUG9MFMmp6sfv5VK+6cKxZ+Dl0l3T9 l6ydf9oAZCY1+sCqMeoAXVWRKl3H6oKn5q4jI= MIME-Version: 1.0 Received: by 10.182.43.10 with SMTP id s10mr4134713obl.43.1326543097311; Sat, 14 Jan 2012 04:11:37 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Sat, 14 Jan 2012 04:11:37 -0800 (PST) In-Reply-To: <201201140859.q0E8x2gV003415@svn.freebsd.org> References: <201201140859.q0E8x2gV003415@svn.freebsd.org> Date: Sat, 14 Jan 2012 15:11:37 +0300 X-Google-Sender-Auth: rkmHLvgBE5ztSpZdr_yt8quRHmM Message-ID: From: Sergey Kandaurov To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230103 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 12:11:38 -0000 On 14 January 2012 12:59, Doug Barton wrote: > Author: dougb > Date: Sat Jan 14 08:59:02 2012 > New Revision: 230103 > URL: http://svn.freebsd.org/changeset/base/230103 > > Log: > =A0Now that its callers have been udpated, remove set_rcvar(). > > =A0The concept of set_rcvar() was nice in theory, but the forks > =A0it creates are a drag on the startup process, which is especially > =A0noticeable on slower systems, such as embedded ones. > > Modified: > =A0head/etc/rc.subr > Hi, rc(8) and rc.subr(8) still reference this function. Also, it would be fine to have some adoption to the new set_rcvar-less order like printing The Big Warning and still doing its job in Y.x branch and stop doing anything in the next Y+1.x branch. --=20 wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 14:43:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB958106566C; Sat, 14 Jan 2012 14:43:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A757D8FC13; Sat, 14 Jan 2012 14:43:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0EEhM3B037026; Sat, 14 Jan 2012 14:43:22 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0EEhM5w037024; Sat, 14 Jan 2012 14:43:22 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201141443.q0EEhM5w037024@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 14 Jan 2012 14:43: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: r230107 - head/release X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 14:43:22 -0000 Author: glebius Date: Sat Jan 14 14:43:22 2012 New Revision: 230107 URL: http://svn.freebsd.org/changeset/base/230107 Log: Autoguess number of make jobs based on hw.ncpu. MAKE_FLAGS can override this. While here move 'mkdir' down below 'set -e'. Modified: head/release/generate-release.sh Modified: head/release/generate-release.sh ============================================================================== --- head/release/generate-release.sh Sat Jan 14 09:57:13 2012 (r230106) +++ head/release/generate-release.sh Sat Jan 14 14:43:22 2012 (r230107) @@ -49,9 +49,18 @@ if [ $# -lt 2 ]; then usage fi -mkdir -p $2/usr/src set -e # Everything must succeed +case $MAKE_FLAGS in + *-j*) + ;; + *) + MAKE_FLAGS="$MAKE_FLAGS -j "$(sysctl -n hw.ncpu) + ;; +esac + +mkdir -p $2/usr/src + svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src $REVISION if [ ! -z $CVSUP_HOST ]; then cat > $2/docports-supfile << EOF From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 17:07:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC4501065670; Sat, 14 Jan 2012 17:07:52 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DA908FC0A; Sat, 14 Jan 2012 17:07:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0EH7qce041354; Sat, 14 Jan 2012 17:07:52 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0EH7qUb041349; Sat, 14 Jan 2012 17:07:52 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201141707.q0EH7qUb041349@svn.freebsd.org> From: Eitan Adler Date: Sat, 14 Jan 2012 17:07: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: r230108 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 17:07:52 -0000 Author: eadler (ports committer) Date: Sat Jan 14 17:07:52 2012 New Revision: 230108 URL: http://svn.freebsd.org/changeset/base/230108 Log: - Fix trivial typo Approved by: nwhitehorn MFC after: 3 days Modified: head/sys/net/bpf_buffer.c head/sys/net/bpf_buffer.h head/sys/net/bpf_zerocopy.c head/sys/net/bpf_zerocopy.h Modified: head/sys/net/bpf_buffer.c ============================================================================== --- head/sys/net/bpf_buffer.c Sat Jan 14 14:43:22 2012 (r230107) +++ head/sys/net/bpf_buffer.c Sat Jan 14 17:07:52 2012 (r230108) @@ -2,7 +2,7 @@ * Copyright (c) 2007 Seccuris Inc. * All rights reserved. * - * This sofware was developed by Robert N. M. Watson under contract to + * This software was developed by Robert N. M. Watson under contract to * Seccuris Inc. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/net/bpf_buffer.h ============================================================================== --- head/sys/net/bpf_buffer.h Sat Jan 14 14:43:22 2012 (r230107) +++ head/sys/net/bpf_buffer.h Sat Jan 14 17:07:52 2012 (r230108) @@ -2,7 +2,7 @@ * Copyright (c) 2007 Seccuris Inc. * All rights reserved. * - * This sofware was developed by Robert N. M. Watson under contract to + * This software was developed by Robert N. M. Watson under contract to * Seccuris Inc. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Sat Jan 14 14:43:22 2012 (r230107) +++ head/sys/net/bpf_zerocopy.c Sat Jan 14 17:07:52 2012 (r230108) @@ -2,7 +2,7 @@ * Copyright (c) 2007 Seccuris Inc. * All rights reserved. * - * This sofware was developed by Robert N. M. Watson under contract to + * This software was developed by Robert N. M. Watson under contract to * Seccuris Inc. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/net/bpf_zerocopy.h ============================================================================== --- head/sys/net/bpf_zerocopy.h Sat Jan 14 14:43:22 2012 (r230107) +++ head/sys/net/bpf_zerocopy.h Sat Jan 14 17:07:52 2012 (r230108) @@ -2,7 +2,7 @@ * Copyright (c) 2007 Seccuris Inc. * All rights reserved. * - * This sofware was developed by Robert N. M. Watson under contract to + * This software was developed by Robert N. M. Watson under contract to * Seccuris Inc. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 17:34:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFE21106564A; Sat, 14 Jan 2012 17:34:32 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AB988FC0C; Sat, 14 Jan 2012 17:34:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0EHYWdB042175; Sat, 14 Jan 2012 17:34:32 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0EHYWBj042173; Sat, 14 Jan 2012 17:34:32 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201141734.q0EHYWBj042173@svn.freebsd.org> From: Eitan Adler Date: Sat, 14 Jan 2012 17:34: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: r230109 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 17:34:32 -0000 Author: eadler (ports committer) Date: Sat Jan 14 17:34:32 2012 New Revision: 230109 URL: http://svn.freebsd.org/changeset/base/230109 Log: - Document TheDraw splash screens in the default loader.conf Submitted by: Jason Hellenthal Approved by: glebius MFC after: 3 days Modified: head/sys/boot/forth/loader.conf Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Sat Jan 14 17:07:52 2012 (r230108) +++ head/sys/boot/forth/loader.conf Sat Jan 14 17:34:32 2012 (r230109) @@ -31,9 +31,10 @@ verbose_loading="NO" # Set to YES for v splash_bmp_load="NO" # Set this to YES for bmp splash screen! splash_pcx_load="NO" # Set this to YES for pcx splash screen! +splash_txt_load="NO" # Set this to YES for TheDraw splash screen! vesa_load="NO" # Set this to YES to load the vesa module bitmap_load="NO" # Set this to YES if you want splash screen! -bitmap_name="splash.bmp" # Set this to the name of the bmp or pcx file +bitmap_name="splash.bmp" # Set this to the name of the file bitmap_type="splash_image_data" # and place it on the module_path From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 18:16:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95F68106564A; Sat, 14 Jan 2012 18:16:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80A3E8FC08; Sat, 14 Jan 2012 18:16:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0EIGAsD043448; Sat, 14 Jan 2012 18:16:10 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0EIGAhc043446; Sat, 14 Jan 2012 18:16:10 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201141816.q0EIGAhc043446@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 14 Jan 2012 18:16:10 +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: r230110 - head/share/man/man7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 18:16:10 -0000 Author: glebius Date: Sat Jan 14 18:16:10 2012 New Revision: 230110 URL: http://svn.freebsd.org/changeset/base/230110 Log: No need to run buildworld before generate-release.sh. Modified: head/share/man/man7/release.7 Modified: head/share/man/man7/release.7 ============================================================================== --- head/share/man/man7/release.7 Sat Jan 14 17:34:32 2012 (r230109) +++ head/share/man/man7/release.7 Sat Jan 14 18:16:10 2012 (r230110) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2011 +.Dd January 14, 2012 .Dt RELEASE 7 .Os .Sh NAME @@ -316,9 +316,7 @@ The following sequence of commands can b .Dq "-CURRENT snapshot" in a clean environment, including ports and documentation: .Bd -literal -offset indent -cd /usr/src -make buildworld -cd release +cd /usr/src/release export CVSUP_HOST=cvsupN.freebsd.org sh generate-release.sh head /local3/release .Ed From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 18:29:11 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C61EC1065670; Sat, 14 Jan 2012 18:29:11 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 37D3B8FC15; Sat, 14 Jan 2012 18:29:10 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 8229DE23; Sat, 14 Jan 2012 19:29:09 +0100 (CET) Date: Sat, 14 Jan 2012 19:27:59 +0100 From: Pawel Jakub Dawidek To: Bruce Evans Message-ID: <20120114182758.GJ1694@garage.freebsd.pl> References: <201201122249.q0CMnaZe030200@svn.freebsd.org> <20120114204720.Q1458@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="j+MD90OnwjQyWNYt" Content-Disposition: inline In-Reply-To: <20120114204720.Q1458@besplex.bde.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Guy Helmer Subject: Re: svn commit: r230037 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 18:29:12 -0000 --j+MD90OnwjQyWNYt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 14, 2012 at 09:59:27PM +1100, Bruce Evans wrote: > On Thu, 12 Jan 2012, Guy Helmer wrote: >=20 > > Log: > > Move struct pidfh definition into pidfile.c, and leave a forward decla= ration > > for pidfh in libutil.h in its place. > > This allows us to hide the contents of the pidfh structure, and also > > allowed removal of the "#ifdef _SYS_PARAM_H" guard from around the > > pidfile_* function prototypes. > > > > Suggested by pjd. >=20 > This has some new style bugs, and I noticed some more old ones: >=20 > > Modified: head/lib/libutil/libutil.h > > =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/libutil/libutil.h Thu Jan 12 22:30:41 2012 (r230036) > > +++ head/lib/libutil/libutil.h Thu Jan 12 22:49:36 2012 (r230037) > > @@ -48,6 +48,11 @@ typedef __gid_t gid_t; > > #define _GID_T_DECLARED > > #endif > > > > +#ifndef _MODE_T_DECLARED > > +typedef __mode_t mode_t; > > +#define _MODE_T_DECLARED > > +#endif > > + >=20 > It's good to declare mode_t, since pidfile_open() uses it and we want > to remove the dependency on . However, this definition > doesn't follow KNF or the style of all the other typedef declarations > in the file, since all the others follow KNF and thus have a space > instead of a tab after #define and also after typedef. I think you mixed space with tab. All the others have a tab after #define and typedef. I fully agree this should be consistent. > > -#ifdef _SYS_PARAM_H_ > > -/* for pidfile.c */ > > -struct pidfh { > > - int pf_fd; > > - char pf_path[MAXPATHLEN + 1]; > > - __dev_t pf_dev; > > - ino_t pf_ino; > > -}; > > -#endif >=20 > After moving this to pidfile.c, the man page seems to be bogus. It > still says that is a prerequisite, but I think that > header was only needed for MAXPATHLEN here. I checked that > still compiles by itself (you had to add this typedef for that), and > that most or all of its manpages except pidfile(3) only say to include > it. I already pointed that out to Guy and also introduced him to concept of pre-commit reviews:) > > @@ -174,14 +170,12 @@ struct group > > int gr_tmp(int _mdf); > > #endif > > > > -#ifdef _SYS_PARAM_H_ > > int pidfile_close(struct pidfh *_pfh); > > int pidfile_fileno(const struct pidfh *_pfh); > > struct pidfh * > > pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); > > int pidfile_remove(struct pidfh *_pfh); > > int pidfile_write(struct pidfh *_pfh); > > -#endif >=20 > Now these are unsorted, since a separate section to hold them is not > needed. It was used just to make the ifdef easier to read (we don't > want to split up the main list with blank lines around each ifdef, and > without such blank lines the ifdefs are harder to read). I'd prefer not to change that. All those functions are part of pidfile(3) API and it would be better, IMHO, to keep them together here too. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --j+MD90OnwjQyWNYt Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8RyS4ACgkQForvXbEpPzTcAgCfU+II2xcUQ1KjDM7FywkOHoRj KiIAniUhLMhFGzl5s7ew9MVx+xES1tTA =Ehm9 -----END PGP SIGNATURE----- --j+MD90OnwjQyWNYt-- From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 21:02:34 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5A841065670; Sat, 14 Jan 2012 21:02:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 7899C8FC0C; Sat, 14 Jan 2012 21:02:34 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0EL2Uin020035 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 15 Jan 2012 08:02:32 +1100 Date: Sun, 15 Jan 2012 08:02:30 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <20120114182758.GJ1694@garage.freebsd.pl> Message-ID: <20120115073823.O843@besplex.bde.org> References: <201201122249.q0CMnaZe030200@svn.freebsd.org> <20120114204720.Q1458@besplex.bde.org> <20120114182758.GJ1694@garage.freebsd.pl> 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, Guy Helmer , Bruce Evans Subject: Re: svn commit: r230037 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 21:02:35 -0000 On Sat, 14 Jan 2012, Pawel Jakub Dawidek wrote: > On Sat, Jan 14, 2012 at 09:59:27PM +1100, Bruce Evans wrote: >> ... >> It's good to declare mode_t, since pidfile_open() uses it and we want >> to remove the dependency on . However, this definition >> doesn't follow KNF or the style of all the other typedef declarations >> in the file, since all the others follow KNF and thus have a space >> instead of a tab after #define and also after typedef. > > I think you mixed space with tab. All the others have a tab after > #define and typedef. I fully agree this should be consistent. Oops. >>> -#ifdef _SYS_PARAM_H_ >>> int pidfile_close(struct pidfh *_pfh); >>> int pidfile_fileno(const struct pidfh *_pfh); >>> struct pidfh * >>> pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); >>> int pidfile_remove(struct pidfh *_pfh); >>> int pidfile_write(struct pidfh *_pfh); >>> -#endif >> >> Now these are unsorted, since a separate section to hold them is not >> needed. It was used just to make the ifdef easier to read (we don't >> want to split up the main list with blank lines around each ifdef, and >> without such blank lines the ifdefs are harder to read). > > I'd prefer not to change that. All those functions are part of pidfile(3) > API and it would be better, IMHO, to keep them together here too. The functions have a unique prefix, so they are grouped nicely when sorted into a long list. While I'm here, I'll complain about the verboseness of that prefix :-). Other APIs in the file mostly use short prefixes: - kinfo_. Should have been ki_ like its struct member names. pidfile uses a good prefix for its struct member names too. - properties_/property_. Bad, like the rest of the API. - uu_. A weird nondescriptive name for serial device locking protocol. Is it from uucp? But its weirdness makes it memorable, unlike a generic English word like `property'. Better yet, I don't have to quote it here. - f. Stdio's prefix meaning `file'. To fit indentifiers in 8 characters, it can't even have an underscore. - pw_. Old prefix/abbrieviation for `password'. It's more readable than `password' once you are used to it. - gr_. Newer prefix for `group'. More verbose than the g in gid. - quota_. At least the English word is short. Just noticed some more disorder: the groups of the defines at the end are in random (mostly historical) order (U*, HO*, F*, PW*, HN* (for the last parameter of humanize_number()), HN* (for the second last parameter...), HD*. If the pidfile API had defines and if the API is kept in its own section, its defines should be in that section. Most of the other APIs that have a man page are large enough to deserve the same treatment if it is done for pidfile. Some like dehumanize^Wscientificize^W humanize_number() are larger although they have fewer functions, since they have lots of defines. Bruce From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 21:09:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57E3D106566B; Sat, 14 Jan 2012 21:09:55 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 424828FC14; Sat, 14 Jan 2012 21:09:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0EL9tLd049004; Sat, 14 Jan 2012 21:09:55 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0EL9tHp049002; Sat, 14 Jan 2012 21:09:55 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201201142109.q0EL9tHp049002@svn.freebsd.org> From: David Schultz Date: Sat, 14 Jan 2012 21:09: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: r230114 - head/tools/regression/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 21:09:55 -0000 Author: das Date: Sat Jan 14 21:09:54 2012 New Revision: 230114 URL: http://svn.freebsd.org/changeset/base/230114 Log: Update the tests for arm and other ports where long double is the same as double, similar to r178141. Modified: head/tools/regression/lib/libc/stdio/test-printfloat.c Modified: head/tools/regression/lib/libc/stdio/test-printfloat.c ============================================================================== --- head/tools/regression/lib/libc/stdio/test-printfloat.c Sat Jan 14 19:38:24 2012 (r230113) +++ head/tools/regression/lib/libc/stdio/test-printfloat.c Sat Jan 14 21:09:54 2012 (r230114) @@ -266,9 +266,9 @@ main(int argc, char *argv[]) testfmt("0x1p-16494", "%La", 0x1p-16494L); testfmt("0x1.2345p-16384", "%La", 0x1.2345p-16384L); #else - testfmt("0xc.90fdaa22168cp-2", "%La", 0x3.243f6a8885a31p0L); - testfmt("0x8p-1077", "%La", 0x1p-1074L); - testfmt("0x9.8765p-1024", "%La", 0x9.8765p-1024L); + testfmt("0x1.921fb54442d18p+1", "%La", 0x3.243f6a8885a31p0L); + testfmt("0x1p-1074", "%La", 0x1p-1074L); + testfmt("0x1.30ecap-1021", "%La", 0x9.8765p-1024L); #endif printf("ok 10 - printfloat\n"); From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 21:38:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D51501065678; Sat, 14 Jan 2012 21:38:31 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5AAD8FC18; Sat, 14 Jan 2012 21:38:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ELcVqE049879; Sat, 14 Jan 2012 21:38:31 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ELcVju049875; Sat, 14 Jan 2012 21:38:31 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201201142138.q0ELcVju049875@svn.freebsd.org> From: David Schultz Date: Sat, 14 Jan 2012 21:38: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: r230115 - head/tools/regression/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 21:38:31 -0000 Author: das Date: Sat Jan 14 21:38:31 2012 New Revision: 230115 URL: http://svn.freebsd.org/changeset/base/230115 Log: Add .t files for tests, missed in prior checkins, so that prove(1) works in this directory. Added: head/tools/regression/lib/libc/stdio/test-getdelim.t - copied unchanged from r230114, head/tools/regression/lib/libc/stdio/test-printfloat.t head/tools/regression/lib/libc/stdio/test-print-positional.t - copied unchanged from r230114, head/tools/regression/lib/libc/stdio/test-printfloat.t head/tools/regression/lib/libc/stdio/test-printbasic.t - copied unchanged from r230114, head/tools/regression/lib/libc/stdio/test-printfloat.t Copied: head/tools/regression/lib/libc/stdio/test-getdelim.t (from r230114, head/tools/regression/lib/libc/stdio/test-printfloat.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/lib/libc/stdio/test-getdelim.t Sat Jan 14 21:38:31 2012 (r230115, copy of r230114, head/tools/regression/lib/libc/stdio/test-printfloat.t) @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable Copied: head/tools/regression/lib/libc/stdio/test-print-positional.t (from r230114, head/tools/regression/lib/libc/stdio/test-printfloat.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/lib/libc/stdio/test-print-positional.t Sat Jan 14 21:38:31 2012 (r230115, copy of r230114, head/tools/regression/lib/libc/stdio/test-printfloat.t) @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable Copied: head/tools/regression/lib/libc/stdio/test-printbasic.t (from r230114, head/tools/regression/lib/libc/stdio/test-printfloat.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/lib/libc/stdio/test-printbasic.t Sat Jan 14 21:38:31 2012 (r230115, copy of r230114, head/tools/regression/lib/libc/stdio/test-printfloat.t) @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 21:43:20 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B2B6106564A; Sat, 14 Jan 2012 21:43:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id E48B18FC12; Sat, 14 Jan 2012 21:43:19 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0ELhHFT017484 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 15 Jan 2012 08:43:17 +1100 Date: Sun, 15 Jan 2012 08:43:17 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andreas Tobler In-Reply-To: <4F07529B.2060608@FreeBSD.org> Message-ID: <20120115080256.E843@besplex.bde.org> References: <201201060921.q069Lfi8081051@svn.freebsd.org> <20120106225728.G9027@besplex.bde.org> <4F07529B.2060608@FreeBSD.org> 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, Bruce Evans Subject: Re: svn commit: r229693 - in head/lib/libc: powerpc powerpc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 21:43:20 -0000 On Fri, 6 Jan 2012, Andreas Tobler wrote: Sorry for the delay. > Hi Bruce, > > thank you for the feedback. I wasn't aware about the fine details. > > I try to understand and implement what you suggest. It may take several > iterations until I match everything. OK. >> The easiest way to fix this is to remove WEAK_ALIAS() and add an asm >> API WEAK_REFERENCE(). Unfortunately, ALIAS is a better name than >> REFERENCE. __weak_reference() is not so easy to change since it is >> used extensively > > So, I started with a WEAK_REFERENCE macro in sys/powerpc/asm.h > It is like the WEAK_ALIAS but with reversed arguments: > > +#define WEAK_REFERENCE(sym, alias) \ > + .weak alias; \ > + alias = sym > + > > Here I do not have a preference for the "=" implementation, is it "=" or is > it .set ..... I prefer .equ, since it is what is ised for weak_reference() and it has minor syntactial advantages. Anyway, This is much easier to change than uses of the macro. > > If we find a final version I'll be able to delete the WEAK_ALIAS. Yes, delete it before it is used much. The only thing to worry about is use of it in ports. I checked a 2005 version of NetBSD. It has separate sys/cdefs files for aout and elf, and spells things completely backwards relative to FreeBSD there: - __asm is spelled __asm__ - the order is reversed in all macros: (alias,sym). The misformatting of no space after the comma in this to support aout is preserved in cdefs_elf.h. - #alias and #sym are not used rawly, even for elf. They are surrounded by _C_LABEL() or _C_LABEL_STRING(). For elf, this usually makes no difference, but there is an option to add an underscore for elf too. OTOH, K&R is not supported, so there are no additional files, ifdefs or macro obfuscations to support it (FreeBSD still has ifdefs for it, but doesn't support aout). - it has __strong_alias() there, but no __strong_reference() - it has __weak_alias() there, but no __weak_reference() - it has __weak_extern() (expands to a plain .weak) - it has __warn_references(). This is the only one that needs much magic (.stabs declarations). - it "=" instead of ".equ" or ".set" - it uses single-line asms instead of multi-line ones, except for the ones with .stabs. This gives additional ugliness from string concatenation and explicit newlines or semicolons to separate the statements (newlines are used, which makes the output more readable, but tabs are not used). One feature of K&R is that this feature is unavailable, so FreeBSD couldn't use it in the K&R part of the ifdef and it may as well not use it in the STDC part. In summary, unportability to NetBSD couldn't be implemented much better if done intentionally. To preserve this intentionally, we shouldn't define __weak_alias(), but should keep __weak_reference() with its args reversed. >> Similarly for STRONG_ALIAS() and __strong_reference(), except >> STRONG_REFERENCE() doesn't exist for most arches and __strong_reference() >> didn't exist until this week, so neither is used extensively. I didn't check what NetBSD does for asm macros. > ... > If I get the above right, the snippet from above should look like this, > right? > > @@ -51,20 +51,17 @@ > ld %r0,16(%r1); \ > mtlr %r0; \ > blr; \ > -ENTRY(__CONCAT(__sys_,x)); \ > - .weak CNAME(x); \ > - .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ > - .weak CNAME(__CONCAT(_,x)); \ > - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ > +ENTRY(__CONCAT(__sys_, x)); \ > + WEAK_REFERENCE(__CONCAT(__sys_, x), x); \ > + WEAK_REFERENCE(__CONCAT(__sys_, x), __CONCAT(_, x)); \ > _SYSCALL(x); \ > bso 2b Yes, assuming the args are in the right order. I would also change `x' to a meaningful name. At least on i386, uses x in most places, but csym and asmsym in 2 places, while uses meaningul parameter names in most places. > If we want to stay with WEAK_ALIAS I can at least fix the style bugs. It is the arg order that I care about most, and with __weak_alias() or WEAK_ALIAS() we should remain compatible with the opposite order in NetBSD. Bruce From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 21:51:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B856106566B; Sat, 14 Jan 2012 21:51:45 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFF7C8FC0C; Sat, 14 Jan 2012 21:51:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ELpiHZ050288; Sat, 14 Jan 2012 21:51:44 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ELpi1Z050285; Sat, 14 Jan 2012 21:51:44 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201142151.q0ELpi1Z050285@svn.freebsd.org> From: Doug Barton Date: Sat, 14 Jan 2012 21:51: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: r230116 - head/share/man/man8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 21:51:45 -0000 Author: dougb Date: Sat Jan 14 21:51:44 2012 New Revision: 230116 URL: http://svn.freebsd.org/changeset/base/230116 Log: Remove documentation for set_rcvar() now that it has been removed. Modified: head/share/man/man8/rc.8 head/share/man/man8/rc.subr.8 Modified: head/share/man/man8/rc.8 ============================================================================== --- head/share/man/man8/rc.8 Sat Jan 14 21:38:31 2012 (r230115) +++ head/share/man/man8/rc.8 Sat Jan 14 21:51:44 2012 (r230116) @@ -35,7 +35,7 @@ .\" @(#)rc.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd November 17, 2009 +.Dd January 14, 2012 .Dt RC 8 .Os .Sh NAME @@ -485,7 +485,7 @@ Most scripts require little more than th \&. /etc/rc.subr name="foo" -rcvar=`set_rcvar` +rcvar=foo_enable command="/usr/local/bin/foo" load_rc_config $name @@ -506,7 +506,7 @@ The script may list and define as many c \&. /etc/rc.subr name="foo" -rcvar=`set_rcvar` +rcvar=foo_enable command="/usr/local/bin/foo" extra_commands="nop hello" hello_cmd="echo Hello World." Modified: head/share/man/man8/rc.subr.8 ============================================================================== --- head/share/man/man8/rc.subr.8 Sat Jan 14 21:38:31 2012 (r230115) +++ head/share/man/man8/rc.subr.8 Sat Jan 14 21:51:44 2012 (r230116) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 18, 2007 +.Dd January 14, 2012 .Dt RC.SUBR 8 .Os .Sh NAME @@ -73,8 +73,6 @@ .It .Ic run_rc_script Ar file Ar argument .It -.Ic set_rcvar Op Ar base -.It .Ic wait_for_pids Op Ar pid ... .It .Ic warn Ar message @@ -832,32 +830,6 @@ signal is sent to the parent process, which is assumed to be .Xr rc 8 . Otherwise, the shell exits with a non-zero status. -.It Ic set_rcvar Op Ar base -Set the variable name required to start a service. -In -.Fx -a daemon is usually controlled by an -.Xr rc.conf 5 -variable consisting of a daemon's name postfixed by the string -.Dq Li "_enable" . -This is not the case in -.Nx . -When the following line is included in a script: -.Pp -.Dl "rcvar=`set_rcvar`" -.Pp -this function will use the value of the -.Va $name -variable, which should be defined by the calling script, -to construct the appropriate -.Xr rc.conf 5 -knob. -If the -.Ar base -argument is set it will use -.Ar base -instead of -.Va $name . .It Ic wait_for_pids Op Ar pid ... Wait until all of the provided .Ar pids From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 21:54:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B50F106564A; Sat, 14 Jan 2012 21:54:13 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15E318FC08; Sat, 14 Jan 2012 21:54:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ELsCSI050399; Sat, 14 Jan 2012 21:54:12 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ELsCHg050397; Sat, 14 Jan 2012 21:54:12 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201142154.q0ELsCHg050397@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 14 Jan 2012 21:54: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: r230117 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 21:54:13 -0000 Author: jilles Date: Sat Jan 14 21:54:12 2012 New Revision: 230117 URL: http://svn.freebsd.org/changeset/base/230117 Log: sh: Fix out of bounds array access when trap is used with an invalid signal. MFC after: 1 week Modified: head/bin/sh/trap.c Modified: head/bin/sh/trap.c ============================================================================== --- head/bin/sh/trap.c Sat Jan 14 21:51:44 2012 (r230116) +++ head/bin/sh/trap.c Sat Jan 14 21:54:12 2012 (r230117) @@ -191,10 +191,11 @@ trapcmd(int argc, char **argv) argv++; } } - while (*argv) { + for (; *argv; argv++) { if ((signo = sigstring_to_signum(*argv)) == -1) { warning("bad signal %s", *argv); errors = 1; + continue; } INTOFF; if (action) @@ -205,7 +206,6 @@ trapcmd(int argc, char **argv) if (signo != 0) setsignal(signo); INTON; - argv++; } return errors; } From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 22:03:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 36F951065672; Sat, 14 Jan 2012 22:03:22 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 572DD154F0C; Sat, 14 Jan 2012 22:03:21 +0000 (UTC) Message-ID: <4F11FBA8.1070005@FreeBSD.org> Date: Sat, 14 Jan 2012 14:03:20 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Sergey Kandaurov References: <201201140859.q0E8x2gV003415@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230103 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 22:03:22 -0000 On 01/14/2012 04:11, Sergey Kandaurov wrote: > On 14 January 2012 12:59, Doug Barton wrote: >> Author: dougb >> Date: Sat Jan 14 08:59:02 2012 >> New Revision: 230103 >> URL: http://svn.freebsd.org/changeset/base/230103 >> >> Log: >> Now that its callers have been udpated, remove set_rcvar(). >> >> The concept of set_rcvar() was nice in theory, but the forks >> it creates are a drag on the startup process, which is especially >> noticeable on slower systems, such as embedded ones. >> >> Modified: >> head/etc/rc.subr >> > > Hi, > > rc(8) and rc.subr(8) still reference this function. Not any more. :) I ran out of steam last night, and so I'm finishing up the doc stuff today. But thanks for the reminder. > Also, it would be fine to have some adoption to the new > set_rcvar-less order like printing The Big Warning and > still doing its job in Y.x branch and stop doing anything > in the next Y+1.x branch. If that becomes necessary, we can certainly do it. This is early enough in the 10-current cycle that I think we should be able to catch all the stragglers well before 10-release, and I personally have no plans to MFC the removal of set_rcvar from rc.subr. But, you know what they say about the best-laid plans .... Doug -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 22:46:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF28F106564A; Sat, 14 Jan 2012 22:46:18 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAB448FC12; Sat, 14 Jan 2012 22:46:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0EMkI8Q052013; Sat, 14 Jan 2012 22:46:18 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0EMkI6P052011; Sat, 14 Jan 2012 22:46:18 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201142246.q0EMkI6P052011@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 14 Jan 2012 22:46: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: r230118 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 22:46:19 -0000 Author: jilles Date: Sat Jan 14 22:46:18 2012 New Revision: 230118 URL: http://svn.freebsd.org/changeset/base/230118 Log: sh: Change input buffer size from 1023 to 1024. PR: bin/161756 Modified: head/bin/sh/input.c Modified: head/bin/sh/input.c ============================================================================== --- head/bin/sh/input.c Sat Jan 14 21:54:12 2012 (r230117) +++ head/bin/sh/input.c Sat Jan 14 22:46:18 2012 (r230118) @@ -97,7 +97,7 @@ int parsenleft; /* copy of parsefile-> MKINIT int parselleft; /* copy of parsefile->lleft */ char *parsenextc; /* copy of parsefile->nextc */ MKINIT struct parsefile basepf; /* top level input file */ -char basebuf[BUFSIZ]; /* buffer for top level input file */ +char basebuf[BUFSIZ + 1]; /* buffer for top level input file */ static struct parsefile *parsefile = &basepf; /* current input file */ int init_editline = 0; /* editline library initialized? */ int whichprompt; /* 1 == PS1, 2 == PS2 */ @@ -189,8 +189,8 @@ retry: nr = 0; else { nr = el_len; - if (nr > BUFSIZ - 1) - nr = BUFSIZ - 1; + if (nr > BUFSIZ) + nr = BUFSIZ; memcpy(parsenextc, rl_cp, nr); if (nr != el_len) { el_len -= nr; @@ -200,7 +200,7 @@ retry: } } else #endif - nr = read(parsefile->fd, parsenextc, BUFSIZ - 1); + nr = read(parsefile->fd, parsenextc, BUFSIZ); if (nr <= 0) { if (nr < 0) { @@ -428,13 +428,13 @@ setinputfd(int fd, int push) (void)fcntl(fd, F_SETFD, FD_CLOEXEC); if (push) { pushfile(); - parsefile->buf = ckmalloc(BUFSIZ); + parsefile->buf = ckmalloc(BUFSIZ + 1); } if (parsefile->fd > 0) close(parsefile->fd); parsefile->fd = fd; if (parsefile->buf == NULL) - parsefile->buf = ckmalloc(BUFSIZ); + parsefile->buf = ckmalloc(BUFSIZ + 1); parselleft = parsenleft = 0; plinno = 1; } From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 22:51:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56511106566B; Sat, 14 Jan 2012 22:51:35 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40BC48FC08; Sat, 14 Jan 2012 22:51:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0EMpZtB052201; Sat, 14 Jan 2012 22:51:35 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0EMpZKd052199; Sat, 14 Jan 2012 22:51:35 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <201201142251.q0EMpZKd052199@svn.freebsd.org> From: "Christian S.J. Peron" Date: Sat, 14 Jan 2012 22:51: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: r230119 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 22:51:35 -0000 Author: csjp Date: Sat Jan 14 22:51:34 2012 New Revision: 230119 URL: http://svn.freebsd.org/changeset/base/230119 Log: Revert to the old behavior of allocating table/table entries using M_NOWAIT. Currently, the code allows for sleeping in the ioctl path to guarantee allocation. However code also handles ENOMEM gracefully, so propagate this error back to user-space, rather than sleeping while holding the global pf mutex. Reviewed by: glebius Discussed with: bz Modified: head/sys/contrib/pf/net/pf_table.c Modified: head/sys/contrib/pf/net/pf_table.c ============================================================================== --- head/sys/contrib/pf/net/pf_table.c Sat Jan 14 22:46:18 2012 (r230118) +++ head/sys/contrib/pf/net/pf_table.c Sat Jan 14 22:51:34 2012 (r230119) @@ -927,16 +927,12 @@ pfr_create_kentry(struct pfr_addr *ad, i { struct pfr_kentry *ke; - if (intr) #ifdef __FreeBSD__ - ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO); + ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO); #else + if (intr) ke = pool_get(&pfr_kentry_pl, PR_NOWAIT | PR_ZERO); -#endif else -#ifdef __FreeBSD__ - ke = pool_get(&V_pfr_kentry_pl, PR_WAITOK|PR_ZERO); -#else ke = pool_get(&pfr_kentry_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL); #endif if (ke == NULL) @@ -2081,16 +2077,12 @@ pfr_create_ktable(struct pfr_table *tbl, struct pfr_ktable *kt; struct pf_ruleset *rs; - if (intr) #ifdef __FreeBSD__ - kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO); + kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO); #else + if (intr) kt = pool_get(&pfr_ktable_pl, PR_NOWAIT|PR_ZERO|PR_LIMITFAIL); -#endif else -#ifdef __FreeBSD__ - kt = pool_get(&V_pfr_ktable_pl, PR_WAITOK|PR_ZERO); -#else kt = pool_get(&pfr_ktable_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL); #endif if (kt == NULL) From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 23:04:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45F7B106566C; Sat, 14 Jan 2012 23:04:28 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3028A8FC15; Sat, 14 Jan 2012 23:04:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0EN4SuT052638; Sat, 14 Jan 2012 23:04:28 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0EN4SEJ052635; Sat, 14 Jan 2012 23:04:28 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201201142304.q0EN4SEJ052635@svn.freebsd.org> From: Alan Cox Date: Sat, 14 Jan 2012 23:04: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: r230120 - head/sys/fs/tmpfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 23:04:28 -0000 Author: alc Date: Sat Jan 14 23:04:27 2012 New Revision: 230120 URL: http://svn.freebsd.org/changeset/base/230120 Log: Neither tmpfs_nocacheread() nor tmpfs_mappedwrite() needs to call vm_object_pip_{add,subtract}() on the swap object because the swap object can't be destroyed while the vnode is exclusively locked. Moreover, even if the swap object could have been destroyed during tmpfs_nocacheread() and tmpfs_mappedwrite() this code is broken because vm_object_pip_subtract() does not wake up the sleeping thread that is trying to destroy the swap object. Free invalid pages after an I/O error. There is no virtue in keeping them around in the swap object creating more work for the page daemon. (I believe that any non-busy page in the swap object will now always be valid.) vm_pager_get_pages() does not return a standard errno, so its return value should not be returned by tmpfs without translation to an errno value. There is no reason for the wakeup on vpg in tmpfs_mappedwrite() to occur with the swap object locked. Eliminate printf()s from tmpfs_nocacheread() and tmpfs_mappedwrite(). (The swap pager already spam your console if data corruption is imminent.) Reviewed by: kib MFC after: 3 weeks Modified: head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Sat Jan 14 22:51:34 2012 (r230119) +++ head/sys/fs/tmpfs/tmpfs_subr.c Sat Jan 14 23:04:27 2012 (r230120) @@ -929,6 +929,7 @@ retry: vm_page_sleep(m, "tmfssz"); goto retry; } + MPASS(m->valid == VM_PAGE_BITS_ALL); } else if (vm_pager_has_page(uobj, idx, NULL, NULL)) { m = vm_page_alloc(uobj, idx, VM_ALLOC_NORMAL); if (m == NULL) { @@ -957,7 +958,6 @@ retry: } if (m != NULL) { pmap_zero_page_area(m, base, PAGE_SIZE - base); - MPASS(m->valid == VM_PAGE_BITS_ALL); vm_page_dirty(m); vm_pager_page_unswapped(m); } Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sat Jan 14 22:51:34 2012 (r230119) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sat Jan 14 23:04:27 2012 (r230120) @@ -437,18 +437,20 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p vm_offset_t offset, size_t tlen, struct uio *uio) { vm_page_t m; - int error; + int error, rv; VM_OBJECT_LOCK(tobj); - vm_object_pip_add(tobj, 1); m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); if (m->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(tobj, idx, NULL, NULL)) { - error = vm_pager_get_pages(tobj, &m, 1, 0); - if (error != 0) { - printf("tmpfs get pages from pager error [read]\n"); - goto out; + rv = vm_pager_get_pages(tobj, &m, 1, 0); + if (rv != VM_PAGER_OK) { + vm_page_lock(m); + vm_page_free(m); + vm_page_unlock(m); + VM_OBJECT_UNLOCK(tobj); + return (EIO); } } else vm_page_zero_invalid(m, TRUE); @@ -456,12 +458,10 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p VM_OBJECT_UNLOCK(tobj); error = uiomove_fromphys(&m, offset, tlen, uio); VM_OBJECT_LOCK(tobj); -out: vm_page_lock(m); vm_page_unwire(m, TRUE); vm_page_unlock(m); vm_page_wakeup(m); - vm_object_pip_subtract(tobj, 1); VM_OBJECT_UNLOCK(tobj); return (error); @@ -624,7 +624,7 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_o vm_offset_t offset; off_t addr; size_t tlen; - int error; + int error, rv; error = 0; @@ -664,14 +664,16 @@ lookupvpg: } nocache: VM_OBJECT_LOCK(tobj); - vm_object_pip_add(tobj, 1); tpg = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); if (tpg->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(tobj, idx, NULL, NULL)) { - error = vm_pager_get_pages(tobj, &tpg, 1, 0); - if (error != 0) { - printf("tmpfs get pages from pager error [write]\n"); + rv = vm_pager_get_pages(tobj, &tpg, 1, 0); + if (rv != VM_PAGER_OK) { + vm_page_lock(tpg); + vm_page_free(tpg); + vm_page_unlock(tpg); + error = EIO; goto out; } } else @@ -685,9 +687,6 @@ nocache: pmap_copy_page(vpg, tpg); } VM_OBJECT_LOCK(tobj); -out: - if (vobj != NULL) - VM_OBJECT_LOCK(vobj); if (error == 0) { KASSERT(tpg->valid == VM_PAGE_BITS_ALL, ("parts of tpg invalid")); @@ -697,12 +696,13 @@ out: vm_page_unwire(tpg, TRUE); vm_page_unlock(tpg); vm_page_wakeup(tpg); - if (vpg != NULL) +out: + VM_OBJECT_UNLOCK(tobj); + if (vpg != NULL) { + VM_OBJECT_LOCK(vobj); vm_page_wakeup(vpg); - if (vobj != NULL) VM_OBJECT_UNLOCK(vobj); - vm_object_pip_subtract(tobj, 1); - VM_OBJECT_UNLOCK(tobj); + } return (error); } From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 23:10:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A76921065673; Sat, 14 Jan 2012 23:10:18 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91D568FC14; Sat, 14 Jan 2012 23:10:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ENAItB052837; Sat, 14 Jan 2012 23:10:18 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ENAIaF052835; Sat, 14 Jan 2012 23:10:18 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201142310.q0ENAIaF052835@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 14 Jan 2012 23:10: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: r230121 - head/tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 23:10:18 -0000 Author: jilles Date: Sat Jan 14 23:10:18 2012 New Revision: 230121 URL: http://svn.freebsd.org/changeset/base/230121 Log: sh: Add testcases that should not be broken by future optimizations. Added: head/tools/regression/bin/sh/expansion/cmdsubst12.0 (contents, props changed) head/tools/regression/bin/sh/expansion/cmdsubst13.0 (contents, props changed) Added: head/tools/regression/bin/sh/expansion/cmdsubst12.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/cmdsubst12.0 Sat Jan 14 23:10:18 2012 (r230121) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +f() { + echo x$(printf foo >&2)y +} +[ "$(f 2>&1)" = "fooxy" ] Added: head/tools/regression/bin/sh/expansion/cmdsubst13.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/cmdsubst13.0 Sat Jan 14 23:10:18 2012 (r230121) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +x=1 y=2 +[ "$( + case $((x+=1)) in + ($((y+=1))) echo bad1 ;; + ($((y-1))) echo $x.$y ;; + ($((y=2))) echo bad2 ;; + (*) echo bad3 ;; + esac +)" = "2.3" ] || echo "Error at $LINENO" +[ "$x.$y" = "1.2" ] || echo "Error at $LINENO" From owner-svn-src-head@FreeBSD.ORG Sat Jan 14 23:19:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA4D91065675; Sat, 14 Jan 2012 23:19:10 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5C108FC12; Sat, 14 Jan 2012 23:19:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ENJAEH053172; Sat, 14 Jan 2012 23:19:10 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ENJAHj053170; Sat, 14 Jan 2012 23:19:10 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201142319.q0ENJAHj053170@svn.freebsd.org> From: Doug Barton Date: Sat, 14 Jan 2012 23:19:10 +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: r230122 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 23:19:11 -0000 Author: dougb Date: Sat Jan 14 23:19:10 2012 New Revision: 230122 URL: http://svn.freebsd.org/changeset/base/230122 Log: For the mass rc.d changes, add a command line to make the update easier Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Jan 14 23:10:18 2012 (r230121) +++ head/UPDATING Sat Jan 14 23:19:10 2012 (r230122) @@ -28,6 +28,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 port installed with a script in /usr/local/etc/rc.d you can either hand-edit the rcvar= line, or reinstall the port. + An easy way to handle the mass-update of /etc/rc.d: + rm /etc/rc.d/* && mergemaster -i + 20120109: panic(9) now stops other CPUs in the SMP systems, disables interrupts on the current CPU and prevents other threads from running.