From owner-svn-src-user@FreeBSD.ORG Thu Mar 4 20:41:11 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D66981065675; Thu, 4 Mar 2010 20:41:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C16F08FC18; Thu, 4 Mar 2010 20:41:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o24KfBTi083061; Thu, 4 Mar 2010 20:41:11 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o24KfBKK083037; Thu, 4 Mar 2010 20:41:11 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201003042041.o24KfBKK083037@svn.freebsd.org> From: Warner Losh Date: Thu, 4 Mar 2010 20:41:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204732 - in user/imp/tbemd: bin/ed sbin/ipfw share/man/man4 sys/netinet/ipfw sys/powerpc/aim usr.bin/chpass usr.bin/ncal usr.sbin usr.sbin/mount_nwfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Mar 2010 20:41:11 -0000 Author: imp Date: Thu Mar 4 20:41:11 2010 New Revision: 204732 URL: http://svn.freebsd.org/changeset/base/204732 Log: Merge through 204723 plus changes to usr.sbin to move to the Makefile.arch setup Added: user/imp/tbemd/usr.sbin/Makefile.amd64 user/imp/tbemd/usr.sbin/Makefile.arm user/imp/tbemd/usr.sbin/Makefile.i386 user/imp/tbemd/usr.sbin/Makefile.ia64 user/imp/tbemd/usr.sbin/Makefile.mips user/imp/tbemd/usr.sbin/Makefile.powerpc user/imp/tbemd/usr.sbin/Makefile.sparc64 Modified: user/imp/tbemd/bin/ed/Makefile user/imp/tbemd/bin/ed/main.c user/imp/tbemd/sbin/ipfw/dummynet.c user/imp/tbemd/sbin/ipfw/ipfw2.c user/imp/tbemd/sbin/ipfw/main.c user/imp/tbemd/share/man/man4/ada.4 user/imp/tbemd/share/man/man4/ahci.4 user/imp/tbemd/share/man/man4/cd.4 user/imp/tbemd/share/man/man4/ch.4 user/imp/tbemd/share/man/man4/da.4 user/imp/tbemd/share/man/man4/pass.4 user/imp/tbemd/share/man/man4/pt.4 user/imp/tbemd/share/man/man4/sa.4 user/imp/tbemd/share/man/man4/scsi.4 user/imp/tbemd/share/man/man4/siis.4 user/imp/tbemd/sys/netinet/ipfw/ip_dummynet.c user/imp/tbemd/sys/netinet/ipfw/ip_fw_sockopt.c user/imp/tbemd/sys/powerpc/aim/mmu_oea64.c user/imp/tbemd/usr.bin/chpass/Makefile user/imp/tbemd/usr.bin/ncal/Makefile user/imp/tbemd/usr.bin/ncal/ncal.1 user/imp/tbemd/usr.bin/ncal/ncal.c user/imp/tbemd/usr.sbin/Makefile user/imp/tbemd/usr.sbin/mount_nwfs/Makefile user/imp/tbemd/usr.sbin/mount_nwfs/mount_nwfs.c Directory Properties: user/imp/tbemd/ (props changed) user/imp/tbemd/contrib/tzcode/stdtime/ (props changed) user/imp/tbemd/contrib/tzcode/zic/ (props changed) user/imp/tbemd/contrib/tzdata/ (props changed) user/imp/tbemd/lib/libz/ (props changed) Modified: user/imp/tbemd/bin/ed/Makefile ============================================================================== --- user/imp/tbemd/bin/ed/Makefile Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/bin/ed/Makefile Thu Mar 4 20:41:11 2010 (r204732) @@ -4,7 +4,6 @@ PROG= ed SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c -WARNS?= 2 LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 Modified: user/imp/tbemd/bin/ed/main.c ============================================================================== --- user/imp/tbemd/bin/ed/main.c Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/bin/ed/main.c Thu Mar 4 20:41:11 2010 (r204732) @@ -103,15 +103,10 @@ const char usage[] = "usage: %s [-] [-sx /* ed: line editor */ int -main(int argc, char *argv[]) +main(volatile int argc, char ** volatile argv) { int c, n; long status = 0; -#if __GNUC__ - /* Avoid longjmp clobbering */ - (void) &argc; - (void) &argv; -#endif (void)setlocale(LC_ALL, ""); Modified: user/imp/tbemd/sbin/ipfw/dummynet.c ============================================================================== --- user/imp/tbemd/sbin/ipfw/dummynet.c Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/sbin/ipfw/dummynet.c Thu Mar 4 20:41:11 2010 (r204732) @@ -10,8 +10,6 @@ * * This software is provided ``AS IS'' without any warranties of any kind. * - * NEW command line interface for IP firewall facility - * * $FreeBSD$ * * dummynet support @@ -1243,8 +1241,8 @@ dummynet_flush(void) void dummynet_list(int ac, char *av[], int show_counters) { - struct dn_id oid, *x; - int ret, l = sizeof(oid); + struct dn_id oid, *x = NULL; + int ret, i, l = sizeof(oid); oid_fill(&oid, l, DN_CMD_GET, DN_API_VERSION); switch (co.do_pipe) { @@ -1258,14 +1256,29 @@ dummynet_list(int ac, char *av[], int sh oid.subtype = DN_SCH; /* list sched */ break; } + + /* Request the buffer size (in oid.id)*/ ret = do_cmd(-IP_DUMMYNET3, &oid, (uintptr_t)&l); // printf("%s returns %d need %d\n", __FUNCTION__, ret, oid.id); if (ret != 0 || oid.id <= sizeof(oid)) return; - l = oid.id; - x = safe_calloc(1, l); + + /* Try max 10 times + * Buffer is correct if l != 0. + * If l == 0 no buffer is sent, maybe because kernel requires + * a greater buffer, so try with the new size in x->id. + */ + for (i = 0, l = oid.id; i < 10; i++, l = x->id) { + x = safe_realloc(x, l); *x = oid; ret = do_cmd(-IP_DUMMYNET3, x, (uintptr_t)&l); + + if (ret != 0 || x->id <= sizeof(oid)) + return; + + if (l != 0) + break; /* ok */ + } // printf("%s returns %d need %d\n", __FUNCTION__, ret, oid.id); // XXX filter on ac, av list_pipes(x, O_NEXT(x, l)); Modified: user/imp/tbemd/sbin/ipfw/ipfw2.c ============================================================================== --- user/imp/tbemd/sbin/ipfw/ipfw2.c Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/sbin/ipfw/ipfw2.c Thu Mar 4 20:41:11 2010 (r204732) @@ -1625,13 +1625,21 @@ ipfw_sets_handler(char *av[]) if (av[0] == NULL) errx(EX_USAGE, "set needs command"); if (_substrcmp(*av, "show") == 0) { - void *data; + void *data = NULL; char const *msg; + int nalloc; - nbytes = sizeof(struct ip_fw); + nalloc = nbytes = sizeof(struct ip_fw); + while (nbytes >= nalloc) { + if (data) + free(data); + nalloc = nalloc * 2 + 200; + nbytes = nalloc; data = safe_calloc(1, nbytes); if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0) err(EX_OSERR, "getsockopt(IP_FW_GET)"); + } + bcopy(&((struct ip_fw *)data)->next_rule, &set_disable, sizeof(set_disable)); @@ -1661,7 +1669,7 @@ ipfw_sets_handler(char *av[]) i = do_cmd(IP_FW_DEL, masks, sizeof(uint32_t)); } else if (_substrcmp(*av, "move") == 0) { av++; - if (!av[0] && _substrcmp(*av, "rule") == 0) { + if (av[0] && _substrcmp(*av, "rule") == 0) { cmd = 2; av++; } else @@ -1685,7 +1693,7 @@ ipfw_sets_handler(char *av[]) av++; masks[0] = masks[1] = 0; - while (!av[0]) { + while (av[0]) { if (isdigit(**av)) { i = atoi(*av); if (i < 0 || i > RESVD_SET) Modified: user/imp/tbemd/sbin/ipfw/main.c ============================================================================== --- user/imp/tbemd/sbin/ipfw/main.c Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/sbin/ipfw/main.c Thu Mar 4 20:41:11 2010 (r204732) @@ -583,6 +583,20 @@ ipfw_readfile(int ac, char *av[]) int main(int ac, char *av[]) { +#if defined(_WIN32) && defined(TCC) + { + WSADATA wsaData; + int ret=0; + unsigned short wVersionRequested = MAKEWORD(2, 2); + ret = WSAStartup(wVersionRequested, &wsaData); + if (ret != 0) { + /* Tell the user that we could not find a usable */ + /* Winsock DLL. */ + printf("WSAStartup failed with error: %d\n", ret); + return 1; + } + } +#endif /* * If the last argument is an absolute pathname, interpret it * as a file to be preprocessed. Modified: user/imp/tbemd/share/man/man4/ada.4 ============================================================================== --- user/imp/tbemd/share/man/man4/ada.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/ada.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -127,6 +127,7 @@ ATA device nodes .Sh SEE ALSO .Xr ad 4 , .Xr ahci 4 , +.Xr cam 4 , .Xr da 4 , .Xr siis 4 .Sh HISTORY Modified: user/imp/tbemd/share/man/man4/ahci.4 ============================================================================== --- user/imp/tbemd/share/man/man4/ahci.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/ahci.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -139,10 +139,10 @@ such as JMicron JMB36x and Marvell 88SX6 .Sh SEE ALSO .Xr ada 4 , .Xr ata 4 , +.Xr cam 4 , .Xr cd 4 , .Xr da 4 , -.Xr sa 4 , -.Xr scsi 4 +.Xr sa 4 .Sh HISTORY The .Nm Modified: user/imp/tbemd/share/man/man4/cd.4 ============================================================================== --- user/imp/tbemd/share/man/man4/cd.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/cd.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -496,8 +496,8 @@ devices .Sh DIAGNOSTICS None. .Sh SEE ALSO +.Xr cam 4 , .Xr da 4 , -.Xr scsi 4 , .Xr disklabel 5 , .Xr disklabel 8 , .Xr cd 9 Modified: user/imp/tbemd/share/man/man4/ch.4 ============================================================================== --- user/imp/tbemd/share/man/man4/ch.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/ch.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -325,6 +325,7 @@ If the media changer does not support fe driver, it will produce both console error messages and failure return codes to the ioctls described here. .Sh SEE ALSO +.Xr cam 4 , .Xr chio 1 , .Xr cd 4 , .Xr da 4 , Modified: user/imp/tbemd/share/man/man4/da.4 ============================================================================== --- user/imp/tbemd/share/man/man4/da.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/da.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -196,6 +196,7 @@ SCSI disk device nodes None. .Sh SEE ALSO .Xr ad 4 , +.Xr cam 4 , .Xr geom 4 , .Xr bsdlabel 8 , .Xr fdisk 8 Modified: user/imp/tbemd/share/man/man4/pass.4 ============================================================================== --- user/imp/tbemd/share/man/man4/pass.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/pass.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -104,6 +104,7 @@ CAM subsystem. None. .Sh SEE ALSO .Xr cam 3 , +.Xr cam 4 , .Xr cam_cdbparse 3 , .Xr xpt 4 , .Xr camcontrol 8 Modified: user/imp/tbemd/share/man/man4/pt.4 ============================================================================== --- user/imp/tbemd/share/man/man4/pt.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/pt.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -84,7 +84,7 @@ the .Ar N Ns th processor device. .El .Sh SEE ALSO -.Xr scsi 4 +.Xr cam 4 .Sh HISTORY The .Nm Modified: user/imp/tbemd/share/man/man4/sa.4 ============================================================================== --- user/imp/tbemd/share/man/man4/sa.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/sa.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -200,8 +200,8 @@ accessing the device, e.g.). .Sh DIAGNOSTICS None. .Sh SEE ALSO -.Xr mt 1 , -.Xr scsi 4 +.Xr cam 4 , +.Xr mt 1 .Sh AUTHORS .An -nosplit The Modified: user/imp/tbemd/share/man/man4/scsi.4 ============================================================================== --- user/imp/tbemd/share/man/man4/scsi.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/scsi.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -24,15 +24,15 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd October 15, 1998 -.Dt SCSI 4 +.Dd March 4, 2010 +.Dt CAM 4 .Os .Sh NAME -.Nm SCSI , .Nm CAM -.Nd CAM SCSI subsystem +.Nd Common Access Method SCSI/ATA subsystem .Sh SYNOPSIS .Cd "device scbus" +.Cd "device ada" .Cd "device cd" .Cd "device ch" .Cd "device da" @@ -49,31 +49,32 @@ .Cd "options SCSI_NO_OP_STRINGS" .Cd "options SCSI_DELAY=8000" .Sh DESCRIPTION -The CAM -.Tn SCSI +The +.Nm subsystem provides a uniform and modular system for the implementation of drivers to control various .Tn SCSI +and +.Tn ATA devices, and to utilize different .Tn SCSI +and +.Tn ATA host adapters through host adapter drivers. -When the system probes the -.Tn SCSI -busses, it attaches any devices it finds to the appropriate -drivers. +When the system probes busses, it attaches any devices it finds to the +appropriate drivers. The .Xr pass 4 -driver, if it is configured in the kernel, will attach to all -.Tn SCSI -devices. +driver, if it is configured in the kernel, will attach to all devices. .Sh KERNEL CONFIGURATION There are a number of generic kernel configuration options for the -CAM -.Tn SCSI +.Nm subsystem: .Bl -tag -width SCSI_NO_SENSE_STRINGS .It Dv CAMDEBUG -This option enables the CAM debugging printf code. +This option enables the +.Nm +debugging printf code. This will not actually cause any debugging information to be printed out when included by itself. Enabling printouts requires additional configuration. @@ -82,12 +83,11 @@ See below for details. This sets the maximum allowable number of concurrent "high power" commands. A "high power" command is a command that takes more electrical power than most to complete. -An example of this (and the only command currently -tagged as "high power") is the +An example of this is the .Tn SCSI START UNIT command. -Starting a SCSI disk often takes significantly more -electrical power than normal operation of the disk. +Starting a disk often takes significantly more electrical power than normal +operation. This option allows the user to specify how many concurrent high power commands may be outstanding without overloading the power supply on his computer. @@ -120,7 +120,9 @@ problems. This is the .Tn SCSI "bus settle delay." -In CAM, it is specified in +In +.Nm , +it is specified in .Em milliseconds , not seconds like the old .Tn SCSI @@ -148,7 +150,7 @@ In that case, the will be reset to 100ms. .El .Pp -All devices and the SCSI busses support boot time allocation so that +All devices and busses support dynamic allocation so that an upper number of devices and controllers does not need to be configured; .Cd "device da" will suffice for any number of disk drivers. @@ -204,7 +206,9 @@ hint.da.0.unit="0" This assigns .Em da0 to target 0, unit (lun) 0 of scbus 0. -Omitting the target or unit hints will instruct CAM to treat them as wildcards +Omitting the target or unit hints will instruct +.Nm +to treat them as wildcards and use the first respective counted instances. These examples can be combined together to allow a peripheral device to be wired to any particular controller, bus, target, and/or unit instance. @@ -221,7 +225,9 @@ The system allows common device drivers types of adapters. The adapters take requests from the upper layers and do all IO between the -.Em SCSI +.Tn SCSI +or +.Tn ATA bus and the system. The maximum size of a transfer is governed by the adapter. @@ -233,7 +239,8 @@ Some adapters support in which the system is capable of operating as a device, responding to operations initiated by another system. Target mode is supported for -some adapters, but is not yet complete for this version of the CAM +some adapters, but is not yet complete for this version of the +.Nm .Tn SCSI subsystem. .Sh FILES @@ -278,7 +285,9 @@ Users can enable debugging from their ke the following kernel config options: .Bl -tag -width CAM_DEBUG_TARGET .It Dv CAMDEBUG -This enables CAM debugging. +This enables +.Nm +debugging. Without this option, users will not even be able to turn on debugging from userland via .Xr camcontrol 8 . @@ -313,9 +322,12 @@ See .Xr camcontrol 8 for details. .Sh SEE ALSO +.Xr ada 4 , .Xr aha 4 , .Xr ahb 4 , .Xr ahc 4 , +.Xr ahci 4 , +.Xr ata 4 , .Xr bt 4 , .Xr cd 4 , .Xr ch 4 , @@ -326,15 +338,26 @@ for details. .Xr xpt 4 , .Xr camcontrol 8 .Sh HISTORY -The CAM +The +.Nm .Tn SCSI subsystem first appeared in .Fx 3.0 . +The +.Nm +ATA support was added in +.Fx 8.0 . .Sh AUTHORS .An -nosplit -The CAM +The +.Nm .Tn SCSI subsystem was written by .An Justin Gibbs and .An Kenneth Merry . +The +.Nm +.Tn ATA +support was added by +.An Alexander Motin Aq mav@FreeBSD.org . Modified: user/imp/tbemd/share/man/man4/siis.4 ============================================================================== --- user/imp/tbemd/share/man/man4/siis.4 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/share/man/man4/siis.4 Thu Mar 4 20:41:11 2010 (r204732) @@ -113,10 +113,10 @@ SiI3531 .Sh SEE ALSO .Xr ada 4 , .Xr ata 4 , +.Xr cam 4 , .Xr cd 4 , .Xr da 4 , -.Xr sa 4 , -.Xr scsi 4 +.Xr sa 4 .Sh HISTORY The .Nm Modified: user/imp/tbemd/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/imp/tbemd/sys/netinet/ipfw/ip_dummynet.c Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/sys/netinet/ipfw/ip_dummynet.c Thu Mar 4 20:41:11 2010 (r204732) @@ -1690,8 +1690,8 @@ compute_space(struct dn_id *cmd, int *to * link, scheduler template, flowset * integrated in scheduler and header * for flowset list - * (NSI)*(dn_flow + dn_queue) all scheduler instance + one - * queue per instance + * (NSI)*(dn_flow) all scheduler instance (includes + * the queue instance) * - ipfw sched show * (NP/2)*(dn_link + dn_sch + dn_id + dn_fs) only half scheduler * link, scheduler template, flowset @@ -1708,11 +1708,13 @@ compute_space(struct dn_id *cmd, int *to default: return -1; /* XXX where do LINK and SCH differ ? */ + /* 'ipfw sched show' could list all queues associated to + * a scheduler. This feature for now is disabled + */ case DN_LINK: /* pipe show */ x = DN_C_LINK | DN_C_SCH | DN_C_FLOW; need += dn_cfg.schk_count * (sizeof(struct dn_fs) + profile_size) / 2; - need += dn_cfg.si_count * sizeof(struct dn_queue); need += dn_cfg.fsk_count * sizeof(uint32_t); break; case DN_SCH: /* sched show */ @@ -2072,11 +2074,12 @@ ip_dn_init(void) static void ip_dn_destroy(void) { + callout_drain(&dn_timeout); + DN_BH_WLOCK(); ip_dn_ctl_ptr = NULL; ip_dn_io_ptr = NULL; - callout_stop(&dn_timeout); dummynet_flush(); DN_BH_WUNLOCK(); taskqueue_drain(dn_tq, &dn_task); Modified: user/imp/tbemd/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- user/imp/tbemd/sys/netinet/ipfw/ip_fw_sockopt.c Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/sys/netinet/ipfw/ip_fw_sockopt.c Thu Mar 4 20:41:11 2010 (r204732) @@ -1212,6 +1212,13 @@ convert_rule_to_7(struct ip_fw *rule) ccmdlen = F_LEN(ccmd); bcopy(ccmd, dst, F_LEN(ccmd)*sizeof(uint32_t)); + + if (dst->opcode > O_NAT) + /* O_REASS doesn't exists in 7.2 version, so + * decrement opcode if it is after O_REASS + */ + dst->opcode--; + if (ccmdlen > ll) { printf("ipfw: opcode %d size truncated\n", ccmd->opcode); @@ -1246,6 +1253,13 @@ convert_rule_to_8(struct ip_fw *rule) ccmdlen = F_LEN(ccmd); bcopy(ccmd, dst, F_LEN(ccmd)*sizeof(uint32_t)); + + if (dst->opcode > O_NAT) + /* O_REASS doesn't exists in 7.2 version, so + * increment opcode if it is after O_REASS + */ + dst->opcode++; + if (ccmdlen > ll) { printf("ipfw: opcode %d size truncated\n", ccmd->opcode); Modified: user/imp/tbemd/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- user/imp/tbemd/sys/powerpc/aim/mmu_oea64.c Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/sys/powerpc/aim/mmu_oea64.c Thu Mar 4 20:41:11 2010 (r204732) @@ -327,7 +327,6 @@ SYSCTL_INT(_machdep, OID_AUTO, moea64_pv &moea64_pvo_remove_calls, 0, ""); vm_offset_t moea64_scratchpage_va[2]; -struct pvo_entry *moea64_scratchpage_pvo[2]; struct lpte *moea64_scratchpage_pte[2]; struct mtx moea64_scratchpage_mtx; @@ -965,22 +964,36 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o PMAP_UNLOCK(kernel_pmap); /* - * Allocate some things for page zeroing + * Allocate some things for page zeroing. We put this directly + * in the page table, marked with LPTE_LOCKED, to avoid any + * of the PVO book-keeping or other parts of the VM system + * from even knowing that this hack exists. */ mtx_init(&moea64_scratchpage_mtx, "pvo zero page", NULL, MTX_DEF); for (i = 0; i < 2; i++) { + struct lpte pt; + uint64_t vsid; + int pteidx, ptegidx; + moea64_scratchpage_va[i] = (virtual_end+1) - PAGE_SIZE; virtual_end -= PAGE_SIZE; - moea64_kenter(mmup,moea64_scratchpage_va[i],0); - LOCK_TABLE(); - moea64_scratchpage_pvo[i] = moea64_pvo_find_va(kernel_pmap, - moea64_scratchpage_va[i],&j); - moea64_scratchpage_pte[i] = moea64_pvo_to_pte( - moea64_scratchpage_pvo[i],j); - moea64_scratchpage_pte[i]->pte_hi |= LPTE_LOCKED; + + vsid = va_to_vsid(kernel_pmap, moea64_scratchpage_va[i]); + moea64_pte_create(&pt, vsid, moea64_scratchpage_va[i], + LPTE_NOEXEC); + pt.pte_hi |= LPTE_LOCKED; + + ptegidx = va_to_pteg(vsid, moea64_scratchpage_va[i]); + pteidx = moea64_pte_insert(ptegidx, &pt); + if (pt.pte_hi & LPTE_HID) + ptegidx ^= moea64_pteg_mask; + + moea64_scratchpage_pte[i] = + &moea64_pteg_table[ptegidx].pt[pteidx]; + UNLOCK_TABLE(); } @@ -1088,18 +1101,16 @@ moea64_change_wiring(mmu_t mmu, pmap_t p static __inline void moea64_set_scratchpage_pa(int which, vm_offset_t pa) { - mtx_assert(&moea64_scratchpage_mtx, MA_OWNED); - moea64_scratchpage_pvo[which]->pvo_pte.lpte.pte_lo &= - ~(LPTE_WIMG | LPTE_RPGN); - moea64_scratchpage_pvo[which]->pvo_pte.lpte.pte_lo |= - moea64_calc_wimg(pa) | (uint64_t)pa; + mtx_assert(&moea64_scratchpage_mtx, MA_OWNED); moea64_scratchpage_pte[which]->pte_hi &= ~LPTE_VALID; TLBIE(kernel_pmap, moea64_scratchpage_va[which]); - moea64_scratchpage_pte[which]->pte_lo = - moea64_scratchpage_pvo[which]->pvo_pte.lpte.pte_lo; + moea64_scratchpage_pte[which]->pte_lo &= + ~(LPTE_WIMG | LPTE_RPGN); + moea64_scratchpage_pte[which]->pte_lo |= + moea64_calc_wimg(pa) | (uint64_t)pa; EIEIO(); moea64_scratchpage_pte[which]->pte_hi |= LPTE_VALID; @@ -1496,11 +1507,11 @@ moea64_remove_write(mmu_t mmu, vm_page_t return; lo = moea64_attr_fetch(m); SYNC(); + LOCK_TABLE(); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { pmap = pvo->pvo_pmap; PMAP_LOCK(pmap); if ((pvo->pvo_pte.lpte.pte_lo & LPTE_PP) != LPTE_BR) { - LOCK_TABLE(); pt = moea64_pvo_to_pte(pvo, -1); pvo->pvo_pte.lpte.pte_lo &= ~LPTE_PP; pvo->pvo_pte.lpte.pte_lo |= LPTE_BR; @@ -1511,10 +1522,10 @@ moea64_remove_write(mmu_t mmu, vm_page_t moea64_pte_change(pt, &pvo->pvo_pte.lpte, pvo->pvo_pmap, PVO_VADDR(pvo)); } - UNLOCK_TABLE(); } PMAP_UNLOCK(pmap); } + UNLOCK_TABLE(); if ((lo & LPTE_CHG) != 0) { moea64_attr_clear(m, LPTE_CHG); vm_page_dirty(m); @@ -1651,12 +1662,16 @@ moea64_page_exists_quick(mmu_t mmu, pmap return FALSE; loops = 0; + LOCK_TABLE(); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { - if (pvo->pvo_pmap == pmap) + if (pvo->pvo_pmap == pmap) { + UNLOCK_TABLE(); return (TRUE); + } if (++loops >= 16) break; } + UNLOCK_TABLE(); return (FALSE); } @@ -1675,9 +1690,11 @@ moea64_page_wired_mappings(mmu_t mmu, vm if (!moea64_initialized || (m->flags & PG_FICTITIOUS) != 0) return (count); mtx_assert(&vm_page_queue_mtx, MA_OWNED); + LOCK_TABLE(); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) if ((pvo->pvo_vaddr & PVO_WIRED) != 0) count++; + UNLOCK_TABLE(); return (count); } @@ -1896,6 +1913,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m mtx_assert(&vm_page_queue_mtx, MA_OWNED); pvo_head = vm_page_to_pvoh(m); + LOCK_TABLE(); for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) { next_pvo = LIST_NEXT(pvo, pvo_vlink); @@ -1905,6 +1923,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m moea64_pvo_remove(pvo, -1); PMAP_UNLOCK(pmap); } + UNLOCK_TABLE(); if ((m->flags & PG_WRITEABLE) && moea64_is_modified(mmu, m)) { moea64_attr_clear(m, LPTE_CHG); vm_page_dirty(m); @@ -2046,7 +2065,7 @@ moea64_pvo_enter(pmap_t pm, uma_zone_t z bootstrap = 1; } else { /* - * Note: drop the table around the UMA allocation in + * Note: drop the table lock around the UMA allocation in * case the UMA allocator needs to manipulate the page * table. The mapping we are working with is already * protected by the PMAP lock. @@ -2130,7 +2149,6 @@ moea64_pvo_remove(struct pvo_entry *pvo, } else { moea64_pte_overflow--; } - UNLOCK_TABLE(); /* * Update our statistics. @@ -2162,9 +2180,12 @@ moea64_pvo_remove(struct pvo_entry *pvo, * if we aren't going to reuse it. */ LIST_REMOVE(pvo, pvo_olink); + UNLOCK_TABLE(); + if (!(pvo->pvo_vaddr & PVO_BOOTSTRAP)) uma_zfree((pvo->pvo_vaddr & PVO_MANAGED) ? moea64_mpvo_zone : moea64_upvo_zone, pvo); + moea64_pvo_entries--; moea64_pvo_remove_calls++; } @@ -2313,6 +2334,7 @@ moea64_query_bit(vm_page_t m, u_int64_t if (moea64_attr_fetch(m) & ptebit) return (TRUE); + LOCK_TABLE(); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { MOEA_PVO_CHECK(pvo); /* sanity check */ @@ -2322,6 +2344,7 @@ moea64_query_bit(vm_page_t m, u_int64_t */ if (pvo->pvo_pte.lpte.pte_lo & ptebit) { moea64_attr_save(m, ptebit); + UNLOCK_TABLE(); MOEA_PVO_CHECK(pvo); /* sanity check */ return (TRUE); } @@ -2341,7 +2364,6 @@ moea64_query_bit(vm_page_t m, u_int64_t * REF/CHG bits from the valid PTE. If the appropriate * ptebit is set, cache it and return success. */ - LOCK_TABLE(); pt = moea64_pvo_to_pte(pvo, -1); if (pt != NULL) { moea64_pte_synch(pt, &pvo->pvo_pte.lpte); @@ -2353,8 +2375,8 @@ moea64_query_bit(vm_page_t m, u_int64_t return (TRUE); } } - UNLOCK_TABLE(); } + UNLOCK_TABLE(); return (FALSE); } @@ -2387,10 +2409,10 @@ moea64_clear_bit(vm_page_t m, u_int64_t * valid pte clear the ptebit from the valid pte. */ count = 0; + LOCK_TABLE(); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { MOEA_PVO_CHECK(pvo); /* sanity check */ - LOCK_TABLE(); pt = moea64_pvo_to_pte(pvo, -1); if (pt != NULL) { moea64_pte_synch(pt, &pvo->pvo_pte.lpte); @@ -2399,11 +2421,11 @@ moea64_clear_bit(vm_page_t m, u_int64_t moea64_pte_clear(pt, pvo->pvo_pmap, PVO_VADDR(pvo), ptebit); } } - UNLOCK_TABLE(); rv |= pvo->pvo_pte.lpte.pte_lo; pvo->pvo_pte.lpte.pte_lo &= ~ptebit; MOEA_PVO_CHECK(pvo); /* sanity check */ } + UNLOCK_TABLE(); if (origbit != NULL) { *origbit = rv; Modified: user/imp/tbemd/usr.bin/chpass/Makefile ============================================================================== --- user/imp/tbemd/usr.bin/chpass/Makefile Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/usr.bin/chpass/Makefile Thu Mar 4 20:41:11 2010 (r204732) @@ -43,7 +43,7 @@ beforeinstall: .if !defined(NO_FSCHG) afterinstall: - chflags schg ${DESTDIR}${BINDIR}/chpass + -chflags schg ${DESTDIR}${BINDIR}/chpass .endif .include Modified: user/imp/tbemd/usr.bin/ncal/Makefile ============================================================================== --- user/imp/tbemd/usr.bin/ncal/Makefile Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/usr.bin/ncal/Makefile Thu Mar 4 20:41:11 2010 (r204732) @@ -4,7 +4,6 @@ PROG= ncal DPADD= ${LIBCALENDAR} ${LIBTERMCAP} LDADD= -lcalendar -ltermcap -WARNS?= 1 LINKS= ${BINDIR}/ncal ${BINDIR}/cal MLINKS= ncal.1 cal.1 Modified: user/imp/tbemd/usr.bin/ncal/ncal.1 ============================================================================== --- user/imp/tbemd/usr.bin/ncal/ncal.1 Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/usr.bin/ncal/ncal.1 Thu Mar 4 20:41:11 2010 (r204732) @@ -109,6 +109,22 @@ Britain and her colonies switched to the Print the number of the week below each week column. .It Fl y Display a calendar for the specified year. +.It Fl b +Switch to backwards compatibility mode (for debugging). +.It Fl d Ar yyyy-mm-dd +Use +.Ar yyyy-mm-dd +as the current date (for debugging of highlighting). +.It Fl 3 +Display the previous, current and next month surrounding today. +.It Fl A Ar number +Display the +.Ar number +of months after the current month. +.It Fl B Ar number +Display the +.Ar number +of months before the current month. .El .Pp A single parameter specifies the year (1\(en9999) to be displayed; @@ -116,12 +132,13 @@ note the year must be fully specified: .Dq Li cal 89 will .Em not -display a calendar for 1989. -Two parameters denote the month and year; the month is either a number between -1 and 12, or a full or abbreviated name as specified by the current locale. -Month and year default to those of the current system clock and time zone (so +display a calendar for 1989. Two parameters denote the month and +year; the month is either a number between 1 and 12, or a full or +abbreviated name as specified by the current locale. Month and +year default to those of the current system clock and time zone (so .Dq Li cal -m 8 -will display a calendar for the month of August in the current year). +will display a calendar for the month of August in the current +year). .Pp A year starts on January 1. .Sh SEE ALSO @@ -142,5 +159,5 @@ The command and manual were written by .An Wolfgang Helbig Aq helbig@FreeBSD.org . .Sh BUGS -The assignment of Julian\(enGregorian switching dates to -country codes is historically naive for many countries. +The assignment of Julian\(enGregorian switching dates to country +codes is historically naive for many countries. Modified: user/imp/tbemd/usr.bin/ncal/ncal.c ============================================================================== --- user/imp/tbemd/usr.bin/ncal/ncal.c Thu Mar 4 20:31:49 2010 (r204731) +++ user/imp/tbemd/usr.bin/ncal/ncal.c Thu Mar 4 20:41:11 2010 (r204732) @@ -45,12 +45,12 @@ static const char rcsid[] = #include #undef lines /* term.h defines this */ -/* Width of one month with backward compatibility */ +/* Width of one month with backward compatibility and in regular mode*/ #define MONTH_WIDTH_B_J 27 #define MONTH_WIDTH_B 20 -#define MONTH_WIDTH_J 24 -#define MONTH_WIDTH 18 +#define MONTH_WIDTH_R_J 24 +#define MONTH_WIDTH_R 18 #define MAX_WIDTH 64 @@ -60,6 +60,7 @@ struct monthlines { wchar_t name[MAX_WIDTH + 1]; char lines[7][MAX_WIDTH + 1]; char weeks[MAX_WIDTH + 1]; + unsigned int linelen[7]; }; struct weekdays { @@ -164,25 +165,22 @@ int nswitchb; /* switch date for backwa const char *term_so, *term_se; int today; -char *center(char *s, char *t, int w); +char *center(char *s, char *t, int w); wchar_t *wcenter(wchar_t *s, wchar_t *t, int w); -void mkmonth(int year, int month, int jd_flag, struct monthlines * monthl); -void mkmonthb(int year, int month, int jd_flag, struct monthlines * monthl); -void mkweekdays(struct weekdays * wds); -int parsemonth(const char *s, int *m, int *y); -void printcc(void); -void printeaster(int year, int julian, int orthodox); -void printmonth(int year, int month, int jd_flag); -void printmonthb(int year, int month, int jd_flag); -void printyear(int year, int jd_flag); -void printyearb(int year, int jd_flag); +void mkmonthr(int year, int month, int jd_flag, struct monthlines * monthl); +void mkmonthb(int year, int month, int jd_flag, struct monthlines * monthl); +void mkweekdays(struct weekdays * wds); +int parsemonth(const char *s, int *m, int *y); +void printcc(void); +void printeaster(int year, int julian, int orthodox); int firstday(int y, int m); -date *sdate(int ndays, struct date * d); -date *sdateb(int ndays, struct date * d); -int sndays(struct date * d); -int sndaysb(struct date * d); -static void usage(void); -int weekdayb(int nd); +date *sdater(int ndays, struct date * d); +date *sdateb(int ndays, struct date * d); +int sndaysr(struct date * d); +int sndaysb(struct date * d); +static void usage(void); +void monthranger(int year, int jd_flag, int m, int before, int after); +void monthrangeb(int year, int jd_flag, int m, int before, int after); int main(int argc, char *argv[]) @@ -190,6 +188,7 @@ main(int argc, char *argv[]) struct djswitch *p, *q; /* to search user defined switch date */ date never = {10000, 1, 1}; /* outside valid range of dates */ date ukswitch = {1752, 9, 2};/* switch date for Great Britain */ + date dt; int ch; /* holds the option character */ int m = 0; /* month */ int y = 0; /* year */ @@ -202,26 +201,17 @@ main(int argc, char *argv[]) int flag_easter = 0; /* use wants easter date */ char *cp; /* character pointer */ char *flag_month = NULL; /* requested month as string */ + char *flag_highlightdate = NULL; + int before, after; const char *locale; /* locale to get country code */ char tbuf[1024], cbuf[512], *b; - time_t t; - struct tm *tm1; + /* On how to highlight on this terminal */ term_se = term_so = NULL; - today = 0; if (isatty(STDOUT_FILENO) && tgetent(tbuf, NULL) == 1) { - date dt; /* handy date */ - b = cbuf; term_so = tgetstr("so", &b); term_se = tgetstr("se", &b); - t = time(NULL); - tm1 = localtime(&t); - dt.y = tm1->tm_year + 1900; - dt.m = tm1->tm_mon + 1; - dt.d = tm1->tm_mday; - - today = sndaysb(&dt); } /* @@ -263,14 +253,35 @@ main(int argc, char *argv[]) if (flag_backward) nswitchb = ndaysj(&ukswitch); - while ((ch = getopt(argc, argv, "Jehjm:ops:wy")) != -1) + before = after = -1; + + while ((ch = getopt(argc, argv, "A:B:3Jbd:ehjm:ops:wy")) != -1) switch (ch) { + case '3': + before = after = 1; + break; + case 'A': + after = strtol(optarg, NULL, 10); + if (after < 0) + errx(1, "Argument to -A must be positive"); + break; + case 'B': + before = strtol(optarg, NULL, 10); + if (before < 0) + errx(1, "Argument to -B must be positive"); + break; case 'J': if (flag_backward) usage(); nswitch = ndaysj(&never); flag_julian_cal = 1; break; + case 'b': + flag_backward = 1; + break; + case 'd': + flag_highlightdate = optarg; + break; case 'h': term_so = term_se = NULL; break; @@ -335,6 +346,9 @@ main(int argc, char *argv[]) y = atoi(*argv++); if (y < 1 || y > 9999) errx(EX_USAGE, "year %d not in range 1..9999", y); + before = 0; + after = 11; + m = 1; break; case 0: { @@ -345,6 +359,10 @@ main(int argc, char *argv[]) tm = localtime(&t); y = tm->tm_year + 1900; m = tm->tm_mon + 1; + if (before == -1) + before = 0; + if (after == -1) + after = 0; } break; default: @@ -359,21 +377,29 @@ main(int argc, char *argv[]) } } + if (flag_highlightdate != NULL) { + dt.y = strtol(flag_highlightdate, NULL, 10); + dt.m = strtol(flag_highlightdate + 5, NULL, 10); + dt.d = strtol(flag_highlightdate + 8, NULL, 10); + } else { + time_t t; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***