From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 00:50:38 2009 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 568D01065673; Sun, 8 Mar 2009 00:50:38 +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 42F828FC1D; Sun, 8 Mar 2009 00:50:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n280ocH9067099; Sun, 8 Mar 2009 00:50:38 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n280obwZ067087; Sun, 8 Mar 2009 00:50:37 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903080050.n280obwZ067087@svn.freebsd.org> From: Robert Watson Date: Sun, 8 Mar 2009 00:50: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: r189503 - head/sys/security/mac 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 Mar 2009 00:50:38 -0000 Author: rwatson Date: Sun Mar 8 00:50:37 2009 New Revision: 189503 URL: http://svn.freebsd.org/changeset/base/189503 Log: Add static DTrace probes for MAC Framework access control checks and privilege grants so that dtrace can be more easily used to monitor the security decisions being generated by the MAC Framework following policy invocation. Successful access control checks will be reported by: mac_framework:kernel::mac_check_ok Failed access control checks will be reported by: mac_framework:kernel::mac_check_err Successful privilege grants will be reported by: mac_framework:kernel:priv_grant:mac_grant_ok Failed privilege grants will be reported by: mac_framework:kernel:priv_grant:mac_grant_err In all cases, the return value (always 0 for _ok, otherwise an errno for _err) will be reported via arg0 on the probe, and subsequent arguments will hold entrypoint-specific data, in a style similar to privilege tracing. Obtained from: TrustedBSD Project Sponsored by: Google, Inc. Modified: head/sys/security/mac/mac_audit.c head/sys/security/mac/mac_cred.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_inet.c head/sys/security/mac/mac_internal.h head/sys/security/mac/mac_net.c head/sys/security/mac/mac_pipe.c head/sys/security/mac/mac_posix_sem.c head/sys/security/mac/mac_posix_shm.c head/sys/security/mac/mac_priv.c head/sys/security/mac/mac_process.c head/sys/security/mac/mac_socket.c head/sys/security/mac/mac_system.c head/sys/security/mac/mac_sysv_msg.c head/sys/security/mac/mac_sysv_sem.c head/sys/security/mac/mac_sysv_shm.c head/sys/security/mac/mac_vfs.c Modified: head/sys/security/mac/mac_audit.c ============================================================================== --- head/sys/security/mac/mac_audit.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_audit.c Sun Mar 8 00:50:37 2009 (r189503) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002 Robert N. M. Watson + * Copyright (c) 1999-2002, 2009 Robert N. M. Watson * Copyright (c) 2001 Ilmar S. Habibulin * Copyright (c) 2001-2004 Networks Associates Technology, Inc. * Copyright (c) 2006 SPARTA, Inc. @@ -15,6 +15,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -40,8 +43,13 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" + #include +#include #include +#include +#include #include #include @@ -50,46 +58,64 @@ __FBSDID("$FreeBSD$"); #include #include +MAC_CHECK_PROBE_DEFINE2(proc_check_setaudit, "struct ucred *", + "struct auditinfo *"); + int mac_proc_check_setaudit(struct ucred *cred, struct auditinfo *ai) { int error; MAC_CHECK(proc_check_setaudit, cred, ai); + MAC_CHECK_PROBE2(proc_check_setaudit, error, cred, ai); return (error); } +MAC_CHECK_PROBE_DEFINE2(proc_check_setaudit_addr, "struct ucred *", + "struct auditinfo_addr *"); + int mac_proc_check_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia) { int error; MAC_CHECK(proc_check_setaudit_addr, cred, aia); + MAC_CHECK_PROBE2(proc_check_setaudit_addr, error, cred, aia); return (error); } +MAC_CHECK_PROBE_DEFINE2(proc_check_setauid, "struct ucred *", "uid_t"); + int mac_proc_check_setauid(struct ucred *cred, uid_t auid) { int error; MAC_CHECK(proc_check_setauid, cred, auid); + MAC_CHECK_PROBE2(proc_check_setauid, error, cred, auid); return (error); } +MAC_CHECK_PROBE_DEFINE3(system_check_audit, "struct ucred *", "void *", + "int"); + int mac_system_check_audit(struct ucred *cred, void *record, int length) { int error; MAC_CHECK(system_check_audit, cred, record, length); + MAC_CHECK_PROBE3(system_check_audit, error, cred, record, length); return (error); } +MAC_CHECK_PROBE_DEFINE2(system_check_auditctl, "struct ucred *", + "struct vnode *"); + int mac_system_check_auditctl(struct ucred *cred, struct vnode *vp) { @@ -99,18 +125,21 @@ mac_system_check_auditctl(struct ucred * ASSERT_VOP_LOCKED(vp, "mac_system_check_auditctl"); vl = (vp != NULL) ? vp->v_label : NULL; - MAC_CHECK(system_check_auditctl, cred, vp, vl); + MAC_CHECK_PROBE2(system_check_auditctl, error, cred, vp); return (error); } +MAC_CHECK_PROBE_DEFINE2(system_check_auditon, "struct ucred *", "int"); + int mac_system_check_auditon(struct ucred *cred, int cmd) { int error; MAC_CHECK(system_check_auditon, cred, cmd); + MAC_CHECK_PROBE2(system_check_auditon, error, cred, cmd); return (error); } Modified: head/sys/security/mac/mac_cred.c ============================================================================== --- head/sys/security/mac/mac_cred.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_cred.c Sun Mar 8 00:50:37 2009 (r189503) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002, 2008 Robert N. M. Watson + * Copyright (c) 1999-2002, 2008-2009 Robert N. M. Watson * Copyright (c) 2001 Ilmar S. Habibulin * Copyright (c) 2001-2003 Networks Associates Technology, Inc. * Copyright (c) 2005 Samy Al Bahra @@ -18,6 +18,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -43,6 +46,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_mac.h" #include @@ -55,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -192,22 +197,30 @@ mac_cred_relabel(struct ucred *cred, str MAC_PERFORM(cred_relabel, cred, newlabel); } +MAC_CHECK_PROBE_DEFINE2(cred_check_relabel, "struct ucred *", + "struct label *"); + int mac_cred_check_relabel(struct ucred *cred, struct label *newlabel) { int error; MAC_CHECK(cred_check_relabel, cred, newlabel); + MAC_CHECK_PROBE2(cred_check_relabel, error, cred, newlabel); return (error); } +MAC_CHECK_PROBE_DEFINE2(cred_check_visible, "struct ucred *", + "struct ucred *"); + int mac_cred_check_visible(struct ucred *cr1, struct ucred *cr2) { int error; MAC_CHECK(cred_check_visible, cr1, cr2); + MAC_CHECK_PROBE2(cred_check_visible, error, cr1, cr2); return (error); } Modified: head/sys/security/mac/mac_framework.c ============================================================================== --- head/sys/security/mac/mac_framework.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_framework.c Sun Mar 8 00:50:37 2009 (r189503) @@ -85,9 +85,11 @@ __FBSDID("$FreeBSD$"); #include /* - * DTrace SDT provider for MAC. + * DTrace SDT providers for MAC. */ SDT_PROVIDER_DEFINE(mac); +SDT_PROVIDER_DEFINE(mac_framework); + SDT_PROBE_DEFINE2(mac, kernel, policy, modevent, "int", "struct mac_policy_conf *mpc"); SDT_PROBE_DEFINE1(mac, kernel, policy, register, "struct mac_policy_conf *"); Modified: head/sys/security/mac/mac_inet.c ============================================================================== --- head/sys/security/mac/mac_inet.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_inet.c Sun Mar 8 00:50:37 2009 (r189503) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002, 2007 Robert N. M. Watson + * Copyright (c) 1999-2002, 2007, 2009 Robert N. M. Watson * Copyright (c) 2001 Ilmar S. Habibulin * Copyright (c) 2001-2004 Networks Associates Technology, Inc. * Copyright (c) 2006 SPARTA, Inc. @@ -17,6 +17,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -42,6 +45,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_mac.h" #include @@ -50,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -298,6 +303,9 @@ mac_ipq_update(struct mbuf *m, struct ip MAC_PERFORM(ipq_update, m, label, q, q->ipq_label); } +MAC_CHECK_PROBE_DEFINE2(inpcb_check_deliver, "struct inpcb *", + "struct mbuf *"); + int mac_inpcb_check_deliver(struct inpcb *inp, struct mbuf *m) { @@ -309,10 +317,14 @@ mac_inpcb_check_deliver(struct inpcb *in label = mac_mbuf_to_label(m); MAC_CHECK(inpcb_check_deliver, inp, inp->inp_label, m, label); + MAC_CHECK_PROBE2(inpcb_check_deliver, error, inp, m); return (error); } +MAC_CHECK_PROBE_DEFINE2(inpcb_check_visible, "struct ucred *", + "struct inpcb *"); + int mac_inpcb_check_visible(struct ucred *cred, struct inpcb *inp) { @@ -321,6 +333,7 @@ mac_inpcb_check_visible(struct ucred *cr INP_LOCK_ASSERT(inp); MAC_CHECK(inpcb_check_visible, cred, inp, inp->inp_label); + MAC_CHECK_PROBE2(inpcb_check_visible, error, cred, inp); return (error); } Modified: head/sys/security/mac/mac_internal.h ============================================================================== --- head/sys/security/mac/mac_internal.h Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_internal.h Sun Mar 8 00:50:37 2009 (r189503) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002, 2006 Robert N. M. Watson + * Copyright (c) 1999-2002, 2006, 2009 Robert N. M. Watson * Copyright (c) 2001 Ilmar S. Habibulin * Copyright (c) 2001-2004 Networks Associates Technology, Inc. * Copyright (c) 2006 nCircle Network Security, Inc. @@ -21,6 +21,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -60,6 +63,72 @@ SYSCTL_DECL(_security_mac); #endif /* SYSCTL_DECL */ /* + * MAC Framework SDT DTrace probe namespace, macros for declaring entry + * point probes, macros for invoking them. + */ +#ifdef SDT_PROVIDER_DECLARE +SDT_PROVIDER_DECLARE(mac); /* MAC Framework-level events. */ +SDT_PROVIDER_DECLARE(mac_framework); /* Entry points to MAC. */ + +#define MAC_CHECK_PROBE_DEFINE4(name, arg0, arg1, arg2, arg3) \ + SDT_PROBE_DEFINE5(mac_framework, kernel, name, mac_check_err, \ + "int", arg0, arg1, arg2, arg3); \ + SDT_PROBE_DEFINE5(mac_framework, kernel, name, mac_check_ok, \ + "int", arg0, arg1, arg2, arg3); + +#define MAC_CHECK_PROBE_DEFINE3(name, arg0, arg1, arg2) \ + SDT_PROBE_DEFINE4(mac_framework, kernel, name, mac_check_err, \ + "int", arg0, arg1, arg2); \ + SDT_PROBE_DEFINE4(mac_framework, kernel, name, mac_check_ok, \ + "int", arg0, arg1, arg2); + +#define MAC_CHECK_PROBE_DEFINE2(name, arg0, arg1) \ + SDT_PROBE_DEFINE3(mac_framework, kernel, name, mac_check_err, \ + "int", arg0, arg1); \ + SDT_PROBE_DEFINE3(mac_framework, kernel, name, mac_check_ok, \ + "int", arg0, arg1); + +#define MAC_CHECK_PROBE_DEFINE1(name, arg0) \ + SDT_PROBE_DEFINE2(mac_framework, kernel, name, mac_check_err, \ + "int", arg0); \ + SDT_PROBE_DEFINE2(mac_framework, kernel, name, mac_check_ok, \ + "int", arg0); + +#define MAC_CHECK_PROBE4(name, error, arg0, arg1, arg2, arg3) do { \ + if (error) { \ + SDT_PROBE(mac_framework, kernel, name, mac_check_err, \ + error, arg0, arg1, arg2, arg3); \ + } else { \ + SDT_PROBE(mac_framework, kernel, name, mac_check_ok, \ + 0, arg0, arg1, arg2, arg3); \ + } \ +} while (0) + +#define MAC_CHECK_PROBE3(name, error, arg0, arg1, arg2) \ + MAC_CHECK_PROBE4(name, error, arg0, arg1, arg2, 0) +#define MAC_CHECK_PROBE2(name, error, arg0, arg1) \ + MAC_CHECK_PROBE3(name, error, arg0, arg1, 0) +#define MAC_CHECK_PROBE1(name, error, arg0) \ + MAC_CHECK_PROBE2(name, error, arg0, 0) +#endif + +#define MAC_GRANT_PROBE_DEFINE2(name, arg0, arg1) \ + SDT_PROBE_DEFINE3(mac_framework, kernel, name, mac_grant_err, \ + "int", arg0, arg1); \ + SDT_PROBE_DEFINE3(mac_framework, kernel, name, mac_grant_ok, \ + "INT", arg0, arg1); + +#define MAC_GRANT_PROBE2(name, error, arg0, arg1) do { \ + if (error) { \ + SDT_PROBE(mac_framework, kernel, name, mac_grant_err, \ + error, arg0, arg1, 0, 0); \ + } else { \ + SDT_PROBE(mac_framework, kernel, name, mac_grant_ok, \ + error, arg0, arg1, 0, 0); \ + } \ +} while (0) + +/* * MAC Framework global types and typedefs. */ LIST_HEAD(mac_policy_list_head, mac_policy_conf); Modified: head/sys/security/mac/mac_net.c ============================================================================== --- head/sys/security/mac/mac_net.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_net.c Sun Mar 8 00:50:37 2009 (r189503) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002 Robert N. M. Watson + * Copyright (c) 1999-2002, 2009 Robert N. M. Watson * Copyright (c) 2001 Ilmar S. Habibulin * Copyright (c) 2001-2004 Networks Associates Technology, Inc. * Copyright (c) 2006 SPARTA, Inc. @@ -17,6 +17,9 @@ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), * as part of the DARPA CHATS research program. * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -42,6 +45,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_mac.h" #include @@ -52,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -324,6 +329,9 @@ mac_ifnet_create_mbuf(struct ifnet *ifp, MAC_IFNET_UNLOCK(ifp); } +MAC_CHECK_PROBE_DEFINE2(bpfdesc_check_receive, "struct bpf_d *", + "struct ifnet *"); + int mac_bpfdesc_check_receive(struct bpf_d *d, struct ifnet *ifp) { @@ -333,11 +341,15 @@ mac_bpfdesc_check_receive(struct bpf_d * MAC_IFNET_LOCK(ifp); MAC_CHECK(bpfdesc_check_receive, d, d->bd_label, ifp, ifp->if_label); + MAC_CHECK_PROBE2(bpfdesc_check_receive, error, d, ifp); MAC_IFNET_UNLOCK(ifp); return (error); } +MAC_CHECK_PROBE_DEFINE2(ifnet_check_transmit, "struct ifnet *", + "struct mbuf *"); + int mac_ifnet_check_transmit(struct ifnet *ifp, struct mbuf *m) { @@ -350,6 +362,7 @@ mac_ifnet_check_transmit(struct ifnet *i MAC_IFNET_LOCK(ifp); MAC_CHECK(ifnet_check_transmit, ifp, ifp->if_label, m, label); + MAC_CHECK_PROBE2(ifnet_check_transmit, error, ifp, m); MAC_IFNET_UNLOCK(ifp); return (error); Modified: head/sys/security/mac/mac_pipe.c ============================================================================== --- head/sys/security/mac/mac_pipe.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_pipe.c Sun Mar 8 00:50:37 2009 (r189503) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2002-2003 Networks Associates Technology, Inc. * Copyright (c) 2006 SPARTA, Inc. + * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. * * This software was developed for the FreeBSD Project in part by Network @@ -11,6 +12,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -36,6 +40,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_mac.h" #include @@ -45,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -135,6 +141,9 @@ mac_pipe_relabel(struct ucred *cred, str MAC_PERFORM(pipe_relabel, cred, pp, pp->pp_label, newlabel); } +MAC_CHECK_PROBE_DEFINE4(pipe_check_ioctl, "struct ucred *", + "struct pipepair *", "unsigned long", "void *"); + int mac_pipe_check_ioctl(struct ucred *cred, struct pipepair *pp, unsigned long cmd, void *data) @@ -144,10 +153,14 @@ mac_pipe_check_ioctl(struct ucred *cred, mtx_assert(&pp->pp_mtx, MA_OWNED); MAC_CHECK(pipe_check_ioctl, cred, pp, pp->pp_label, cmd, data); + MAC_CHECK_PROBE4(pipe_check_ioctl, error, cred, pp, cmd, data); return (error); } +MAC_CHECK_PROBE_DEFINE2(pipe_check_poll, "struct ucred *", + "struct pipepair *"); + int mac_pipe_check_poll(struct ucred *cred, struct pipepair *pp) { @@ -156,10 +169,14 @@ mac_pipe_check_poll(struct ucred *cred, mtx_assert(&pp->pp_mtx, MA_OWNED); MAC_CHECK(pipe_check_poll, cred, pp, pp->pp_label); + MAC_CHECK_PROBE2(pipe_check_poll, error, cred, pp); return (error); } +MAC_CHECK_PROBE_DEFINE2(pipe_check_read, "struct ucred *", + "struct pipepair *"); + int mac_pipe_check_read(struct ucred *cred, struct pipepair *pp) { @@ -168,10 +185,14 @@ mac_pipe_check_read(struct ucred *cred, mtx_assert(&pp->pp_mtx, MA_OWNED); MAC_CHECK(pipe_check_read, cred, pp, pp->pp_label); + MAC_CHECK_PROBE2(pipe_check_read, error, cred, pp); return (error); } +MAC_CHECK_PROBE_DEFINE3(pipe_check_relabel, "struct ucred *", + "struct pipepair *", "struct label *"); + static int mac_pipe_check_relabel(struct ucred *cred, struct pipepair *pp, struct label *newlabel) @@ -181,10 +202,14 @@ mac_pipe_check_relabel(struct ucred *cre mtx_assert(&pp->pp_mtx, MA_OWNED); MAC_CHECK(pipe_check_relabel, cred, pp, pp->pp_label, newlabel); + MAC_CHECK_PROBE3(pipe_check_relabel, error, cred, pp, newlabel); return (error); } +MAC_CHECK_PROBE_DEFINE2(pipe_check_stat, "struct ucred *", + "struct pipepair *"); + int mac_pipe_check_stat(struct ucred *cred, struct pipepair *pp) { @@ -193,10 +218,14 @@ mac_pipe_check_stat(struct ucred *cred, mtx_assert(&pp->pp_mtx, MA_OWNED); MAC_CHECK(pipe_check_stat, cred, pp, pp->pp_label); + MAC_CHECK_PROBE2(pipe_check_stat, error, cred, pp); return (error); } +MAC_CHECK_PROBE_DEFINE2(pipe_check_write, "struct ucred *", + "struct pipepair *"); + int mac_pipe_check_write(struct ucred *cred, struct pipepair *pp) { @@ -205,6 +234,7 @@ mac_pipe_check_write(struct ucred *cred, mtx_assert(&pp->pp_mtx, MA_OWNED); MAC_CHECK(pipe_check_write, cred, pp, pp->pp_label); + MAC_CHECK_PROBE2(pipe_check_write, error, cred, pp); return (error); } Modified: head/sys/security/mac/mac_posix_sem.c ============================================================================== --- head/sys/security/mac/mac_posix_sem.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_posix_sem.c Sun Mar 8 00:50:37 2009 (r189503) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003-2006 SPARTA, Inc. + * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. * * This software was developed for the FreeBSD Project in part by Network @@ -10,6 +11,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -35,6 +39,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_mac.h" #include "opt_posix.h" @@ -43,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -95,16 +101,23 @@ mac_posixsem_create(struct ucred *cred, MAC_PERFORM(posixsem_create, cred, ks, ks->ks_label); } +MAC_CHECK_PROBE_DEFINE2(posixsem_check_open, "struct ucred *", + "struct ksem *"); + int mac_posixsem_check_open(struct ucred *cred, struct ksem *ks) { int error; MAC_CHECK(posixsem_check_open, cred, ks, ks->ks_label); + MAC_CHECK_PROBE2(posixsem_check_open, error, cred, ks); return (error); } +MAC_CHECK_PROBE_DEFINE3(posixsem_check_getvalue, "struct ucred *", + "struct ucred *", "struct ksem *"); + int mac_posixsem_check_getvalue(struct ucred *active_cred, struct ucred *file_cred, struct ksem *ks) @@ -113,10 +126,15 @@ mac_posixsem_check_getvalue(struct ucred MAC_CHECK(posixsem_check_getvalue, active_cred, file_cred, ks, ks->ks_label); + MAC_CHECK_PROBE3(posixsem_check_getvalue, error, active_cred, + file_cred, ks); return (error); } +MAC_CHECK_PROBE_DEFINE3(posixsem_check_post, "struct ucred *", + "struct ucred *", "struct ksem *"); + int mac_posixsem_check_post(struct ucred *active_cred, struct ucred *file_cred, struct ksem *ks) @@ -125,10 +143,15 @@ mac_posixsem_check_post(struct ucred *ac MAC_CHECK(posixsem_check_post, active_cred, file_cred, ks, ks->ks_label); + MAC_CHECK_PROBE3(posixsem_check_post, error, active_cred, file_cred, + ks); return (error); } +MAC_CHECK_PROBE_DEFINE3(posixsem_check_stat, "struct ucred *", + "struct ucred *", "struct ksem *"); + int mac_posixsem_check_stat(struct ucred *active_cred, struct ucred *file_cred, struct ksem *ks) @@ -137,20 +160,29 @@ mac_posixsem_check_stat(struct ucred *ac MAC_CHECK(posixsem_check_stat, active_cred, file_cred, ks, ks->ks_label); + MAC_CHECK_PROBE3(posixsem_check_stat, error, active_cred, file_cred, + ks); return (error); } +MAC_CHECK_PROBE_DEFINE2(posixsem_check_unlink, "struct ucred *", + "struct ksem *"); + int mac_posixsem_check_unlink(struct ucred *cred, struct ksem *ks) { int error; MAC_CHECK(posixsem_check_unlink, cred, ks, ks->ks_label); + MAC_CHECK_PROBE2(posixsem_check_unlink, error, cred, ks); return (error); } +MAC_CHECK_PROBE_DEFINE3(posixsem_check_wait, "struct ucred *", + "struct ucred *", "struct ksem *"); + int mac_posixsem_check_wait(struct ucred *active_cred, struct ucred *file_cred, struct ksem *ks) @@ -159,6 +191,8 @@ mac_posixsem_check_wait(struct ucred *ac MAC_CHECK(posixsem_check_wait, active_cred, file_cred, ks, ks->ks_label); + MAC_CHECK_PROBE3(posixsem_check_wait, error, active_cred, file_cred, + ks); return (error); } Modified: head/sys/security/mac/mac_posix_shm.c ============================================================================== --- head/sys/security/mac/mac_posix_shm.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_posix_shm.c Sun Mar 8 00:50:37 2009 (r189503) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003-2006 SPARTA, Inc. + * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. * * This software was developed for the FreeBSD Project in part by Network @@ -8,7 +9,10 @@ * as part of the DARPA CHATS research program. * * This software was enhanced by SPARTA ISSO under SPAWAR contract - * N66001-04-C-6019 ("SEFOS"). + * N66001-04-C-6019 ("SEFOS"). * + * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,6 +39,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_mac.h" #include @@ -42,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -94,6 +100,9 @@ mac_posixshm_create(struct ucred *cred, MAC_PERFORM(posixshm_create, cred, shmfd, shmfd->shm_label); } +MAC_CHECK_PROBE_DEFINE4(posixshm_check_mmap, "struct ucred *", + "struct shmfd *", "int", "int"); + int mac_posixshm_check_mmap(struct ucred *cred, struct shmfd *shmfd, int prot, int flags) @@ -102,20 +111,29 @@ mac_posixshm_check_mmap(struct ucred *cr MAC_CHECK(posixshm_check_mmap, cred, shmfd, shmfd->shm_label, prot, flags); + MAC_CHECK_PROBE4(posixshm_check_mmap, error, cred, shmfd, prot, + flags); return (error); } +MAC_CHECK_PROBE_DEFINE2(posixshm_check_open, "struct ucred *", + "struct shmfd *"); + int mac_posixshm_check_open(struct ucred *cred, struct shmfd *shmfd) { int error; MAC_CHECK(posixshm_check_open, cred, shmfd, shmfd->shm_label); + MAC_CHECK_PROBE2(posixshm_check_open, error, cred, shmfd); return (error); } +MAC_CHECK_PROBE_DEFINE3(posixshm_check_stat, "struct ucred *", + "struct ucred *", "struct shmfd *"); + int mac_posixshm_check_stat(struct ucred *active_cred, struct ucred *file_cred, struct shmfd *shmfd) @@ -124,10 +142,15 @@ mac_posixshm_check_stat(struct ucred *ac MAC_CHECK(posixshm_check_stat, active_cred, file_cred, shmfd, shmfd->shm_label); + MAC_CHECK_PROBE3(posixshm_check_stat, error, active_cred, file_cred, + shmfd); return (error); } +MAC_CHECK_PROBE_DEFINE3(posixshm_check_truncate, "struct ucred *", + "struct ucred *", "struct shmfd *"); + int mac_posixshm_check_truncate(struct ucred *active_cred, struct ucred *file_cred, struct shmfd *shmfd) @@ -136,16 +159,22 @@ mac_posixshm_check_truncate(struct ucred MAC_CHECK(posixshm_check_truncate, active_cred, file_cred, shmfd, shmfd->shm_label); + MAC_CHECK_PROBE3(posixshm_check_truncate, error, active_cred, + file_cred, shmfd); return (error); } +MAC_CHECK_PROBE_DEFINE2(posixshm_check_unlink, "struct ucred *", + "struct shmfd *"); + int mac_posixshm_check_unlink(struct ucred *cred, struct shmfd *shmfd) { int error; MAC_CHECK(posixshm_check_unlink, cred, shmfd, shmfd->shm_label); + MAC_CHECK_PROBE2(posixshm_check_unlink, error, cred, shmfd); return (error); } Modified: head/sys/security/mac/mac_priv.c ============================================================================== --- head/sys/security/mac/mac_priv.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_priv.c Sun Mar 8 00:50:37 2009 (r189503) @@ -1,10 +1,14 @@ /*- * Copyright (c) 2006 nCircle Network Security, Inc. + * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. * * This software was developed by Robert N. M. Watson for the TrustedBSD * Project under contract to nCircle Network Security, Inc. * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +38,13 @@ #include "sys/cdefs.h" __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_mac.h" #include +#include #include +#include #include #include @@ -54,6 +61,8 @@ __FBSDID("$FreeBSD$"); * composition. */ +MAC_CHECK_PROBE_DEFINE2(priv_check, "struct ucred *", "int"); + /* * Restrict access to a privilege for a credential. Return failure if any * policy denies access. @@ -64,10 +73,13 @@ mac_priv_check(struct ucred *cred, int p int error; MAC_CHECK(priv_check, cred, priv); + MAC_CHECK_PROBE2(priv_check, error, cred, priv); return (error); } +MAC_GRANT_PROBE_DEFINE2(priv_grant, "struct ucred *", "int"); + /* * Grant access to a privilege for a credential. Return success if any * policy grants access. @@ -78,6 +90,7 @@ mac_priv_grant(struct ucred *cred, int p int error; MAC_GRANT(priv_grant, cred, priv); + MAC_GRANT_PROBE2(priv_grant, error, cred, priv); return (error); } Modified: head/sys/security/mac/mac_process.c ============================================================================== --- head/sys/security/mac/mac_process.c Sun Mar 8 00:11:26 2009 (r189502) +++ head/sys/security/mac/mac_process.c Sun Mar 8 00:50:37 2009 (r189503) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002, 2008 Robert N. M. Watson + * Copyright (c) 1999-2002, 2008-2009 Robert N. M. Watson * Copyright (c) 2001 Ilmar S. Habibulin * Copyright (c) 2001-2003 Networks Associates Technology, Inc. * Copyright (c) 2005 Samy Al Bahra @@ -18,6 +18,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -43,6 +46,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_mac.h" #include @@ -55,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -373,6 +378,8 @@ mac_proc_vm_revoke_recurse(struct thread vm_map_unlock(map); } +MAC_CHECK_PROBE_DEFINE2(proc_check_debug, "struct ucred *", "struct proc *"); + int mac_proc_check_debug(struct ucred *cred, struct proc *p) { @@ -381,10 +388,13 @@ mac_proc_check_debug(struct ucred *cred, PROC_LOCK_ASSERT(p, MA_OWNED); MAC_CHECK(proc_check_debug, cred, p); + MAC_CHECK_PROBE2(proc_check_debug, error, cred, p); return (error); } +MAC_CHECK_PROBE_DEFINE2(proc_check_sched, "struct ucred *", "struct proc *"); + int mac_proc_check_sched(struct ucred *cred, struct proc *p) { @@ -393,10 +403,14 @@ mac_proc_check_sched(struct ucred *cred, PROC_LOCK_ASSERT(p, MA_OWNED); MAC_CHECK(proc_check_sched, cred, p); + MAC_CHECK_PROBE2(proc_check_sched, error, cred, p); return (error); } +MAC_CHECK_PROBE_DEFINE3(proc_check_signal, "struct ucred *", "struct proc *", + "int"); + int mac_proc_check_signal(struct ucred *cred, struct proc *p, int signum) { @@ -405,10 +419,13 @@ mac_proc_check_signal(struct ucred *cred PROC_LOCK_ASSERT(p, MA_OWNED); MAC_CHECK(proc_check_signal, cred, p, signum); + MAC_CHECK_PROBE3(proc_check_signal, error, cred, p, signum); return (error); } +MAC_CHECK_PROBE_DEFINE2(proc_check_setuid, "struct ucred *", "uid_t"); + int mac_proc_check_setuid(struct proc *p, struct ucred *cred, uid_t uid) { @@ -417,9 +434,13 @@ mac_proc_check_setuid(struct proc *p, st PROC_LOCK_ASSERT(p, MA_OWNED); MAC_CHECK(proc_check_setuid, cred, uid); + MAC_CHECK_PROBE2(proc_check_setuid, error, cred, uid); + return (error); } +MAC_CHECK_PROBE_DEFINE2(proc_check_seteuid, "struct ucred *", "uid_t"); + int mac_proc_check_seteuid(struct proc *p, struct ucred *cred, uid_t euid) { @@ -428,9 +449,13 @@ mac_proc_check_seteuid(struct proc *p, s PROC_LOCK_ASSERT(p, MA_OWNED); MAC_CHECK(proc_check_seteuid, cred, euid); + MAC_CHECK_PROBE2(proc_check_seteuid, error, cred, euid); + return (error); } +MAC_CHECK_PROBE_DEFINE2(proc_check_setgid, "struct ucred *", "gid_t"); + int mac_proc_check_setgid(struct proc *p, struct ucred *cred, gid_t gid) { @@ -439,10 +464,13 @@ mac_proc_check_setgid(struct proc *p, st PROC_LOCK_ASSERT(p, MA_OWNED); MAC_CHECK(proc_check_setgid, cred, gid); + MAC_CHECK_PROBE2(proc_check_setgid, error, cred, gid); return (error); } +MAC_CHECK_PROBE_DEFINE2(proc_check_setegid, "struct ucred *", "gid_t"); + int mac_proc_check_setegid(struct proc *p, struct ucred *cred, gid_t egid) { @@ -451,10 +479,14 @@ mac_proc_check_setegid(struct proc *p, s PROC_LOCK_ASSERT(p, MA_OWNED); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 04:20:20 2009 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 4AB86106564A; Sun, 8 Mar 2009 04:20:20 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3738D8FC0A; Sun, 8 Mar 2009 04:20:20 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n284KKVs071454; Sun, 8 Mar 2009 04:20:20 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n284KK14071452; Sun, 8 Mar 2009 04:20:20 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080420.n284KK14071452@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 04:20: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: r189507 - head/lib/libarchive 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 Mar 2009 04:20:20 -0000 Author: kientzle Date: Sun Mar 8 04:20:19 2009 New Revision: 189507 URL: http://svn.freebsd.org/changeset/base/189507 Log: Merge a bunch of changes through r722 from libarchive.googlecode.com: mtree writer now supports a variety of checksum keys; it also provides option hooks to set what keys get written. Modified: head/lib/libarchive/archive_write_set_format_mtree.c head/lib/libarchive/config_freebsd.h Modified: head/lib/libarchive/archive_write_set_format_mtree.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_mtree.c Sun Mar 8 03:15:36 2009 (r189506) +++ head/lib/libarchive/archive_write_set_format_mtree.c Sun Mar 8 04:20:19 2009 (r189507) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2009 Michihiro NAKAJIMA * Copyright (c) 2008 Joerg Sonnenberger * All rights reserved. * @@ -26,19 +27,199 @@ #include "archive_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_SYS_TYPES_H +#include +#endif #include #include #include +#ifdef HAVE_OPENSSL_MD5_H +#include +#else /* HAVE_OPENSSL_MD5_H */ +#ifdef HAVE_MD5_H +#include +#endif +#endif /* HAVE_OPENSSL_MD5_H */ +#ifdef HAVE_OPENSSL_RIPEMD_H +#include +#else /* HAVE_OPENSSL_RIPEMD_H */ +#ifdef HAVE_RIPEMD_H +#include +#endif +#ifdef HAVE_RMD160_H +#include +#endif +#endif /* HAVE_OPENSSL_RIPEMD_H */ +#ifdef HAVE_OPENSSL_SHA_H +#include +#else /* HAVE_OPENSSL_SHA_H */ +#ifdef HAVE_SHA_H +#include +#endif +#ifdef HAVE_SHA1_H +#include +#endif +#ifdef HAVE_SHA2_H +#include +#endif +#ifdef HAVE_SHA256_H +#include +#endif +#endif /* HAVE_OPENSSL_SHA_H */ #include "archive.h" #include "archive_entry.h" #include "archive_private.h" #include "archive_write_private.h" +#define INDENTNAMELEN 15 +#define MAXLINELEN 80 + struct mtree_writer { struct archive_entry *entry; + struct archive_string ebuf; struct archive_string buf; int first; + uint64_t entry_bytes_remaining; + struct { + int output; + int processed; + struct archive_string parent; + mode_t type; + int keys; + uid_t uid; + gid_t gid; + mode_t mode; + unsigned long fflags_set; + unsigned long fflags_clear; + } set; + /* chekc sum */ + int compute_sum; + uint32_t crc; + uint64_t crc_len; +#ifdef HAVE_MD5 + MD5_CTX md5ctx; +#endif +#if defined(HAVE_OPENSSL_RIPEMD_H) || defined(HAVE_RIPEMD_H) + RIPEMD160_CTX rmd160ctx; +#elif defined(HAVE_RMD160_H) + RMD160_CTX rmd160ctx; +#endif +#ifdef HAVE_SHA1 +#if defined(HAVE_OPENSSL_SHA_H) || defined(HAVE_SHA_H) + SHA_CTX sha1ctx; +#else + SHA1_CTX sha1ctx; +#endif +#endif +#ifdef HAVE_SHA256 + SHA256_CTX sha256ctx; +#endif +#ifdef HAVE_SHA384 +#if defined(HAVE_OPENSSL_SHA_H) + SHA512_CTX sha384ctx; +#else + SHA384_CTX sha384ctx; +#endif +#endif +#ifdef HAVE_SHA512 + SHA512_CTX sha512ctx; +#endif + /* Keyword options */ + int keys; +#define F_CKSUM 0x00000001 /* check sum */ +#define F_DEV 0x00000002 /* device type */ +#define F_DONE 0x00000004 /* directory done */ +#define F_FLAGS 0x00000008 /* file flags */ +#define F_GID 0x00000010 /* gid */ +#define F_GNAME 0x00000020 /* group name */ +#define F_IGN 0x00000040 /* ignore */ +#define F_MAGIC 0x00000080 /* name has magic chars */ +#define F_MD5 0x00000100 /* MD5 digest */ +#define F_MODE 0x00000200 /* mode */ +#define F_NLINK 0x00000400 /* number of links */ +#define F_NOCHANGE 0x00000800 /* If owner/mode "wrong", do + * not change */ +#define F_OPT 0x00001000 /* existence optional */ +#define F_RMD160 0x00002000 /* RIPEMD160 digest */ +#define F_SHA1 0x00004000 /* SHA-1 digest */ +#define F_SIZE 0x00008000 /* size */ +#define F_SLINK 0x00010000 /* symbolic link */ +#define F_TAGS 0x00020000 /* tags */ +#define F_TIME 0x00040000 /* modification time */ +#define F_TYPE 0x00080000 /* file type */ +#define F_UID 0x00100000 /* uid */ +#define F_UNAME 0x00200000 /* user name */ +#define F_VISIT 0x00400000 /* file visited */ +#define F_SHA256 0x00800000 /* SHA-256 digest */ +#define F_SHA384 0x01000000 /* SHA-384 digest */ +#define F_SHA512 0x02000000 /* SHA-512 digest */ + + /* Options */ + int dironly; /* if the dironly is 1, ignore everything except + * directory type files. like mtree(8) -d option. + */ + int indent; /* if the indent is 1, indent writing data. */ +}; + +#define DEFAULT_KEYS (F_DEV | F_FLAGS | F_GID | F_GNAME | F_SLINK | F_MODE\ + | F_NLINK | F_SIZE | F_TIME | F_TYPE | F_UID\ + | F_UNAME) + +#define COMPUTE_CRC(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)] +static const uint32_t crctab[] = { + 0x0, + 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, + 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, + 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, + 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, + 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, + 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, + 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, + 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, + 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, + 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, + 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, + 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, + 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, + 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, + 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, + 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, + 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, + 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, + 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, + 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, + 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, + 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, + 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, + 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, + 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, + 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, + 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, + 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, + 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, + 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, + 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, + 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, + 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, + 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, + 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, + 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, + 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, + 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, + 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, + 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, + 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, + 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, + 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, + 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, + 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, + 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, + 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, + 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, + 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; static int @@ -63,7 +244,7 @@ mtree_safe_char(char c) } static void -mtree_quote(struct mtree_writer *mtree, const char *str) +mtree_quote(struct archive_string *s, const char *str) { const char *start; char buf[4]; @@ -73,18 +254,333 @@ mtree_quote(struct mtree_writer *mtree, if (mtree_safe_char(*str)) continue; if (start != str) - archive_strncat(&mtree->buf, start, str - start); + archive_strncat(s, start, str - start); c = (unsigned char)*str; buf[0] = '\\'; buf[1] = (c / 64) + '0'; buf[2] = (c / 8 % 8) + '0'; buf[3] = (c % 8) + '0'; - archive_strncat(&mtree->buf, buf, 4); + archive_strncat(s, buf, 4); start = str + 1; } if (start != str) - archive_strncat(&mtree->buf, start, str - start); + archive_strncat(s, start, str - start); +} + +static void +mtree_indent(struct mtree_writer *mtree) +{ + int i, fn; + const char *r, *s, *x; + + fn = 1; + s = r = mtree->ebuf.s; + x = NULL; + while (*r == ' ') + r++; + while ((r = strchr(r, ' ')) != NULL) { + if (fn) { + fn = 0; + archive_strncat(&mtree->buf, s, r - s); + if (r -s > INDENTNAMELEN) { + archive_strncat(&mtree->buf, " \\\n", 3); + for (i = 0; i < (INDENTNAMELEN + 1); i++) + archive_strappend_char(&mtree->buf, ' '); + } else { + for (i = r -s; i < (INDENTNAMELEN + 1); i++) + archive_strappend_char(&mtree->buf, ' '); + } + s = ++r; + x = NULL; + continue; + } + if (r - s <= MAXLINELEN - 3 - INDENTNAMELEN) + x = r++; + else { + if (x == NULL) + x = r; + archive_strncat(&mtree->buf, s, x - s); + archive_strncat(&mtree->buf, " \\\n", 3); + for (i = 0; i < (INDENTNAMELEN + 1); i++) + archive_strappend_char(&mtree->buf, ' '); + s = r = ++x; + x = NULL; + } + } + if (x != NULL && strlen(s) > MAXLINELEN - 3 - INDENTNAMELEN) { + /* Last keyword is longer. */ + archive_strncat(&mtree->buf, s, x - s); + archive_strncat(&mtree->buf, " \\\n", 3); + for (i = 0; i < (INDENTNAMELEN + 1); i++) + archive_strappend_char(&mtree->buf, ' '); + s = ++x; + } + archive_strcat(&mtree->buf, s); + archive_string_empty(&mtree->ebuf); +} + +#ifndef _WIN32 +static size_t +dir_len(struct archive_entry *entry) +{ + const char *path, *r; + + path = archive_entry_pathname(entry); + r = strrchr(path, '/'); + if (r == NULL) + return (0); + /* Include a separator size */ + return (r - path + 1); +} + +#else +/* + * Note: We should use wide-character for findng '\' character, + * a directory separator on Windows, because some character-set have + * been using the '\' character for a part of its multibyte character + * code. + */ +static size_t +dir_len(struct archive_entry *entry) +{ + wchar_t wc; + const char *path; + const char *p, *rp; + size_t al, l, size; + + path = archive_entry_pathname(entry); + al = l = -1; + for (p = path; *p != '\0'; ++p) { + if (*p == '\\') + al = l = p - path; + else if (*p == '/') + al = p - path; + } + if (l == -1) + goto alen; + size = p - path; + rp = p = path; + while (*p != '\0') { + l = mbtowc(&wc, p, size); + if (l == -1) + goto alen; + if (l == 1 && (wc == L'/' || wc == L'\\')) + rp = p; + p += l; + size -= l; + } + return (rp - path + 1); +alen: + if (al == -1) + return (0); + return (al + 1); +} +#endif /* _WIN32 */ + +static int +parent_dir_changed(struct archive_string *dir, struct archive_entry *entry) +{ + const char *path; + size_t l; + + l = dir_len(entry); + path = archive_entry_pathname(entry); + if (archive_strlen(dir) > 0) { + if (l == 0) { + archive_string_empty(dir); + return (1); + } + if (strncmp(dir->s, path, l) == 0) + return (0); /* The parent directory is the same. */ + } else if (l == 0) + return (0); /* The parent directory is the same. */ + archive_strncpy(dir, path, l); + return (1); +} + +/* + * Write /set keyword. It means set global datas. + * [directory-only mode] + * - It is only once to write /set keyword. It is using values of the + * first entry. + * [normal mode] + * - Write /set keyword. It is using values of the first entry whose + * filetype is a regular file. + * - When a parent directory of the entry whose filetype is the regular + * file is changed, check the global datas and write it again if its + * values are different from the entry's. + */ +static void +set_global(struct mtree_writer *mtree, struct archive_entry *entry) +{ + struct archive_string setstr; + struct archive_string unsetstr; + const char *name; + int keys, oldkeys, effkeys; + mode_t set_type = 0; + + switch (archive_entry_filetype(entry)) { + case AE_IFLNK: case AE_IFSOCK: case AE_IFCHR: + case AE_IFBLK: case AE_IFIFO: + break; + case AE_IFDIR: + if (mtree->dironly) + set_type = AE_IFDIR; + break; + case AE_IFREG: + default: /* Handle unknown file types as regular files. */ + if (!mtree->dironly) + set_type = AE_IFREG; + break; + } + if (set_type == 0) + return; + if (mtree->set.processed && + !parent_dir_changed(&mtree->set.parent, entry)) + return; + /* At first, save a parent directory of the entry for following + * entries. */ + if (!mtree->set.processed && set_type == AE_IFREG) + parent_dir_changed(&mtree->set.parent, entry); + + archive_string_init(&setstr); + archive_string_init(&unsetstr); + keys = mtree->keys & (F_FLAGS | F_GID | F_GNAME | F_NLINK | F_MODE + | F_TYPE | F_UID | F_UNAME); + oldkeys = mtree->set.keys; + effkeys = keys; + if (mtree->set.processed) { + /* + * Check the global datas for whether it needs updating. + */ + effkeys &= ~F_TYPE; + if ((oldkeys & (F_UNAME | F_UID)) != 0 && + mtree->set.uid == archive_entry_uid(entry)) + effkeys &= ~(F_UNAME | F_UID); + if ((oldkeys & (F_GNAME | F_GID)) != 0 && + mtree->set.gid == archive_entry_gid(entry)) + effkeys &= ~(F_GNAME | F_GID); + if ((oldkeys & F_MODE) != 0 && + mtree->set.mode == (archive_entry_mode(entry) & 07777)) + effkeys &= ~F_MODE; + if ((oldkeys & F_FLAGS) != 0) { + unsigned long fflags_set; + unsigned long fflags_clear; + + archive_entry_fflags(entry, &fflags_set, &fflags_clear); + if (fflags_set == mtree->set.fflags_set && + fflags_clear == mtree->set.fflags_clear) + effkeys &= ~F_FLAGS; + } + } + if ((keys & effkeys & F_TYPE) != 0) { + mtree->set.type = set_type; + if (set_type == AE_IFDIR) + archive_strcat(&setstr, " type=dir"); + else + archive_strcat(&setstr, " type=file"); + } + if ((keys & effkeys & F_UNAME) != 0) { + if ((name = archive_entry_uname(entry)) != NULL) { + archive_strcat(&setstr, " uname="); + mtree_quote(&setstr, name); + } else if ((oldkeys & F_UNAME) != 0) + archive_strcat(&unsetstr, " uname"); + else + keys &= ~F_UNAME; + } + if ((keys & effkeys & F_UID) != 0) { + mtree->set.uid = archive_entry_uid(entry); + archive_string_sprintf(&setstr, " uid=%jd", + (intmax_t)mtree->set.uid); + } + if ((keys & effkeys & F_GNAME) != 0) { + if ((name = archive_entry_gname(entry)) != NULL) { + archive_strcat(&setstr, " gname="); + mtree_quote(&setstr, name); + } else if ((oldkeys & F_GNAME) != 0) + archive_strcat(&unsetstr, " gname"); + else + keys &= ~F_GNAME; + } + if ((keys & effkeys & F_GID) != 0) { + mtree->set.gid = archive_entry_gid(entry); + archive_string_sprintf(&setstr, " gid=%jd", + (intmax_t)mtree->set.gid); + } + if ((keys & effkeys & F_MODE) != 0) { + mtree->set.mode = archive_entry_mode(entry) & 07777; + archive_string_sprintf(&setstr, " mode=%o", mtree->set.mode); + } + if ((keys & effkeys & F_FLAGS) != 0) { + if ((name = archive_entry_fflags_text(entry)) != NULL) { + archive_strcat(&setstr, " flags="); + mtree_quote(&setstr, name); + archive_entry_fflags(entry, &mtree->set.fflags_set, + &mtree->set.fflags_clear); + } else if ((oldkeys & F_FLAGS) != 0) + archive_strcat(&unsetstr, " flags"); + else + keys &= ~F_FLAGS; + } + if (unsetstr.length > 0) + archive_string_sprintf(&mtree->buf, "/unset%s\n", unsetstr.s); + archive_string_free(&unsetstr); + if (setstr.length > 0) + archive_string_sprintf(&mtree->buf, "/set%s\n", setstr.s); + archive_string_free(&setstr); + mtree->set.keys = keys; + mtree->set.processed = 1; + /* On directory-only mode, it is only once to write /set keyword. */ + if (mtree->dironly) + mtree->set.output = 0; +} + +static int +get_keys(struct mtree_writer *mtree, struct archive_entry *entry) +{ + int keys; + + keys = mtree->keys; + if (mtree->set.keys == 0) + return (keys); + if ((mtree->set.keys & (F_GNAME | F_GID)) != 0 && + mtree->set.gid == archive_entry_gid(entry)) + keys &= ~(F_GNAME | F_GID); + if ((mtree->set.keys & (F_UNAME | F_UID)) != 0 && + mtree->set.uid == archive_entry_uid(entry)) + keys &= ~(F_UNAME | F_UID); + if (mtree->set.keys & F_FLAGS) { + unsigned long set, clear; + + archive_entry_fflags(entry, &set, &clear); + if (mtree->set.fflags_set == set && + mtree->set.fflags_clear == clear) + keys &= ~F_FLAGS; + } + if ((mtree->set.keys & F_MODE) != 0 && + mtree->set.mode == (archive_entry_mode(entry) & 07777)) + keys &= ~F_MODE; + + switch (archive_entry_filetype(entry)) { + case AE_IFLNK: case AE_IFSOCK: case AE_IFCHR: + case AE_IFBLK: case AE_IFIFO: + break; + case AE_IFDIR: + if ((mtree->set.keys & F_TYPE) != 0 && + mtree->set.type == AE_IFDIR) + keys &= ~F_TYPE; + break; + case AE_IFREG: + default: /* Handle unknown file types as regular files. */ + if ((mtree->set.keys & F_TYPE) != 0 && + mtree->set.type == AE_IFREG) + keys &= ~F_TYPE; + break; + } + + return (keys); } static int @@ -92,6 +588,7 @@ archive_write_mtree_header(struct archiv struct archive_entry *entry) { struct mtree_writer *mtree= a->format_data; + struct archive_string *str; const char *path; mtree->entry = archive_entry_clone(entry); @@ -101,13 +598,75 @@ archive_write_mtree_header(struct archiv mtree->first = 0; archive_strcat(&mtree->buf, "#mtree\n"); } + if (mtree->set.output) + set_global(mtree, entry); - mtree_quote(mtree, path); + archive_string_empty(&mtree->ebuf); + str = (mtree->indent)? &mtree->ebuf : &mtree->buf; + if (!mtree->dironly || archive_entry_filetype(entry) == AE_IFDIR) + mtree_quote(str, path); + + mtree->entry_bytes_remaining = archive_entry_size(entry); + if ((mtree->keys & F_CKSUM) != 0 && + archive_entry_filetype(entry) == AE_IFREG) { + mtree->compute_sum |= F_CKSUM; + mtree->crc = 0; + mtree->crc_len = 0; + } else + mtree->compute_sum &= ~F_CKSUM; +#ifdef HAVE_MD5 + if ((mtree->keys & F_MD5) != 0 && + archive_entry_filetype(entry) == AE_IFREG) { + mtree->compute_sum |= F_MD5; + MD5_Init(&mtree->md5ctx); + } else + mtree->compute_sum &= ~F_MD5; +#endif +#ifdef HAVE_RMD160 + if ((mtree->keys & F_RMD160) != 0 && + archive_entry_filetype(entry) == AE_IFREG) { + mtree->compute_sum |= F_RMD160; + RIPEMD160_Init(&mtree->rmd160ctx); + } else + mtree->compute_sum &= ~F_RMD160; +#endif +#ifdef HAVE_SHA1 + if ((mtree->keys & F_SHA1) != 0 && + archive_entry_filetype(entry) == AE_IFREG) { + mtree->compute_sum |= F_SHA1; + SHA1_Init(&mtree->sha1ctx); + } else + mtree->compute_sum &= ~F_SHA1; +#endif +#ifdef HAVE_SHA256 + if ((mtree->keys & F_SHA256) != 0 && + archive_entry_filetype(entry) == AE_IFREG) { + mtree->compute_sum |= F_SHA256; + SHA256_Init(&mtree->sha256ctx); + } else + mtree->compute_sum &= ~F_SHA256; +#endif +#ifdef HAVE_SHA384 + if ((mtree->keys & F_SHA384) != 0 && + archive_entry_filetype(entry) == AE_IFREG) { + mtree->compute_sum |= F_SHA384; + SHA384_Init(&mtree->sha384ctx); + } else + mtree->compute_sum &= ~F_SHA384; +#endif +#ifdef HAVE_SHA512 + if ((mtree->keys & F_SHA512) != 0 && + archive_entry_filetype(entry) == AE_IFREG) { + mtree->compute_sum |= F_SHA512; + SHA512_Init(&mtree->sha512ctx); + } else + mtree->compute_sum &= ~F_SHA512; +#endif return (ARCHIVE_OK); } -#if 0 +#if defined(HAVE_MD5) || defined(HAVE_RMD160) || defined(HAVE_SHA1) || defined(HAVE_SHA256) || defined(HAVE_SHA384) || defined(HAVE_SHA512) static void strappend_bin(struct archive_string *s, const unsigned char *bin, int n) { @@ -126,8 +685,9 @@ archive_write_mtree_finish_entry(struct { struct mtree_writer *mtree = a->format_data; struct archive_entry *entry; + struct archive_string *str; const char *name; - int ret; + int keys, ret; entry = mtree->entry; if (entry == NULL) { @@ -137,65 +697,166 @@ archive_write_mtree_finish_entry(struct } mtree->entry = NULL; - if (archive_entry_nlink(entry) != 1 && + if (mtree->dironly && archive_entry_filetype(entry) != AE_IFDIR) { + archive_entry_free(entry); + return (ARCHIVE_OK); + } + + str = (mtree->indent)? &mtree->ebuf : &mtree->buf; + keys = get_keys(mtree, entry); + if ((keys & F_NLINK) != 0 && + archive_entry_nlink(entry) != 1 && archive_entry_filetype(entry) != AE_IFDIR) - archive_string_sprintf(&mtree->buf, + archive_string_sprintf(str, " nlink=%u", archive_entry_nlink(entry)); - if ((name = archive_entry_gname(entry)) != NULL) { - archive_strcat(&mtree->buf, " gname="); - mtree_quote(mtree, name); - } - if ((name = archive_entry_uname(entry)) != NULL) { - archive_strcat(&mtree->buf, " uname="); - mtree_quote(mtree, name); - } - if ((name = archive_entry_fflags_text(entry)) != NULL) { - archive_strcat(&mtree->buf, " flags="); - mtree_quote(mtree, name); - } - - archive_string_sprintf(&mtree->buf, - " time=%jd mode=%o gid=%jd uid=%jd", - (intmax_t)archive_entry_mtime(entry), - archive_entry_mode(entry) & 07777, - (intmax_t)archive_entry_gid(entry), - (intmax_t)archive_entry_uid(entry)); + if ((keys & F_GNAME) != 0 && + (name = archive_entry_gname(entry)) != NULL) { + archive_strcat(str, " gname="); + mtree_quote(str, name); + } + if ((keys & F_UNAME) != 0 && + (name = archive_entry_uname(entry)) != NULL) { + archive_strcat(str, " uname="); + mtree_quote(str, name); + } + if ((keys & F_FLAGS) != 0 && + (name = archive_entry_fflags_text(entry)) != NULL) { + archive_strcat(str, " flags="); + mtree_quote(str, name); + } + if ((keys & F_TIME) != 0) + archive_string_sprintf(str, " time=%jd.%jd", + (intmax_t)archive_entry_mtime(entry), + (intmax_t)archive_entry_mtime_nsec(entry)); + if ((keys & F_MODE) != 0) + archive_string_sprintf(str, " mode=%o", + archive_entry_mode(entry) & 07777); + if ((keys & F_GID) != 0) + archive_string_sprintf(str, " gid=%jd", + (intmax_t)archive_entry_gid(entry)); + if ((keys & F_UID) != 0) + archive_string_sprintf(str, " uid=%jd", + (intmax_t)archive_entry_uid(entry)); switch (archive_entry_filetype(entry)) { case AE_IFLNK: - archive_strcat(&mtree->buf, " type=link link="); - mtree_quote(mtree, archive_entry_symlink(entry)); - archive_strcat(&mtree->buf, "\n"); + if ((keys & F_TYPE) != 0) + archive_strcat(str, " type=link"); + if ((keys & F_SLINK) != 0) { + archive_strcat(str, " link="); + mtree_quote(str, archive_entry_symlink(entry)); + } break; case AE_IFSOCK: - archive_strcat(&mtree->buf, " type=socket\n"); + if ((keys & F_TYPE) != 0) + archive_strcat(str, " type=socket"); break; case AE_IFCHR: - archive_string_sprintf(&mtree->buf, - " type=char device=native,%d,%d\n", - archive_entry_rdevmajor(entry), - archive_entry_rdevminor(entry)); + if ((keys & F_TYPE) != 0) + archive_strcat(str, " type=char"); + if ((keys & F_DEV) != 0) { + archive_string_sprintf(str, + " device=native,%d,%d", + archive_entry_rdevmajor(entry), + archive_entry_rdevminor(entry)); + } break; case AE_IFBLK: - archive_string_sprintf(&mtree->buf, - " type=block device=native,%d,%d\n", - archive_entry_rdevmajor(entry), - archive_entry_rdevminor(entry)); + if ((keys & F_TYPE) != 0) + archive_strcat(str, " type=block"); + if ((keys & F_DEV) != 0) { + archive_string_sprintf(str, + " device=native,%d,%d", + archive_entry_rdevmajor(entry), + archive_entry_rdevminor(entry)); + } break; case AE_IFDIR: - archive_strcat(&mtree->buf, " type=dir\n"); + if ((keys & F_TYPE) != 0) + archive_strcat(str, " type=dir"); break; case AE_IFIFO: - archive_strcat(&mtree->buf, " type=fifo\n"); + if ((keys & F_TYPE) != 0) + archive_strcat(str, " type=fifo"); break; case AE_IFREG: default: /* Handle unknown file types as regular files. */ - archive_string_sprintf(&mtree->buf, " type=file size=%jd\n", - (intmax_t)archive_entry_size(entry)); + if ((keys & F_TYPE) != 0) + archive_strcat(str, " type=file"); + if ((keys & F_SIZE) != 0) + archive_string_sprintf(str, " size=%jd", + (intmax_t)archive_entry_size(entry)); break; } + if (mtree->compute_sum & F_CKSUM) { + uint64_t len; + /* Include the length of the file. */ + for (len = mtree->crc_len; len != 0; len >>= 8) + COMPUTE_CRC(mtree->crc, len & 0xff); + mtree->crc = ~mtree->crc; + archive_string_sprintf(str, " cksum=%ju", + (uintmax_t)mtree->crc); + } +#ifdef HAVE_MD5 + if (mtree->compute_sum & F_MD5) { + unsigned char buf[16]; + + MD5_Final(buf, &mtree->md5ctx); + archive_strcat(str, " md5digest="); + strappend_bin(str, buf, sizeof(buf)); + } +#endif +#ifdef HAVE_RMD160 + if (mtree->compute_sum & F_RMD160) { + unsigned char buf[20]; + + RIPEMD160_Final(buf, &mtree->rmd160ctx); + archive_strcat(str, " rmd160digest="); + strappend_bin(str, buf, sizeof(buf)); + } +#endif +#ifdef HAVE_SHA1 + if (mtree->compute_sum & F_SHA1) { + unsigned char buf[20]; + + SHA1_Final(buf, &mtree->sha1ctx); + archive_strcat(str, " sha1digest="); + strappend_bin(str, buf, sizeof(buf)); + } +#endif +#ifdef HAVE_SHA256 + if (mtree->compute_sum & F_SHA256) { + unsigned char buf[32]; + + SHA256_Final(buf, &mtree->sha256ctx); + archive_strcat(str, " sha256digest="); + strappend_bin(str, buf, sizeof(buf)); + } +#endif +#ifdef HAVE_SHA384 + if (mtree->compute_sum & F_SHA384) { + unsigned char buf[48]; + + SHA384_Final(buf, &mtree->sha384ctx); + archive_strcat(str, " sha384digest="); + strappend_bin(str, buf, sizeof(buf)); + } +#endif +#ifdef HAVE_SHA512 + if (mtree->compute_sum & F_SHA512) { + unsigned char buf[64]; + + SHA512_Final(buf, &mtree->sha512ctx); + archive_strcat(str, " sha512digest="); + strappend_bin(str, buf, sizeof(buf)); + } +#endif + archive_strcat(str, "\n"); + if (mtree->indent) + mtree_indent(mtree); + archive_entry_free(entry); if (mtree->buf.length > 32768) { @@ -220,9 +881,49 @@ archive_write_mtree_finish(struct archiv static ssize_t archive_write_mtree_data(struct archive_write *a, const void *buff, size_t n) { - (void)a; /* UNUSED */ - (void)buff; /* UNUSED */ - return n; + struct mtree_writer *mtree= a->format_data; + + if (n > mtree->entry_bytes_remaining) + n = mtree->entry_bytes_remaining; + if (mtree->dironly) + /* We don't need compute a regular file sum */ + return (n); + if (mtree->compute_sum & F_CKSUM) { + /* + * Compute a POSIX 1003.2 checksum + */ + const unsigned char *p; + int nn; + + for (nn = n, p = buff; nn--; ++p) + COMPUTE_CRC(mtree->crc, *p); + mtree->crc_len += n; + } +#ifdef HAVE_MD5 + if (mtree->compute_sum & F_MD5) + MD5_Update(&mtree->md5ctx, buff, n); +#endif +#ifdef HAVE_RMD160 + if (mtree->compute_sum & F_RMD160) + RIPEMD160_Update(&mtree->rmd160ctx, buff, n); +#endif +#ifdef HAVE_SHA1 + if (mtree->compute_sum & F_SHA1) + SHA1_Update(&mtree->sha1ctx, buff, n); +#endif +#ifdef HAVE_SHA256 + if (mtree->compute_sum & F_SHA256) + SHA256_Update(&mtree->sha256ctx, buff, n); +#endif +#ifdef HAVE_SHA384 + if (mtree->compute_sum & F_SHA384) + SHA384_Update(&mtree->sha384ctx, buff, n); +#endif +#ifdef HAVE_SHA512 + if (mtree->compute_sum & F_SHA512) + SHA512_Update(&mtree->sha512ctx, buff, n); +#endif + return (n); } static int @@ -234,12 +935,125 @@ archive_write_mtree_destroy(struct archi return (ARCHIVE_OK); archive_entry_free(mtree->entry); + archive_string_free(&mtree->ebuf); archive_string_free(&mtree->buf); + archive_string_free(&mtree->set.parent); free(mtree); a->format_data = NULL; return (ARCHIVE_OK); } +static int +archive_write_mtree_options(struct archive_write *a, const char *key, + const char *value) +{ + struct mtree_writer *mtree= a->format_data; + int keybit = 0; + + switch (key[0]) { + case 'a': + if (strcmp(key, "all") == 0) + keybit = ~0; + break; + case 'c': + if (strcmp(key, "cksum") == 0) + keybit = F_CKSUM; + break; + case 'd': + if (strcmp(key, "device") == 0) + keybit = F_DEV; + else if (strcmp(key, "dironly") == 0) + mtree->dironly = (value != NULL)? 1: 0; + break; + case 'f': + if (strcmp(key, "flags") == 0) + keybit = F_FLAGS; + break; + case 'g': + if (strcmp(key, "gid") == 0) + keybit = F_GID; + else if (strcmp(key, "gname") == 0) + keybit = F_GNAME; + break; + case 'i': + if (strcmp(key, "indent") == 0) + mtree->indent = (value != NULL)? 1: 0; + break; + case 'l': + if (strcmp(key, "link") == 0) + keybit = F_SLINK; + break; + case 'm': +#ifdef HAVE_MD5 + if (strcmp(key, "md5") == 0 || + strcmp(key, "md5digest") == 0) + keybit = F_MD5; +#endif + if (strcmp(key, "mode") == 0) + keybit = F_MODE; + break; + case 'n': + if (strcmp(key, "nlink") == 0) + keybit = F_NLINK; + break; +#ifdef HAVE_RMD160 + case 'r': + if (strcmp(key, "ripemd160digest") == 0 || + strcmp(key, "rmd160") == 0 || + strcmp(key, "rmd160digest") == 0) + keybit = F_RMD160; + break; +#endif + case 's': +#ifdef HAVE_SHA1 + if (strcmp(key, "sha1") == 0 || + strcmp(key, "sha1digest") == 0) + keybit = F_SHA1; +#endif +#ifdef HAVE_SHA256 + if (strcmp(key, "sha256") == 0 || + strcmp(key, "sha256digest") == 0) + keybit = F_SHA256; +#endif +#ifdef HAVE_SHA384 + if (strcmp(key, "sha384") == 0 || + strcmp(key, "sha384digest") == 0) + keybit = F_SHA384; +#endif +#ifdef HAVE_SHA384 + if (strcmp(key, "sha512") == 0 || + strcmp(key, "sha512digest") == 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 04:32:38 2009 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 56C1E106566C; Sun, 8 Mar 2009 04:32:38 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4577C8FC0C; Sun, 8 Mar 2009 04:32:38 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n284WctE071695; Sun, 8 Mar 2009 04:32:38 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n284WcZV071694; Sun, 8 Mar 2009 04:32:38 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080432.n284WcZV071694@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 04:32:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189508 - head/lib/libarchive 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 Mar 2009 04:32:38 -0000 Author: kientzle Date: Sun Mar 8 04:32:38 2009 New Revision: 189508 URL: http://svn.freebsd.org/changeset/base/189508 Log: Set version to 2.6.901a to indicate this now matches libarchive.googlecode.com r745. (Except for the lzma/xz support, which needs a little more attention before it can be merged.) Modified: head/lib/libarchive/archive.h Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Sun Mar 8 04:20:19 2009 (r189507) +++ head/lib/libarchive/archive.h Sun Mar 8 04:32:38 2009 (r189508) @@ -118,13 +118,13 @@ extern "C" { * (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000) * #endif */ -#define ARCHIVE_VERSION_NUMBER 2005903 +#define ARCHIVE_VERSION_NUMBER 2006901 __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_STRING "libarchive 2.5.903a" +#define ARCHIVE_VERSION_STRING "libarchive 2.6.901a" __LA_DECL const char * archive_version_string(void); #if ARCHIVE_VERSION_NUMBER < 3000000 @@ -231,6 +231,7 @@ typedef int archive_close_callback(struc #define ARCHIVE_COMPRESSION_COMPRESS 3 #define ARCHIVE_COMPRESSION_PROGRAM 4 #define ARCHIVE_COMPRESSION_LZMA 5 +#define ARCHIVE_COMPRESSION_XZ 6 /* * Codes returned by archive_format. From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:01:39 2009 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 EED65106566B; Sun, 8 Mar 2009 05:01:39 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD6D58FC08; Sun, 8 Mar 2009 05:01:39 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2851dqo072374; Sun, 8 Mar 2009 05:01:39 GMT (envelope-from sobomax@svn.freebsd.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2851dYO072372; Sun, 8 Mar 2009 05:01:39 GMT (envelope-from sobomax@svn.freebsd.org) Message-Id: <200903080501.n2851dYO072372@svn.freebsd.org> From: Maxim Sobolev Date: Sun, 8 Mar 2009 05:01: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: r189509 - in head/sys: amd64/amd64 i386/i386 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 Mar 2009 05:01:40 -0000 Author: sobomax Date: Sun Mar 8 05:01:39 2009 New Revision: 189509 URL: http://svn.freebsd.org/changeset/base/189509 Log: Small comment nit: "run time" -> "run-time". Submitted by: rwatson Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/i386/i386/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sun Mar 8 04:32:38 2009 (r189508) +++ head/sys/amd64/amd64/mp_machdep.c Sun Mar 8 05:01:39 2009 (r189509) @@ -1227,7 +1227,7 @@ sysctl_hyperthreading_allowed(SYSCTL_HAN #ifdef SCHED_ULE /* * SCHED_ULE doesn't allow enabling/disabling HT cores at - * run time. + * run-time. */ if (allowed != hyperthreading_allowed) return (ENOTSUP); Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Sun Mar 8 04:32:38 2009 (r189508) +++ head/sys/i386/i386/mp_machdep.c Sun Mar 8 05:01:39 2009 (r189509) @@ -1398,7 +1398,7 @@ sysctl_hyperthreading_allowed(SYSCTL_HAN #ifdef SCHED_ULE /* * SCHED_ULE doesn't allow enabling/disabling HT cores at - * run time. + * run-time. */ if (allowed != hyperthreading_allowed) return (ENOTSUP); From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:10:51 2009 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 77E65106564A; Sun, 8 Mar 2009 05:10:51 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 668968FC18; Sun, 8 Mar 2009 05:10:51 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285ApSG072563; Sun, 8 Mar 2009 05:10:51 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285ApFx072562; Sun, 8 Mar 2009 05:10:51 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080510.n285ApFx072562@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:10: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: r189510 - head/usr.bin/tar/test 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 Mar 2009 05:10:51 -0000 Author: kientzle Date: Sun Mar 8 05:10:51 2009 New Revision: 189510 URL: http://svn.freebsd.org/changeset/base/189510 Log: Merge r273 from libarchive.googlecode.com: Use open() correctly. Modified: head/usr.bin/tar/test/test_option_T.c Modified: head/usr.bin/tar/test/test_option_T.c ============================================================================== --- head/usr.bin/tar/test/test_option_T.c Sun Mar 8 05:01:39 2009 (r189509) +++ head/usr.bin/tar/test/test_option_T.c Sun Mar 8 05:10:51 2009 (r189510) @@ -28,7 +28,7 @@ __FBSDID("$FreeBSD$"); static int touch(const char *fn) { - int fd = open(fn, O_RDWR | O_CREAT); + int fd = open(fn, O_RDWR | O_CREAT, 0644); failure("Couldn't create file '%s', fd=%d, errno=%d (%s)\n", fn, fd, errno, strerror(errno)); if (!assert(fd > 0)) From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:14:16 2009 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 D0E4B106566B; Sun, 8 Mar 2009 05:14:16 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B0108FC14; Sun, 8 Mar 2009 05:14:16 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285EGth072666; Sun, 8 Mar 2009 05:14:16 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285EGGb072665; Sun, 8 Mar 2009 05:14:16 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080514.n285EGGb072665@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:14: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: r189511 - head/usr.bin/tar/test 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 Mar 2009 05:14:17 -0000 Author: kientzle Date: Sun Mar 8 05:14:16 2009 New Revision: 189511 URL: http://svn.freebsd.org/changeset/base/189511 Log: Merge r278 from libarchive.googlecode.com: Reduce the number of patterns tested here from 200 to 170, which seems to be the most that Cygwin can handle. Modified: head/usr.bin/tar/test/test_copy.c Modified: head/usr.bin/tar/test/test_copy.c ============================================================================== --- head/usr.bin/tar/test/test_copy.c Sun Mar 8 05:10:51 2009 (r189510) +++ head/usr.bin/tar/test/test_copy.c Sun Mar 8 05:14:16 2009 (r189511) @@ -25,6 +25,8 @@ #include "test.h" __FBSDID("$FreeBSD$"); +#define LOOP_MAX 170 + static void create_tree(void) { @@ -41,7 +43,7 @@ create_tree(void) assertEqualInt(0, mkdir("s", 0775)); assertEqualInt(0, mkdir("d", 0775)); - for (i = 0; i < 200; i++) { + for (i = 0; i < LOOP_MAX; i++) { buff[0] = 'f'; buff[1] = '/'; /* Create a file named "f/abcdef..." */ @@ -97,7 +99,7 @@ verify_tree(int limit) struct dirent *de; /* Generate the names we know should be there and verify them. */ - for (i = 1; i < 200; i++) { + for (i = 1; i < LOOP_MAX; i++) { /* Generate a base name of the correct length. */ for (j = 0; j < i; ++j) filename[j] = 'a' + (j % 26); @@ -219,7 +221,7 @@ verify_tree(int limit) } /* Our files have very particular filename patterns. */ if (p[0] != '.' || (p[1] != '.' && p[1] != '\0')) { - for (i = 0; p[i] != '\0' && i < 200; i++) { + for (i = 0; p[i] != '\0' && i < LOOP_MAX; i++) { failure("i=%d, p[i]='%c' 'a'+(i%%26)='%c'", i, p[i], 'a' + (i % 26)); assertEqualInt(p[i], 'a' + (i % 26)); } From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:17:59 2009 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 A0618106566B; Sun, 8 Mar 2009 05:17:59 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83B4F8FC17; Sun, 8 Mar 2009 05:17:59 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285Hxvl072814; Sun, 8 Mar 2009 05:17:59 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285HxYa072812; Sun, 8 Mar 2009 05:17:59 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080517.n285HxYa072812@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:17: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: r189512 - head/usr.bin/tar/test 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 Mar 2009 05:18:00 -0000 Author: kientzle Date: Sun Mar 8 05:17:58 2009 New Revision: 189512 URL: http://svn.freebsd.org/changeset/base/189512 Log: Merge r369 from libarchive.googlecode.com: Test -s option. Added: head/usr.bin/tar/test/test_option_s.c (contents, props changed) Modified: head/usr.bin/tar/test/Makefile Modified: head/usr.bin/tar/test/Makefile ============================================================================== --- head/usr.bin/tar/test/Makefile Sun Mar 8 05:14:16 2009 (r189511) +++ head/usr.bin/tar/test/Makefile Sun Mar 8 05:17:58 2009 (r189512) @@ -16,6 +16,7 @@ TESTS= \ test_help.c \ test_option_T.c \ test_option_q.c \ + test_option_s.c \ test_patterns.c \ test_stdio.c \ test_strip_components.c \ Added: head/usr.bin/tar/test/test_option_s.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/tar/test/test_option_s.c Sun Mar 8 05:17:58 2009 (r189512) @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2003-2008 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +static int +mkfile(const char *fn, const char *contents) +{ + int fd = open(fn, O_RDWR | O_CREAT, 0644); + failure("Couldn't create file '%s', fd=%d, errno=%d (%s)\n", + fn, fd, errno, strerror(errno)); + if (!assert(fd > 0)) + return (1); /* Failure. */ + if (contents != NULL) + assertEqualInt(strlen(contents), + write(fd, contents, strlen(contents))); + assertEqualInt(0, close(fd)); + return (0); /* Success */ +} + +DEFINE_TEST(test_option_s) +{ + /* Create a sample file heirarchy. */ + assertEqualInt(0, mkdir("in", 0755)); + assertEqualInt(0, mkdir("in/d1", 0755)); + assertEqualInt(0, mkfile("in/d1/foo", "foo")); + assertEqualInt(0, mkfile("in/d1/bar", "bar")); + + /* + * Test 1: Filename substitution when creating archives. + */ + assertEqualInt(0, mkdir("test1", 0755)); + systemf("%s -cf - -s /foo/bar/ in/d1/foo | %s -xf - -C test1", + testprog, testprog); + assertFileContents("foo", 3, "test1/in/d1/bar"); + systemf("%s -cf - -s /d1/d2/ in/d1/foo | %s -xf - -C test1", + testprog, testprog); + assertFileContents("foo", 3, "test1/in/d2/foo"); + + + /* + * Test 2: Basic substitution when extracting archive. + */ + assertEqualInt(0, mkdir("test2", 0755)); + systemf("%s -cf - in/d1/foo | %s -xf - -s /foo/bar/ -C test2", + testprog, testprog); + assertFileContents("foo", 3, "test2/in/d1/bar"); + + /* + * Test 3: Files with empty names shouldn't be archived. + */ + systemf("%s -cf - -s ,in/d1/foo,, in/d1/foo | %s -tvf - > in.lst", + testprog, testprog); + assertEmptyFile("in.lst"); + + /* + * Test 4: Multiple substitutions when extracting archive. + */ + assertEqualInt(0, mkdir("test4", 0755)); + systemf("%s -cf - in/d1/foo in/d1/bar | %s -xf - -s /foo/bar/ -s }bar}baz} -C test4", + testprog, testprog); + assertFileContents("foo", 3, "test4/in/d1/bar"); + assertFileContents("bar", 3, "test4/in/d1/baz"); + + /* + * Test 5: Name-switching substitutions when extracting archive. + */ + assertEqualInt(0, mkdir("test5", 0755)); + systemf("%s -cf - in/d1/foo in/d1/bar | %s -xf - -s /foo/bar/ -s }bar}foo} -C test5", + testprog, testprog); + assertFileContents("foo", 3, "test5/in/d1/bar"); + assertFileContents("bar", 3, "test5/in/d1/foo"); +} From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:19:36 2009 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 CCACD106566C; Sun, 8 Mar 2009 05:19:36 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5B538FC15; Sun, 8 Mar 2009 05:19:36 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285JaAo072886; Sun, 8 Mar 2009 05:19:36 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285JaeQ072885; Sun, 8 Mar 2009 05:19:36 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080519.n285JaeQ072885@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:19: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: r189513 - head/usr.bin/tar/test 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 Mar 2009 05:19:37 -0000 Author: kientzle Date: Sun Mar 8 05:19:36 2009 New Revision: 189513 URL: http://svn.freebsd.org/changeset/base/189513 Log: Merge r374 from libarchive.googlecode.com: Stupid typo in open() call. Modified: head/usr.bin/tar/test/test_strip_components.c Modified: head/usr.bin/tar/test/test_strip_components.c ============================================================================== --- head/usr.bin/tar/test/test_strip_components.c Sun Mar 8 05:17:58 2009 (r189512) +++ head/usr.bin/tar/test/test_strip_components.c Sun Mar 8 05:19:36 2009 (r189513) @@ -28,7 +28,7 @@ __FBSDID("$FreeBSD$"); static int touch(const char *fn) { - int fd = open(fn, O_RDWR | O_CREAT | 0644); + int fd = open(fn, O_RDWR | O_CREAT, 0644); failure("Couldn't create file '%s', fd=%d, errno=%d (%s)\n", fn, fd, errno, strerror(errno)); if (!assert(fd > 0)) From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:22:51 2009 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 7BB46106564A; Sun, 8 Mar 2009 05:22:51 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3228C8FC16; Sun, 8 Mar 2009 05:22:51 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285Mpjr072996; Sun, 8 Mar 2009 05:22:51 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285MpIB072993; Sun, 8 Mar 2009 05:22:51 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080522.n285MpIB072993@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:22: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: r189514 - head/usr.bin/tar 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 Mar 2009 05:22:52 -0000 Author: kientzle Date: Sun Mar 8 05:22:50 2009 New Revision: 189514 URL: http://svn.freebsd.org/changeset/base/189514 Log: Merge r283,r423 from libarchive.googlecode.com: Use libarchive's new archive_read_disk API to pull metadata off of disk. This removes a lot of platform-specific knowledge of things like ACLs, file flags, and extended attributes from bsdtar. Modified: head/usr.bin/tar/bsdtar.h head/usr.bin/tar/matching.c head/usr.bin/tar/write.c Modified: head/usr.bin/tar/bsdtar.h ============================================================================== --- head/usr.bin/tar/bsdtar.h Sun Mar 8 05:19:36 2009 (r189513) +++ head/usr.bin/tar/bsdtar.h Sun Mar 8 05:22:50 2009 (r189514) @@ -92,7 +92,8 @@ struct bsdtar { * Data for various subsystems. Full definitions are located in * the file where they are used. */ - struct archive_entry_linkresolver *resolver; + struct archive *diskreader; /* for write.c */ + struct archive_entry_linkresolver *resolver; /* for write.c */ struct archive_dir *archive_dir; /* for write.c */ struct name_cache *gname_cache; /* for write.c */ char *buff; /* for write.c */ Modified: head/usr.bin/tar/matching.c ============================================================================== --- head/usr.bin/tar/matching.c Sun Mar 8 05:19:36 2009 (r189513) +++ head/usr.bin/tar/matching.c Sun Mar 8 05:22:50 2009 (r189514) @@ -188,7 +188,7 @@ excluded(struct bsdtar *bsdtar, const ch * gtar. In particular, 'a*b' will match 'foo/a1111/222b/bar' * */ -int +static int match_exclusion(struct match *match, const char *pathname) { const char *p; Modified: head/usr.bin/tar/write.c ============================================================================== --- head/usr.bin/tar/write.c Sun Mar 8 05:19:36 2009 (r189513) +++ head/usr.bin/tar/write.c Sun Mar 8 05:22:50 2009 (r189514) @@ -44,7 +44,8 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include #endif -#ifdef HAVE_EXT2FS_EXT2_FS_H +#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__) +/* This header exists but is broken on Cygwin. */ #include #endif #ifdef HAVE_FCNTL_H @@ -120,25 +121,10 @@ static int archive_names_from_file_hel const char *line); static int copy_file_data(struct bsdtar *bsdtar, struct archive *a, struct archive *ina); -static void create_cleanup(struct bsdtar *); -static void free_cache(struct name_cache *cache); -static const char * lookup_gname(struct bsdtar *bsdtar, gid_t gid); -static int lookup_gname_helper(struct bsdtar *bsdtar, - const char **name, id_t gid); -static const char * lookup_uname(struct bsdtar *bsdtar, uid_t uid); -static int lookup_uname_helper(struct bsdtar *bsdtar, - const char **name, id_t uid); static int new_enough(struct bsdtar *, const char *path, const struct stat *); -static void setup_acls(struct bsdtar *, struct archive_entry *, - const char *path); -static void setup_xattrs(struct bsdtar *, struct archive_entry *, - const char *path); static void test_for_append(struct bsdtar *); static void write_archive(struct archive *, struct bsdtar *); -static void write_entry(struct bsdtar *, struct archive *, - const struct stat *, const char *pathname, - const char *accpath); static void write_entry_backend(struct bsdtar *, struct archive *, struct archive_entry *); static int write_file_data(struct bsdtar *, struct archive *, @@ -417,6 +403,9 @@ write_archive(struct archive *a, struct bsdtar_errc(bsdtar, 1, 0, "cannot create link resolver"); archive_entry_linkresolver_set_strategy(bsdtar->resolver, archive_format(a)); + if ((bsdtar->diskreader = archive_read_disk_new()) == NULL) + bsdtar_errc(bsdtar, 1, 0, "Cannot create read_disk object"); + archive_read_disk_set_standard_lookup(bsdtar->diskreader); if (bsdtar->names_from_file != NULL) archive_names_from_file(bsdtar, a); @@ -458,7 +447,6 @@ write_archive(struct archive *a, struct archive_entry_linkify(bsdtar->resolver, &entry, &sparse_entry); } - create_cleanup(bsdtar); if (archive_write_close(a)) { bsdtar_warnc(bsdtar, 0, "%s", archive_error_string(a)); bsdtar->return_value = 1; @@ -467,6 +455,10 @@ write_archive(struct archive *a, struct cleanup: /* Free file data buffer. */ free(bsdtar->buff); + archive_entry_linkresolver_free(bsdtar->resolver); + bsdtar->resolver = NULL; + archive_read_finish(bsdtar->diskreader); + bsdtar->diskreader = NULL; if (bsdtar->option_totals) { fprintf(stderr, "Total bytes written: " BSDTAR_FILESIZE_PRINTF "\n", @@ -636,6 +628,7 @@ copy_file_data(struct bsdtar *bsdtar, st static void write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path) { + struct archive_entry *entry = NULL, *spare_entry = NULL; struct tree *tree; char symlink_mode = bsdtar->symlink_mode; dev_t first_dev = 0; @@ -651,8 +644,10 @@ write_hierarchy(struct bsdtar *bsdtar, s } while ((tree_ret = tree_next(tree))) { + int r; const char *name = tree_current_path(tree); - const struct stat *st = NULL, *lst = NULL; + const struct stat *st = NULL; /* info to use for this entry */ + const struct stat *lst = NULL; /* lstat() information */ int descend; if (tree_ret == TREE_ERROR_FATAL) @@ -666,31 +661,56 @@ write_hierarchy(struct bsdtar *bsdtar, s } if (tree_ret != TREE_REGULAR) continue; + + /* + * If this file/dir is excluded by a filename + * pattern, skip it. + */ + if (excluded(bsdtar, name)) + continue; + + /* + * Get lstat() info from the tree library. + */ lst = tree_current_lstat(tree); if (lst == NULL) { /* Couldn't lstat(); must not exist. */ bsdtar_warnc(bsdtar, errno, "%s: Cannot stat", name); - - /* - * Report an error via the exit code if the failed - * path is a prefix of what the user provided via - * the command line. (Testing for string equality - * here won't work due to trailing '/' characters.) - */ - if (memcmp(name, path, strlen(name)) == 0) - bsdtar->return_value = 1; - + /* Return error if files disappear during traverse. */ + bsdtar->return_value = 1; continue; } - if (S_ISLNK(lst->st_mode)) + + /* + * Distinguish 'L'/'P'/'H' symlink following. + */ + switch(symlink_mode) { + case 'H': + /* 'H': After the first item, rest like 'P'. */ + symlink_mode = 'P'; + /* 'H': First item (from command line) like 'L'. */ + /* FALLTHROUGH */ + case 'L': + /* 'L': Do descend through a symlink to dir. */ + descend = tree_current_is_dir(tree); + /* 'L': Follow symlinks to files. */ + archive_read_disk_set_symlink_logical(bsdtar->diskreader); + /* 'L': Archive symlinks as targets, if we can. */ st = tree_current_stat(tree); - /* Default: descend into any dir or symlink to dir. */ - /* We'll adjust this later on. */ - descend = 0; - if ((st != NULL) && S_ISDIR(st->st_mode)) - descend = 1; - if ((lst != NULL) && S_ISDIR(lst->st_mode)) - descend = 1; + if (st != NULL) + break; + /* If stat fails, we have a broken symlink; + * in that case, don't follow the link. */ + /* FALLTHROUGH */ + default: + /* 'P': Don't descend through a symlink to dir. */ + descend = tree_current_is_physical_dir(tree); + /* 'P': Don't follow symlinks to files. */ + archive_read_disk_set_symlink_physical(bsdtar->diskreader); + /* 'P': Archive symlinks as symlinks. */ + st = lst; + break; + } /* * If user has asked us not to cross mount points, @@ -702,11 +722,41 @@ write_hierarchy(struct bsdtar *bsdtar, s dev_recorded = 1; } if (bsdtar->option_dont_traverse_mounts) { - if (lst != NULL && lst->st_dev != first_dev) + if (lst->st_dev != first_dev) descend = 0; } /* + * In -u mode, check that the file is newer than what's + * already in the archive; in all modes, obey --newerXXX flags. + */ + if (!new_enough(bsdtar, name, st)) + continue; + + archive_entry_free(entry); + entry = archive_entry_new(); + + archive_entry_set_pathname(entry, name); + archive_entry_copy_sourcepath(entry, + tree_current_access_path(tree)); + + /* Populate the archive_entry with metadata from the disk. */ + /* XXX TODO: Arrange to open a regular file before + * calling this so we can pass in an fd and shorten + * the race to query metadata. The linkify dance + * makes this more complex than it might sound. */ + r = archive_read_disk_entry_from_file(bsdtar->diskreader, + entry, -1, st); + if (r != ARCHIVE_OK) + bsdtar_warnc(bsdtar, archive_errno(bsdtar->diskreader), + archive_error_string(bsdtar->diskreader)); + if (r < ARCHIVE_WARN) + continue; + + /* XXX TODO: Just use flag data from entry; avoid the + * duplicate check here. */ + + /* * If this file/dir is flagged "nodump" and we're * honoring such flags, skip this file/dir. */ @@ -732,62 +782,55 @@ write_hierarchy(struct bsdtar *bsdtar, s #endif /* - * If this file/dir is excluded by a filename - * pattern, skip it. - */ - if (excluded(bsdtar, name)) - continue; - - /* * If the user vetoes this file/directory, skip it. + * We want this to be fairly late; if some other + * check would veto this file, we shouldn't bother + * the user with it. */ if (bsdtar->option_interactive && !yes("add '%s'", name)) continue; - /* - * If this is a dir, decide whether or not to recurse. - */ - if (bsdtar->option_no_subdirs) - descend = 0; + /* Note: if user vetoes, we won't descend. */ + if (descend && !bsdtar->option_no_subdirs) + tree_descend(tree); /* - * Distinguish 'L'/'P'/'H' symlink following. + * Rewrite the pathname to be archived. If rewrite + * fails, skip the entry. */ - switch(symlink_mode) { - case 'H': - /* 'H': After the first item, rest like 'P'. */ - symlink_mode = 'P'; - /* 'H': First item (from command line) like 'L'. */ - /* FALLTHROUGH */ - case 'L': - /* 'L': Do descend through a symlink to dir. */ - /* 'L': Archive symlink to file as file. */ - lst = tree_current_stat(tree); - /* If stat fails, we have a broken symlink; - * in that case, archive the link as such. */ - if (lst == NULL) - lst = tree_current_lstat(tree); - break; - default: - /* 'P': Don't descend through a symlink to dir. */ - if (!S_ISDIR(lst->st_mode)) - descend = 0; - /* 'P': Archive symlink to file as symlink. */ - /* lst = tree_current_lstat(tree); */ - break; - } + if (edit_pathname(bsdtar, entry)) + continue; - if (descend) - tree_descend(tree); + /* Display entry as we process it. + * This format is required by SUSv2. */ + if (bsdtar->verbose) + safe_fprintf(stderr, "a %s", + archive_entry_pathname(entry)); - /* - * Write the entry. Note that write_entry() handles - * pathname editing and newness testing. - */ - write_entry(bsdtar, a, lst, name, - tree_current_access_path(tree)); + /* Non-regular files get archived with zero size. */ + if (!S_ISREG(st->st_mode)) + archive_entry_set_size(entry, 0); + + /* Record what we're doing, for SIGINFO / SIGUSR1. */ + siginfo_setinfo(bsdtar, "adding", + archive_entry_pathname(entry), archive_entry_size(entry)); + archive_entry_linkify(bsdtar->resolver, &entry, &spare_entry); + + /* Handle SIGINFO / SIGUSR1 request if one was made. */ + siginfo_printinfo(bsdtar, 0); + + while (entry != NULL) { + write_entry_backend(bsdtar, a, entry); + archive_entry_free(entry); + entry = spare_entry; + spare_entry = NULL; + } + + if (bsdtar->verbose) + fprintf(stderr, "\n"); } + archive_entry_free(entry); tree_close(tree); } @@ -846,117 +889,6 @@ write_entry_backend(struct bsdtar *bsdta close(fd); } -/* - * Add a single filesystem object to the archive. - */ -static void -write_entry(struct bsdtar *bsdtar, struct archive *a, const struct stat *st, - const char *pathname, const char *accpath) -{ - struct archive_entry *entry, *sparse_entry; - static char linkbuffer[PATH_MAX+1]; - - entry = archive_entry_new(); - - archive_entry_set_pathname(entry, pathname); - archive_entry_copy_sourcepath(entry, accpath); - - /* - * Rewrite the pathname to be archived. If rewrite - * fails, skip the entry. - */ - if (edit_pathname(bsdtar, entry)) - goto abort; - - /* - * In -u mode, check that the file is newer than what's - * already in the archive; in all modes, obey --newerXXX flags. - */ - if (!new_enough(bsdtar, archive_entry_pathname(entry), st)) - goto abort; - - /* Display entry as we process it. This format is required by SUSv2. */ - if (bsdtar->verbose) - safe_fprintf(stderr, "a %s", archive_entry_pathname(entry)); - - /* Read symbolic link information. */ - if ((st->st_mode & S_IFMT) == S_IFLNK) { - int lnklen; - - lnklen = readlink(accpath, linkbuffer, PATH_MAX); - if (lnklen < 0) { - if (!bsdtar->verbose) - bsdtar_warnc(bsdtar, errno, - "%s: Couldn't read symbolic link", - pathname); - else - safe_fprintf(stderr, - ": Couldn't read symbolic link: %s", - strerror(errno)); - goto cleanup; - } - linkbuffer[lnklen] = 0; - archive_entry_set_symlink(entry, linkbuffer); - } - - /* Look up username and group name. */ - archive_entry_set_uname(entry, lookup_uname(bsdtar, st->st_uid)); - archive_entry_set_gname(entry, lookup_gname(bsdtar, st->st_gid)); - -#ifdef HAVE_STRUCT_STAT_ST_FLAGS - /* XXX TODO: archive_entry_copy_stat() should copy st_flags - * on platforms that support it. This should go away then. */ - if (st->st_flags != 0) - archive_entry_set_fflags(entry, st->st_flags, 0); -#endif - -#ifdef EXT2_IOC_GETFLAGS - /* XXX TODO: Find a way to merge this with the - * flags fetch for nodump support earlier. */ - if ((S_ISREG(st->st_mode) || S_ISDIR(st->st_mode))) { - int fd = open(accpath, O_RDONLY | O_NONBLOCK); - if (fd >= 0) { - unsigned long stflags; - int r = ioctl(fd, EXT2_IOC_GETFLAGS, &stflags); - close(fd); - if (r == 0 && stflags != 0) - archive_entry_set_fflags(entry, stflags, 0); - } - } -#endif - - archive_entry_copy_stat(entry, st); - setup_acls(bsdtar, entry, accpath); - setup_xattrs(bsdtar, entry, accpath); - - /* Non-regular files get archived with zero size. */ - if (!S_ISREG(st->st_mode)) - archive_entry_set_size(entry, 0); - - /* Record what we're doing, for the benefit of SIGINFO / SIGUSR1. */ - siginfo_setinfo(bsdtar, "adding", archive_entry_pathname(entry), - archive_entry_size(entry)); - archive_entry_linkify(bsdtar->resolver, &entry, &sparse_entry); - - /* Handle SIGINFO / SIGUSR1 request if one was made. */ - siginfo_printinfo(bsdtar, 0); - - while (entry != NULL) { - write_entry_backend(bsdtar, a, entry); - archive_entry_free(entry); - entry = sparse_entry; - sparse_entry = NULL; - } - -cleanup: - if (bsdtar->verbose) - fprintf(stderr, "\n"); - -abort: - if (entry != NULL) - archive_entry_free(entry); -} - /* Helper function to copy file to archive. */ static int @@ -991,342 +923,6 @@ write_file_data(struct bsdtar *bsdtar, s return 0; } - -static void -create_cleanup(struct bsdtar *bsdtar) -{ - free_cache(bsdtar->uname_cache); - bsdtar->uname_cache = NULL; - free_cache(bsdtar->gname_cache); - bsdtar->gname_cache = NULL; -} - -#ifdef HAVE_POSIX_ACL -static void setup_acl(struct bsdtar *bsdtar, - struct archive_entry *entry, const char *accpath, - int acl_type, int archive_entry_acl_type); - -static void -setup_acls(struct bsdtar *bsdtar, struct archive_entry *entry, - const char *accpath) -{ - archive_entry_acl_clear(entry); - - setup_acl(bsdtar, entry, accpath, - ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_TYPE_ACCESS); - /* Only directories can have default ACLs. */ - if (S_ISDIR(archive_entry_mode(entry))) - setup_acl(bsdtar, entry, accpath, - ACL_TYPE_DEFAULT, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT); -} - -static void -setup_acl(struct bsdtar *bsdtar, struct archive_entry *entry, - const char *accpath, int acl_type, int archive_entry_acl_type) -{ - acl_t acl; - acl_tag_t acl_tag; - acl_entry_t acl_entry; - acl_permset_t acl_permset; - int s, ae_id, ae_tag, ae_perm; - const char *ae_name; - - /* Retrieve access ACL from file. */ - acl = acl_get_file(accpath, acl_type); - if (acl != NULL) { - s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry); - while (s == 1) { - ae_id = -1; - ae_name = NULL; - - acl_get_tag_type(acl_entry, &acl_tag); - if (acl_tag == ACL_USER) { - ae_id = (int)*(uid_t *)acl_get_qualifier(acl_entry); - ae_name = lookup_uname(bsdtar, ae_id); - ae_tag = ARCHIVE_ENTRY_ACL_USER; - } else if (acl_tag == ACL_GROUP) { - ae_id = (int)*(gid_t *)acl_get_qualifier(acl_entry); - ae_name = lookup_gname(bsdtar, ae_id); - ae_tag = ARCHIVE_ENTRY_ACL_GROUP; - } else if (acl_tag == ACL_MASK) { - ae_tag = ARCHIVE_ENTRY_ACL_MASK; - } else if (acl_tag == ACL_USER_OBJ) { - ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ; - } else if (acl_tag == ACL_GROUP_OBJ) { - ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ; - } else if (acl_tag == ACL_OTHER) { - ae_tag = ARCHIVE_ENTRY_ACL_OTHER; - } else { - /* Skip types that libarchive can't support. */ - continue; - } - - acl_get_permset(acl_entry, &acl_permset); - ae_perm = 0; - /* - * acl_get_perm() is spelled differently on different - * platforms; see bsdtar_platform.h for details. - */ - if (ACL_GET_PERM(acl_permset, ACL_EXECUTE)) - ae_perm |= ARCHIVE_ENTRY_ACL_EXECUTE; - if (ACL_GET_PERM(acl_permset, ACL_READ)) - ae_perm |= ARCHIVE_ENTRY_ACL_READ; - if (ACL_GET_PERM(acl_permset, ACL_WRITE)) - ae_perm |= ARCHIVE_ENTRY_ACL_WRITE; - - archive_entry_acl_add_entry(entry, - archive_entry_acl_type, ae_perm, ae_tag, - ae_id, ae_name); - - s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry); - } - acl_free(acl); - } -} -#else -static void -setup_acls(struct bsdtar *bsdtar, struct archive_entry *entry, - const char *accpath) -{ - (void)bsdtar; - (void)entry; - (void)accpath; -} -#endif - -#if HAVE_LISTXATTR && HAVE_LLISTXATTR && HAVE_GETXATTR && HAVE_LGETXATTR - -static void -setup_xattr(struct bsdtar *bsdtar, struct archive_entry *entry, - const char *accpath, const char *name) -{ - size_t size; - void *value = NULL; - char symlink_mode = bsdtar->symlink_mode; - - if (symlink_mode == 'H') - size = getxattr(accpath, name, NULL, 0); - else - size = lgetxattr(accpath, name, NULL, 0); - - if (size == -1) { - bsdtar_warnc(bsdtar, errno, "Couldn't get extended attribute"); - return; - } - - if (size > 0 && (value = malloc(size)) == NULL) { - bsdtar_errc(bsdtar, 1, errno, "Out of memory"); - return; - } - - if (symlink_mode == 'H') - size = getxattr(accpath, name, value, size); - else - size = lgetxattr(accpath, name, value, size); - - if (size == -1) { - bsdtar_warnc(bsdtar, errno, "Couldn't get extended attribute"); - return; - } - - archive_entry_xattr_add_entry(entry, name, value, size); - - free(value); -} - -/* - * Linux extended attribute support - */ -static void -setup_xattrs(struct bsdtar *bsdtar, struct archive_entry *entry, - const char *accpath) -{ - char *list, *p; - size_t list_size; - char symlink_mode = bsdtar->symlink_mode; - - if (symlink_mode == 'H') - list_size = listxattr(accpath, NULL, 0); - else - list_size = llistxattr(accpath, NULL, 0); - - if (list_size == -1) { - bsdtar_warnc(bsdtar, errno, - "Couldn't list extended attributes"); - return; - } else if (list_size == 0) - return; - - if ((list = malloc(list_size)) == NULL) { - bsdtar_errc(bsdtar, 1, errno, "Out of memory"); - return; - } - - if (symlink_mode == 'H') - list_size = listxattr(accpath, list, list_size); - else - list_size = llistxattr(accpath, list, list_size); - - if (list_size == -1) { - bsdtar_warnc(bsdtar, errno, - "Couldn't list extended attributes"); - free(list); - return; - } - - for (p = list; (p - list) < list_size; p += strlen(p) + 1) { - if (strncmp(p, "system.", 7) == 0 || - strncmp(p, "xfsroot.", 8) == 0) - continue; - - setup_xattr(bsdtar, entry, accpath, p); - } - - free(list); -} - -#else - -/* - * Generic (stub) extended attribute support. - */ -static void -setup_xattrs(struct bsdtar *bsdtar, struct archive_entry *entry, - const char *accpath) -{ - (void)bsdtar; /* UNUSED */ - (void)entry; /* UNUSED */ - (void)accpath; /* UNUSED */ -} - -#endif - -static void -free_cache(struct name_cache *cache) -{ - size_t i; - - if (cache != NULL) { - for (i = 0; i < cache->size; i++) { - if (cache->cache[i].name != NULL && - cache->cache[i].name != NO_NAME) - free((void *)(uintptr_t)cache->cache[i].name); - } - free(cache); - } -} - -/* - * Lookup uid/gid from uname/gname, return NULL if no match. - */ -static const char * -lookup_name(struct bsdtar *bsdtar, struct name_cache **name_cache_variable, - int (*lookup_fn)(struct bsdtar *, const char **, id_t), id_t id) -{ - struct name_cache *cache; - const char *name; - int slot; - - - if (*name_cache_variable == NULL) { - *name_cache_variable = malloc(sizeof(struct name_cache)); - if (*name_cache_variable == NULL) - bsdtar_errc(bsdtar, 1, ENOMEM, "No more memory"); - memset(*name_cache_variable, 0, sizeof(struct name_cache)); - (*name_cache_variable)->size = name_cache_size; - } - - cache = *name_cache_variable; - cache->probes++; - - slot = id % cache->size; - if (cache->cache[slot].name != NULL) { - if (cache->cache[slot].id == id) { - cache->hits++; - if (cache->cache[slot].name == NO_NAME) - return (NULL); - return (cache->cache[slot].name); - } - if (cache->cache[slot].name != NO_NAME) - free((void *)(uintptr_t)cache->cache[slot].name); - cache->cache[slot].name = NULL; - } - - if (lookup_fn(bsdtar, &name, id) == 0) { - if (name == NULL || name[0] == '\0') { - /* Cache the negative response. */ - cache->cache[slot].name = NO_NAME; - cache->cache[slot].id = id; - } else { - cache->cache[slot].name = strdup(name); - if (cache->cache[slot].name != NULL) { - cache->cache[slot].id = id; - return (cache->cache[slot].name); - } - /* - * Conveniently, NULL marks an empty slot, so - * if the strdup() fails, we've just failed to - * cache it. No recovery necessary. - */ - } - } - return (NULL); -} - -static const char * -lookup_uname(struct bsdtar *bsdtar, uid_t uid) -{ - return (lookup_name(bsdtar, &bsdtar->uname_cache, - &lookup_uname_helper, (id_t)uid)); -} - -static int -lookup_uname_helper(struct bsdtar *bsdtar, const char **name, id_t id) -{ - struct passwd *pwent; - - (void)bsdtar; /* UNUSED */ - - errno = 0; - pwent = getpwuid((uid_t)id); - if (pwent == NULL) { - *name = NULL; - if (errno != 0) - bsdtar_warnc(bsdtar, errno, "getpwuid(%d) failed", id); - return (errno); - } - - *name = pwent->pw_name; - return (0); -} - -static const char * -lookup_gname(struct bsdtar *bsdtar, gid_t gid) -{ - return (lookup_name(bsdtar, &bsdtar->gname_cache, - &lookup_gname_helper, (id_t)gid)); -} - -static int -lookup_gname_helper(struct bsdtar *bsdtar, const char **name, id_t id) -{ - struct group *grent; - - (void)bsdtar; /* UNUSED */ - - errno = 0; - grent = getgrgid((gid_t)id); - if (grent == NULL) { - *name = NULL; - if (errno != 0) - bsdtar_warnc(bsdtar, errno, "getgrgid(%d) failed", id); - return (errno); - } - - *name = grent->gr_name; - return (0); -} - /* * Test if the specified file is new enough to include in the archive. */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:24:37 2009 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 D3ACF106566B; Sun, 8 Mar 2009 05:24:37 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C22F38FC0C; Sun, 8 Mar 2009 05:24:37 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285Obus073066; Sun, 8 Mar 2009 05:24:37 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285ObBO073064; Sun, 8 Mar 2009 05:24:37 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080524.n285ObBO073064@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:24: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: r189515 - in head/usr.bin/tar: . test 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 Mar 2009 05:24:38 -0000 Author: kientzle Date: Sun Mar 8 05:24:37 2009 New Revision: 189515 URL: http://svn.freebsd.org/changeset/base/189515 Log: Merge r435,r443 from libarchive.googlecode.com: Let the compiler options determine how to read config.h. Modified: head/usr.bin/tar/bsdtar_platform.h head/usr.bin/tar/test/test.h Modified: head/usr.bin/tar/bsdtar_platform.h ============================================================================== --- head/usr.bin/tar/bsdtar_platform.h Sun Mar 8 05:22:50 2009 (r189514) +++ head/usr.bin/tar/bsdtar_platform.h Sun Mar 8 05:24:37 2009 (r189515) @@ -39,7 +39,7 @@ #include PLATFORM_CONFIG_H #elif defined(HAVE_CONFIG_H) /* Most POSIX platforms use the 'configure' script to build config.h */ -#include "../config.h" +#include "config.h" #else /* Warn if bsdtar hasn't been (automatically or manually) configured. */ #error Oops: No config.h and no built-in configuration in bsdtar_platform.h. Modified: head/usr.bin/tar/test/test.h ============================================================================== --- head/usr.bin/tar/test/test.h Sun Mar 8 05:22:50 2009 (r189514) +++ head/usr.bin/tar/test/test.h Sun Mar 8 05:24:37 2009 (r189515) @@ -33,13 +33,13 @@ */ #if defined(HAVE_CONFIG_H) /* Most POSIX platforms use the 'configure' script to build config.h */ -#include "../../config.h" +#include "config.h" #elif defined(__FreeBSD__) /* Building as part of FreeBSD system requires a pre-built config.h. */ -#include "../config_freebsd.h" +#include "config_freebsd.h" #elif defined(_WIN32) /* Win32 can't run the 'configure' script. */ -#include "../config_windows.h" +#include "config_windows.h" #else /* Warn if the library hasn't been (automatically or manually) configured. */ #error Oops: No config.h and no pre-built configuration in test.h. From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:28:53 2009 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 1E8E1106566C; Sun, 8 Mar 2009 05:28:53 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D2328FC12; Sun, 8 Mar 2009 05:28:53 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285Sqgr073183; Sun, 8 Mar 2009 05:28:52 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285SqR0073182; Sun, 8 Mar 2009 05:28:52 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080528.n285SqR0073182@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:28: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: r189516 - head/usr.bin/tar 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 Mar 2009 05:28:53 -0000 Author: kientzle Date: Sun Mar 8 05:28:52 2009 New Revision: 189516 URL: http://svn.freebsd.org/changeset/base/189516 Log: Merge r529 from libarchive.googlecode.com: Fix how we read ext2fs_fs.h headers on Linux. Modified: head/usr.bin/tar/write.c Modified: head/usr.bin/tar/write.c ============================================================================== --- head/usr.bin/tar/write.c Sun Mar 8 05:24:37 2009 (r189515) +++ head/usr.bin/tar/write.c Sun Mar 8 05:28:52 2009 (r189516) @@ -44,10 +44,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include #endif -#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__) -/* This header exists but is broken on Cygwin. */ -#include -#endif #ifdef HAVE_FCNTL_H #include #endif @@ -63,6 +59,17 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_LINUX_FS_H #include /* for Linux file flags */ #endif +/* + * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h. + * As the include guards don't agree, the order of include is important. + */ +#ifdef HAVE_LINUX_EXT2_FS_H +#include /* for Linux file flags */ +#endif +#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__) +/* This header exists but is broken on Cygwin. */ +#include +#endif #ifdef HAVE_PWD_H #include #endif From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:34:21 2009 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 27FC21065672; Sun, 8 Mar 2009 05:34:21 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16A318FC0A; Sun, 8 Mar 2009 05:34:21 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285YK7h073351; Sun, 8 Mar 2009 05:34:20 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285YKvW073350; Sun, 8 Mar 2009 05:34:20 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080534.n285YKvW073350@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:34: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: r189517 - head/usr.bin/tar 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 Mar 2009 05:34:21 -0000 Author: kientzle Date: Sun Mar 8 05:34:20 2009 New Revision: 189517 URL: http://svn.freebsd.org/changeset/base/189517 Log: Merge r552,r559 from libarchive.googlecode.com: High-resolution time support on Tru64, AIX, and GNU Hurd, thanks to BjĂśrn Jacke. Modified: head/usr.bin/tar/bsdtar_platform.h Modified: head/usr.bin/tar/bsdtar_platform.h ============================================================================== --- head/usr.bin/tar/bsdtar_platform.h Sun Mar 8 05:28:52 2009 (r189516) +++ head/usr.bin/tar/bsdtar_platform.h Sun Mar 8 05:34:20 2009 (r189517) @@ -137,15 +137,22 @@ #if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC #define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_ctimespec.tv_nsec #define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtimespec.tv_nsec -#else -#if HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC +#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC #define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_ctim.tv_nsec #define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtim.tv_nsec +#elif HAVE_STRUCT_STAT_ST_MTIME_N +#define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_ctime_n +#define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtime_n +#elif HAVE_STRUCT_STAT_ST_UMTIME +#define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_uctime * 1000 +#define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_umtime * 1000 +#elif HAVE_STRUCT_STAT_ST_MTIME_USEC +#define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_ctime_usec * 1000 +#define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtime_usec * 1000 #else #define ARCHIVE_STAT_CTIME_NANOS(st) (0) #define ARCHIVE_STAT_MTIME_NANOS(st) (0) #endif -#endif /* How to mark functions that don't return. */ /* This facilitates use of some newer static code analysis tools. */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:35:59 2009 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 86866106572A; Sun, 8 Mar 2009 05:35:59 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74B108FC16; Sun, 8 Mar 2009 05:35:59 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285Zxa7073424; Sun, 8 Mar 2009 05:35:59 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285Zx08073423; Sun, 8 Mar 2009 05:35:59 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080535.n285Zx08073423@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:35: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: r189518 - head/usr.bin/tar 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 Mar 2009 05:36:00 -0000 Author: kientzle Date: Sun Mar 8 05:35:59 2009 New Revision: 189518 URL: http://svn.freebsd.org/changeset/base/189518 Log: Merge r622 from libarchive.googlecode.com: Avoid warning on platforms that lack regex.h. Modified: head/usr.bin/tar/util.c Modified: head/usr.bin/tar/util.c ============================================================================== --- head/usr.bin/tar/util.c Sun Mar 8 05:34:20 2009 (r189517) +++ head/usr.bin/tar/util.c Sun Mar 8 05:35:59 2009 (r189518) @@ -453,8 +453,8 @@ edit_pathname(struct bsdtar *bsdtar, str const char *name = archive_entry_pathname(entry); #if HAVE_REGEX_H char *subst_name; -#endif int r; +#endif #if HAVE_REGEX_H r = apply_substitution(bsdtar, name, &subst_name, 0); From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:38:46 2009 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 208B8106564A; Sun, 8 Mar 2009 05:38:46 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03F398FC08; Sun, 8 Mar 2009 05:38:46 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285cjPq073515; Sun, 8 Mar 2009 05:38:45 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285cjM8073513; Sun, 8 Mar 2009 05:38:45 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080538.n285cjM8073513@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:38: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: r189519 - head/usr.bin/tar/test 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 Mar 2009 05:38:46 -0000 Author: kientzle Date: Sun Mar 8 05:38:45 2009 New Revision: 189519 URL: http://svn.freebsd.org/changeset/base/189519 Log: Merge r368,496,625,626 from libarchive.googlecode.com: A number of style and portability tweaks to the test harness. Most significantly, don't use getopt(). Modified: head/usr.bin/tar/test/main.c head/usr.bin/tar/test/test.h Modified: head/usr.bin/tar/test/main.c ============================================================================== --- head/usr.bin/tar/test/main.c Sun Mar 8 05:35:59 2009 (r189518) +++ head/usr.bin/tar/test/main.c Sun Mar 8 05:38:45 2009 (r189519) @@ -56,7 +56,11 @@ __FBSDID("$FreeBSD$"); */ #undef DEFINE_TEST #define DEFINE_TEST(name) void name(void); +#ifdef LIST_H +#include LIST_H +#else #include "list.h" +#endif /* Interix doesn't define these in a standard header. */ #if __INTERIX__ @@ -80,7 +84,7 @@ static int skips = 0; static int assertions = 0; /* Directory where uuencoded reference files can be found. */ -static char *refdir; +static const char *refdir; /* * My own implementation of the standard assert() macro emits the @@ -476,7 +480,9 @@ test_assert_empty_file(const char *f1fmt va_end(ap); if (stat(f1, &st) != 0) { - fprintf(stderr, "%s:%d: Could not stat: %s\n", test_filename, test_line, f1); + fprintf(stderr, "%s:%d: Could not stat: %s\n", + test_filename, test_line, f1); + failures ++; report_failure(NULL); return (0); } @@ -519,6 +525,7 @@ test_assert_non_empty_file(const char *f fprintf(stderr, "%s:%d: Could not stat: %s\n", test_filename, test_line, f1); report_failure(NULL); + failures++; return (0); } if (st.st_size != 0) @@ -630,6 +637,15 @@ test_assert_file_contents(const void *bu va_end(ap); fd = open(f, O_RDONLY); + if (fd < 0) { + failures ++; + if (!previous_failures(test_filename, test_line)) { + fprintf(stderr, "%s:%d: File doesn't exist: %s\n", + test_filename, test_line, f); + report_failure(test_extra); + } + return (0); + } contents = malloc(s * 2); n = read(fd, contents, s * 2); if (n == s && memcmp(buff, contents, s) == 0) { @@ -731,7 +747,11 @@ slurpfile(size_t * sizep, const char *fm #undef DEFINE_TEST #define DEFINE_TEST(n) { n, #n }, struct { void (*func)(void); const char *name; } tests[] = { +#ifdef LIST_H + #include LIST_H +#else #include "list.h" +#endif }; /* @@ -881,10 +901,12 @@ int main(int argc, char **argv) int i, tests_run = 0, tests_failed = 0, opt; time_t now; char *refdir_alloc = NULL; - char *progname, *p; + const char *opt_arg, *progname, *p; char tmpdir[256]; char tmpdir_timestamp[256]; + (void)argc; /* UNUSED */ + /* * Name of this program, used to build root of our temp directory * tree. @@ -909,39 +931,62 @@ int main(int argc, char **argv) refdir = getenv(ENVBASE "_TEST_FILES"); /* - * Parse options. + * Parse options, without using getopt(), which isn't available + * on all platforms. */ - while ((opt = getopt(argc, argv, "dkp:qr:v")) != -1) { - switch (opt) { - case 'd': - dump_on_failure = 1; + ++argv; /* Skip program name */ + while (*argv != NULL) { + if (**argv != '-') break; - case 'k': - keep_temp_files = 1; - break; - case 'p': + p = *argv++; + ++p; /* Skip '-' */ + while (*p != '\0') { + opt = *p++; + opt_arg = NULL; + /* If 'opt' takes an argument, parse that. */ + if (opt == 'p' || opt == 'r') { + if (*p != '\0') + opt_arg = p; + else if (*argv == NULL) { + fprintf(stderr, + "Option -%c requires argument.\n", + opt); + usage(progname); + } else + opt_arg = *argv++; + p = ""; /* End of this option word. */ + } + + /* Now, handle the option. */ + switch (opt) { + case 'd': + dump_on_failure = 1; + break; + case 'k': + keep_temp_files = 1; + break; + case 'p': #ifdef PROGRAM - testprog = optarg; + testprog = opt_arg; #else - usage(progname); + usage(progname); #endif - break; - case 'q': - quiet_flag++; - break; - case 'r': - refdir = optarg; - break; - case 'v': - verbose = 1; - break; - case '?': - default: - usage(progname); + break; + case 'q': + quiet_flag++; + break; + case 'r': + refdir = opt_arg; + break; + case 'v': + verbose = 1; + break; + case '?': + default: + usage(progname); + } } } - argc -= optind; - argv += optind; /* * Sanity-check that our options make sense. @@ -976,12 +1021,14 @@ int main(int argc, char **argv) * reference files, use the current directory for that. */ if (refdir == NULL) { + char *q; systemf("/bin/pwd > %s/refdir", tmpdir); - refdir = refdir_alloc = slurpfile(NULL, "%s/refdir", tmpdir); - p = refdir + strlen(refdir); - while (p[-1] == '\n') { - --p; - *p = '\0'; + q = slurpfile(NULL, "%s/refdir", tmpdir); + refdir = refdir_alloc = q; + q += strlen(refdir); + while (q[-1] == '\n') { + --q; + *q = '\0'; } systemf("rm %s/refdir", tmpdir); } @@ -1003,7 +1050,7 @@ int main(int argc, char **argv) /* * Run some or all of the individual tests. */ - if (argc == 0) { + if (*argv == NULL) { /* Default: Run all tests. */ for (i = 0; i < limit; i++) { if (test_run(i, tmpdir)) Modified: head/usr.bin/tar/test/test.h ============================================================================== --- head/usr.bin/tar/test/test.h Sun Mar 8 05:35:59 2009 (r189518) +++ head/usr.bin/tar/test/test.h Sun Mar 8 05:38:45 2009 (r189519) @@ -151,4 +151,4 @@ void extract_reference_file(const char * */ /* Pathname of exe to be tested. */ -char *testprog; +const char *testprog; From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 05:47:23 2009 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 32541106564A; Sun, 8 Mar 2009 05:47:23 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EEC18FC1A; Sun, 8 Mar 2009 05:47:23 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n285lMfr073756; Sun, 8 Mar 2009 05:47:22 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n285lMQw073738; Sun, 8 Mar 2009 05:47:22 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080547.n285lMQw073738@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 05:47: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: r189520 - in head/usr.bin/tar: . test 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 Mar 2009 05:47:23 -0000 Author: kientzle Date: Sun Mar 8 05:47:21 2009 New Revision: 189520 URL: http://svn.freebsd.org/changeset/base/189520 Log: Merger r629-631,633-646,648,654,678,681,682 from libarchive.googlecode.com: Many changes for Windows compatibility. bsdtar_test now runs successfully on both POSIX platforms and Windows. Added: head/usr.bin/tar/test/test_patterns_2.tar.uu (contents, props changed) head/usr.bin/tar/test/test_patterns_3.tar.uu (contents, props changed) Deleted: head/usr.bin/tar/test/test_patterns_2.tgz.uu head/usr.bin/tar/test/test_patterns_3.tgz.uu Modified: head/usr.bin/tar/bsdtar.c head/usr.bin/tar/bsdtar_platform.h head/usr.bin/tar/getdate.y head/usr.bin/tar/read.c head/usr.bin/tar/siginfo.c head/usr.bin/tar/test/main.c head/usr.bin/tar/test/test.h head/usr.bin/tar/test/test_0.c head/usr.bin/tar/test/test_basic.c head/usr.bin/tar/test/test_copy.c head/usr.bin/tar/test/test_option_T.c head/usr.bin/tar/test/test_option_s.c head/usr.bin/tar/test/test_patterns.c head/usr.bin/tar/test/test_strip_components.c head/usr.bin/tar/test/test_symlink_dir.c head/usr.bin/tar/test/test_version.c head/usr.bin/tar/tree.c head/usr.bin/tar/util.c head/usr.bin/tar/write.c Modified: head/usr.bin/tar/bsdtar.c ============================================================================== --- head/usr.bin/tar/bsdtar.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/bsdtar.c Sun Mar 8 05:47:21 2009 (r189520) @@ -73,6 +73,9 @@ __FBSDID("$FreeBSD$"); #ifdef __linux #define _PATH_DEFTAPE "/dev/st0" #endif +#ifdef _WIN32 +#define _PATH_DEFTAPE "\\\\.\\tape0" +#endif #ifndef _PATH_DEFTAPE #define _PATH_DEFTAPE "/dev/tape" @@ -109,12 +112,20 @@ main(int argc, char **argv) memset(bsdtar, 0, sizeof(*bsdtar)); bsdtar->fd = -1; /* Mark as "unused" */ option_o = 0; +#ifdef _WIN32 + /* open() function is always with a binary mode. */ + _set_fmode(_O_BINARY); +#endif /* Need bsdtar->progname before calling bsdtar_warnc. */ if (*argv == NULL) bsdtar->progname = "bsdtar"; else { +#if _WIN32 + bsdtar->progname = strrchr(*argv, '\\'); +#else bsdtar->progname = strrchr(*argv, '/'); +#endif if (bsdtar->progname != NULL) bsdtar->progname++; else @@ -143,7 +154,7 @@ main(int argc, char **argv) bsdtar->extract_flags |= SECURITY; /* Defaults for root user: */ - if (bsdtar->user_uid == 0) { + if (bsdtar_is_privileged(bsdtar)) { /* --same-owner */ bsdtar->extract_flags |= ARCHIVE_EXTRACT_OWNER; /* -p */ @@ -152,6 +163,10 @@ main(int argc, char **argv) bsdtar->extract_flags |= ARCHIVE_EXTRACT_XATTR; bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS; } +#ifdef _WIN32 + /* Windows cannot set UNIX like uid/gid. */ + bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_OWNER; +#endif bsdtar->argv = argv; bsdtar->argc = argc; Modified: head/usr.bin/tar/bsdtar_platform.h ============================================================================== --- head/usr.bin/tar/bsdtar_platform.h Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/bsdtar_platform.h Sun Mar 8 05:47:21 2009 (r189520) @@ -164,4 +164,10 @@ #define __LA_DEAD #endif +#ifdef _WIN32 +#include "bsdtar_windows.h" +#else +#define bsdtar_is_privileged(bsdtar) (bsdtar->user_uid == 0) +#endif + #endif /* !BSDTAR_PLATFORM_H_INCLUDED */ Modified: head/usr.bin/tar/getdate.y ============================================================================== --- head/usr.bin/tar/getdate.y Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/getdate.y Sun Mar 8 05:47:21 2009 (r189520) @@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef _MSC_VER +#define __STDC__ /* for a bug of bison 2.1 on Windows */ +#endif + #define yyparse getdate_yyparse #define yylex getdate_yylex #define yyerror getdate_yyerror Modified: head/usr.bin/tar/read.c ============================================================================== --- head/usr.bin/tar/read.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/read.c Sun Mar 8 05:47:21 2009 (r189520) @@ -384,10 +384,18 @@ list_item_verbose(struct bsdtar *bsdtar, /* Format the time using 'ls -l' conventions. */ tim = (time_t)st->st_mtime; +#ifdef _WIN32 + /* Windows' strftime function does not support %e format. */ + if (abs(tim - now) > (365/2)*86400) + fmt = bsdtar->day_first ? "%d %b %Y" : "%b %d %Y"; + else + fmt = bsdtar->day_first ? "%d %b %H:%M" : "%b %d %H:%M"; +#else if (abs(tim - now) > (365/2)*86400) fmt = bsdtar->day_first ? "%e %b %Y" : "%b %e %Y"; else fmt = bsdtar->day_first ? "%e %b %H:%M" : "%b %e %H:%M"; +#endif strftime(tmp, sizeof(tmp), fmt, localtime(&tim)); fprintf(out, " %s ", tmp); safe_fprintf(out, "%s", archive_entry_pathname(entry)); Modified: head/usr.bin/tar/siginfo.c ============================================================================== --- head/usr.bin/tar/siginfo.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/siginfo.c Sun Mar 8 05:47:21 2009 (r189520) @@ -82,8 +82,10 @@ siginfo_init(struct bsdtar *bsdtar) /* We want to catch SIGINFO, if it exists. */ bsdtar->siginfo->siginfo_old = signal(SIGINFO, siginfo_handler); #endif +#ifdef SIGUSR1 /* ... and treat SIGUSR1 the same way as SIGINFO. */ bsdtar->siginfo->sigusr1_old = signal(SIGUSR1, siginfo_handler); +#endif } void @@ -135,8 +137,10 @@ siginfo_done(struct bsdtar *bsdtar) /* Restore old SIGINFO handler. */ signal(SIGINFO, bsdtar->siginfo->siginfo_old); #endif +#ifdef SIGUSR1 /* And the old SIGUSR1 handler, too. */ signal(SIGUSR1, bsdtar->siginfo->sigusr1_old); +#endif /* Free strings. */ free(bsdtar->siginfo->path); Modified: head/usr.bin/tar/test/main.c ============================================================================== --- head/usr.bin/tar/test/main.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/test/main.c Sun Mar 8 05:47:21 2009 (r189520) @@ -504,6 +504,7 @@ test_assert_empty_file(const char *f1fmt (ssize_t)sizeof(buff) : (ssize_t)st.st_size; s = read(fd, buff, s); hexdump(buff, NULL, s, 0); + close(fd); } report_failure(NULL); return (0); @@ -564,11 +565,16 @@ test_assert_equal_file(const char *f1, c n2 = read(fd2, buff2, sizeof(buff2)); if (n1 != n2) break; - if (n1 == 0 && n2 == 0) + if (n1 == 0 && n2 == 0) { + close(fd1); + close(fd2); return (1); + } if (memcmp(buff1, buff2, n1) != 0) break; } + close(fd1); + close(fd2); failures ++; if (!verbose && previous_failures(test_filename, test_line)) return (0); @@ -648,6 +654,7 @@ test_assert_file_contents(const void *bu } contents = malloc(s * 2); n = read(fd, contents, s * 2); + close(fd); if (n == s && memcmp(buff, contents, s) == 0) { free(contents); return (1); @@ -802,7 +809,11 @@ static int test_run(int i, const char *t /* If there were no failures, we can remove the work dir. */ if (failures == failures_before) { if (!keep_temp_files && chdir(tmpdir) == 0) { +#ifdef _WIN32 + systemf("rmdir /S /Q %s", tests[i].name); +#else systemf("rm -rf %s", tests[i].name); +#endif } } /* Return appropriate status. */ @@ -901,6 +912,9 @@ int main(int argc, char **argv) int i, tests_run = 0, tests_failed = 0, opt; time_t now; char *refdir_alloc = NULL; +#ifdef _WIN32 + char *testprg; +#endif const char *opt_arg, *progname, *p; char tmpdir[256]; char tmpdir_timestamp[256]; @@ -913,7 +927,8 @@ int main(int argc, char **argv) */ progname = p = argv[0]; while (*p != '\0') { - if (*p == '/') + /* Support \ or / dir separators for Windows compat. */ + if (*p == '/' || *p == '\\') progname = p + 1; ++p; } @@ -995,6 +1010,18 @@ int main(int argc, char **argv) if (testprog == NULL) usage(progname); #endif +#ifdef _WIN32 + /* + * command.com cannot accept the command used '/' with drive + * name such as c:/xxx/command.exe when use '|' pipe handling. + */ + testprg = strdup(testprog); + for (i = 0; testprg[i] != '\0'; i++) { + if (testprg[i] == '/') + testprg[i] = '\\'; + } + testprog = testprg; +#endif /* * Create a temp directory for the following tests. Modified: head/usr.bin/tar/test/test.h ============================================================================== --- head/usr.bin/tar/test/test.h Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/test/test.h Sun Mar 8 05:47:21 2009 (r189520) @@ -45,7 +45,13 @@ #error Oops: No config.h and no pre-built configuration in test.h. #endif +#ifndef _WIN32 #include +#else +#define dirent direct +#include "../bsdtar_windows.h" +#include +#endif #include #include #include Modified: head/usr.bin/tar/test/test_0.c ============================================================================== --- head/usr.bin/tar/test/test_0.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/test/test_0.c Sun Mar 8 05:47:21 2009 (r189520) @@ -29,6 +29,11 @@ __FBSDID("$FreeBSD$"); * This first test does basic sanity checks on the environment. For * most of these, we just exit on failure. */ +#ifndef _WIN32 +#define DEV_NULL "/dev/null" +#else +#define DEV_NULL "NUL" +#endif DEFINE_TEST(test_0) { @@ -46,9 +51,9 @@ DEFINE_TEST(test_0) * Try to succesfully run the program; this requires that * we know some option that will succeed. */ - if (0 == systemf("%s --version >/dev/null", testprog)) { + if (0 == systemf("%s --version >" DEV_NULL, testprog)) { /* This worked. */ - } else if (0 == systemf("%s -W version >/dev/null", testprog)) { + } else if (0 == systemf("%s -W version >" DEV_NULL, testprog)) { /* This worked. */ } else { failure("Unable to successfully run any of the following:\n" Modified: head/usr.bin/tar/test/test_basic.c ============================================================================== --- head/usr.bin/tar/test/test_basic.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/test/test_basic.c Sun Mar 8 05:47:21 2009 (r189520) @@ -27,16 +27,23 @@ __FBSDID("$FreeBSD$"); static void -basic_tar(const char *target, const char *pack_options, const char *unpack_options) +basic_tar(const char *target, const char *pack_options, + const char *unpack_options, const char *flist) { struct stat st, st2; +#ifndef _WIN32 char buff[128]; +#endif int r; assertEqualInt(0, mkdir(target, 0775)); /* Use the tar program to create an archive. */ - r = systemf("%s cf - %s `cat filelist` >%s/archive 2>%s/pack.err", testprog, pack_options, target, target); +#ifndef _WIN32 + r = systemf("%s cf - %s `cat %s` >%s/archive 2>%s/pack.err", testprog, pack_options, flist, target, target); +#else + r = systemf("%s cf - %s %s >%s/archive 2>%s/pack.err", testprog, pack_options, flist, target, target); +#endif failure("Error invoking %s cf -", testprog, pack_options); assertEqualInt(r, 0); @@ -65,7 +72,11 @@ basic_tar(const char *target, const char assertEqualInt(r, 0); if (r == 0) { assert(S_ISREG(st.st_mode)); +#ifndef _WIN32 assertEqualInt(0644, st.st_mode & 0777); +#else + assertEqualInt(0600, st.st_mode & 0700); +#endif assertEqualInt(10, st.st_size); failure("file %s/file", target); assertEqualInt(2, st.st_nlink); @@ -77,7 +88,11 @@ basic_tar(const char *target, const char assertEqualInt(r, 0); if (r == 0) { assert(S_ISREG(st2.st_mode)); +#ifndef _WIN32 assertEqualInt(0644, st2.st_mode & 0777); +#else + assertEqualInt(0600, st2.st_mode & 0700); +#endif assertEqualInt(10, st2.st_size); failure("file %s/linkfile", target); assertEqualInt(2, st2.st_nlink); @@ -87,6 +102,7 @@ basic_tar(const char *target, const char assertEqualInt(st.st_ino, st2.st_ino); } +#ifndef _WIN32 /* Symlink */ r = lstat("symlink", &st); failure("Failed to stat file %s/symlink, errno=%d", target, errno); @@ -102,13 +118,18 @@ basic_tar(const char *target, const char assertEqualString(buff, "file"); } } +#endif /* dir */ r = lstat("dir", &st); if (r == 0) { assertEqualInt(r, 0); assert(S_ISDIR(st.st_mode)); +#ifndef _WIN32 assertEqualInt(0775, st.st_mode & 0777); +#else + assertEqualInt(0700, st.st_mode & 0700); +#endif } chdir(".."); @@ -119,6 +140,7 @@ DEFINE_TEST(test_basic) int fd; int filelist; int oldumask; + const char *flist; oldumask = umask(0); @@ -148,11 +170,16 @@ DEFINE_TEST(test_basic) /* All done. */ close(filelist); +#ifndef _WIN32 + flist = "filelist"; +#else + flist = "file linkfile symlink dir"; +#endif /* Archive/dearchive with a variety of options. */ - basic_tar("copy", "", ""); + basic_tar("copy", "", "", flist); /* tar doesn't handle cpio symlinks correctly */ /* basic_tar("copy_odc", "--format=odc", ""); */ - basic_tar("copy_ustar", "--format=ustar", ""); + basic_tar("copy_ustar", "--format=ustar", "", flist); umask(oldumask); } Modified: head/usr.bin/tar/test/test_copy.c ============================================================================== --- head/usr.bin/tar/test/test_copy.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/test/test_copy.c Sun Mar 8 05:47:21 2009 (r189520) @@ -64,6 +64,7 @@ create_tree(void) buff2[0] = 'm'; assertEqualInt(0, link(buff, buff2)); +#ifndef _WIN32 /* Create a symlink named "s/abcdef..." to the above. */ strcpy(buff2 + 3, buff); buff[0] = 's'; @@ -71,7 +72,9 @@ create_tree(void) buff2[1] = '.'; buff2[2] = '/'; assertEqualInt(0, symlink(buff2, buff)); - +#else + skipping("create a symlink to the above"); +#endif /* Create a dir named "d/abcdef...". */ buff[0] = 'd'; assertEqualInt(0, mkdir(buff, 0775)); @@ -153,6 +156,7 @@ verify_tree(int limit) } } +#ifndef _WIN32 /* * Symlink text doesn't include the 'original/' prefix, * so the limit here is 100 characters. @@ -174,7 +178,9 @@ verify_tree(int limit) } } } - +#else + skipping("verify symlink"); +#endif /* Verify dir "d/abcdef...". */ strcpy(name1, "d/"); strcat(name1, filename); Modified: head/usr.bin/tar/test/test_option_T.c ============================================================================== --- head/usr.bin/tar/test/test_option_T.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/test/test_option_T.c Sun Mar 8 05:47:21 2009 (r189520) @@ -41,6 +41,7 @@ DEFINE_TEST(test_option_T) { FILE *f; int r; + struct stat st; /* Create a simple dir heirarchy; bail if anything fails. */ if (!assertEqualInt(0, mkdir("d1", 0755))) return; @@ -127,19 +128,26 @@ DEFINE_TEST(test_option_T) assertEqualInt(0, mkdir("test4/d1", 0755)); assertEqualInt(1, touch("test4/d1/foo")); - systemf("%s -cf - -s /foo/bar/ test4/d1/foo | %s -xf - -C test4_out", - testprog, testprog); - assertEmptyFile("test4_out/test4/d1/bar"); - systemf("%s -cf - -s /d1/d2/ test4/d1/foo | %s -xf - -C test4_out", - testprog, testprog); - assertEmptyFile("test4_out/test4/d2/foo"); - systemf("%s -cf - -s ,test4/d1/foo,, test4/d1/foo | %s -tvf - > test4.lst", - testprog, testprog); - assertEmptyFile("test4.lst"); - systemf("%s -cf - test4/d1/foo | %s -xf - -s /foo/bar/ -C test4_out2", - testprog, testprog); - assertEmptyFile("test4_out2/test4/d1/bar"); - + /* Does bsdtar support -s option ? */ + systemf("%s -cf - -s /foo/bar/ test4/d1/foo > NUL 2> check.err", + testprog); + assertEqualInt(0, stat("check.err", &st)); + if (st.st_size == 0) { + systemf("%s -cf - -s /foo/bar/ test4/d1/foo | %s -xf - -C test4_out", + testprog, testprog); + assertEmptyFile("test4_out/test4/d1/bar"); + systemf("%s -cf - -s /d1/d2/ test4/d1/foo | %s -xf - -C test4_out", + testprog, testprog); + assertEmptyFile("test4_out/test4/d2/foo"); + systemf("%s -cf - -s ,test4/d1/foo,, test4/d1/foo | %s -tvf - > test4.lst", + testprog, testprog); + assertEmptyFile("test4.lst"); + systemf("%s -cf - test4/d1/foo | %s -xf - -s /foo/bar/ -C test4_out2", + testprog, testprog); + assertEmptyFile("test4_out2/test4/d1/bar"); + } else { + skipping("bsdtar does not support -s option on this platform"); + } /* TODO: Include some use of -C directory-changing within the filelist. */ /* I'm pretty sure -C within the filelist is broken on extract. */ } Modified: head/usr.bin/tar/test/test_option_s.c ============================================================================== --- head/usr.bin/tar/test/test_option_s.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/test/test_option_s.c Sun Mar 8 05:47:21 2009 (r189520) @@ -42,12 +42,23 @@ mkfile(const char *fn, const char *conte DEFINE_TEST(test_option_s) { + struct stat st; + /* Create a sample file heirarchy. */ assertEqualInt(0, mkdir("in", 0755)); assertEqualInt(0, mkdir("in/d1", 0755)); assertEqualInt(0, mkfile("in/d1/foo", "foo")); assertEqualInt(0, mkfile("in/d1/bar", "bar")); + /* Does bsdtar support -s option ? */ + systemf("%s -cf - -s /foo/bar/ in/d1/foo > NUL 2> check.err", + testprog); + assertEqualInt(0, stat("check.err", &st)); + if (st.st_size != 0) { + skipping("bsdtar does not support -s option on this platform"); + return; + } + /* * Test 1: Filename substitution when creating archives. */ Modified: head/usr.bin/tar/test/test_patterns.c ============================================================================== --- head/usr.bin/tar/test/test_patterns.c Sun Mar 8 05:38:45 2009 (r189519) +++ head/usr.bin/tar/test/test_patterns.c Sun Mar 8 05:47:21 2009 (r189520) @@ -28,8 +28,8 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_patterns) { int fd, r; - const char *reffile2 = "test_patterns_2.tgz"; - const char *reffile3 = "test_patterns_3.tgz"; + const char *reffile2 = "test_patterns_2.tar"; + const char *reffile3 = "test_patterns_3.tar"; const char *p; /* @@ -45,9 +45,9 @@ DEFINE_TEST(test_patterns) fd = open("foo", O_CREAT | O_WRONLY, 0644); assert(fd >= 0); close(fd); - r = systemf("%s zcfv tar1.tgz foo > tar1a.out 2> tar1a.err", testprog); + r = systemf("%s cfv tar1.tgz foo > tar1a.out 2> tar1a.err", testprog); assertEqualInt(r, 0); - r = systemf("%s zxfv tar1.tgz foo bar > tar1b.out 2> tar1b.err", testprog); + r = systemf("%s xfv tar1.tgz foo bar > tar1b.out 2> tar1b.err", testprog); failure("tar should return non-zero because a file was given on the command line that's not in the archive"); assert(r != 0); @@ -59,7 +59,11 @@ DEFINE_TEST(test_patterns) r = systemf("%s tf %s /tmp/foo/bar > tar2a.out 2> tar2a.err", testprog, reffile2); assertEqualInt(r, 0); +#ifndef _WIN32 p = "/tmp/foo/bar/\n/tmp/foo/bar/baz\n"; +#else + p = "/tmp/foo/bar/\r\n/tmp/foo/bar/baz\r\n"; +#endif assertFileContents(p, strlen(p), "tar2a.out"); assertEmptyFile("tar2a.err"); Added: head/usr.bin/tar/test/test_patterns_2.tar.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/tar/test/test_patterns_2.tar.uu Sun Mar 8 05:47:21 2009 (r189520) @@ -0,0 +1,232 @@ +$FreeBSD$ +begin 644 test_patterns_2.tar +M+W1M<"]F;V\O```````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````#`P,#@`````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````P +M,#`V-#0@`#`P,3@`````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````#`P,#8T-"``,#`Q-S4P(``P,#`P,#`@`#`P,#`P +M,#`P,#`P(#$Q,#4Q,C$R-C4S(#`Q,S8V-P`@,``````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````!U 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 5D529106566C; Sun, 8 Mar 2009 06:03:15 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A1568FC0C; Sun, 8 Mar 2009 06:03:15 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2863FbB074092; Sun, 8 Mar 2009 06:03:15 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2863FS1074089; Sun, 8 Mar 2009 06:03:15 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080603.n2863FS1074089@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 06:03: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: r189521 - in head/usr.bin/tar: . test 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 Mar 2009 06:03:15 -0000 Author: kientzle Date: Sun Mar 8 06:03:15 2009 New Revision: 189521 URL: http://svn.freebsd.org/changeset/base/189521 Log: Merge r687-689,691,693-701,720 from libarchive.googlecode.com: Translate getdate.y into C for portability. Make the get_date() function easier to test as well: * Have it accept a time_t "now" to use as a reference so that test code can verify relative time specifications against known starting points. * Set up default date after parsing the string so that we can use the specified timezone (if any) instead of the local default. Otherwise, local DST makes it almost impossible to reliably test time specifications such as "sunday UTC" Added: head/usr.bin/tar/getdate.c (contents, props changed) Deleted: head/usr.bin/tar/getdate.y Modified: head/usr.bin/tar/ (props changed) head/usr.bin/tar/Makefile head/usr.bin/tar/bsdtar.c head/usr.bin/tar/test/Makefile head/usr.bin/tar/test/test_getdate.c Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Sun Mar 8 05:47:21 2009 (r189520) +++ head/usr.bin/tar/Makefile Sun Mar 8 06:03:15 2009 (r189521) @@ -2,7 +2,7 @@ PROG= bsdtar BSDTAR_VERSION_STRING=2.5.903a -SRCS= bsdtar.c cmdline.c getdate.y matching.c read.c siginfo.c subst.c tree.c util.c write.c +SRCS= bsdtar.c cmdline.c getdate.c matching.c read.c siginfo.c subst.c tree.c util.c write.c WARNS?= 5 DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ} LDADD= -larchive -lbz2 -lz Modified: head/usr.bin/tar/bsdtar.c ============================================================================== --- head/usr.bin/tar/bsdtar.c Sun Mar 8 05:47:21 2009 (r189520) +++ head/usr.bin/tar/bsdtar.c Sun Mar 8 06:03:15 2009 (r189521) @@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$"); #endif /* External function to parse a date/time string (from getdate.y) */ -time_t get_date(const char *); +time_t get_date(time_t, const char *); static void long_help(struct bsdtar *); static void only_mode(struct bsdtar *, const char *opt, @@ -103,6 +103,7 @@ main(int argc, char **argv) char option_o; char possible_help_request; char buff[16]; + time_t now; /* * Use a pointer for consistency, but stack-allocated storage @@ -132,6 +133,8 @@ main(int argc, char **argv) bsdtar->progname = *argv; } + time(&now); + if (setlocale(LC_ALL, "") == NULL) bsdtar_warnc(bsdtar, 0, "Failed to set default locale"); #if defined(HAVE_NL_LANGINFO) && defined(HAVE_D_MD_ORDER) @@ -290,7 +293,7 @@ main(int argc, char **argv) * TODO: Add corresponding "older" options to reverse these. */ case OPTION_NEWER_CTIME: /* GNU tar */ - bsdtar->newer_ctime_sec = get_date(bsdtar->optarg); + bsdtar->newer_ctime_sec = get_date(now, bsdtar->optarg); break; case OPTION_NEWER_CTIME_THAN: { @@ -304,7 +307,7 @@ main(int argc, char **argv) } break; case OPTION_NEWER_MTIME: /* GNU tar */ - bsdtar->newer_mtime_sec = get_date(bsdtar->optarg); + bsdtar->newer_mtime_sec = get_date(now, bsdtar->optarg); break; case OPTION_NEWER_MTIME_THAN: { Added: head/usr.bin/tar/getdate.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/tar/getdate.c Sun Mar 8 06:03:15 2009 (r189521) @@ -0,0 +1,1050 @@ +/* + * This code is in the public domain and has no copyright. + * + * This is a plain C recursive-descent translation of an old + * public-domain YACC grammar that has been used for parsing dates in + * very many open-source projects. + * + * Since the original authors were generous enough to donate their + * work to the public domain, I feel compelled to match their + * generosity. + * + * Tim Kientzle, February 2009. + */ + +/* + * Header comment from original getdate.y: + */ + +/* +** Originally written by Steven M. Bellovin while +** at the University of North Carolina at Chapel Hill. Later tweaked by +** a couple of people on Usenet. Completely overhauled by Rich $alz +** and Jim Berets in August, 1990; +** +** This grammar has 10 shift/reduce conflicts. +** +** This code is in the public domain and has no copyright. +*/ + +#ifdef __FreeBSD__ +#include +__FBSDID("$FreeBSD$"); +#endif + +#include +#include +#include +#include +#include + +/* This file defines a single public function. */ +time_t get_date(time_t now, char *); + +/* Basic time units. */ +#define EPOCH 1970 +#define MINUTE (60L) +#define HOUR (60L * MINUTE) +#define DAY (24L * HOUR) + +/* Daylight-savings mode: on, off, or not yet known. */ +enum DSTMODE { DSTon, DSToff, DSTmaybe }; +/* Meridian: am or pm. */ +enum { tAM, tPM }; +/* Token types returned by nexttoken() */ +enum { tAGO = 260, tDAY, tDAYZONE, tAMPM, tMONTH, tMONTH_UNIT, tSEC_UNIT, + tUNUMBER, tZONE, tDST }; +struct token { int token; time_t value; }; + +/* + * Parser state. + */ +struct gdstate { + struct token *tokenp; /* Pointer to next token. */ + /* HaveXxxx counts how many of this kind of phrase we've seen; + * it's a fatal error to have more than one time, zone, day, + * or date phrase. */ + int HaveYear; + int HaveMonth; + int HaveDay; + int HaveWeekDay; /* Day of week */ + int HaveTime; /* Hour/minute/second */ + int HaveZone; /* timezone and/or DST info */ + int HaveRel; /* time offset; we can have more than one */ + /* Absolute time values. */ + time_t Timezone; /* Seconds offset from GMT */ + time_t Day; + time_t Hour; + time_t Minutes; + time_t Month; + time_t Seconds; + time_t Year; + /* DST selection */ + enum DSTMODE DSTmode; + /* Day of week accounting, e.g., "3rd Tuesday" */ + time_t DayOrdinal; /* "3" in "3rd Tuesday" */ + time_t DayNumber; /* "Tuesday" in "3rd Tuesday" */ + /* Relative time values: hour/day/week offsets are measured in + * seconds, month/year are counted in months. */ + time_t RelMonth; + time_t RelSeconds; +}; + +/* + * A series of functions that recognize certain common time phrases. + * Each function returns 1 if it managed to make sense of some of the + * tokens, zero otherwise. + */ + +/* + * hour:minute or hour:minute:second with optional AM, PM, or numeric + * timezone offset + */ +static int +timephrase(struct gdstate *gds) +{ + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == ':' + && gds->tokenp[2].token == tUNUMBER + && gds->tokenp[3].token == ':' + && gds->tokenp[4].token == tUNUMBER) { + /* "12:14:18" or "22:08:07" */ + ++gds->HaveTime; + gds->Hour = gds->tokenp[0].value; + gds->Minutes = gds->tokenp[2].value; + gds->Seconds = gds->tokenp[4].value; + gds->tokenp += 5; + } + else if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == ':' + && gds->tokenp[2].token == tUNUMBER) { + /* "12:14" or "22:08" */ + ++gds->HaveTime; + gds->Hour = gds->tokenp[0].value; + gds->Minutes = gds->tokenp[2].value; + gds->Seconds = 0; + gds->tokenp += 3; + } + else if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == tAMPM) { + /* "7" is a time if it's followed by "am" or "pm" */ + ++gds->HaveTime; + gds->Hour = gds->tokenp[0].value; + gds->Minutes = gds->Seconds = 0; + /* We'll handle the AM/PM below. */ + gds->tokenp += 1; + } else { + /* We can't handle this. */ + return 0; + } + + if (gds->tokenp[0].token == tAMPM) { + /* "7:12pm", "12:20:13am" */ + if (gds->Hour == 12) + gds->Hour = 0; + if (gds->tokenp[0].value == tPM) + gds->Hour += 12; + gds->tokenp += 1; + } + if (gds->tokenp[0].token == '+' + && gds->tokenp[1].token == tUNUMBER) { + /* "7:14+0700" */ + gds->HaveZone++; + gds->DSTmode = DSToff; + gds->Timezone = - ((gds->tokenp[1].value / 100) * HOUR + + (gds->tokenp[1].value % 100) * MINUTE); + gds->tokenp += 2; + } + if (gds->tokenp[0].token == '-' + && gds->tokenp[1].token == tUNUMBER) { + /* "19:14:12-0530" */ + gds->HaveZone++; + gds->DSTmode = DSToff; + gds->Timezone = + ((gds->tokenp[1].value / 100) * HOUR + + (gds->tokenp[1].value % 100) * MINUTE); + gds->tokenp += 2; + } + return 1; +} + +/* + * Timezone name, possibly including DST. + */ +static int +zonephrase(struct gdstate *gds) +{ + if (gds->tokenp[0].token == tZONE + && gds->tokenp[1].token == tDST) { + gds->HaveZone++; + gds->Timezone = gds->tokenp[0].value; + gds->DSTmode = DSTon; + gds->tokenp += 1; + return 1; + } + + if (gds->tokenp[0].token == tZONE) { + gds->HaveZone++; + gds->Timezone = gds->tokenp[0].value; + gds->DSTmode = DSToff; + gds->tokenp += 1; + return 1; + } + + if (gds->tokenp[0].token == tDAYZONE) { + gds->HaveZone++; + gds->Timezone = gds->tokenp[0].value; + gds->DSTmode = DSTon; + gds->tokenp += 1; + return 1; + } + return 0; +} + +/* + * Year/month/day in various combinations. + */ +static int +datephrase(struct gdstate *gds) +{ + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == '/' + && gds->tokenp[2].token == tUNUMBER + && gds->tokenp[3].token == '/' + && gds->tokenp[4].token == tUNUMBER) { + gds->HaveYear++; + gds->HaveMonth++; + gds->HaveDay++; + if (gds->tokenp[0].value >= 13) { + /* First number is big: 2004/01/29, 99/02/17 */ + gds->Year = gds->tokenp[0].value; + gds->Month = gds->tokenp[2].value; + gds->Day = gds->tokenp[4].value; + } else if ((gds->tokenp[4].value >= 13) || (gds->tokenp[2].value >= 13)) { + /* Last number is big: 01/07/98 */ + /* Middle number is big: 01/29/04 */ + gds->Month = gds->tokenp[0].value; + gds->Day = gds->tokenp[2].value; + gds->Year = gds->tokenp[4].value; + } else { + /* No significant clues: 02/03/04 */ + gds->Month = gds->tokenp[0].value; + gds->Day = gds->tokenp[2].value; + gds->Year = gds->tokenp[4].value; + } + gds->tokenp += 5; + return 1; + } + + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == '/' + && gds->tokenp[2].token == tUNUMBER) { + /* "1/15" */ + gds->HaveMonth++; + gds->HaveDay++; + gds->Month = gds->tokenp[0].value; + gds->Day = gds->tokenp[2].value; + gds->tokenp += 3; + return 1; + } + + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == '-' + && gds->tokenp[2].token == tUNUMBER + && gds->tokenp[3].token == '-' + && gds->tokenp[4].token == tUNUMBER) { + /* ISO 8601 format. yyyy-mm-dd. */ + gds->HaveYear++; + gds->HaveMonth++; + gds->HaveDay++; + gds->Year = gds->tokenp[0].value; + gds->Month = gds->tokenp[2].value; + gds->Day = gds->tokenp[4].value; + gds->tokenp += 5; + return 1; + } + + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == '-' + && gds->tokenp[2].token == tMONTH + && gds->tokenp[3].token == '-' + && gds->tokenp[4].token == tUNUMBER) { + gds->HaveYear++; + gds->HaveMonth++; + gds->HaveDay++; + if (gds->tokenp[0].value > 31) { + /* e.g. 1992-Jun-17 */ + gds->Year = gds->tokenp[0].value; + gds->Month = gds->tokenp[2].value; + gds->Day = gds->tokenp[4].value; + } else { + /* e.g. 17-JUN-1992. */ + gds->Day = gds->tokenp[0].value; + gds->Month = gds->tokenp[2].value; + gds->Year = gds->tokenp[4].value; + } + gds->tokenp += 5; + return 1; + } + + if (gds->tokenp[0].token == tMONTH + && gds->tokenp[1].token == tUNUMBER + && gds->tokenp[2].token == ',' + && gds->tokenp[3].token == tUNUMBER) { + /* "June 17, 2001" */ + gds->HaveYear++; + gds->HaveMonth++; + gds->HaveDay++; + gds->Month = gds->tokenp[0].value; + gds->Day = gds->tokenp[1].value; + gds->Year = gds->tokenp[3].value; + gds->tokenp += 4; + return 1; + } + + if (gds->tokenp[0].token == tMONTH + && gds->tokenp[1].token == tUNUMBER) { + /* "May 3" */ + gds->HaveMonth++; + gds->HaveDay++; + gds->Month = gds->tokenp[0].value; + gds->Day = gds->tokenp[1].value; + gds->tokenp += 2; + return 1; + } + + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == tMONTH + && gds->tokenp[2].token == tUNUMBER) { + /* "12 Sept 1997" */ + gds->HaveYear++; + gds->HaveMonth++; + gds->HaveDay++; + gds->Day = gds->tokenp[0].value; + gds->Month = gds->tokenp[1].value; + gds->Year = gds->tokenp[2].value; + gds->tokenp += 3; + return 1; + } + + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == tMONTH) { + /* "12 Sept" */ + gds->HaveMonth++; + gds->HaveDay++; + gds->Day = gds->tokenp[0].value; + gds->Month = gds->tokenp[1].value; + gds->tokenp += 2; + return 1; + } + + return 0; +} + +/* + * Relative time phrase: "tomorrow", "yesterday", "+1 hour", etc. + */ +static int +relunitphrase(struct gdstate *gds) +{ + if (gds->tokenp[0].token == '-' + && gds->tokenp[1].token == tUNUMBER + && gds->tokenp[2].token == tSEC_UNIT) { + /* "-3 hours" */ + gds->HaveRel++; + gds->RelSeconds -= gds->tokenp[1].value * gds->tokenp[2].value; + gds->tokenp += 3; + return 1; + } + if (gds->tokenp[0].token == '+' + && gds->tokenp[1].token == tUNUMBER + && gds->tokenp[2].token == tSEC_UNIT) { + /* "+1 minute" */ + gds->HaveRel++; + gds->RelSeconds += gds->tokenp[1].value * gds->tokenp[2].value; + gds->tokenp += 3; + return 1; + } + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == tSEC_UNIT) { + /* "1 day" */ + gds->HaveRel++; + gds->RelSeconds += gds->tokenp[1].value * gds->tokenp[2].value; + gds->tokenp += 3; + return 1; + } + if (gds->tokenp[0].token == '-' + && gds->tokenp[1].token == tUNUMBER + && gds->tokenp[2].token == tMONTH_UNIT) { + /* "-3 months" */ + gds->HaveRel++; + gds->RelMonth -= gds->tokenp[1].value * gds->tokenp[2].value; + gds->tokenp += 3; + return 1; + } + if (gds->tokenp[0].token == '+' + && gds->tokenp[1].token == tUNUMBER + && gds->tokenp[2].token == tMONTH_UNIT) { + /* "+5 years" */ + gds->HaveRel++; + gds->RelMonth += gds->tokenp[1].value * gds->tokenp[2].value; + gds->tokenp += 3; + return 1; + } + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == tMONTH_UNIT) { + /* "2 years" */ + gds->HaveRel++; + gds->RelMonth += gds->tokenp[0].value * gds->tokenp[1].value; + gds->tokenp += 2; + return 1; + } + if (gds->tokenp[0].token == tSEC_UNIT) { + /* "now", "tomorrow" */ + gds->HaveRel++; + gds->RelSeconds += gds->tokenp[0].value; + ++gds->tokenp; + return 1; + } + if (gds->tokenp[0].token == tMONTH_UNIT) { + /* "month" */ + gds->HaveRel++; + gds->RelMonth += gds->tokenp[0].value; + gds->tokenp += 1; + return 1; + } + return 0; +} + +/* + * Day of the week specification. + */ +static int +dayphrase(struct gdstate *gds) +{ + if (gds->tokenp[0].token == tDAY) { + /* "tues", "wednesday," */ + gds->HaveWeekDay++; + gds->DayOrdinal = 1; + gds->DayNumber = gds->tokenp[0].value; + gds->tokenp += 1; + if (gds->tokenp[0].token == ',') + gds->tokenp += 1; + return 1; + } + if (gds->tokenp[0].token == tUNUMBER + && gds->tokenp[1].token == tDAY) { + /* "second tues" "3 wed" */ + gds->HaveWeekDay++; + gds->DayOrdinal = gds->tokenp[0].value; + gds->DayNumber = gds->tokenp[1].value; + gds->tokenp += 2; + return 1; + } + return 0; +} + +/* + * Try to match a phrase using one of the above functions. + * This layer also deals with a couple of generic issues. + */ +static int +phrase(struct gdstate *gds) +{ + if (timephrase(gds)) + return 1; + if (zonephrase(gds)) + return 1; + if (datephrase(gds)) + return 1; + if (dayphrase(gds)) + return 1; + if (relunitphrase(gds)) { + if (gds->tokenp[0].token == tAGO) { + gds->RelSeconds = -gds->RelSeconds; + gds->RelMonth = -gds->RelMonth; + gds->tokenp += 1; + } + return 1; + } + + /* Bare numbers sometimes have meaning. */ + if (gds->tokenp[0].token == tUNUMBER) { + if (gds->HaveTime && !gds->HaveYear && !gds->HaveRel) { + gds->HaveYear++; + gds->Year = gds->tokenp[0].value; + gds->tokenp += 1; + return 1; + } + + if(gds->tokenp[0].value > 10000) { + /* "20040301" */ + gds->HaveYear++; + gds->HaveMonth++; + gds->HaveDay++; + gds->Day= (gds->tokenp[0].value)%100; + gds->Month= (gds->tokenp[0].value/100)%100; + gds->Year = gds->tokenp[0].value/10000; + gds->tokenp += 1; + return 1; + } + + if (gds->tokenp[0].value < 24) { + gds->HaveTime++; + gds->Hour = gds->tokenp[0].value; + gds->Minutes = 0; + gds->Seconds = 0; + gds->tokenp += 1; + return 1; + } + + if ((gds->tokenp[0].value / 100 < 24) + && (gds->tokenp[0].value % 100 < 60)) { + /* "513" is same as "5:13" */ + gds->Hour = gds->tokenp[0].value / 100; + gds->Minutes = gds->tokenp[0].value % 100; + gds->Seconds = 0; + gds->tokenp += 1; + return 1; + } + } + + return 0; +} + +/* + * A dictionary of time words. + */ +static struct LEXICON { + size_t abbrev; + const char *name; + int type; + time_t value; +} const TimeWords[] = { + /* am/pm */ + { 0, "am", tAMPM, tAM }, + { 0, "pm", tAMPM, tPM }, + + /* Month names. */ + { 3, "january", tMONTH, 1 }, + { 3, "february", tMONTH, 2 }, + { 3, "march", tMONTH, 3 }, + { 3, "april", tMONTH, 4 }, + { 3, "may", tMONTH, 5 }, + { 3, "june", tMONTH, 6 }, + { 3, "july", tMONTH, 7 }, + { 3, "august", tMONTH, 8 }, + { 3, "september", tMONTH, 9 }, + { 3, "october", tMONTH, 10 }, + { 3, "november", tMONTH, 11 }, + { 3, "december", tMONTH, 12 }, + + /* Days of the week. */ + { 2, "sunday", tDAY, 0 }, + { 3, "monday", tDAY, 1 }, + { 2, "tuesday", tDAY, 2 }, + { 3, "wednesday", tDAY, 3 }, + { 2, "thursday", tDAY, 4 }, + { 2, "friday", tDAY, 5 }, + { 2, "saturday", tDAY, 6 }, + + /* Timezones: Offsets are in seconds. */ + { 0, "gmt", tZONE, 0*HOUR }, /* Greenwich Mean */ + { 0, "ut", tZONE, 0*HOUR }, /* Universal (Coordinated) */ + { 0, "utc", tZONE, 0*HOUR }, + { 0, "wet", tZONE, 0*HOUR }, /* Western European */ + { 0, "bst", tDAYZONE, 0*HOUR }, /* British Summer */ + { 0, "wat", tZONE, 1*HOUR }, /* West Africa */ + { 0, "at", tZONE, 2*HOUR }, /* Azores */ + /* { 0, "bst", tZONE, 3*HOUR }, */ /* Brazil Standard: Conflict */ + /* { 0, "gst", tZONE, 3*HOUR }, */ /* Greenland Standard: Conflict*/ + { 0, "nft", tZONE, 3*HOUR+30*MINUTE }, /* Newfoundland */ + { 0, "nst", tZONE, 3*HOUR+30*MINUTE }, /* Newfoundland Standard */ + { 0, "ndt", tDAYZONE, 3*HOUR+30*MINUTE }, /* Newfoundland Daylight */ + { 0, "ast", tZONE, 4*HOUR }, /* Atlantic Standard */ + { 0, "adt", tDAYZONE, 4*HOUR }, /* Atlantic Daylight */ + { 0, "est", tZONE, 5*HOUR }, /* Eastern Standard */ + { 0, "edt", tDAYZONE, 5*HOUR }, /* Eastern Daylight */ + { 0, "cst", tZONE, 6*HOUR }, /* Central Standard */ + { 0, "cdt", tDAYZONE, 6*HOUR }, /* Central Daylight */ + { 0, "mst", tZONE, 7*HOUR }, /* Mountain Standard */ + { 0, "mdt", tDAYZONE, 7*HOUR }, /* Mountain Daylight */ + { 0, "pst", tZONE, 8*HOUR }, /* Pacific Standard */ + { 0, "pdt", tDAYZONE, 8*HOUR }, /* Pacific Daylight */ + { 0, "yst", tZONE, 9*HOUR }, /* Yukon Standard */ + { 0, "ydt", tDAYZONE, 9*HOUR }, /* Yukon Daylight */ + { 0, "hst", tZONE, 10*HOUR }, /* Hawaii Standard */ + { 0, "hdt", tDAYZONE, 10*HOUR }, /* Hawaii Daylight */ + { 0, "cat", tZONE, 10*HOUR }, /* Central Alaska */ + { 0, "ahst", tZONE, 10*HOUR }, /* Alaska-Hawaii Standard */ + { 0, "nt", tZONE, 11*HOUR }, /* Nome */ + { 0, "idlw", tZONE, 12*HOUR }, /* Intl Date Line West */ + { 0, "cet", tZONE, -1*HOUR }, /* Central European */ + { 0, "met", tZONE, -1*HOUR }, /* Middle European */ + { 0, "mewt", tZONE, -1*HOUR }, /* Middle European Winter */ + { 0, "mest", tDAYZONE, -1*HOUR }, /* Middle European Summer */ + { 0, "swt", tZONE, -1*HOUR }, /* Swedish Winter */ + { 0, "sst", tDAYZONE, -1*HOUR }, /* Swedish Summer */ + { 0, "fwt", tZONE, -1*HOUR }, /* French Winter */ + { 0, "fst", tDAYZONE, -1*HOUR }, /* French Summer */ + { 0, "eet", tZONE, -2*HOUR }, /* Eastern Eur, USSR Zone 1 */ + { 0, "bt", tZONE, -3*HOUR }, /* Baghdad, USSR Zone 2 */ + { 0, "it", tZONE, -3*HOUR-30*MINUTE },/* Iran */ + { 0, "zp4", tZONE, -4*HOUR }, /* USSR Zone 3 */ + { 0, "zp5", tZONE, -5*HOUR }, /* USSR Zone 4 */ + { 0, "ist", tZONE, -5*HOUR-30*MINUTE },/* Indian Standard */ + { 0, "zp6", tZONE, -6*HOUR }, /* USSR Zone 5 */ + /* { 0, "nst", tZONE, -6.5*HOUR }, */ /* North Sumatra: Conflict */ + /* { 0, "sst", tZONE, -7*HOUR }, */ /* So Sumatra, USSR 6: Conflict */ + { 0, "wast", tZONE, -7*HOUR }, /* West Australian Standard */ + { 0, "wadt", tDAYZONE, -7*HOUR }, /* West Australian Daylight */ + { 0, "jt", tZONE, -7*HOUR-30*MINUTE },/* Java (3pm in Cronusland!)*/ + { 0, "cct", tZONE, -8*HOUR }, /* China Coast, USSR Zone 7 */ + { 0, "jst", tZONE, -9*HOUR }, /* Japan Std, USSR Zone 8 */ + { 0, "cast", tZONE, -9*HOUR-30*MINUTE },/* Ctrl Australian Std */ + { 0, "cadt", tDAYZONE, -9*HOUR-30*MINUTE },/* Ctrl Australian Daylt */ + { 0, "east", tZONE, -10*HOUR }, /* Eastern Australian Std */ + { 0, "eadt", tDAYZONE, -10*HOUR }, /* Eastern Australian Daylt */ + { 0, "gst", tZONE, -10*HOUR }, /* Guam Std, USSR Zone 9 */ + { 0, "nzt", tZONE, -12*HOUR }, /* New Zealand */ + { 0, "nzst", tZONE, -12*HOUR }, /* New Zealand Standard */ + { 0, "nzdt", tDAYZONE, -12*HOUR }, /* New Zealand Daylight */ + { 0, "idle", tZONE, -12*HOUR }, /* Intl Date Line East */ + + { 0, "dst", tDST, 0 }, + + /* Time units. */ + { 4, "years", tMONTH_UNIT, 12 }, + { 5, "months", tMONTH_UNIT, 1 }, + { 9, "fortnights", tSEC_UNIT, 14 * DAY }, + { 4, "weeks", tSEC_UNIT, 7 * DAY }, + { 3, "days", tSEC_UNIT, DAY }, + { 4, "hours", tSEC_UNIT, HOUR }, + { 3, "minutes", tSEC_UNIT, MINUTE }, + { 3, "seconds", tSEC_UNIT, 1 }, + + /* Relative-time words. */ + { 0, "tomorrow", tSEC_UNIT, DAY }, + { 0, "yesterday", tSEC_UNIT, -DAY }, + { 0, "today", tSEC_UNIT, 0 }, + { 0, "now", tSEC_UNIT, 0 }, + { 0, "last", tUNUMBER, -1 }, + { 0, "this", tSEC_UNIT, 0 }, + { 0, "next", tUNUMBER, 2 }, + { 0, "first", tUNUMBER, 1 }, + { 0, "1st", tUNUMBER, 1 }, +/* { 0, "second", tUNUMBER, 2 }, */ + { 0, "2nd", tUNUMBER, 2 }, + { 0, "third", tUNUMBER, 3 }, + { 0, "3rd", tUNUMBER, 3 }, + { 0, "fourth", tUNUMBER, 4 }, + { 0, "4th", tUNUMBER, 4 }, + { 0, "fifth", tUNUMBER, 5 }, + { 0, "5th", tUNUMBER, 5 }, + { 0, "sixth", tUNUMBER, 6 }, + { 0, "seventh", tUNUMBER, 7 }, + { 0, "eighth", tUNUMBER, 8 }, + { 0, "ninth", tUNUMBER, 9 }, + { 0, "tenth", tUNUMBER, 10 }, + { 0, "eleventh", tUNUMBER, 11 }, + { 0, "twelfth", tUNUMBER, 12 }, + { 0, "ago", tAGO, 1 }, + + /* Military timezones. */ + { 0, "a", tZONE, 1*HOUR }, + { 0, "b", tZONE, 2*HOUR }, + { 0, "c", tZONE, 3*HOUR }, + { 0, "d", tZONE, 4*HOUR }, + { 0, "e", tZONE, 5*HOUR }, + { 0, "f", tZONE, 6*HOUR }, + { 0, "g", tZONE, 7*HOUR }, + { 0, "h", tZONE, 8*HOUR }, + { 0, "i", tZONE, 9*HOUR }, + { 0, "k", tZONE, 10*HOUR }, + { 0, "l", tZONE, 11*HOUR }, + { 0, "m", tZONE, 12*HOUR }, + { 0, "n", tZONE, -1*HOUR }, + { 0, "o", tZONE, -2*HOUR }, + { 0, "p", tZONE, -3*HOUR }, + { 0, "q", tZONE, -4*HOUR }, + { 0, "r", tZONE, -5*HOUR }, + { 0, "s", tZONE, -6*HOUR }, + { 0, "t", tZONE, -7*HOUR }, + { 0, "u", tZONE, -8*HOUR }, + { 0, "v", tZONE, -9*HOUR }, + { 0, "w", tZONE, -10*HOUR }, + { 0, "x", tZONE, -11*HOUR }, + { 0, "y", tZONE, -12*HOUR }, + { 0, "z", tZONE, 0*HOUR }, + + /* End of table. */ + { 0, NULL, 0, 0 } +}; + +/* + * Convert hour/minute/second to count of seconds. + */ +static time_t +ToSeconds(time_t Hours, time_t Minutes, time_t Seconds) +{ + if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59) + return -1; + if (Hours < 0 || Hours > 23) + return -1; + return Hours * HOUR + Minutes * MINUTE + Seconds; +} + + +/* + * Year is either: + * = A number from 0 to 99, which means a year from 1970 to 2069, or + * = The actual year (>=100). + */ +static time_t +Convert(time_t Month, time_t Day, time_t Year, + time_t Hours, time_t Minutes, time_t Seconds, + time_t Timezone, enum DSTMODE DSTmode) +{ + static int DaysInMonth[12] = { + 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 + }; + time_t tod; + time_t Julian; + int i; + + if (Year < 69) + Year += 2000; + else if (Year < 100) + Year += 1900; + DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) + ? 29 : 28; + /* Checking for 2038 bogusly assumes that time_t is 32 bits. But + I'm too lazy to try to check for time_t overflow in another way. */ + if (Year < EPOCH || Year > 2038 + || Month < 1 || Month > 12 + /* Lint fluff: "conversion from long may lose accuracy" */ + || Day < 1 || Day > DaysInMonth[(int)--Month]) + return -1; + + Julian = Day - 1; + for (i = 0; i < Month; i++) + Julian += DaysInMonth[i]; + for (i = EPOCH; i < Year; i++) + Julian += 365 + (i % 4 == 0); + Julian *= DAY; + Julian += Timezone; + if ((tod = ToSeconds(Hours, Minutes, Seconds)) < 0) + return -1; + Julian += tod; + if (DSTmode == DSTon + || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst)) + Julian -= HOUR; + return Julian; +} + + +static time_t +DSTcorrect(time_t Start, time_t Future) +{ + time_t StartDay; + time_t FutureDay; + + StartDay = (localtime(&Start)->tm_hour + 1) % 24; + FutureDay = (localtime(&Future)->tm_hour + 1) % 24; + return (Future - Start) + (StartDay - FutureDay) * HOUR; +} + + +static time_t +RelativeDate(time_t Start, time_t zone, int dstmode, + time_t DayOrdinal, time_t DayNumber) +{ + struct tm *tm; + time_t t, now; + + t = Start - zone; + tm = gmtime(&t); + now = Start; + now += DAY * ((DayNumber - tm->tm_wday + 7) % 7); + now += 7 * DAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1); + if (dstmode == DSTmaybe) + return DSTcorrect(Start, now); + return now - Start; +} + + +static time_t +RelativeMonth(time_t Start, time_t Timezone, time_t RelMonth) +{ + struct tm *tm; + time_t Month; + time_t Year; + + if (RelMonth == 0) + return 0; + tm = localtime(&Start); + Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth; + Year = Month / 12; + Month = Month % 12 + 1; + return DSTcorrect(Start, + Convert(Month, (time_t)tm->tm_mday, Year, + (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec, + Timezone, DSTmaybe)); +} + +/* + * Tokenizer. + */ +static int +nexttoken(char **in, time_t *value) +{ + char c; + char buff[64]; + + for ( ; ; ) { + while (isspace((unsigned char)**in)) + ++*in; + + /* Skip parenthesized comments. */ + if (**in == '(') { + int Count = 0; + do { + c = *(*in)++; + if (c == '\0') + return c; + if (c == '(') + Count++; + else if (c == ')') + Count--; + } while (Count > 0); + continue; + } + + /* Try the next token in the word table first. */ + /* This allows us to match "2nd", for example. */ + { + char *src = *in; + const struct LEXICON *tp; + unsigned i = 0; + + /* Force to lowercase and strip '.' characters. */ + while (*src != '\0' + && (isalnum((unsigned char)*src) || *src == '.') + && i < sizeof(buff)-1) { + if (*src != '.') { + if (isupper((unsigned char)*src)) + buff[i++] = tolower((unsigned char)*src); + else + buff[i++] = *src; + } + src++; + } + buff[i++] = '\0'; + + /* + * Find the first match. If the word can be + * abbreviated, make sure we match at least + * the minimum abbreviation. + */ + for (tp = TimeWords; tp->name; tp++) { + size_t abbrev = tp->abbrev; + if (abbrev == 0) + abbrev = strlen(tp->name); + if (strlen(buff) >= abbrev + && strncmp(tp->name, buff, strlen(buff)) + == 0) { + /* Skip over token. */ + *in = src; + /* Return the match. */ + *value = tp->value; + return tp->type; + } + } + } + + /* + * Not in the word table, maybe it's a number. Note: + * Because '-' and '+' have other special meanings, I + * don't deal with signed numbers here. + */ + if (isdigit((unsigned char)(c = **in))) { + for (*value = 0; isdigit((unsigned char)(c = *(*in)++)); ) + *value = 10 * *value + c - '0'; + (*in)--; + return (tUNUMBER); + } + + return *(*in)++; + } +} + +#define TM_YEAR_ORIGIN 1900 + +/* Yield A - B, measured in seconds. */ +static long +difftm (struct tm *a, struct tm *b) +{ + int ay = a->tm_year + (TM_YEAR_ORIGIN - 1); + int by = b->tm_year + (TM_YEAR_ORIGIN - 1); + int days = ( + /* difference in day of year */ + a->tm_yday - b->tm_yday + /* + intervening leap days */ + + ((ay >> 2) - (by >> 2)) + - (ay/100 - by/100) + + ((ay/100 >> 2) - (by/100 >> 2)) + /* + difference in years * 365 */ + + (long)(ay-by) * 365 + ); + return (days * DAY + (a->tm_hour - b->tm_hour) * HOUR + + (a->tm_min - b->tm_min) * MINUTE + + (a->tm_sec - b->tm_sec)); +} + +/* + * + * The public function. + * + * TODO: tokens[] array should be dynamically sized. + */ +time_t +get_date(time_t now, char *p) +{ + struct token tokens[256]; + struct gdstate _gds; + struct token *lasttoken; + struct gdstate *gds; + struct tm local, *tm; + struct tm gmt, *gmt_ptr; + time_t Start; + time_t tod; + long tzone; + + /* Clear out the parsed token array. */ + memset(tokens, 0, sizeof(tokens)); + /* Initialize the parser state. */ + memset(&_gds, 0, sizeof(_gds)); + gds = &_gds; + + /* Look up the current time. */ + memset(&local, 0, sizeof(local)); + tm = localtime (&now); + if (tm == NULL) + return -1; + local = *tm; + + /* Look up UTC if we can and use that to determine the current + * timezone offset. */ + memset(&gmt, 0, sizeof(gmt)); + gmt_ptr = gmtime (&now); + if (gmt_ptr != NULL) { + /* Copy, in case localtime and gmtime use the same buffer. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 06:03:29 2009 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 5134A106564A; Sun, 8 Mar 2009 06:03:29 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FC688FC18; Sun, 8 Mar 2009 06:03:29 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2863TDT074131; Sun, 8 Mar 2009 06:03:29 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2863TQK074130; Sun, 8 Mar 2009 06:03:29 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903080603.n2863TQK074130@svn.freebsd.org> From: Andrew Thompson Date: Sun, 8 Mar 2009 06:03: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: r189522 - head/sys/dev/usb/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 Mar 2009 06:03:29 -0000 Author: thompsa Date: Sun Mar 8 06:03:28 2009 New Revision: 189522 URL: http://svn.freebsd.org/changeset/base/189522 Log: Fix endian conversion from htole16 to htole32. Tested with: ARM xscale Modified: head/sys/dev/usb/net/if_axe.c Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Sun Mar 8 06:03:15 2009 (r189521) +++ head/sys/dev/usb/net/if_axe.c Sun Mar 8 06:03:28 2009 (r189522) @@ -318,7 +318,7 @@ axe_miibus_writereg(device_t dev, int ph struct axe_softc *sc = device_get_softc(dev); int locked; - val = htole16(val); + val = htole32(val); if (sc->sc_phyno != phy) return (0); From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 06:07:36 2009 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 3034D106564A; Sun, 8 Mar 2009 06:07:36 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D4EE8FC12; Sun, 8 Mar 2009 06:07:36 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2867aeJ074274; Sun, 8 Mar 2009 06:07:36 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2867ZH3074271; Sun, 8 Mar 2009 06:07:35 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080607.n2867ZH3074271@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 06:07: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: r189523 - in head/usr.bin/tar: . test 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 Mar 2009 06:07:36 -0000 Author: kientzle Date: Sun Mar 8 06:07:35 2009 New Revision: 189523 URL: http://svn.freebsd.org/changeset/base/189523 Log: Merge r709,r710 from libarchive.googlecode.com: More work on Windows support. Added: head/usr.bin/tar/test/test_patterns_4.tar.uu (contents, props changed) Modified: head/usr.bin/tar/test/test_patterns.c head/usr.bin/tar/util.c Modified: head/usr.bin/tar/test/test_patterns.c ============================================================================== --- head/usr.bin/tar/test/test_patterns.c Sun Mar 8 06:03:28 2009 (r189522) +++ head/usr.bin/tar/test/test_patterns.c Sun Mar 8 06:07:35 2009 (r189523) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2009 Michihiro NAKAJIMA * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. * @@ -30,6 +31,7 @@ DEFINE_TEST(test_patterns) int fd, r; const char *reffile2 = "test_patterns_2.tar"; const char *reffile3 = "test_patterns_3.tar"; + const char *reffile4 = "test_patterns_4.tar"; const char *p; /* @@ -101,4 +103,81 @@ DEFINE_TEST(test_patterns) assertEmptyFile("tar3d.out"); assertEmptyFile("tar3d.err"); assertEqualInt(0, access("tmp/foo/baz/bar", F_OK)); + + /* + * Test 4 archive has some entries starting with windows drive letters + * such as 'c:\', '//./c:/' or '//?/c:/'. + */ + extract_reference_file(reffile4); + + r = systemf("%s xf %s -C tmp > tar4.out 2> tar4.err", + testprog, reffile4); + assert(r != 0); + assertEmptyFile("tar4.out"); + assertNonEmptyFile("tar4.err"); + + for (r = 1; r <= 54; r++) { + char file_a[] = "tmp/fileXX"; + char file_b1[] = "tmp/server/share/fileXX"; + char file_b2[] = "tmp/server\\share\\fileXX"; + char file_c[] = "tmp/../fileXX"; + char *filex; + int xsize; + + switch (r) { + case 15: case 18: + /* + * Including server and share names. + * //?/UNC/server/share/file15 + * //?/unc/server/share/file18 + */ + filex = file_b1; + xsize = sizeof(file_b1); + break; + case 35: case 38: case 52: + /* + * Including server and share names. + * \\?\UNC\server\share\file35 + * \\?\unc\server\share\file38 + * \/?/uNc/server\share\file52 + */ + filex = file_b2; + xsize = sizeof(file_b2); + break; + default: + filex = file_a; + xsize = sizeof(file_a); + break; + } + filex[xsize-3] = '0' + r / 10; + filex[xsize-2] = '0' + r % 10; + switch (r) { + case 5: case 6: case 17: case 20: case 25: + case 26: case 37: case 40: case 43: case 54: + /* + * Not extracted patterns. + * D:../file05 + * c:../../file06 + * //?/UNC/../file17 + * //?/unc/../file20 + * z:..\file25 + * c:..\..\file26 + * \\?\UNC\..\file37 + * \\?\unc\..\file40 + * c:../..\file43 + * \/?\UnC\../file54 + */ + assertEqualInt(-1, access(filex, F_OK)); + filex = file_c; + xsize = sizeof(file_c); + filex[xsize-3] = '0' + r / 10; + filex[xsize-2] = '0' + r % 10; + assertEqualInt(-1, access(filex, F_OK)); + break; + default: + /* Extracted patterns. */ + assertEqualInt(0, access(filex, F_OK)); + break; + } + } } Added: head/usr.bin/tar/test/test_patterns_4.tar.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/tar/test/test_patterns_4.tar.uu Sun Mar 8 06:07:35 2009 (r189523) @@ -0,0 +1,642 @@ +$FreeBSD$ +begin 644 test_patterns_4.tar +M+V9I;&4P,0`````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P +M(#$Q,34P-CCHN+EQF:6QE,C4````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P +M,#`P(#$Q,34P-Coption_absolute_paths) { - /* Strip Windows drive letters. */ - if (((name[0] >= 'A' && name[0] <= 'Z') - || (name[0] >= 'a' && name[0] <= 'z')) - && name[1] == ':' - && (name[2] == '/' || name[2] == '\\')) + const char *rp, *p = name; + int slashonly = 1; + + /* Remove leading "//./" or "//?/" or "//?/UNC/" + * (absolute path prefixes used by Windows API) */ + if ((p[0] == '/' || p[0] == '\\') && + (p[1] == '/' || p[1] == '\\') && + (p[2] == '.' || p[2] == '?') && + (p[3] == '/' || p[3] == '\\')) { - /* Generate a warning the first time this happens. */ - if (!bsdtar->warned_lead_slash) { - bsdtar_warnc(bsdtar, 0, - "Removing leading drive letter from member names"); - bsdtar->warned_lead_slash = 1; - } - name += 3; - while (*name == '/' || *name == '\\') - ++name; - /* Special case: Stripping everything yields ".". */ - if (*name == '\0') - name = "."; + if (p[2] == '?' && + (p[4] == 'U' || p[4] == 'u') && + (p[5] == 'N' || p[5] == 'n') && + (p[6] == 'C' || p[6] == 'c') && + (p[7] == '/' || p[7] == '\\')) + p += 8; + else + p += 4; + slashonly = 0; } + do { + rp = p; + /* Remove leading drive letter from archives created + * on Windows. */ + if (((p[0] >= 'a' && p[0] <= 'z') || + (p[0] >= 'A' && p[0] <= 'Z')) && + p[1] == ':') { + p += 2; + slashonly = 0; + } + /* Remove leading "/../", "//", etc. */ + while (p[0] == '/' || p[0] == '\\') { + if (p[1] == '.' && p[2] == '.' && + (p[3] == '/' || p[3] == '\\')) { + p += 3; /* Remove "/..", leave "/" + * for next pass. */ + slashonly = 0; + } else + p += 1; /* Remove "/". */ + } + } while (rp != p); - /* Strip leading '/'. */ - if (name[0] == '/') { + if (p != name && !bsdtar->warned_lead_slash) { /* Generate a warning the first time this happens. */ - if (!bsdtar->warned_lead_slash) { + if (slashonly) bsdtar_warnc(bsdtar, 0, - "Removing leading '/' from member names"); - bsdtar->warned_lead_slash = 1; - } - name++; - /* Special case: Stripping everything yields ".". */ - if (*name == '\0') - name = "."; + "Removing leading '%c' from member names", + name[0]); + else + bsdtar_warnc(bsdtar, 0, + "Removing leading drive letter from " + "member names"); + bsdtar->warned_lead_slash = 1; } + + /* Special case: Stripping everything yields ".". */ + if (*p == '\0') + name = "."; + else + name = p; + } else { + /* Strip redundant leading '/' characters. */ + while (name[0] == '/' && name[1] == '/') + name++; } /* Safely replace name in archive_entry. */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 06:09:21 2009 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 5215B106564A; Sun, 8 Mar 2009 06:09:21 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 409C68FC18; Sun, 8 Mar 2009 06:09:21 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2869L7B074338; Sun, 8 Mar 2009 06:09:21 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2869LFH074336; Sun, 8 Mar 2009 06:09:21 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080609.n2869LFH074336@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 06:09: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: r189524 - in head/usr.bin/tar: . test 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 Mar 2009 06:09:21 -0000 Author: kientzle Date: Sun Mar 8 06:09:20 2009 New Revision: 189524 URL: http://svn.freebsd.org/changeset/base/189524 Log: Match a comment to reduce differences with libarchive.googlecode.com. Modified: head/usr.bin/tar/bsdtar.c head/usr.bin/tar/test/main.c Modified: head/usr.bin/tar/bsdtar.c ============================================================================== --- head/usr.bin/tar/bsdtar.c Sun Mar 8 06:07:35 2009 (r189523) +++ head/usr.bin/tar/bsdtar.c Sun Mar 8 06:09:20 2009 (r189524) @@ -114,7 +114,7 @@ main(int argc, char **argv) bsdtar->fd = -1; /* Mark as "unused" */ option_o = 0; #ifdef _WIN32 - /* open() function is always with a binary mode. */ + /* Make sure open() function will be used with a binary mode. */ _set_fmode(_O_BINARY); #endif Modified: head/usr.bin/tar/test/main.c ============================================================================== --- head/usr.bin/tar/test/main.c Sun Mar 8 06:07:35 2009 (r189523) +++ head/usr.bin/tar/test/main.c Sun Mar 8 06:09:20 2009 (r189524) @@ -921,6 +921,10 @@ int main(int argc, char **argv) (void)argc; /* UNUSED */ +#ifdef _WIN32 + /* Make sure open() function will be used with a binary mode. */ + _set_fmode(_O_BINARY); +#endif /* * Name of this program, used to build root of our temp directory * tree. From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 06:14:34 2009 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 4210F106566C; Sun, 8 Mar 2009 06:14:34 +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 30D7A8FC18; Sun, 8 Mar 2009 06:14:34 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n286EYBO074504; Sun, 8 Mar 2009 06:14:34 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n286EYCE074503; Sun, 8 Mar 2009 06:14:34 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903080614.n286EYCE074503@svn.freebsd.org> From: David Schultz Date: Sun, 8 Mar 2009 06:14: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: r189525 - head/sys/gnu/fs/reiserfs 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 Mar 2009 06:14:34 -0000 Author: das Date: Sun Mar 8 06:14:33 2009 New Revision: 189525 URL: http://svn.freebsd.org/changeset/base/189525 Log: Don't declare bin_search() as an inline function, since there's no inline definition of it. Modified: head/sys/gnu/fs/reiserfs/reiserfs_fs.h Modified: head/sys/gnu/fs/reiserfs/reiserfs_fs.h ============================================================================== --- head/sys/gnu/fs/reiserfs/reiserfs_fs.h Sun Mar 8 06:09:20 2009 (r189524) +++ head/sys/gnu/fs/reiserfs/reiserfs_fs.h Sun Mar 8 06:14:33 2009 (r189525) @@ -1216,7 +1216,7 @@ const struct key *get_lkey(const struct const struct reiserfs_sb_info *p_s_sbi); const struct key *get_rkey(const struct path *p_s_chk_path, const struct reiserfs_sb_info *p_s_sbi); -inline int bin_search(const void * p_v_key, const void * p_v_base, +int bin_search(const void * p_v_key, const void * p_v_base, int p_n_num, int p_n_width, int * p_n_pos); void pathrelse(struct path *p_s_search_path); From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 06:19:28 2009 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 D5815106564A; Sun, 8 Mar 2009 06:19:28 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C340B8FC13; Sun, 8 Mar 2009 06:19:28 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n286JSUF074634; Sun, 8 Mar 2009 06:19:28 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n286JSgH074629; Sun, 8 Mar 2009 06:19:28 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080619.n286JSgH074629@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 06:19: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: r189526 - head/usr.bin/tar 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 Mar 2009 06:19:29 -0000 Author: kientzle Date: Sun Mar 8 06:19:28 2009 New Revision: 189526 URL: http://svn.freebsd.org/changeset/base/189526 Log: Merge r492 from libarchive.googlecode.com: First cut at exposing the new options mechanism to userland. Documentation pending... Modified: head/usr.bin/tar/bsdtar.c head/usr.bin/tar/bsdtar.h head/usr.bin/tar/cmdline.c head/usr.bin/tar/read.c head/usr.bin/tar/write.c Modified: head/usr.bin/tar/bsdtar.c ============================================================================== --- head/usr.bin/tar/bsdtar.c Sun Mar 8 06:14:33 2009 (r189525) +++ head/usr.bin/tar/bsdtar.c Sun Mar 8 06:19:28 2009 (r189526) @@ -212,6 +212,9 @@ main(int argc, char **argv) case OPTION_FORMAT: /* GNU tar, others */ bsdtar->create_format = bsdtar->optarg; break; + case OPTION_FORMAT_OPTIONS: + bsdtar->option_format_options = bsdtar->optarg; + break; case 'f': /* SUSv2 */ bsdtar->filename = bsdtar->optarg; if (strcmp(bsdtar->filename, "-") == 0) Modified: head/usr.bin/tar/bsdtar.h ============================================================================== --- head/usr.bin/tar/bsdtar.h Sun Mar 8 06:14:33 2009 (r189525) +++ head/usr.bin/tar/bsdtar.h Sun Mar 8 06:19:28 2009 (r189526) @@ -60,6 +60,7 @@ struct bsdtar { char option_chroot; /* --chroot */ char option_dont_traverse_mounts; /* --one-file-system */ char option_fast_read; /* --fast-read */ + const char *option_format_options; /* --format-options */ char option_honor_nodump; /* --nodump */ char option_interactive; /* -w */ char option_no_owner; /* -o */ @@ -110,6 +111,7 @@ enum { OPTION_CHROOT, OPTION_EXCLUDE, OPTION_FORMAT, + OPTION_FORMAT_OPTIONS, OPTION_HELP, OPTION_INCLUDE, OPTION_KEEP_NEWER_FILES, Modified: head/usr.bin/tar/cmdline.c ============================================================================== --- head/usr.bin/tar/cmdline.c Sun Mar 8 06:14:33 2009 (r189525) +++ head/usr.bin/tar/cmdline.c Sun Mar 8 06:19:28 2009 (r189526) @@ -83,6 +83,7 @@ static struct option { { "file", 1, 'f' }, { "files-from", 1, 'T' }, { "format", 1, OPTION_FORMAT }, + { "format-options", 1, OPTION_FORMAT_OPTIONS }, { "gunzip", 0, 'z' }, { "gzip", 0, 'z' }, { "help", 0, OPTION_HELP }, Modified: head/usr.bin/tar/read.c ============================================================================== --- head/usr.bin/tar/read.c Sun Mar 8 06:14:33 2009 (r189525) +++ head/usr.bin/tar/read.c Sun Mar 8 06:19:28 2009 (r189526) @@ -132,6 +132,12 @@ read_archive(struct bsdtar *bsdtar, char DEFAULT_BYTES_PER_BLOCK)) bsdtar_errc(bsdtar, 1, 0, "Error opening archive: %s", archive_error_string(a)); + if (bsdtar->option_format_options != NULL) { + r = archive_read_set_options(a, bsdtar->option_format_options); + if (r != ARCHIVE_OK) + bsdtar_errc(bsdtar, 1, 0, "Error archive options: %s", + archive_error_string(a)); + } do_chdir(bsdtar); Modified: head/usr.bin/tar/write.c ============================================================================== --- head/usr.bin/tar/write.c Sun Mar 8 06:14:33 2009 (r189525) +++ head/usr.bin/tar/write.c Sun Mar 8 06:19:28 2009 (r189526) @@ -208,6 +208,12 @@ tar_mode_c(struct bsdtar *bsdtar) if (r != ARCHIVE_OK) bsdtar_errc(bsdtar, 1, 0, archive_error_string(a)); + if (bsdtar->option_format_options != NULL) { + r = archive_write_set_options(a, bsdtar->option_format_options); + if (r != ARCHIVE_OK) + bsdtar_errc(bsdtar, 1, 0, archive_error_string(a)); + } + write_archive(a, bsdtar); } @@ -294,6 +300,11 @@ tar_mode_r(struct bsdtar *bsdtar) } lseek(bsdtar->fd, end_offset, SEEK_SET); /* XXX check return val XXX */ archive_write_open_fd(a, bsdtar->fd); /* XXX check return val XXX */ + if (bsdtar->option_format_options != NULL) { + r = archive_write_set_options(a, bsdtar->option_format_options); + if (r != ARCHIVE_OK) + bsdtar_errc(bsdtar, 1, 0, archive_error_string(a)); + } write_archive(a, bsdtar); /* XXX check return val XXX */ @@ -310,6 +321,7 @@ tar_mode_u(struct bsdtar *bsdtar) int format; struct archive_dir_entry *p; struct archive_dir archive_dir; + int r; bsdtar->archive_dir = &archive_dir; memset(&archive_dir, 0, sizeof(archive_dir)); @@ -374,6 +386,11 @@ tar_mode_u(struct bsdtar *bsdtar) lseek(bsdtar->fd, end_offset, SEEK_SET); ftruncate(bsdtar->fd, end_offset); archive_write_open_fd(a, bsdtar->fd); + if (bsdtar->option_format_options != NULL) { + r = archive_write_set_options(a, bsdtar->option_format_options); + if (r != ARCHIVE_OK) + bsdtar_errc(bsdtar, 1, 0, archive_error_string(a)); + } write_archive(a, bsdtar); From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 06:20:35 2009 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 8B1F9106566C; Sun, 8 Mar 2009 06:20:35 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 79DB68FC14; Sun, 8 Mar 2009 06:20:35 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n286KZkL074698; Sun, 8 Mar 2009 06:20:35 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n286KZBd074697; Sun, 8 Mar 2009 06:20:35 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903080620.n286KZBd074697@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Mar 2009 06:20: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: r189527 - head/usr.bin/tar 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 Mar 2009 06:20:35 -0000 Author: kientzle Date: Sun Mar 8 06:20:35 2009 New Revision: 189527 URL: http://svn.freebsd.org/changeset/base/189527 Log: Update version to 2.6.901a to indicate this is synced up with r745 of libarchive.googlecode.com (except for the lzma/xz support). Modified: head/usr.bin/tar/Makefile Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Sun Mar 8 06:19:28 2009 (r189526) +++ head/usr.bin/tar/Makefile Sun Mar 8 06:20:35 2009 (r189527) @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= bsdtar -BSDTAR_VERSION_STRING=2.5.903a +BSDTAR_VERSION_STRING=2.6.901a SRCS= bsdtar.c cmdline.c getdate.c matching.c read.c siginfo.c subst.c tree.c util.c write.c WARNS?= 5 DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ} From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 06:56:14 2009 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 99916106564A; Sun, 8 Mar 2009 06:56:14 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A13E8FC08; Sun, 8 Mar 2009 06:56:14 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n286uEJ9075434; Sun, 8 Mar 2009 06:56:14 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n286uEBh075431; Sun, 8 Mar 2009 06:56:14 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903080656.n286uEBh075431@svn.freebsd.org> From: Andrew Thompson Date: Sun, 8 Mar 2009 06:56: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: r189528 - head/sys/dev/usb/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 Mar 2009 06:56:15 -0000 Author: thompsa Date: Sun Mar 8 06:56:13 2009 New Revision: 189528 URL: http://svn.freebsd.org/changeset/base/189528 Log: Move m_getcl() into its own function. This also fixes a bug where the m_adj for ETHER_ALIGN was having no effect since m_len had not been set. Modified: head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/net/usb_ethernet.c head/sys/dev/usb/net/usb_ethernet.h Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Sun Mar 8 06:20:35 2009 (r189527) +++ head/sys/dev/usb/net/if_cdce.c Sun Mar 8 06:56:13 2009 (r189528) @@ -665,13 +665,10 @@ cdce_bulk_read_callback(struct usb2_xfer */ for (x = 0; x != 1; x++) { if (sc->sc_rx_buf[x] == NULL) { - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = usb2_ether_newbuf(); if (m == NULL) goto tr_stall; sc->sc_rx_buf[x] = m; - /* adjust for ethernet */ - m->m_len = m->m_pkthdr.len = MCLBYTES; - m_adj(m, ETHER_ALIGN); } else { m = sc->sc_rx_buf[x]; } Modified: head/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.c Sun Mar 8 06:20:35 2009 (r189527) +++ head/sys/dev/usb/net/usb_ethernet.c Sun Mar 8 06:56:13 2009 (r189528) @@ -512,6 +512,20 @@ static moduledata_t usb2_ether_mod = { 0 }; +struct mbuf * +usb2_ether_newbuf(void) +{ + struct mbuf *m_new; + + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m_new == NULL) + return (NULL); + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + + m_adj(m_new, ETHER_ALIGN); + return (m_new); +} + int usb2_ether_rxmbuf(struct usb2_ether *ue, struct mbuf *m, unsigned int len) @@ -539,16 +553,15 @@ usb2_ether_rxbuf(struct usb2_ether *ue, UE_LOCK_ASSERT(ue, MA_OWNED); - if (len < ETHER_HDR_LEN || len > MCLBYTES) + if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) return (1); - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = usb2_ether_newbuf(); if (m == NULL) { ifp->if_ierrors++; return (ENOMEM); } - m_adj(m, ETHER_ALIGN); usb2_copy_out(pc, offset, mtod(m, uint8_t *), len); /* finalize mbuf */ Modified: head/sys/dev/usb/net/usb_ethernet.h ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.h Sun Mar 8 06:20:35 2009 (r189527) +++ head/sys/dev/usb/net/usb_ethernet.h Sun Mar 8 06:56:13 2009 (r189528) @@ -111,6 +111,7 @@ void *usb2_ether_getsc(struct usb2_ethe int usb2_ether_ifattach(struct usb2_ether *); void usb2_ether_ifdetach(struct usb2_ether *); int usb2_ether_ioctl(struct ifnet *, u_long, caddr_t); +struct mbuf *usb2_ether_newbuf(void); int usb2_ether_rxmbuf(struct usb2_ether *, struct mbuf *, unsigned int); int usb2_ether_rxbuf(struct usb2_ether *, From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 10:58:38 2009 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 9DD7B1065680; Sun, 8 Mar 2009 10:58:38 +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 8935A8FC1C; Sun, 8 Mar 2009 10:58:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28AwcNY081581; Sun, 8 Mar 2009 10:58:38 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28AwcKj081572; Sun, 8 Mar 2009 10:58:38 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903081058.n28AwcKj081572@svn.freebsd.org> From: Robert Watson Date: Sun, 8 Mar 2009 10:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189529 - in head/sys: kern security/audit security/mac security/mac_stub security/mac_test 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 Mar 2009 10:58:39 -0000 Author: rwatson Date: Sun Mar 8 10:58:37 2009 New Revision: 189529 URL: http://svn.freebsd.org/changeset/base/189529 Log: Improve the consistency of MAC Framework and MAC policy entry point naming by renaming certain "proc" entry points to "cred" entry points, reflecting their manipulation of credentials. For some entry points, the process was passed into the framework but not into policies; in these cases, stop passing in the process since we don't need it. mac_proc_check_setaudit -> mac_cred_check_setaudit mac_proc_check_setaudit_addr -> mac_cred_check_setaudit_addr mac_proc_check_setauid -> mac_cred_check_setauid mac_proc_check_setegid -> mac_cred_check_setegid mac_proc_check_seteuid -> mac_cred_check_seteuid mac_proc_check_setgid -> mac_cred_check_setgid mac_proc_check_setgroups -> mac_cred_ceck_setgroups mac_proc_check_setregid -> mac_cred_check_setregid mac_proc_check_setresgid -> mac_cred_check_setresgid mac_proc_check_setresuid -> mac_cred_check_setresuid mac_proc_check_setreuid -> mac_cred_check_setreuid mac_proc_check_setuid -> mac_cred_check_setuid Obtained from: TrustedBSD Project Sponsored by: Google, Inc. Modified: head/sys/kern/kern_prot.c head/sys/security/audit/audit_syscalls.c head/sys/security/mac/mac_audit.c head/sys/security/mac/mac_cred.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_framework.h head/sys/security/mac/mac_policy.h head/sys/security/mac/mac_process.c head/sys/security/mac_stub/mac_stub.c head/sys/security/mac_test/mac_test.c Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/kern/kern_prot.c Sun Mar 8 10:58:37 2009 (r189529) @@ -489,7 +489,7 @@ setuid(struct thread *td, struct setuid_ oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setuid(p, oldcred, uid); + error = mac_cred_check_setuid(oldcred, uid); if (error) goto fail; #endif @@ -601,7 +601,7 @@ seteuid(struct thread *td, struct seteui oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_seteuid(p, oldcred, euid); + error = mac_cred_check_seteuid(oldcred, euid); if (error) goto fail; #endif @@ -654,7 +654,7 @@ setgid(struct thread *td, struct setgid_ oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setgid(p, oldcred, gid); + error = mac_cred_check_setgid(oldcred, gid); if (error) goto fail; #endif @@ -753,7 +753,7 @@ setegid(struct thread *td, struct setegi oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setegid(p, oldcred, egid); + error = mac_cred_check_setegid(oldcred, egid); if (error) goto fail; #endif @@ -815,7 +815,7 @@ kern_setgroups(struct thread *td, u_int oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setgroups(p, oldcred, ngrp, groups); + error = mac_cred_check_setgroups(oldcred, ngrp, groups); if (error) goto fail; #endif @@ -880,7 +880,7 @@ setreuid(register struct thread *td, str oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setreuid(p, oldcred, ruid, euid); + error = mac_cred_check_setreuid(oldcred, ruid, euid); if (error) goto fail; #endif @@ -945,7 +945,7 @@ setregid(register struct thread *td, str oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setregid(p, oldcred, rgid, egid); + error = mac_cred_check_setregid(oldcred, rgid, egid); if (error) goto fail; #endif @@ -1016,7 +1016,7 @@ setresuid(register struct thread *td, st oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setresuid(p, oldcred, ruid, euid, suid); + error = mac_cred_check_setresuid(oldcred, ruid, euid, suid); if (error) goto fail; #endif @@ -1093,7 +1093,7 @@ setresgid(register struct thread *td, st oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setresgid(p, oldcred, rgid, egid, sgid); + error = mac_cred_check_setresgid(oldcred, rgid, egid, sgid); if (error) goto fail; #endif Modified: head/sys/security/audit/audit_syscalls.c ============================================================================== --- head/sys/security/audit/audit_syscalls.c Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/audit/audit_syscalls.c Sun Mar 8 10:58:37 2009 (r189529) @@ -474,7 +474,7 @@ setauid(struct thread *td, struct setaui oldcred = td->td_proc->p_ucred; crcopy(newcred, oldcred); #ifdef MAC - error = mac_proc_check_setauid(oldcred, id); + error = mac_cred_check_setauid(oldcred, id); if (error) goto fail; #endif @@ -539,7 +539,7 @@ setaudit(struct thread *td, struct setau oldcred = td->td_proc->p_ucred; crcopy(newcred, oldcred); #ifdef MAC - error = mac_proc_check_setaudit(oldcred, &ai); + error = mac_cred_check_setaudit(oldcred, &ai); if (error) goto fail; #endif @@ -602,7 +602,7 @@ setaudit_addr(struct thread *td, struct oldcred = td->td_proc->p_ucred; crcopy(newcred, oldcred); #ifdef MAC - error = mac_proc_check_setaudit_addr(oldcred, &aia); + error = mac_cred_check_setaudit_addr(oldcred, &aia); if (error) goto fail; #endif Modified: head/sys/security/mac/mac_audit.c ============================================================================== --- head/sys/security/mac/mac_audit.c Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/mac/mac_audit.c Sun Mar 8 10:58:37 2009 (r189529) @@ -58,43 +58,43 @@ __FBSDID("$FreeBSD$"); #include #include -MAC_CHECK_PROBE_DEFINE2(proc_check_setaudit, "struct ucred *", +MAC_CHECK_PROBE_DEFINE2(cred_check_setaudit, "struct ucred *", "struct auditinfo *"); int -mac_proc_check_setaudit(struct ucred *cred, struct auditinfo *ai) +mac_cred_check_setaudit(struct ucred *cred, struct auditinfo *ai) { int error; - MAC_CHECK(proc_check_setaudit, cred, ai); - MAC_CHECK_PROBE2(proc_check_setaudit, error, cred, ai); + MAC_CHECK(cred_check_setaudit, cred, ai); + MAC_CHECK_PROBE2(cred_check_setaudit, error, cred, ai); return (error); } -MAC_CHECK_PROBE_DEFINE2(proc_check_setaudit_addr, "struct ucred *", +MAC_CHECK_PROBE_DEFINE2(cred_check_setaudit_addr, "struct ucred *", "struct auditinfo_addr *"); int -mac_proc_check_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia) +mac_cred_check_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia) { int error; - MAC_CHECK(proc_check_setaudit_addr, cred, aia); - MAC_CHECK_PROBE2(proc_check_setaudit_addr, error, cred, aia); + MAC_CHECK(cred_check_setaudit_addr, cred, aia); + MAC_CHECK_PROBE2(cred_check_setaudit_addr, error, cred, aia); return (error); } -MAC_CHECK_PROBE_DEFINE2(proc_check_setauid, "struct ucred *", "uid_t"); +MAC_CHECK_PROBE_DEFINE2(cred_check_setauid, "struct ucred *", "uid_t"); int -mac_proc_check_setauid(struct ucred *cred, uid_t auid) +mac_cred_check_setauid(struct ucred *cred, uid_t auid) { int error; - MAC_CHECK(proc_check_setauid, cred, auid); - MAC_CHECK_PROBE2(proc_check_setauid, error, cred, auid); + MAC_CHECK(cred_check_setauid, cred, auid); + MAC_CHECK_PROBE2(cred_check_setauid, error, cred, auid); return (error); } Modified: head/sys/security/mac/mac_cred.c ============================================================================== --- head/sys/security/mac/mac_cred.c Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/mac/mac_cred.c Sun Mar 8 10:58:37 2009 (r189529) @@ -211,6 +211,132 @@ mac_cred_check_relabel(struct ucred *cre return (error); } +MAC_CHECK_PROBE_DEFINE2(cred_check_setuid, "struct ucred *", "uid_t"); + +int +mac_cred_check_setuid(struct ucred *cred, uid_t uid) +{ + int error; + + MAC_CHECK(cred_check_setuid, cred, uid); + MAC_CHECK_PROBE2(cred_check_setuid, error, cred, uid); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE2(cred_check_seteuid, "struct ucred *", "uid_t"); + +int +mac_cred_check_seteuid(struct ucred *cred, uid_t euid) +{ + int error; + + MAC_CHECK(cred_check_seteuid, cred, euid); + MAC_CHECK_PROBE2(cred_check_seteuid, error, cred, euid); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE2(cred_check_setgid, "struct ucred *", "gid_t"); + +int +mac_cred_check_setgid(struct ucred *cred, gid_t gid) +{ + int error; + + MAC_CHECK(cred_check_setgid, cred, gid); + MAC_CHECK_PROBE2(cred_check_setgid, error, cred, gid); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE2(cred_check_setegid, "struct ucred *", "gid_t"); + +int +mac_cred_check_setegid(struct ucred *cred, gid_t egid) +{ + int error; + + MAC_CHECK(cred_check_setegid, cred, egid); + MAC_CHECK_PROBE2(cred_check_setegid, error, cred, egid); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE3(cred_check_setgroups, "struct ucred *", "int", + "gid_t *"); + +int +mac_cred_check_setgroups(struct ucred *cred, int ngroups, gid_t *gidset) +{ + int error; + + MAC_CHECK(cred_check_setgroups, cred, ngroups, gidset); + MAC_CHECK_PROBE3(cred_check_setgroups, error, cred, ngroups, gidset); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE3(cred_check_setreuid, "struct ucred *", "uid_t", + "uid_t"); + +int +mac_cred_check_setreuid(struct ucred *cred, uid_t ruid, uid_t euid) +{ + int error; + + MAC_CHECK(cred_check_setreuid, cred, ruid, euid); + MAC_CHECK_PROBE3(cred_check_setreuid, error, cred, ruid, euid); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE3(cred_check_setregid, "struct ucred *", "gid_t", + "gid_t"); + +int +mac_cred_check_setregid(struct ucred *cred, gid_t rgid, gid_t egid) +{ + int error; + + MAC_CHECK(cred_check_setregid, cred, rgid, egid); + MAC_CHECK_PROBE3(cred_check_setregid, error, cred, rgid, egid); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE4(cred_check_setresuid, "struct ucred *", "uid_t", + "uid_t", "uid_t"); + +int +mac_cred_check_setresuid(struct ucred *cred, uid_t ruid, uid_t euid, + uid_t suid) +{ + int error; + + MAC_CHECK(cred_check_setresuid, cred, ruid, euid, suid); + MAC_CHECK_PROBE4(cred_check_setresuid, error, cred, ruid, euid, + suid); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE4(cred_check_setresgid, "struct ucred *", "gid_t", + "gid_t", "gid_t"); + +int +mac_cred_check_setresgid(struct ucred *cred, gid_t rgid, gid_t egid, + gid_t sgid) +{ + int error; + + MAC_CHECK(cred_check_setresgid, cred, rgid, egid, sgid); + MAC_CHECK_PROBE4(cred_check_setresgid, error, cred, rgid, egid, + sgid); + + return (error); +} + MAC_CHECK_PROBE_DEFINE2(cred_check_visible, "struct ucred *", "struct ucred *"); Modified: head/sys/security/mac/mac_framework.c ============================================================================== --- head/sys/security/mac/mac_framework.c Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/mac/mac_framework.c Sun Mar 8 10:58:37 2009 (r189529) @@ -17,6 +17,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: Modified: head/sys/security/mac/mac_framework.h ============================================================================== --- head/sys/security/mac/mac_framework.h Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/mac/mac_framework.h Sun Mar 8 10:58:37 2009 (r189529) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002, 2007-2008 Robert N. M. Watson + * Copyright (c) 1999-2002, 2007-2009 Robert N. M. Watson * Copyright (c) 2001-2005 Networks Associates Technology, Inc. * Copyright (c) 2005-2006 SPARTA, Inc. * All rights reserved. @@ -14,6 +14,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -105,6 +108,22 @@ void mac_bpfdesc_destroy(struct bpf_d *) void mac_bpfdesc_init(struct bpf_d *); void mac_cred_associate_nfsd(struct ucred *cred); +int mac_cred_check_setaudit(struct ucred *cred, struct auditinfo *ai); +int mac_cred_check_setaudit_addr(struct ucred *cred, + struct auditinfo_addr *aia); +int mac_cred_check_setauid(struct ucred *cred, uid_t auid); +int mac_cred_check_setegid(struct ucred *cred, gid_t egid); +int mac_cred_check_seteuid(struct ucred *cred, uid_t euid); +int mac_cred_check_setgid(struct ucred *cred, gid_t gid); +int mac_cred_check_setgroups(struct ucred *cred, int ngroups, + gid_t *gidset); +int mac_cred_check_setregid(struct ucred *cred, gid_t rgid, gid_t egid); +int mac_cred_check_setresgid(struct ucred *cred, gid_t rgid, gid_t egid, + gid_t sgid); +int mac_cred_check_setresuid(struct ucred *cred, uid_t ruid, uid_t euid, + uid_t suid); +int mac_cred_check_setreuid(struct ucred *cred, uid_t ruid, uid_t euid); +int mac_cred_check_setuid(struct ucred *cred, uid_t uid); int mac_cred_check_visible(struct ucred *cr1, struct ucred *cr2); void mac_cred_copy(struct ucred *cr1, struct ucred *cr2); void mac_cred_create_init(struct ucred *cred); @@ -233,28 +252,6 @@ int mac_priv_grant(struct ucred *cred, i int mac_proc_check_debug(struct ucred *cred, struct proc *p); int mac_proc_check_sched(struct ucred *cred, struct proc *p); -int mac_proc_check_setaudit(struct ucred *cred, struct auditinfo *ai); -int mac_proc_check_setaudit_addr(struct ucred *cred, - struct auditinfo_addr *aia); -int mac_proc_check_setauid(struct ucred *cred, uid_t auid); -int mac_proc_check_setegid(struct proc *p, struct ucred *cred, - gid_t egid); -int mac_proc_check_seteuid(struct proc *p, struct ucred *cred, - uid_t euid); -int mac_proc_check_setgid(struct proc *p, struct ucred *cred, - gid_t gid); -int mac_proc_check_setgroups(struct proc *p, struct ucred *cred, - int ngroups, gid_t *gidset); -int mac_proc_check_setregid(struct proc *p, struct ucred *cred, - gid_t rgid, gid_t egid); -int mac_proc_check_setresgid(struct proc *p, struct ucred *cred, - gid_t rgid, gid_t egid, gid_t sgid); -int mac_proc_check_setresuid(struct proc *p, struct ucred *cred, - uid_t ruid, uid_t euid, uid_t suid); -int mac_proc_check_setreuid(struct proc *p, struct ucred *cred, - uid_t ruid, uid_t euid); -int mac_proc_check_setuid(struct proc *p, struct ucred *cred, - uid_t uid); int mac_proc_check_signal(struct ucred *cred, struct proc *p, int signum); int mac_proc_check_wait(struct ucred *cred, struct proc *p); Modified: head/sys/security/mac/mac_policy.h ============================================================================== --- head/sys/security/mac/mac_policy.h Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/mac/mac_policy.h Sun Mar 8 10:58:37 2009 (r189529) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002, 2007-2008 Robert N. M. Watson + * Copyright (c) 1999-2002, 2007-2009 Robert N. M. Watson * Copyright (c) 2001-2005 Networks Associates Technology, Inc. * Copyright (c) 2005-2006 SPARTA, Inc. * Copyright (c) 2008 Apple Inc. @@ -15,6 +15,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -132,6 +135,25 @@ typedef void (*mpo_bpfdesc_init_label_t) typedef void (*mpo_cred_associate_nfsd_t)(struct ucred *cred); typedef int (*mpo_cred_check_relabel_t)(struct ucred *cred, struct label *newlabel); +typedef int (*mpo_cred_check_setaudit_t)(struct ucred *cred, + struct auditinfo *ai); +typedef int (*mpo_cred_check_setaudit_addr_t)(struct ucred *cred, + struct auditinfo_addr *aia); +typedef int (*mpo_cred_check_setauid_t)(struct ucred *cred, uid_t auid); +typedef int (*mpo_cred_check_setegid_t)(struct ucred *cred, gid_t egid); +typedef int (*mpo_cred_check_seteuid_t)(struct ucred *cred, uid_t euid); +typedef int (*mpo_cred_check_setgid_t)(struct ucred *cred, gid_t gid); +typedef int (*mpo_cred_check_setgroups_t)(struct ucred *cred, int ngroups, + gid_t *gidset); +typedef int (*mpo_cred_check_setregid_t)(struct ucred *cred, gid_t rgid, + gid_t egid); +typedef int (*mpo_cred_check_setresgid_t)(struct ucred *cred, gid_t rgid, + gid_t egid, gid_t sgid); +typedef int (*mpo_cred_check_setresuid_t)(struct ucred *cred, uid_t ruid, + uid_t euid, uid_t suid); +typedef int (*mpo_cred_check_setreuid_t)(struct ucred *cred, uid_t ruid, + uid_t euid); +typedef int (*mpo_cred_check_setuid_t)(struct ucred *cred, uid_t uid); typedef int (*mpo_cred_check_visible_t)(struct ucred *cr1, struct ucred *cr2); typedef void (*mpo_cred_copy_label_t)(struct label *src, @@ -353,25 +375,6 @@ typedef int (*mpo_proc_check_debug_t)(st struct proc *p); typedef int (*mpo_proc_check_sched_t)(struct ucred *cred, struct proc *p); -typedef int (*mpo_proc_check_setaudit_t)(struct ucred *cred, - struct auditinfo *ai); -typedef int (*mpo_proc_check_setaudit_addr_t)(struct ucred *cred, - struct auditinfo_addr *aia); -typedef int (*mpo_proc_check_setauid_t)(struct ucred *cred, uid_t auid); -typedef int (*mpo_proc_check_setegid_t)(struct ucred *cred, gid_t egid); -typedef int (*mpo_proc_check_seteuid_t)(struct ucred *cred, uid_t euid); -typedef int (*mpo_proc_check_setgid_t)(struct ucred *cred, gid_t gid); -typedef int (*mpo_proc_check_setgroups_t)(struct ucred *cred, int ngroups, - gid_t *gidset); -typedef int (*mpo_proc_check_setregid_t)(struct ucred *cred, gid_t rgid, - gid_t egid); -typedef int (*mpo_proc_check_setresgid_t)(struct ucred *cred, gid_t rgid, - gid_t egid, gid_t sgid); -typedef int (*mpo_proc_check_setresuid_t)(struct ucred *cred, uid_t ruid, - uid_t euid, uid_t suid); -typedef int (*mpo_proc_check_setreuid_t)(struct ucred *cred, uid_t ruid, - uid_t euid); -typedef int (*mpo_proc_check_setuid_t)(struct ucred *cred, uid_t uid); typedef int (*mpo_proc_check_signal_t)(struct ucred *cred, struct proc *proc, int signum); typedef int (*mpo_proc_check_wait_t)(struct ucred *cred, @@ -679,6 +682,18 @@ struct mac_policy_ops { mpo_cred_associate_nfsd_t mpo_cred_associate_nfsd; mpo_cred_check_relabel_t mpo_cred_check_relabel; + mpo_cred_check_setaudit_t mpo_cred_check_setaudit; + mpo_cred_check_setaudit_addr_t mpo_cred_check_setaudit_addr; + mpo_cred_check_setauid_t mpo_cred_check_setauid; + mpo_cred_check_setuid_t mpo_cred_check_setuid; + mpo_cred_check_seteuid_t mpo_cred_check_seteuid; + mpo_cred_check_setgid_t mpo_cred_check_setgid; + mpo_cred_check_setegid_t mpo_cred_check_setegid; + mpo_cred_check_setgroups_t mpo_cred_check_setgroups; + mpo_cred_check_setreuid_t mpo_cred_check_setreuid; + mpo_cred_check_setregid_t mpo_cred_check_setregid; + mpo_cred_check_setresuid_t mpo_cred_check_setresuid; + mpo_cred_check_setresgid_t mpo_cred_check_setresgid; mpo_cred_check_visible_t mpo_cred_check_visible; mpo_cred_copy_label_t mpo_cred_copy_label; mpo_cred_create_swapper_t mpo_cred_create_swapper; @@ -798,18 +813,6 @@ struct mac_policy_ops { mpo_proc_check_debug_t mpo_proc_check_debug; mpo_proc_check_sched_t mpo_proc_check_sched; - mpo_proc_check_setaudit_t mpo_proc_check_setaudit; - mpo_proc_check_setaudit_addr_t mpo_proc_check_setaudit_addr; - mpo_proc_check_setauid_t mpo_proc_check_setauid; - mpo_proc_check_setuid_t mpo_proc_check_setuid; - mpo_proc_check_seteuid_t mpo_proc_check_seteuid; - mpo_proc_check_setgid_t mpo_proc_check_setgid; - mpo_proc_check_setegid_t mpo_proc_check_setegid; - mpo_proc_check_setgroups_t mpo_proc_check_setgroups; - mpo_proc_check_setreuid_t mpo_proc_check_setreuid; - mpo_proc_check_setregid_t mpo_proc_check_setregid; - mpo_proc_check_setresuid_t mpo_proc_check_setresuid; - mpo_proc_check_setresgid_t mpo_proc_check_setresgid; mpo_proc_check_signal_t mpo_proc_check_signal; mpo_proc_check_wait_t mpo_proc_check_wait; mpo_proc_destroy_label_t mpo_proc_destroy_label; Modified: head/sys/security/mac/mac_process.c ============================================================================== --- head/sys/security/mac/mac_process.c Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/mac/mac_process.c Sun Mar 8 10:58:37 2009 (r189529) @@ -2,7 +2,6 @@ * Copyright (c) 1999-2002, 2008-2009 Robert N. M. Watson * Copyright (c) 2001 Ilmar S. Habibulin * Copyright (c) 2001-2003 Networks Associates Technology, Inc. - * Copyright (c) 2005 Samy Al Bahra * Copyright (c) 2006 SPARTA, Inc. * Copyright (c) 2008 Apple Inc. * All rights reserved. @@ -424,153 +423,6 @@ mac_proc_check_signal(struct ucred *cred return (error); } -MAC_CHECK_PROBE_DEFINE2(proc_check_setuid, "struct ucred *", "uid_t"); - -int -mac_proc_check_setuid(struct proc *p, struct ucred *cred, uid_t uid) -{ - int error; - - PROC_LOCK_ASSERT(p, MA_OWNED); - - MAC_CHECK(proc_check_setuid, cred, uid); - MAC_CHECK_PROBE2(proc_check_setuid, error, cred, uid); - - return (error); -} - -MAC_CHECK_PROBE_DEFINE2(proc_check_seteuid, "struct ucred *", "uid_t"); - -int -mac_proc_check_seteuid(struct proc *p, struct ucred *cred, uid_t euid) -{ - int error; - - PROC_LOCK_ASSERT(p, MA_OWNED); - - MAC_CHECK(proc_check_seteuid, cred, euid); - MAC_CHECK_PROBE2(proc_check_seteuid, error, cred, euid); - - return (error); -} - -MAC_CHECK_PROBE_DEFINE2(proc_check_setgid, "struct ucred *", "gid_t"); - -int -mac_proc_check_setgid(struct proc *p, struct ucred *cred, gid_t gid) -{ - int error; - - PROC_LOCK_ASSERT(p, MA_OWNED); - - MAC_CHECK(proc_check_setgid, cred, gid); - MAC_CHECK_PROBE2(proc_check_setgid, error, cred, gid); - - return (error); -} - -MAC_CHECK_PROBE_DEFINE2(proc_check_setegid, "struct ucred *", "gid_t"); - -int -mac_proc_check_setegid(struct proc *p, struct ucred *cred, gid_t egid) -{ - int error; - - PROC_LOCK_ASSERT(p, MA_OWNED); - - MAC_CHECK(proc_check_setegid, cred, egid); - MAC_CHECK_PROBE2(proc_check_setegid, error, cred, egid); - - return (error); -} - -MAC_CHECK_PROBE_DEFINE3(proc_check_setgroups, "struct ucred *", "int", - "gid_t *"); - -int -mac_proc_check_setgroups(struct proc *p, struct ucred *cred, int ngroups, - gid_t *gidset) -{ - int error; - - PROC_LOCK_ASSERT(p, MA_OWNED); - - MAC_CHECK(proc_check_setgroups, cred, ngroups, gidset); - MAC_CHECK_PROBE3(proc_check_setgroups, error, cred, ngroups, gidset); - - return (error); -} - -MAC_CHECK_PROBE_DEFINE3(proc_check_setreuid, "struct ucred *", "uid_t", - "uid_t"); - -int -mac_proc_check_setreuid(struct proc *p, struct ucred *cred, uid_t ruid, - uid_t euid) -{ - int error; - - PROC_LOCK_ASSERT(p, MA_OWNED); - - MAC_CHECK(proc_check_setreuid, cred, ruid, euid); - MAC_CHECK_PROBE3(proc_check_setreuid, error, cred, ruid, euid); - - return (error); -} - -MAC_CHECK_PROBE_DEFINE3(proc_check_setregid, "struct ucred *", "gid_t", - "gid_t"); - -int -mac_proc_check_setregid(struct proc *proc, struct ucred *cred, gid_t rgid, - gid_t egid) -{ - int error; - - PROC_LOCK_ASSERT(proc, MA_OWNED); - - MAC_CHECK(proc_check_setregid, cred, rgid, egid); - MAC_CHECK_PROBE3(proc_check_setregid, error, cred, rgid, egid); - - return (error); -} - -MAC_CHECK_PROBE_DEFINE4(proc_check_setresuid, "struct ucred *", "uid_t", - "uid_t", "uid_t"); - -int -mac_proc_check_setresuid(struct proc *p, struct ucred *cred, uid_t ruid, - uid_t euid, uid_t suid) -{ - int error; - - PROC_LOCK_ASSERT(p, MA_OWNED); - - MAC_CHECK(proc_check_setresuid, cred, ruid, euid, suid); - MAC_CHECK_PROBE4(proc_check_setresuid, error, cred, ruid, euid, - suid); - - return (error); -} - -MAC_CHECK_PROBE_DEFINE4(proc_check_setresgid, "struct ucred *", "gid_t", - "gid_t", "gid_t"); - -int -mac_proc_check_setresgid(struct proc *p, struct ucred *cred, gid_t rgid, - gid_t egid, gid_t sgid) -{ - int error; - - PROC_LOCK_ASSERT(p, MA_OWNED); - - MAC_CHECK(proc_check_setresgid, cred, rgid, egid, sgid); - MAC_CHECK_PROBE4(proc_check_setresgid, error, cred, rgid, egid, - sgid); - - return (error); -} - MAC_CHECK_PROBE_DEFINE2(proc_check_wait, "struct ucred *", "struct proc *"); int Modified: head/sys/security/mac_stub/mac_stub.c ============================================================================== --- head/sys/security/mac_stub/mac_stub.c Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/mac_stub/mac_stub.c Sun Mar 8 10:58:37 2009 (r189529) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002, 2007-2008 Robert N. M. Watson + * Copyright (c) 1999-2002, 2007-2009 Robert N. M. Watson * Copyright (c) 2001-2005 McAfee, Inc. * Copyright (c) 2005-2006 SPARTA, Inc. * Copyright (c) 2008 Apple Inc. @@ -15,6 +15,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -199,6 +202,93 @@ stub_cred_check_relabel(struct ucred *cr } static int +stub_cred_check_setaudit(struct ucred *cred, struct auditinfo *ai) +{ + + return (0); +} + +static int +stub_cred_check_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia) +{ + + return (0); +} + +static int +stub_cred_check_setauid(struct ucred *cred, uid_t auid) +{ + + return (0); +} + +static int +stub_cred_check_setegid(struct ucred *cred, gid_t egid) +{ + + return (0); +} + +static int +stub_cred_check_seteuid(struct ucred *cred, uid_t euid) +{ + + return (0); +} + +static int +stub_cred_check_setgid(struct ucred *cred, gid_t gid) +{ + + return (0); +} + +static int +stub_cred_check_setgroups(struct ucred *cred, int ngroups, + gid_t *gidset) +{ + + return (0); +} + +static int +stub_cred_check_setregid(struct ucred *cred, gid_t rgid, gid_t egid) +{ + + return (0); +} + +static int +stub_cred_check_setresgid(struct ucred *cred, gid_t rgid, gid_t egid, + gid_t sgid) +{ + + return (0); +} + +static int +stub_cred_check_setresuid(struct ucred *cred, uid_t ruid, uid_t euid, + uid_t suid) +{ + + return (0); +} + +static int +stub_cred_check_setreuid(struct ucred *cred, uid_t ruid, uid_t euid) +{ + + return (0); +} + +static int +stub_cred_check_setuid(struct ucred *cred, uid_t uid) +{ + + return (0); +} + +static int stub_cred_check_visible(struct ucred *cr1, struct ucred *cr2) { @@ -701,93 +791,6 @@ stub_proc_check_sched(struct ucred *cred } static int -stub_proc_check_setaudit(struct ucred *cred, struct auditinfo *ai) -{ - - return (0); -} - -static int -stub_proc_check_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia) -{ - - return (0); -} - -static int -stub_proc_check_setauid(struct ucred *cred, uid_t auid) -{ - - return (0); -} - -static int -stub_proc_check_setegid(struct ucred *cred, gid_t egid) -{ - - return (0); -} - -static int -stub_proc_check_seteuid(struct ucred *cred, uid_t euid) -{ - - return (0); -} - -static int -stub_proc_check_setgid(struct ucred *cred, gid_t gid) -{ - - return (0); -} - -static int -stub_proc_check_setgroups(struct ucred *cred, int ngroups, - gid_t *gidset) -{ - - return (0); -} - -static int -stub_proc_check_setregid(struct ucred *cred, gid_t rgid, gid_t egid) -{ - - return (0); -} - -static int -stub_proc_check_setresgid(struct ucred *cred, gid_t rgid, gid_t egid, - gid_t sgid) -{ - - return (0); -} - -static int -stub_proc_check_setresuid(struct ucred *cred, uid_t ruid, uid_t euid, - uid_t suid) -{ - - return (0); -} - -static int -stub_proc_check_setreuid(struct ucred *cred, uid_t ruid, uid_t euid) -{ - - return (0); -} - -static int -stub_proc_check_setuid(struct ucred *cred, uid_t uid) -{ - - return (0); -} - -static int stub_proc_check_signal(struct ucred *cred, struct proc *p, int signum) { @@ -1541,6 +1544,18 @@ static struct mac_policy_ops stub_ops = .mpo_cred_associate_nfsd = stub_cred_associate_nfsd, .mpo_cred_check_relabel = stub_cred_check_relabel, + .mpo_cred_check_setaudit = stub_cred_check_setaudit, + .mpo_cred_check_setaudit_addr = stub_cred_check_setaudit_addr, + .mpo_cred_check_setauid = stub_cred_check_setauid, + .mpo_cred_check_setegid = stub_cred_check_setegid, + .mpo_cred_check_seteuid = stub_cred_check_seteuid, + .mpo_cred_check_setgid = stub_cred_check_setgid, + .mpo_cred_check_setgroups = stub_cred_check_setgroups, + .mpo_cred_check_setregid = stub_cred_check_setregid, + .mpo_cred_check_setresgid = stub_cred_check_setresgid, + .mpo_cred_check_setresuid = stub_cred_check_setresuid, + .mpo_cred_check_setreuid = stub_cred_check_setreuid, + .mpo_cred_check_setuid = stub_cred_check_setuid, .mpo_cred_check_visible = stub_cred_check_visible, .mpo_cred_copy_label = stub_copy_label, .mpo_cred_create_init = stub_cred_create_init, @@ -1660,18 +1675,6 @@ static struct mac_policy_ops stub_ops = .mpo_proc_check_debug = stub_proc_check_debug, .mpo_proc_check_sched = stub_proc_check_sched, - .mpo_proc_check_setaudit = stub_proc_check_setaudit, - .mpo_proc_check_setaudit_addr = stub_proc_check_setaudit_addr, - .mpo_proc_check_setauid = stub_proc_check_setauid, - .mpo_proc_check_setegid = stub_proc_check_setegid, - .mpo_proc_check_seteuid = stub_proc_check_seteuid, - .mpo_proc_check_setgid = stub_proc_check_setgid, - .mpo_proc_check_setgroups = stub_proc_check_setgroups, - .mpo_proc_check_setregid = stub_proc_check_setregid, - .mpo_proc_check_setresgid = stub_proc_check_setresgid, - .mpo_proc_check_setresuid = stub_proc_check_setresuid, - .mpo_proc_check_setreuid = stub_proc_check_setreuid, - .mpo_proc_check_setuid = stub_proc_check_setuid, .mpo_proc_check_signal = stub_proc_check_signal, .mpo_proc_check_wait = stub_proc_check_wait, Modified: head/sys/security/mac_test/mac_test.c ============================================================================== --- head/sys/security/mac_test/mac_test.c Sun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/mac_test/mac_test.c Sun Mar 8 10:58:37 2009 (r189529) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2002, 2007-2008 Robert N. M. Watson + * Copyright (c) 1999-2002, 2007-2009 Robert N. M. Watson * Copyright (c) 2001-2005 McAfee, Inc. * Copyright (c) 2006 SPARTA, Inc. * Copyright (c) 2008 Apple Inc. @@ -15,6 +15,9 @@ * This software was enhanced by SPARTA ISSO under SPAWAR contract * N66001-04-C-6019 ("SEFOS"). * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -220,6 +223,142 @@ test_cred_check_relabel(struct ucred *cr return (0); } +COUNTER_DECL(cred_check_setaudit); +static int +test_cred_check_setaudit(struct ucred *cred, struct auditinfo *ai) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + COUNTER_INC(cred_check_setaudit); + + return (0); +} + +COUNTER_DECL(cred_check_setaudit_addr); +static int +test_cred_check_setaudit_addr(struct ucred *cred, + struct auditinfo_addr *aia) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + COUNTER_INC(cred_check_setaudit_addr); + + return (0); +} + +COUNTER_DECL(cred_check_setauid); +static int +test_cred_check_setauid(struct ucred *cred, uid_t auid) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + COUNTER_INC(cred_check_setauid); + + return (0); +} + +COUNTER_DECL(cred_check_setegid); +static int +test_cred_check_setegid(struct ucred *cred, gid_t egid) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + COUNTER_INC(cred_check_setegid); + + return (0); +} + +COUNTER_DECL(proc_check_euid); +static int +test_cred_check_seteuid(struct ucred *cred, uid_t euid) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + COUNTER_INC(proc_check_euid); + + return (0); +} + +COUNTER_DECL(cred_check_setregid); +static int +test_cred_check_setregid(struct ucred *cred, gid_t rgid, gid_t egid) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + COUNTER_INC(cred_check_setregid); + + return (0); +} + +COUNTER_DECL(cred_check_setreuid); +static int +test_cred_check_setreuid(struct ucred *cred, uid_t ruid, uid_t euid) +{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 11:43:57 2009 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 602FF1065672; Sun, 8 Mar 2009 11:43:57 +0000 (UTC) (envelope-from gary.jennejohn@freenet.de) Received: from mout5.freenet.de (mout5.freenet.de [IPv6:2001:748:100:40::2:7]) by mx1.freebsd.org (Postfix) with ESMTP id E41668FC0A; Sun, 8 Mar 2009 11:43:56 +0000 (UTC) (envelope-from gary.jennejohn@freenet.de) Received: from [195.4.92.27] (helo=17.mx.freenet.de) by mout5.freenet.de with esmtpa (ID gary.jennejohn@freenet.de) (port 25) (Exim 4.69 #76) id 1LgHQB-0004l6-Ij; Sun, 08 Mar 2009 12:43:55 +0100 Received: from td057.t.pppool.de ([89.55.208.87]:21246 helo=ernst.jennejohn.org) by 17.mx.freenet.de with esmtpa (ID gary.jennejohn@freenet.de) (port 25) (Exim 4.69 #76) id 1LgHQB-00028O-AV; Sun, 08 Mar 2009 12:43:55 +0100 Date: Sun, 8 Mar 2009 12:43:54 +0100 From: Gary Jennejohn To: Robert Noland Message-ID: <20090308124354.1b564268@ernst.jennejohn.org> In-Reply-To: <200903072136.n27Lavnv063380@svn.freebsd.org> References: <200903072136.n27Lavnv063380@svn.freebsd.org> X-Mailer: Claws Mail 3.7.1 (GTK+ 2.14.7; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189499 - in head/sys: conf dev/drm modules/drm/radeon X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gary.jennejohn@freenet.de 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 Mar 2009 11:43:58 -0000 On Sat, 7 Mar 2009 21:36:57 +0000 (UTC) Robert Noland wrote: > Author: rnoland > Date: Sat Mar 7 21:36:57 2009 > New Revision: 189499 > URL: http://svn.freebsd.org/changeset/base/189499 > > Log: > Import support for ATI Radeon R600 and R700 series chips. > > Tested on an HD3850 (RV670) on loan from Warren Block. > > Currently, you need one of the following for this to be useful: > > x11-drivers/xf86-video-radeonhd-devel (not tested) > I tested this driver with radeon-drm-next-r6-7xx-030609-2.patch (the precursor to this commit) and it works OK. --- Gary Jennejohn From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 12:22:01 2009 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 28F21106566B; Sun, 8 Mar 2009 12:22:01 +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 16EA78FC1B; Sun, 8 Mar 2009 12:22:01 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28CM0QY083205; Sun, 8 Mar 2009 12:22:00 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28CM0IX083204; Sun, 8 Mar 2009 12:22:00 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903081222.n28CM0IX083204@svn.freebsd.org> From: Robert Watson Date: Sun, 8 Mar 2009 12:22: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: r189532 - head/sys/security/mac 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 Mar 2009 12:22:01 -0000 Author: rwatson Date: Sun Mar 8 12:22:00 2009 New Revision: 189532 URL: http://svn.freebsd.org/changeset/base/189532 Log: Rename 'ucred' argument to mac_socket_check_bind() to 'cred' to match other use of the same variable type. Obtained from: TrustedBSD Project Sponsored by: Google, Inc. Modified: head/sys/security/mac/mac_socket.c Modified: head/sys/security/mac/mac_socket.c ============================================================================== --- head/sys/security/mac/mac_socket.c Sun Mar 8 11:20:54 2009 (r189531) +++ head/sys/security/mac/mac_socket.c Sun Mar 8 12:22:00 2009 (r189532) @@ -301,15 +301,15 @@ MAC_CHECK_PROBE_DEFINE3(socket_check_bin "struct socket *", "struct sockaddr *"); int -mac_socket_check_bind(struct ucred *ucred, struct socket *so, +mac_socket_check_bind(struct ucred *cred, struct socket *so, struct sockaddr *sa) { int error; SOCK_LOCK_ASSERT(so); - MAC_CHECK(socket_check_bind, ucred, so, so->so_label, sa); - MAC_CHECK_PROBE3(socket_check_bind, error, ucred, so, sa); + MAC_CHECK(socket_check_bind, cred, so, so->so_label, sa); + MAC_CHECK_PROBE3(socket_check_bind, error, cred, so, sa); return (error); } From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 12:32:07 2009 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 09A331065670; Sun, 8 Mar 2009 12:32:07 +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 E8D858FC28; Sun, 8 Mar 2009 12:32:06 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28CW633083432; Sun, 8 Mar 2009 12:32:06 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28CW6hx083421; Sun, 8 Mar 2009 12:32:06 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903081232.n28CW6hx083421@svn.freebsd.org> From: Robert Watson Date: Sun, 8 Mar 2009 12:32: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: r189533 - in head/sys: kern security/mac security/mac_biba security/mac_bsdextended security/mac_lomac security/mac_mls security/mac_stub security/mac_test 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 Mar 2009 12:32:07 -0000 Author: rwatson Date: Sun Mar 8 12:32:06 2009 New Revision: 189533 URL: http://svn.freebsd.org/changeset/base/189533 Log: Remove 'uio' argument from MAC Framework and MAC policy entry points for extended attribute get/set; in the case of get an uninitialized user buffer was passed before the EA was retrieved, making it of relatively little use; the latter was simply unused by any policies. Obtained from: TrustedBSD Project Sponsored by: Google, Inc. Modified: head/sys/kern/vfs_extattr.c head/sys/security/mac/mac_framework.h head/sys/security/mac/mac_policy.h head/sys/security/mac/mac_vfs.c head/sys/security/mac_biba/mac_biba.c head/sys/security/mac_bsdextended/ugidfw_internal.h head/sys/security/mac_bsdextended/ugidfw_vnode.c head/sys/security/mac_lomac/mac_lomac.c head/sys/security/mac_mls/mac_mls.c head/sys/security/mac_stub/mac_stub.c head/sys/security/mac_test/mac_test.c Modified: head/sys/kern/vfs_extattr.c ============================================================================== --- head/sys/kern/vfs_extattr.c Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/kern/vfs_extattr.c Sun Mar 8 12:32:06 2009 (r189533) @@ -195,7 +195,7 @@ extattr_set_vp(struct vnode *vp, int att #ifdef MAC error = mac_vnode_check_setextattr(td->td_ucred, vp, attrnamespace, - attrname, &auio); + attrname); if (error) goto done; #endif @@ -373,7 +373,7 @@ extattr_get_vp(struct vnode *vp, int att #ifdef MAC error = mac_vnode_check_getextattr(td->td_ucred, vp, attrnamespace, - attrname, &auio); + attrname); if (error) goto done; #endif Modified: head/sys/security/mac/mac_framework.h ============================================================================== --- head/sys/security/mac/mac_framework.h Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac/mac_framework.h Sun Mar 8 12:32:06 2009 (r189533) @@ -85,7 +85,6 @@ struct pipepair; struct thread; struct timespec; struct ucred; -struct uio; struct vattr; struct vnode; struct vop_setlabel_args; @@ -377,7 +376,7 @@ int mac_vnode_check_exec(struct ucred *c int mac_vnode_check_getacl(struct ucred *cred, struct vnode *vp, acl_type_t type); int mac_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, - int attrnamespace, const char *name, struct uio *uio); + int attrnamespace, const char *name); int mac_vnode_check_link(struct ucred *cred, struct vnode *dvp, struct vnode *vp, struct componentname *cnp); int mac_vnode_check_listextattr(struct ucred *cred, struct vnode *vp, @@ -404,7 +403,7 @@ int mac_vnode_check_revoke(struct ucred int mac_vnode_check_setacl(struct ucred *cred, struct vnode *vp, acl_type_t type, struct acl *acl); int mac_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - int attrnamespace, const char *name, struct uio *uio); + int attrnamespace, const char *name); int mac_vnode_check_setflags(struct ucred *cred, struct vnode *vp, u_long flags); int mac_vnode_check_setmode(struct ucred *cred, struct vnode *vp, Modified: head/sys/security/mac/mac_policy.h ============================================================================== --- head/sys/security/mac/mac_policy.h Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac/mac_policy.h Sun Mar 8 12:32:06 2009 (r189533) @@ -97,7 +97,6 @@ struct sysctl_oid; struct sysctl_req; struct thread; struct ucred; -struct uio; struct vattr; struct vnode; @@ -557,7 +556,7 @@ typedef int (*mpo_vnode_check_getacl_t)( acl_type_t type); typedef int (*mpo_vnode_check_getextattr_t)(struct ucred *cred, struct vnode *vp, struct label *vplabel, - int attrnamespace, const char *name, struct uio *uio); + int attrnamespace, const char *name); typedef int (*mpo_vnode_check_link_t)(struct ucred *cred, struct vnode *dvp, struct label *dvplabel, struct vnode *vp, struct label *vplabel, @@ -606,7 +605,7 @@ typedef int (*mpo_vnode_check_setacl_t)( struct acl *acl); typedef int (*mpo_vnode_check_setextattr_t)(struct ucred *cred, struct vnode *vp, struct label *vplabel, - int attrnamespace, const char *name, struct uio *uio); + int attrnamespace, const char *name); typedef int (*mpo_vnode_check_setflags_t)(struct ucred *cred, struct vnode *vp, struct label *vplabel, u_long flags); typedef int (*mpo_vnode_check_setmode_t)(struct ucred *cred, Modified: head/sys/security/mac/mac_vfs.c ============================================================================== --- head/sys/security/mac/mac_vfs.c Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac/mac_vfs.c Sun Mar 8 12:32:06 2009 (r189533) @@ -506,14 +506,14 @@ MAC_CHECK_PROBE_DEFINE4(vnode_check_gete int mac_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, - int attrnamespace, const char *name, struct uio *uio) + int attrnamespace, const char *name) { int error; ASSERT_VOP_LOCKED(vp, "mac_vnode_check_getextattr"); MAC_CHECK(vnode_check_getextattr, cred, vp, vp->v_label, - attrnamespace, name, uio); + attrnamespace, name); MAC_CHECK_PROBE4(vnode_check_getextattr, error, cred, vp, attrnamespace, name); @@ -798,14 +798,14 @@ MAC_CHECK_PROBE_DEFINE4(vnode_check_sete int mac_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - int attrnamespace, const char *name, struct uio *uio) + int attrnamespace, const char *name) { int error; ASSERT_VOP_LOCKED(vp, "mac_vnode_check_setextattr"); MAC_CHECK(vnode_check_setextattr, cred, vp, vp->v_label, - attrnamespace, name, uio); + attrnamespace, name); MAC_CHECK_PROBE4(vnode_check_setextattr, error, cred, vp, attrnamespace, name); Modified: head/sys/security/mac_biba/mac_biba.c ============================================================================== --- head/sys/security/mac_biba/mac_biba.c Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac_biba/mac_biba.c Sun Mar 8 12:32:06 2009 (r189533) @@ -2775,8 +2775,7 @@ biba_vnode_check_getacl(struct ucred *cr static int biba_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { struct mac_biba *subj, *obj; @@ -3116,8 +3115,7 @@ biba_vnode_check_setacl(struct ucred *cr static int biba_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { struct mac_biba *subj, *obj; Modified: head/sys/security/mac_bsdextended/ugidfw_internal.h ============================================================================== --- head/sys/security/mac_bsdextended/ugidfw_internal.h Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac_bsdextended/ugidfw_internal.h Sun Mar 8 12:32:06 2009 (r189533) @@ -72,8 +72,7 @@ int ugidfw_vnode_check_exec(struct ucred int ugidfw_vnode_check_getacl(struct ucred *cred, struct vnode *vp, struct label *vplabel, acl_type_t type); int ugidfw_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio); + struct label *vplabel, int attrnamespace, const char *name); int ugidfw_vnode_check_link(struct ucred *cred, struct vnode *dvp, struct label *dvplabel, struct vnode *vp, struct label *label, struct componentname *cnp); @@ -98,8 +97,7 @@ int ugidfw_vnode_check_revoke(struct ucr int ugidfw_check_setacl_vnode(struct ucred *cred, struct vnode *vp, struct label *vplabel, acl_type_t type, struct acl *acl); int ugidfw_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio); + struct label *vplabel, int attrnamespace, const char *name); int ugidfw_vnode_check_setflags(struct ucred *cred, struct vnode *vp, struct label *vplabel, u_long flags); int ugidfw_vnode_check_setmode(struct ucred *cred, struct vnode *vp, Modified: head/sys/security/mac_bsdextended/ugidfw_vnode.c ============================================================================== --- head/sys/security/mac_bsdextended/ugidfw_vnode.c Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac_bsdextended/ugidfw_vnode.c Sun Mar 8 12:32:06 2009 (r189533) @@ -127,8 +127,7 @@ ugidfw_vnode_check_getacl(struct ucred * int ugidfw_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { return (ugidfw_check_vp(cred, vp, MBI_READ)); @@ -236,8 +235,7 @@ ugidfw_check_setacl_vnode(struct ucred * int ugidfw_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { return (ugidfw_check_vp(cred, vp, MBI_WRITE)); Modified: head/sys/security/mac_lomac/mac_lomac.c ============================================================================== --- head/sys/security/mac_lomac/mac_lomac.c Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac_lomac/mac_lomac.c Sun Mar 8 12:32:06 2009 (r189533) @@ -2631,8 +2631,7 @@ lomac_vnode_check_setacl(struct ucred *c static int lomac_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { struct mac_lomac *subj, *obj; Modified: head/sys/security/mac_mls/mac_mls.c ============================================================================== --- head/sys/security/mac_mls/mac_mls.c Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac_mls/mac_mls.c Sun Mar 8 12:32:06 2009 (r189533) @@ -2398,8 +2398,7 @@ mls_vnode_check_getacl(struct ucred *cre static int mls_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { struct mac_mls *subj, *obj; @@ -2739,8 +2738,7 @@ mls_vnode_check_setacl(struct ucred *cre static int mls_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { struct mac_mls *subj, *obj; Modified: head/sys/security/mac_stub/mac_stub.c ============================================================================== --- head/sys/security/mac_stub/mac_stub.c Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac_stub/mac_stub.c Sun Mar 8 12:32:06 2009 (r189533) @@ -1283,8 +1283,7 @@ stub_vnode_check_getacl(struct ucred *cr static int stub_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { return (0); @@ -1422,8 +1421,7 @@ stub_vnode_check_setacl(struct ucred *cr static int stub_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { return (0); Modified: head/sys/security/mac_test/mac_test.c ============================================================================== --- head/sys/security/mac_test/mac_test.c Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac_test/mac_test.c Sun Mar 8 12:32:06 2009 (r189533) @@ -2435,8 +2435,7 @@ test_vnode_check_getacl(struct ucred *cr COUNTER_DECL(vnode_check_getextattr); static int test_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { LABEL_CHECK(cred->cr_label, MAGIC_CRED); @@ -2642,8 +2641,7 @@ test_vnode_check_setacl(struct ucred *cr COUNTER_DECL(vnode_check_setextattr); static int test_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - struct label *vplabel, int attrnamespace, const char *name, - struct uio *uio) + struct label *vplabel, int attrnamespace, const char *name) { LABEL_CHECK(cred->cr_label, MAGIC_CRED); From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 14:28:41 2009 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 258DF1065670; Sun, 8 Mar 2009 14:28:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED94F8FC1E; Sun, 8 Mar 2009 14:28:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28ESeIT085547; Sun, 8 Mar 2009 14:28:40 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28ESeb6085546; Sun, 8 Mar 2009 14:28:40 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903081428.n28ESeb6085546@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 8 Mar 2009 14:28: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: r189534 - head/sbin/devd 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 Mar 2009 14:28:41 -0000 Author: kib Date: Sun Mar 8 14:28:40 2009 New Revision: 189534 URL: http://svn.freebsd.org/changeset/base/189534 Log: Document several notifications, among them are DEVFS, update to ifneti, coretemp and kern. The asmc(4) and zfs(5) are still not documented. Based on the patch by Roland Smith . MFC after: 1 week Modified: head/sbin/devd/devd.conf.5 Modified: head/sbin/devd/devd.conf.5 ============================================================================== --- head/sbin/devd/devd.conf.5 Sun Mar 8 12:32:06 2009 (r189533) +++ head/sbin/devd/devd.conf.5 Sun Mar 8 14:28:40 2009 (r189534) @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd October 25, 2006 +.Dd March 8, 2009 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -238,6 +238,10 @@ statement. .Ic Description .It Li bus Device name of parent bus. +.It Li cdev +Device node path if one is created by the +.Xr devfs 5 +filesystem. .It Li cisproduct CIS-product. .It Li cisvendor @@ -280,7 +284,7 @@ A partial list of systems, subsystems, a .Ic notify mechanism. .Pp -.Bl -tag -width ".Li IFNET" -compact +.Bl -tag -width ".Li coretemp" -compact .It Sy System .It Li ACPI Events related to the ACPI subsystem. @@ -313,6 +317,55 @@ took place. Carrier status changed to UP. .It Li LINK_DOWN Carrier status changed to DOWN. +.It Li ATTACH +The network inteface is attached to the system. +.It Li DETACH +The network inteface is detached from the system. +.El +.El +.It Li DEVFS +Events related to the +.Xr devfs 5 +filesystem. +.Bl -tag -width ".Sy Subsystem" -compact +.It Sy Subsystem +.It Li CDEV +.Bl -tag -width ".Li DESTROY" -compact +.It Sy Type +.It Li CREATE +The +.Xr devfs 5 +node is created. +.It Li DESTROY +The +.Xr devfs 5 +node is destroyed. +.El +.El +.It Li coretemp +Events related to the +.Xr coretemp 4 +device. +.Bl -tag -width ".Sy Subsystem" -compact +.It Sy Subsystem +.It Li Thermal +Notification that the CPU core has reached critical temperature. +.Bl -tag -width ".Ar temperature" -compact +.It Sy Type +.It Ar temperature +String containing the temperature of the core that has become too hot. +.El +.El +.It Li kern +Events related to the kernel. +.Bl -tag -width ".Sy Subsystem" -compact +.It Sy Subsystem +.It Li power +Information about the state of the system. +.Bl -tag -width ".li resume" -compact +.It Sy Type +.It Li resume +Notification that the system has woken from the suspended state. .El .El .El @@ -430,4 +483,6 @@ The installed .Pa /etc/devd.conf has many additional examples. .Sh SEE ALSO -.Xr devd 8 +.Xr devd 8 , +.Xr devfs 5 , +.Xr coretemp 4 From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 18:02:31 2009 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 1B31E106566B; Sun, 8 Mar 2009 18:02:31 +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 08F3C8FC29; Sun, 8 Mar 2009 18:02:31 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28I2UTt089603; Sun, 8 Mar 2009 18:02:30 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28I2US2089602; Sun, 8 Mar 2009 18:02:30 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200903081802.n28I2US2089602@svn.freebsd.org> From: Maxim Konovalov Date: Sun, 8 Mar 2009 18:02: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: r189538 - head/sbin/devd 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 Mar 2009 18:02:32 -0000 Author: maxim Date: Sun Mar 8 18:02:30 2009 New Revision: 189538 URL: http://svn.freebsd.org/changeset/base/189538 Log: o Spell. Sort .Xrs. Modified: head/sbin/devd/devd.conf.5 Modified: head/sbin/devd/devd.conf.5 ============================================================================== --- head/sbin/devd/devd.conf.5 Sun Mar 8 16:29:59 2009 (r189537) +++ head/sbin/devd/devd.conf.5 Sun Mar 8 18:02:30 2009 (r189538) @@ -120,7 +120,7 @@ Specifies PID file. .It Ic set Ar regexp-name Qq Ar (some|regexp) ; Creates a regular expression and assigns it to the variable .Ar regexp-name . -The variable is avaiable throughout the rest of +The variable is available throughout the rest of the configuration file. All regular expressions have an implicit .Ql ^$ @@ -208,7 +208,7 @@ The following sub-statements are support statement. The .Dq Li notify -variable is avaiable inside this statement and contains, a value, depending +variable is available inside this statement and contains, a value, depending on which system and subsystem that delivered the event. .Bl -tag -width ".Ic directory" .It Ic action Qq Ar command ; @@ -223,7 +223,7 @@ statements can exist within a statement; .Ar value can be either a fixed string or a regular expression. -Below is a list of avaiable systems, subsystems, and types. +Below is a list of available systems, subsystems, and types. .It Ic media-type Qq Ar string ; See above. .El @@ -318,9 +318,9 @@ Carrier status changed to UP. .It Li LINK_DOWN Carrier status changed to DOWN. .It Li ATTACH -The network inteface is attached to the system. +The network interface is attached to the system. .It Li DETACH -The network inteface is detached from the system. +The network interface is detached from the system. .El .El .It Li DEVFS @@ -483,6 +483,6 @@ The installed .Pa /etc/devd.conf has many additional examples. .Sh SEE ALSO -.Xr devd 8 , +.Xr coretemp 4 , .Xr devfs 5 , -.Xr coretemp 4 +.Xr devd 8 From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 19:05:54 2009 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 BBD881065670; Sun, 8 Mar 2009 19:05:54 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EF038FC08; Sun, 8 Mar 2009 19:05:54 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28J5sXM092476; Sun, 8 Mar 2009 19:05:54 GMT (envelope-from marcus@svn.freebsd.org) Received: (from marcus@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28J5sFQ092475; Sun, 8 Mar 2009 19:05:54 GMT (envelope-from marcus@svn.freebsd.org) Message-Id: <200903081905.n28J5sFQ092475@svn.freebsd.org> From: Joe Marcus Clarke Date: Sun, 8 Mar 2009 19:05: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: r189539 - 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 Mar 2009 19:05:55 -0000 Author: marcus (doc,ports committer) Date: Sun Mar 8 19:05:53 2009 New Revision: 189539 URL: http://svn.freebsd.org/changeset/base/189539 Log: Add a default implementation for VOP_VPTOCNP(9) which scans the parent directory of a vnode to find a dirent with a matching file number. The name from that dirent is then used to provide the component name. Note: if the initial vnode argument is not a directory itself, then the default VOP_VPTOCNP(9) implementation still returns ENOENT. Reviewed by: kib Approved by: kib Tested by: pho Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Sun Mar 8 18:02:30 2009 (r189538) +++ head/sys/kern/vfs_default.c Sun Mar 8 19:05:53 2009 (r189539) @@ -48,8 +48,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include +#include #include #include @@ -63,6 +66,14 @@ __FBSDID("$FreeBSD$"); static int vop_nolookup(struct vop_lookup_args *); static int vop_nostrategy(struct vop_strategy_args *); +static int get_next_dirent(struct vnode *vp, struct dirent **dpp, + char *dirbuf, int dirbuflen, off_t *off, + char **cpos, int *len, int *eofflag, + struct thread *td); +static int dirent_exists(struct vnode *vp, const char *dirname, + struct thread *td); + +#define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN+1) + 4) /* * This vnode table stores what we want to do if the filesystem doesn't @@ -98,7 +109,7 @@ struct vop_vector default_vnodeops = { .vop_revoke = VOP_PANIC, .vop_strategy = vop_nostrategy, .vop_unlock = vop_stdunlock, - .vop_vptocnp = VOP_ENOENT, + .vop_vptocnp = vop_stdvptocnp, .vop_vptofh = vop_stdvptofh, }; @@ -210,6 +221,108 @@ vop_nostrategy (struct vop_strategy_args return (EOPNOTSUPP); } +static int +get_next_dirent(struct vnode *vp, struct dirent **dpp, char *dirbuf, + int dirbuflen, off_t *off, char **cpos, int *len, + int *eofflag, struct thread *td) +{ + int error, reclen; + struct uio uio; + struct iovec iov; + struct dirent *dp; + + KASSERT(VOP_ISLOCKED(vp), ("vp %p is not locked", vp)); + KASSERT(vp->v_type == VDIR, ("vp %p is not a directory", vp)); + + if (*len == 0) { + iov.iov_base = dirbuf; + iov.iov_len = dirbuflen; + + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + uio.uio_offset = *off; + uio.uio_resid = dirbuflen; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_rw = UIO_READ; + uio.uio_td = td; + + *eofflag = 0; + +#ifdef MAC + error = mac_vnode_check_readdir(td->td_ucred, vp); + if (error == 0) +#endif + error = VOP_READDIR(vp, &uio, td->td_ucred, eofflag, + NULL, NULL); + if (error) + return (error); + + *off = uio.uio_offset; + + *cpos = dirbuf; + *len = (dirbuflen - uio.uio_resid); + } + + dp = (struct dirent *)(*cpos); + reclen = dp->d_reclen; + *dpp = dp; + + /* check for malformed directory.. */ + if (reclen < DIRENT_MINSIZE) + return (EINVAL); + + *cpos += reclen; + *len -= reclen; + + return (0); +} + +/* + * Check if a named file exists in a given directory vnode. + */ +static int +dirent_exists(struct vnode *vp, const char *dirname, struct thread *td) +{ + char *dirbuf, *cpos; + int error, eofflag, dirbuflen, len, found; + off_t off; + struct dirent *dp; + struct vattr va; + + KASSERT(VOP_ISLOCKED(vp), ("vp %p is not locked", vp)); + KASSERT(vp->v_type == VDIR, ("vp %p is not a directory", vp)); + + found = 0; + + error = VOP_GETATTR(vp, &va, td->td_ucred); + if (error) + return (found); + + dirbuflen = DEV_BSIZE; + if (dirbuflen < va.va_blocksize) + dirbuflen = va.va_blocksize; + dirbuf = (char *)malloc(dirbuflen, M_TEMP, M_WAITOK); + + off = 0; + len = 0; + do { + error = get_next_dirent(vp, &dp, dirbuf, dirbuflen, &off, + &cpos, &len, &eofflag, td); + if (error) + goto out; + + if ((dp->d_type != DT_WHT) && + !strcmp(dp->d_name, dirname)) { + found = 1; + goto out; + } + } while (len > 0 || !eofflag); + +out: + free(dirbuf, M_TEMP); + return (found); +} + /* * Advisory record locking support */ @@ -557,6 +670,127 @@ vop_stdvptofh(struct vop_vptofh_args *ap return (EOPNOTSUPP); } +int +vop_stdvptocnp(struct vop_vptocnp_args *ap) +{ + struct vnode *vp = ap->a_vp; + struct vnode **dvp = ap->a_vpp; + char *buf = ap->a_buf; + int *buflen = ap->a_buflen; + char *dirbuf, *cpos; + int i, error, eofflag, dirbuflen, flags, locked, len, covered; + off_t off; + ino_t fileno; + struct vattr va; + struct nameidata nd; + struct thread *td; + struct dirent *dp; + struct vnode *mvp; + + i = *buflen; + error = 0; + covered = 0; + td = curthread; + + if (vp->v_type != VDIR) + return (ENOENT); + + error = VOP_GETATTR(vp, &va, td->td_ucred); + if (error) + return (error); + + VREF(vp); + locked = VOP_ISLOCKED(vp); + VOP_UNLOCK(vp, 0); + NDINIT_ATVP(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, + "..", vp, td); + flags = FREAD; + error = vn_open(&nd, &flags, 0, NULL); + if (error) { + vn_lock(vp, locked | LK_RETRY); + return (error); + } + NDFREE(&nd, NDF_ONLY_PNBUF); + + mvp = *dvp = nd.ni_vp; + + if (vp->v_mount != (*dvp)->v_mount && + ((*dvp)->v_vflag & VV_ROOT) && + ((*dvp)->v_mount->mnt_flag & MNT_UNION)) { + *dvp = (*dvp)->v_mount->mnt_vnodecovered; + VREF(mvp); + VOP_UNLOCK(mvp, 0); + vn_close(mvp, FREAD, td->td_ucred, td); + VREF(*dvp); + vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY); + covered = 1; + } + + fileno = va.va_fileid; + + dirbuflen = DEV_BSIZE; + if (dirbuflen < va.va_blocksize) + dirbuflen = va.va_blocksize; + dirbuf = (char *)malloc(dirbuflen, M_TEMP, M_WAITOK); + + if ((*dvp)->v_type != VDIR) { + error = ENOENT; + goto out; + } + + off = 0; + len = 0; + do { + /* call VOP_READDIR of parent */ + error = get_next_dirent(*dvp, &dp, dirbuf, dirbuflen, &off, + &cpos, &len, &eofflag, td); + if (error) + goto out; + + if ((dp->d_type != DT_WHT) && + (dp->d_fileno == fileno)) { + if (covered) { + VOP_UNLOCK(*dvp, 0); + vn_lock(mvp, LK_EXCLUSIVE | LK_RETRY); + if (dirent_exists(mvp, dp->d_name, td)) { + error = ENOENT; + VOP_UNLOCK(mvp, 0); + vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY); + goto out; + } + VOP_UNLOCK(mvp, 0); + vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY); + } + i -= dp->d_namlen; + + if (i < 0) { + error = ENOMEM; + goto out; + } + bcopy(dp->d_name, buf + i, dp->d_namlen); + error = 0; + goto out; + } + } while (len > 0 || !eofflag); + error = ENOENT; + +out: + free(dirbuf, M_TEMP); + if (!error) { + *buflen = i; + vhold(*dvp); + } + if (covered) { + vput(*dvp); + vrele(mvp); + } else { + VOP_UNLOCK(mvp, 0); + vn_close(mvp, FREAD, td->td_ucred, td); + } + vn_lock(vp, locked | LK_RETRY); + return (error); +} + /* * vfs default ops * used to fill the vfs function table to get reasonable default return values. From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 19:06:26 2009 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 A600D106564A; Sun, 8 Mar 2009 19:06:26 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 949208FC15; Sun, 8 Mar 2009 19:06:26 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28J6Q4W092529; Sun, 8 Mar 2009 19:06:26 GMT (envelope-from marcus@svn.freebsd.org) Received: (from marcus@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28J6QeL092528; Sun, 8 Mar 2009 19:06:26 GMT (envelope-from marcus@svn.freebsd.org) Message-Id: <200903081906.n28J6QeL092528@svn.freebsd.org> From: Joe Marcus Clarke Date: Sun, 8 Mar 2009 19:06: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: r189540 - head/sys/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: Sun, 08 Mar 2009 19:06:27 -0000 Author: marcus (doc,ports committer) Date: Sun Mar 8 19:06:26 2009 New Revision: 189540 URL: http://svn.freebsd.org/changeset/base/189540 Log: Add a prototype for the new vop_stdvptocnp function. Reviewed by: kib Approved by: kib Tested by: pho Modified: head/sys/sys/vnode.h Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sun Mar 8 19:05:53 2009 (r189539) +++ head/sys/sys/vnode.h Sun Mar 8 19:06:26 2009 (r189540) @@ -658,6 +658,7 @@ int vop_stdadvlock(struct vop_advlock_ar int vop_stdadvlockasync(struct vop_advlockasync_args *ap); int vop_stdpathconf(struct vop_pathconf_args *); int vop_stdpoll(struct vop_poll_args *); +int vop_stdvptocnp(struct vop_vptocnp_args *ap); int vop_stdvptofh(struct vop_vptofh_args *ap); int vop_eopnotsupp(struct vop_generic_args *ap); int vop_ebadf(struct vop_generic_args *ap); From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 19:07:44 2009 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 73F7210656E6; Sun, 8 Mar 2009 19:07:44 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61F018FC1C; Sun, 8 Mar 2009 19:07:44 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28J7iPc092618; Sun, 8 Mar 2009 19:07:44 GMT (envelope-from marcus@svn.freebsd.org) Received: (from marcus@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28J7iX8092617; Sun, 8 Mar 2009 19:07:44 GMT (envelope-from marcus@svn.freebsd.org) Message-Id: <200903081907.n28J7iX8092617@svn.freebsd.org> From: Joe Marcus Clarke Date: Sun, 8 Mar 2009 19:07: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: r189541 - head/share/man/man9 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 Mar 2009 19:07:45 -0000 Author: marcus (doc,ports committer) Date: Sun Mar 8 19:07:44 2009 New Revision: 189541 URL: http://svn.freebsd.org/changeset/base/189541 Log: Document the new default implementation of VOP_VPTOCNP(9). Approved by: kib Modified: head/share/man/man9/VOP_VPTOCNP.9 Modified: head/share/man/man9/VOP_VPTOCNP.9 ============================================================================== --- head/share/man/man9/VOP_VPTOCNP.9 Sun Mar 8 19:06:26 2009 (r189540) +++ head/share/man/man9/VOP_VPTOCNP.9 Sun Mar 8 19:07:44 2009 (r189541) @@ -57,7 +57,13 @@ The remaining size of the buffer. .Pp The default implementation of .Nm -simply returns ENOENT. +scans through +.Fa vp Ns 's +parent directory looking for a dirent with a matching file number. If +.Fa vp +is not a directory, then +.Nm +returns ENOENT. .Sh LOCKS The vnode should be locked on entry and will still be locked on exit. The parent directory vnode will be unlocked on a successful exit. However, it From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 19:09:56 2009 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 002F7106566C; Sun, 8 Mar 2009 19:09:55 +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 E14FD8FC16; Sun, 8 Mar 2009 19:09:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28J9tV9092710; Sun, 8 Mar 2009 19:09:55 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28J9tVg092709; Sun, 8 Mar 2009 19:09:55 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200903081909.n28J9tVg092709@svn.freebsd.org> From: Ed Schouten Date: Sun, 8 Mar 2009 19: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: r189542 - 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: Sun, 08 Mar 2009 19:09:56 -0000 Author: ed Date: Sun Mar 8 19:09:55 2009 New Revision: 189542 URL: http://svn.freebsd.org/changeset/base/189542 Log: Don't disable CR-to-NL translation when waiting for data to arrive. A difference between the old and the new TTY layer is that the new implementation does not perform any post-processing before returning data back to userspace when calling read(). sh(1)'s read turns the TTY into a raw mode before calling select(). This means that the first character will not receive any ICRNL processing. Inherit this flag from the original terminal attributes. Even though this issue is not present on RELENG_*, I'm MFCing it to make sh(1) in jails behave better. PR: bin/129566 MFC after: 2 weeks Modified: head/bin/sh/miscbltin.c Modified: head/bin/sh/miscbltin.c ============================================================================== --- head/bin/sh/miscbltin.c Sun Mar 8 19:07:44 2009 (r189541) +++ head/bin/sh/miscbltin.c Sun Mar 8 19:09:55 2009 (r189542) @@ -147,6 +147,7 @@ readcmd(int argc __unused, char **argv _ if (tcgetattr(0, &told) == 0) { memcpy(&tnew, &told, sizeof(told)); cfmakeraw(&tnew); + tnew.c_iflag |= told.c_iflag & ICRNL; tcsetattr(0, TCSANOW, &tnew); tsaved = 1; } From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 19:18:41 2009 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 B7C72106564A; Sun, 8 Mar 2009 19:18:41 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 895F58FC12; Sun, 8 Mar 2009 19:18:41 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n28JIfFE012487 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 Mar 2009 12:18:41 -0700 (PDT) (envelope-from sam@freebsd.org) Message-ID: <49B41A11.8000508@freebsd.org> Date: Sun, 08 Mar 2009 12:18:41 -0700 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.18 (X11/20081209) MIME-Version: 1.0 To: Andrew Thompson References: <200903071949.n27JnlTM061191@svn.freebsd.org> In-Reply-To: <200903071949.n27JnlTM061191@svn.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC-sonic.net-Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189496 - 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: Sun, 08 Mar 2009 19:18:42 -0000 Andrew Thompson wrote: > Author: thompsa > Date: Sat Mar 7 19:49:47 2009 > New Revision: 189496 > URL: http://svn.freebsd.org/changeset/base/189496 > > Log: > (re)merge r186415,186416 from the old usb stack; > > o add Transaction Translator support (still missing ISOC xfers) > o add EHCI_SCFLG_BIGEMMIO flag to force big-endian byte-select to be > set in USBMODE > o split reset work into new public routine ehci_reset so bus shim drivers > can force big-endian byte-select before ehci_init > o enable TT and big-endian MMIO > o force a reset before ehci_init to get byte-select setup > > Also go back to using USB_EHCI_BIG_ENDIAN_DESC at compile time to enable the > byteswapping and reduce diffs to the original commits. > > This fixes the new USB stack on the Cambria board. > Beware there appear to be h/w issues w/ usb on 2358 boards that show up as devices not attaching properly (at least for me) and/or poor performance. I also observe significant problems on 2348 boards that I do not see with the usb1 code--which is why it remains the default configuration. Sam From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 19:25:29 2009 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 900CD106567E; Sun, 8 Mar 2009 19:25:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 32AE18FC44; Sun, 8 Mar 2009 19:25:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LgOcp-000MvC-6z; Sun, 08 Mar 2009 21:25:27 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n28JPQfM010451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 Mar 2009 21:25:26 +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.3/8.14.3) with ESMTP id n28JPQjf098601; Sun, 8 Mar 2009 21:25:26 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n28JPQOq098600; Sun, 8 Mar 2009 21:25:26 +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: Sun, 8 Mar 2009 21:25:26 +0200 From: Kostik Belousov To: Ed Schouten Message-ID: <20090308192525.GO41617@deviant.kiev.zoral.com.ua> References: <200903081909.n28J9tVg092709@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="q/E04pvXIjS/VngA" Content-Disposition: inline In-Reply-To: <200903081909.n28J9tVg092709@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Virus-Scanned: mail.terabit.net.ua 1LgOcp-000MvC-6z c875e31df4c98aff4738b342715102d0 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189542 - 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: Sun, 08 Mar 2009 19:25:30 -0000 --q/E04pvXIjS/VngA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 08, 2009 at 07:09:55PM +0000, Ed Schouten wrote: > Author: ed > Date: Sun Mar 8 19:09:55 2009 > New Revision: 189542 > URL: http://svn.freebsd.org/changeset/base/189542 >=20 > Log: > Don't disable CR-to-NL translation when waiting for data to arrive. > =20 > A difference between the old and the new TTY layer is that the new > implementation does not perform any post-processing before returning > data back to userspace when calling read(). > =20 > sh(1)'s read turns the TTY into a raw mode before calling select(). This > means that the first character will not receive any ICRNL processing. > Inherit this flag from the original terminal attributes. > =20 > Even though this issue is not present on RELENG_*, I'm MFCing it to make > sh(1) in jails behave better. Wouldn't this be a problem for any other tty users too, in particular for the other shells that use raw mode ? --q/E04pvXIjS/VngA Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm0G6UACgkQC3+MBN1Mb4iEJwCghLdTOmo70VyvMbC2bWB00F1e Df0AoOTChxcTbkO7mT0dTip9iQfD/PAF =eEaP -----END PGP SIGNATURE----- --q/E04pvXIjS/VngA-- From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 19:34:03 2009 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 0AA16106566B; Sun, 8 Mar 2009 19:34:03 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id C09C58FC08; Sun, 8 Mar 2009 19:34:02 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 2129C1CF0D; Sun, 8 Mar 2009 20:34:02 +0100 (CET) Date: Sun, 8 Mar 2009 20:34:02 +0100 From: Ed Schouten To: Kostik Belousov Message-ID: <20090308193402.GP19161@hoeg.nl> References: <200903081909.n28J9tVg092709@svn.freebsd.org> <20090308192525.GO41617@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kwyOAufsvjrbDa1R" Content-Disposition: inline In-Reply-To: <20090308192525.GO41617@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189542 - 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: Sun, 08 Mar 2009 19:34:03 -0000 --kwyOAufsvjrbDa1R Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Kostik Belousov wrote: > Wouldn't this be a problem for any other tty users too, in particular for > the other shells that use raw mode ? Not likely. Where processing should be done (before or after storing it in a queue) is not specified (in POSIX) at all. As mentioned in the PR, it turns out Solaris has the same behaviour, for example. Shells that work on a number of different operating systems should not be affected. --=20 Ed Schouten WWW: http://80386.nl/ --kwyOAufsvjrbDa1R Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm0HaoACgkQ52SDGA2eCwUE4ACbBy33tZQat00yXi92KolChrtY kxEAn2U7w3Xe0bSpmAESfrZfdvW2AUsn =cpkn -----END PGP SIGNATURE----- --kwyOAufsvjrbDa1R-- From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 21:06:02 2009 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 9A0B8106564A; Sun, 8 Mar 2009 21:06:02 +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 87A4F8FC08; Sun, 8 Mar 2009 21:06:02 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28L62FM096900; Sun, 8 Mar 2009 21:06:02 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28L62EF096899; Sun, 8 Mar 2009 21:06:02 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903082106.n28L62EF096899@svn.freebsd.org> From: Robert Watson Date: Sun, 8 Mar 2009 21: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: r189543 - head/tools/regression/sockets/unix_gc 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 Mar 2009 21:06:03 -0000 Author: rwatson Date: Sun Mar 8 21:06:02 2009 New Revision: 189543 URL: http://svn.freebsd.org/changeset/base/189543 Log: In UNIX domain socket GC regression test, after setting a socket non-blocking, EINPROGRESS is an acceptable result from connect(). Modified: head/tools/regression/sockets/unix_gc/unix_gc.c Modified: head/tools/regression/sockets/unix_gc/unix_gc.c ============================================================================== --- head/tools/regression/sockets/unix_gc/unix_gc.c Sun Mar 8 19:09:55 2009 (r189542) +++ head/tools/regression/sockets/unix_gc/unix_gc.c Sun Mar 8 21:06:02 2009 (r189543) @@ -160,7 +160,7 @@ static void my_connect(int sock, struct sockaddr *sa, socklen_t len) { - if (connect(sock, sa, len) < 0) + if (connect(sock, sa, len) < 0 && errno != EINPROGRESS) err(-1, "%s: connect", test); } From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 21:48:30 2009 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 3C9501065672; Sun, 8 Mar 2009 21:48:30 +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 28FD68FC1E; Sun, 8 Mar 2009 21:48:30 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28LmUBV098311; Sun, 8 Mar 2009 21:48:30 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28LmUfZ098309; Sun, 8 Mar 2009 21:48:30 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903082148.n28LmUfZ098309@svn.freebsd.org> From: Robert Watson Date: Sun, 8 Mar 2009 21: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: r189544 - 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 Mar 2009 21:48:31 -0000 Author: rwatson Date: Sun Mar 8 21:48:29 2009 New Revision: 189544 URL: http://svn.freebsd.org/changeset/base/189544 Log: Decompose the global UNIX domain sockets rwlock into two different locks: a global list/counter/generation counter protected by a new mutex unp_list_lock, and a global linkage rwlock, unp_global_rwlock, which protects the connections between UNIX domain sockets. This eliminates conditional lock acquisition that was previously a property of the global lock being held over sonewconn() leading to a call to uipc_attach(), which also required the global lock, but couldn't rely on it as other paths existed to uipc_attach() that didn't hold it: now uipc_attach() uses only the list lock, which follows the linkage lock in the lock order. It may also reduce contention on the global lock for some workloads. Add global UNIX domain socket locks to hard-coded witness lock order. MFC after: 1 week Discussed with: kris Modified: head/sys/kern/subr_witness.c head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sun Mar 8 21:06:02 2009 (r189543) +++ head/sys/kern/subr_witness.c Sun Mar 8 21:48:29 2009 (r189544) @@ -522,6 +522,8 @@ static struct witness_order_list_entry o /* * UNIX Domain Sockets */ + { "unp_global_rwlock", &lock_class_rw }, + { "unp_list_lock", &lock_class_mtx_sleep }, { "unp", &lock_class_mtx_sleep }, { "so_snd", &lock_class_mtx_sleep }, { NULL, NULL }, Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Sun Mar 8 21:06:02 2009 (r189543) +++ head/sys/kern/uipc_usrreq.c Sun Mar 8 21:48:29 2009 (r189544) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. - * Copyright (c) 2004-2008 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,13 +99,19 @@ __FBSDID("$FreeBSD$"); #include +/* + * Locking key: + * (l) Locked using list lock + * (g) Locked using linkage lock + */ + static uma_zone_t unp_zone; -static unp_gen_t unp_gencnt; -static u_int unp_count; /* Count of local sockets. */ +static unp_gen_t unp_gencnt; /* (l) */ +static u_int unp_count; /* (l) Count of local sockets. */ static ino_t unp_ino; /* Prototype for fake inode numbers. */ -static int unp_rights; /* File descriptors in flight. */ -static struct unp_head unp_shead; /* List of local stream sockets. */ -static struct unp_head unp_dhead; /* List of local datagram sockets. */ +static int unp_rights; /* (g) File descriptors in flight. */ +static struct unp_head unp_shead; /* (l) List of stream sockets. */ +static struct unp_head unp_dhead; /* (l) List of datagram sockets. */ static const struct sockaddr sun_noname = { sizeof(sun_noname), AF_LOCAL }; @@ -152,14 +158,13 @@ SYSCTL_INT(_net_local, OID_AUTO, infligh /*- * Locking and synchronization: * - * The global UNIX domain socket rwlock (unp_global_rwlock) protects all - * global variables, including the linked lists tracking the set of allocated - * UNIX domain sockets. The global rwlock also serves to prevent deadlock - * when more than one PCB lock is acquired at a time (i.e., during - * connect()). Finally, the global rwlock protects uncounted references from - * vnodes to sockets bound to those vnodes: to safely dereference the - * v_socket pointer, the global rwlock must be held while a full reference is - * acquired. + * Three types of locks exit in the local domain socket implementation: a + * global list mutex, a global linkage rwlock, and per-unpcb mutexes. Of the + * global locks, the list lock protects the socket count, global generation + * number, and stream/datagram global lists. The linkage lock protects the + * interconnection of unpcbs, the v_socket and unp_vnode pointers, and can be + * held exclusively over the acquisition of multiple unpcb locks to prevent + * deadlock. * * UNIX domain sockets each have an unpcb hung off of their so_pcb pointer, * allocated in pru_attach() and freed in pru_detach(). The validity of that @@ -180,8 +185,8 @@ SYSCTL_INT(_net_local, OID_AUTO, infligh * atomic reads without the lock may be performed "lockless", but more * complex reads and read-modify-writes require the mutex to be held. No * lock order is defined between unpcb locks -- multiple unpcb locks may be - * acquired at the same time only when holding the global UNIX domain socket - * rwlock exclusively, which prevents deadlocks. + * acquired at the same time only when holding the linkage rwlock + * exclusively, which prevents deadlocks. * * Blocking with UNIX domain sockets is a tricky issue: unlike most network * protocols, bind() is a non-atomic operation, and connect() requires @@ -196,26 +201,28 @@ SYSCTL_INT(_net_local, OID_AUTO, infligh * binding, both of which involve dropping UNIX domain socket locks in order * to perform namei() and other file system operations. */ -static struct rwlock unp_global_rwlock; +static struct rwlock unp_link_rwlock; +static struct mtx unp_list_lock; -#define UNP_GLOBAL_LOCK_INIT() rw_init(&unp_global_rwlock, \ - "unp_global_rwlock") +#define UNP_LINK_LOCK_INIT() rw_init(&unp_link_rwlock, \ + "unp_link_rwlock") -#define UNP_GLOBAL_LOCK_ASSERT() rw_assert(&unp_global_rwlock, \ +#define UNP_LINK_LOCK_ASSERT() rw_assert(&unp_link_rwlock, \ RA_LOCKED) -#define UNP_GLOBAL_UNLOCK_ASSERT() rw_assert(&unp_global_rwlock, \ +#define UNP_LINK_UNLOCK_ASSERT() rw_assert(&unp_link_rwlock, \ RA_UNLOCKED) -#define UNP_GLOBAL_WLOCK() rw_wlock(&unp_global_rwlock) -#define UNP_GLOBAL_WUNLOCK() rw_wunlock(&unp_global_rwlock) -#define UNP_GLOBAL_WLOCK_ASSERT() rw_assert(&unp_global_rwlock, \ +#define UNP_LINK_RLOCK() rw_rlock(&unp_link_rwlock) +#define UNP_LINK_RUNLOCK() rw_runlock(&unp_link_rwlock) +#define UNP_LINK_WLOCK() rw_wlock(&unp_link_rwlock) +#define UNP_LINK_WUNLOCK() rw_wunlock(&unp_link_rwlock) +#define UNP_LINK_WLOCK_ASSERT() rw_assert(&unp_link_rwlock, \ RA_WLOCKED) -#define UNP_GLOBAL_WOWNED() rw_wowned(&unp_global_rwlock) -#define UNP_GLOBAL_RLOCK() rw_rlock(&unp_global_rwlock) -#define UNP_GLOBAL_RUNLOCK() rw_runlock(&unp_global_rwlock) -#define UNP_GLOBAL_RLOCK_ASSERT() rw_assert(&unp_global_rwlock, \ - RA_RLOCKED) +#define UNP_LIST_LOCK_INIT() mtx_init(&unp_list_lock, \ + "unp_list_lock", NULL, MTX_DEF) +#define UNP_LIST_LOCK() mtx_lock(&unp_list_lock) +#define UNP_LIST_UNLOCK() mtx_unlock(&unp_list_lock) #define UNP_PCB_LOCK_INIT(unp) mtx_init(&(unp)->unp_mtx, \ "unp_mtx", "unp_mtx", \ @@ -285,7 +292,7 @@ uipc_abort(struct socket *so) unp = sotounpcb(so); KASSERT(unp != NULL, ("uipc_abort: unp == NULL")); - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); UNP_PCB_LOCK(unp); unp2 = unp->unp_conn; if (unp2 != NULL) { @@ -294,7 +301,7 @@ uipc_abort(struct socket *so) UNP_PCB_UNLOCK(unp2); } UNP_PCB_UNLOCK(unp); - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); } static int @@ -311,7 +318,7 @@ uipc_accept(struct socket *so, struct so KASSERT(unp != NULL, ("uipc_accept: unp == NULL")); *nam = malloc(sizeof(struct sockaddr_un), M_SONAME, M_WAITOK); - UNP_GLOBAL_RLOCK(); + UNP_LINK_RLOCK(); unp2 = unp->unp_conn; if (unp2 != NULL && unp2->unp_addr != NULL) { UNP_PCB_LOCK(unp2); @@ -322,7 +329,7 @@ uipc_accept(struct socket *so, struct so sa = &sun_noname; bcopy(sa, *nam, sa->sa_len); } - UNP_GLOBAL_RUNLOCK(); + UNP_LINK_RUNLOCK(); return (0); } @@ -331,7 +338,7 @@ uipc_attach(struct socket *so, int proto { u_long sendspace, recvspace; struct unpcb *unp; - int error, locked; + int error; KASSERT(so->so_pcb == NULL, ("uipc_attach: so_pcb != NULL")); if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { @@ -362,22 +369,12 @@ uipc_attach(struct socket *so, int proto so->so_pcb = unp; unp->unp_refcount = 1; - /* - * uipc_attach() may be called indirectly from within the UNIX domain - * socket code via sonewconn() in unp_connect(). Since rwlocks can - * not be recursed, we do the closest thing. - */ - locked = 0; - if (!UNP_GLOBAL_WOWNED()) { - UNP_GLOBAL_WLOCK(); - locked = 1; - } + UNP_LIST_LOCK(); unp->unp_gencnt = ++unp_gencnt; unp_count++; LIST_INSERT_HEAD(so->so_type == SOCK_DGRAM ? &unp_dhead : &unp_shead, unp, unp_link); - if (locked) - UNP_GLOBAL_WUNLOCK(); + UNP_LIST_UNLOCK(); return (0); } @@ -474,14 +471,14 @@ restart: ASSERT_VOP_ELOCKED(vp, "uipc_bind"); soun = (struct sockaddr_un *)sodupsockaddr(nam, M_WAITOK); - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); UNP_PCB_LOCK(unp); vp->v_socket = unp->unp_socket; unp->unp_vnode = vp; unp->unp_addr = soun; unp->unp_flags &= ~UNP_BINDING; UNP_PCB_UNLOCK(unp); - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); VOP_UNLOCK(vp, 0); vn_finished_write(mp); VFS_UNLOCK_GIANT(vfslocked); @@ -503,9 +500,9 @@ uipc_connect(struct socket *so, struct s int error; KASSERT(td == curthread, ("uipc_connect: td != curthread")); - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); error = unp_connect(so, nam, td); - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); return (error); } @@ -517,7 +514,7 @@ uipc_close(struct socket *so) unp = sotounpcb(so); KASSERT(unp != NULL, ("uipc_close: unp == NULL")); - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); UNP_PCB_LOCK(unp); unp2 = unp->unp_conn; if (unp2 != NULL) { @@ -526,7 +523,7 @@ uipc_close(struct socket *so) UNP_PCB_UNLOCK(unp2); } UNP_PCB_UNLOCK(unp); - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); } static int @@ -535,7 +532,7 @@ uipc_connect2(struct socket *so1, struct struct unpcb *unp, *unp2; int error; - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); unp = so1->so_pcb; KASSERT(unp != NULL, ("uipc_connect2: unp == NULL")); UNP_PCB_LOCK(unp); @@ -545,7 +542,7 @@ uipc_connect2(struct socket *so1, struct error = unp_connect2(so1, so2, PRU_CONNECT2); UNP_PCB_UNLOCK(unp2); UNP_PCB_UNLOCK(unp); - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); return (error); } @@ -560,12 +557,13 @@ uipc_detach(struct socket *so) unp = sotounpcb(so); KASSERT(unp != NULL, ("uipc_detach: unp == NULL")); - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); + UNP_LIST_LOCK(); UNP_PCB_LOCK(unp); - LIST_REMOVE(unp, unp_link); unp->unp_gencnt = ++unp_gencnt; --unp_count; + UNP_LIST_UNLOCK(); /* * XXXRW: Should assert vp->v_socket == so. @@ -582,7 +580,7 @@ uipc_detach(struct socket *so) } /* - * We hold the global lock exclusively, so it's OK to acquire + * We hold the linkage lock exclusively, so it's OK to acquire * multiple pcb locks at a time. */ while (!LIST_EMPTY(&unp->unp_refs)) { @@ -593,7 +591,7 @@ uipc_detach(struct socket *so) UNP_PCB_UNLOCK(ref); } local_unp_rights = unp_rights; - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); unp->unp_socket->so_pcb = NULL; saved_unp_addr = unp->unp_addr; unp->unp_addr = NULL; @@ -625,7 +623,7 @@ uipc_disconnect(struct socket *so) unp = sotounpcb(so); KASSERT(unp != NULL, ("uipc_disconnect: unp == NULL")); - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); UNP_PCB_LOCK(unp); unp2 = unp->unp_conn; if (unp2 != NULL) { @@ -634,7 +632,7 @@ uipc_disconnect(struct socket *so) UNP_PCB_UNLOCK(unp2); } UNP_PCB_UNLOCK(unp); - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); return (0); } @@ -768,9 +766,9 @@ uipc_send(struct socket *so, int flags, if (control != NULL && (error = unp_internalize(&control, td))) goto release; if ((nam != NULL) || (flags & PRUS_EOF)) - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); else - UNP_GLOBAL_RLOCK(); + UNP_LINK_RLOCK(); switch (so->so_type) { case SOCK_DGRAM: { @@ -778,7 +776,7 @@ uipc_send(struct socket *so, int flags, unp2 = unp->unp_conn; if (nam != NULL) { - UNP_GLOBAL_WLOCK_ASSERT(); + UNP_LINK_WLOCK_ASSERT(); if (unp2 != NULL) { error = EISCONN; break; @@ -819,7 +817,7 @@ uipc_send(struct socket *so, int flags, error = ENOBUFS; } if (nam != NULL) { - UNP_GLOBAL_WLOCK_ASSERT(); + UNP_LINK_WLOCK_ASSERT(); UNP_PCB_LOCK(unp2); unp_disconnect(unp, unp2); UNP_PCB_UNLOCK(unp2); @@ -831,7 +829,7 @@ uipc_send(struct socket *so, int flags, case SOCK_STREAM: if ((so->so_state & SS_ISCONNECTED) == 0) { if (nam != NULL) { - UNP_GLOBAL_WLOCK_ASSERT(); + UNP_LINK_WLOCK_ASSERT(); error = unp_connect(so, nam, td); if (error) break; /* XXX */ @@ -854,7 +852,7 @@ uipc_send(struct socket *so, int flags, * return the slightly counter-intuitive but otherwise * correct error that the socket is not connected. * - * Locking here must be done carefully: the global lock + * Locking here must be done carefully: the inkage lock * prevents interconnections between unpcbs from changing, so * we can traverse from unp to unp2 without acquiring unp's * lock. Socket buffer locks follow unpcb locks, so we can @@ -915,9 +913,9 @@ uipc_send(struct socket *so, int flags, } if ((nam != NULL) || (flags & PRUS_EOF)) - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); else - UNP_GLOBAL_RUNLOCK(); + UNP_LINK_RUNLOCK(); if (control != NULL && error != 0) unp_dispose(control); @@ -940,7 +938,7 @@ uipc_sense(struct socket *so, struct sta KASSERT(unp != NULL, ("uipc_sense: unp == NULL")); sb->st_blksize = so->so_snd.sb_hiwat; - UNP_GLOBAL_RLOCK(); + UNP_LINK_RLOCK(); UNP_PCB_LOCK(unp); unp2 = unp->unp_conn; if (so->so_type == SOCK_STREAM && unp2 != NULL) { @@ -952,7 +950,7 @@ uipc_sense(struct socket *so, struct sta unp->unp_ino = (++unp_ino == 0) ? ++unp_ino : unp_ino; sb->st_ino = unp->unp_ino; UNP_PCB_UNLOCK(unp); - UNP_GLOBAL_RUNLOCK(); + UNP_LINK_RUNLOCK(); return (0); } @@ -964,12 +962,12 @@ uipc_shutdown(struct socket *so) unp = sotounpcb(so); KASSERT(unp != NULL, ("uipc_shutdown: unp == NULL")); - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); UNP_PCB_LOCK(unp); socantsendmore(so); unp_shutdown(unp); UNP_PCB_UNLOCK(unp); - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); return (0); } @@ -1139,7 +1137,7 @@ unp_connect(struct socket *so, struct so char buf[SOCK_MAXADDRLEN]; struct sockaddr *sa; - UNP_GLOBAL_WLOCK_ASSERT(); + UNP_LINK_WLOCK_ASSERT(); unp = sotounpcb(so); KASSERT(unp != NULL, ("unp_connect: unp == NULL")); @@ -1155,7 +1153,7 @@ unp_connect(struct socket *so, struct so UNP_PCB_UNLOCK(unp); return (EALREADY); } - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); unp->unp_flags |= UNP_CONNECTING; UNP_PCB_UNLOCK(unp); @@ -1191,10 +1189,10 @@ unp_connect(struct socket *so, struct so KASSERT(unp != NULL, ("unp_connect: unp == NULL")); /* - * Lock global lock for two reasons: make sure v_socket is stable, + * Lock linkage lock for two reasons: make sure v_socket is stable, * and to protect simultaneous locking of multiple pcbs. */ - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); so2 = vp->v_socket; if (so2 == NULL) { error = ECONNREFUSED; @@ -1206,11 +1204,6 @@ unp_connect(struct socket *so, struct so } if (so->so_proto->pr_flags & PR_CONNREQUIRED) { if (so2->so_options & SO_ACCEPTCONN) { - /* - * We can't drop the global lock here or 'so2' may - * become invalid. As a result, we need to handle - * possibly lock recursion in uipc_attach. - */ so3 = sonewconn(so2, 0); } else so3 = NULL; @@ -1272,7 +1265,7 @@ unp_connect(struct socket *so, struct so UNP_PCB_UNLOCK(unp2); UNP_PCB_UNLOCK(unp); bad2: - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); if (vfslocked) /* * Giant has been previously acquired. This means filesystem @@ -1284,7 +1277,7 @@ bad: vput(vp); VFS_UNLOCK_GIANT(vfslocked); free(sa, M_SONAME); - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); UNP_PCB_LOCK(unp); unp->unp_flags &= ~UNP_CONNECTING; UNP_PCB_UNLOCK(unp); @@ -1302,7 +1295,7 @@ unp_connect2(struct socket *so, struct s unp2 = sotounpcb(so2); KASSERT(unp2 != NULL, ("unp_connect2: unp2 == NULL")); - UNP_GLOBAL_WLOCK_ASSERT(); + UNP_LINK_WLOCK_ASSERT(); UNP_PCB_LOCK_ASSERT(unp); UNP_PCB_LOCK_ASSERT(unp2); @@ -1339,7 +1332,7 @@ unp_disconnect(struct unpcb *unp, struct KASSERT(unp2 != NULL, ("unp_disconnect: unp2 == NULL")); - UNP_GLOBAL_WLOCK_ASSERT(); + UNP_LINK_WLOCK_ASSERT(); UNP_PCB_LOCK_ASSERT(unp); UNP_PCB_LOCK_ASSERT(unp2); @@ -1399,10 +1392,10 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) * OK, now we're committed to doing something. */ xug = malloc(sizeof(*xug), M_TEMP, M_WAITOK); - UNP_GLOBAL_RLOCK(); + UNP_LIST_LOCK(); gencnt = unp_gencnt; n = unp_count; - UNP_GLOBAL_RUNLOCK(); + UNP_LIST_UNLOCK(); xug->xug_len = sizeof *xug; xug->xug_count = n; @@ -1416,7 +1409,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) unp_list = malloc(n * sizeof *unp_list, M_TEMP, M_WAITOK); - UNP_GLOBAL_RLOCK(); + UNP_LIST_LOCK(); for (unp = LIST_FIRST(head), i = 0; unp && i < n; unp = LIST_NEXT(unp, unp_link)) { UNP_PCB_LOCK(unp); @@ -1431,7 +1424,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) } UNP_PCB_UNLOCK(unp); } - UNP_GLOBAL_RUNLOCK(); + UNP_LIST_UNLOCK(); n = i; /* In case we lost some during malloc. */ error = 0; @@ -1499,7 +1492,7 @@ unp_shutdown(struct unpcb *unp) struct unpcb *unp2; struct socket *so; - UNP_GLOBAL_WLOCK_ASSERT(); + UNP_LINK_WLOCK_ASSERT(); UNP_PCB_LOCK_ASSERT(unp); unp2 = unp->unp_conn; @@ -1516,7 +1509,7 @@ unp_drop(struct unpcb *unp, int errno) struct socket *so = unp->unp_socket; struct unpcb *unp2; - UNP_GLOBAL_WLOCK_ASSERT(); + UNP_LINK_WLOCK_ASSERT(); UNP_PCB_LOCK_ASSERT(unp); so->so_error = errno; @@ -1556,7 +1549,7 @@ unp_externalize(struct mbuf *control, st int f; u_int newlen; - UNP_GLOBAL_UNLOCK_ASSERT(); + UNP_LINK_UNLOCK_ASSERT(); error = 0; if (controlp != NULL) /* controlp == NULL => free control messages */ @@ -1666,7 +1659,8 @@ unp_init(void) LIST_INIT(&unp_dhead); LIST_INIT(&unp_shead); TASK_INIT(&unp_gc_task, 0, unp_gc, NULL); - UNP_GLOBAL_LOCK_INIT(); + UNP_LINK_LOCK_INIT(); + UNP_LIST_LOCK_INIT(); } static int @@ -1686,7 +1680,7 @@ unp_internalize(struct mbuf **controlp, int error, oldfds; u_int newlen; - UNP_GLOBAL_UNLOCK_ASSERT(); + UNP_LINK_UNLOCK_ASSERT(); error = 0; *controlp = NULL; @@ -1880,14 +1874,14 @@ unp_internalize_fp(struct file *fp) { struct unpcb *unp; - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); if ((unp = fptounp(fp)) != NULL) { unp->unp_file = fp; unp->unp_msgcount++; } fhold(fp); unp_rights++; - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); } static void @@ -1895,11 +1889,11 @@ unp_externalize_fp(struct file *fp) { struct unpcb *unp; - UNP_GLOBAL_WLOCK(); + UNP_LINK_WLOCK(); if ((unp = fptounp(fp)) != NULL) unp->unp_msgcount--; unp_rights--; - UNP_GLOBAL_WUNLOCK(); + UNP_LINK_WUNLOCK(); } /* @@ -1987,7 +1981,7 @@ unp_gc(__unused void *arg, int pending) int i; unp_taskcount++; - UNP_GLOBAL_RLOCK(); + UNP_LIST_LOCK(); /* * First clear all gc flags from previous runs. */ @@ -2008,7 +2002,7 @@ unp_gc(__unused void *arg, int pending) LIST_FOREACH(unp, *head, unp_link) unp_gc_process(unp); } while (unp_marked); - UNP_GLOBAL_RUNLOCK(); + UNP_LIST_UNLOCK(); if (unp_unreachable == 0) return; @@ -2022,7 +2016,7 @@ unp_gc(__unused void *arg, int pending) * Iterate looking for sockets which have been specifically marked * as as unreachable and store them locally. */ - UNP_GLOBAL_RLOCK(); + UNP_LIST_LOCK(); for (i = 0, head = heads; *head != NULL; head++) LIST_FOREACH(unp, *head, unp_link) if (unp->unp_gcflag & UNPGC_DEAD) { @@ -2033,7 +2027,7 @@ unp_gc(__unused void *arg, int pending) KASSERT(i <= unp_unreachable, ("unp_gc: incorrect unreachable count.")); } - UNP_GLOBAL_RUNLOCK(); + UNP_LIST_UNLOCK(); /* * Now flush all sockets, free'ing rights. This will free the From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 22:19:29 2009 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 4E287106566B; Sun, 8 Mar 2009 22:19:29 +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 3C6B78FC0A; Sun, 8 Mar 2009 22:19:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28MJTDu099843; Sun, 8 Mar 2009 22:19:29 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28MJTIA099842; Sun, 8 Mar 2009 22:19:29 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903082219.n28MJTIA099842@svn.freebsd.org> From: Robert Watson Date: Sun, 8 Mar 2009 22:19: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: r189545 - 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 Mar 2009 22:19:29 -0000 Author: rwatson Date: Sun Mar 8 22:19:28 2009 New Revision: 189545 URL: http://svn.freebsd.org/changeset/base/189545 Log: By default, don't compile in counters of calls to various time query functions in the kernel, as these effectively serialize parallel calls to the gettimeofday(2) system call, as well as other kernel services that use timestamps. Use the NetBSD version of the fix (kern_tc.c:1.32 by ad@) as they have picked up our timecounter code and also ran into the same problem. Reported by: kris Obtained from: NetBSD MFC after: 3 days Modified: head/sys/kern/kern_tc.c Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Sun Mar 8 21:48:29 2009 (r189544) +++ head/sys/kern/kern_tc.c Sun Mar 8 22:19:28 2009 (r189545) @@ -103,6 +103,7 @@ static int timestepwarnings; SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW, ×tepwarnings, 0, ""); +#ifdef TC_COUNTERS #define TC_STATS(foo) \ static u_int foo; \ SYSCTL_UINT(_kern_timecounter, OID_AUTO, foo, CTLFLAG_RD, &foo, 0, "");\ @@ -114,7 +115,11 @@ TC_STATS(ngetbinuptime); TC_STATS(ngetna TC_STATS(ngetbintime); TC_STATS(ngetnanotime); TC_STATS(ngetmicrotime); TC_STATS(nsetclock); +#define TC_COUNT(var) var++ #undef TC_STATS +#else +#define TC_COUNT(var) /* nothing */ +#endif /* TC_COUNTERS */ static void tc_windup(void); static void cpu_tick_calibrate(int); @@ -180,7 +185,7 @@ binuptime(struct bintime *bt) struct timehands *th; u_int gen; - nbinuptime++; + TC_COUNT(nbinuptime); do { th = timehands; gen = th->th_generation; @@ -194,7 +199,7 @@ nanouptime(struct timespec *tsp) { struct bintime bt; - nnanouptime++; + TC_COUNT(nnanouptime); binuptime(&bt); bintime2timespec(&bt, tsp); } @@ -204,7 +209,7 @@ microuptime(struct timeval *tvp) { struct bintime bt; - nmicrouptime++; + TC_COUNT(nmicrouptime); binuptime(&bt); bintime2timeval(&bt, tvp); } @@ -213,7 +218,7 @@ void bintime(struct bintime *bt) { - nbintime++; + TC_COUNT(nbintime); binuptime(bt); bintime_add(bt, &boottimebin); } @@ -223,7 +228,7 @@ nanotime(struct timespec *tsp) { struct bintime bt; - nnanotime++; + TC_COUNT(nnanotime); bintime(&bt); bintime2timespec(&bt, tsp); } @@ -233,7 +238,7 @@ microtime(struct timeval *tvp) { struct bintime bt; - nmicrotime++; + TC_COUNT(nmicrotime); bintime(&bt); bintime2timeval(&bt, tvp); } @@ -244,7 +249,7 @@ getbinuptime(struct bintime *bt) struct timehands *th; u_int gen; - ngetbinuptime++; + TC_COUNT(ngetbinuptime); do { th = timehands; gen = th->th_generation; @@ -258,7 +263,7 @@ getnanouptime(struct timespec *tsp) struct timehands *th; u_int gen; - ngetnanouptime++; + TC_COUNT(ngetnanouptime); do { th = timehands; gen = th->th_generation; @@ -272,7 +277,7 @@ getmicrouptime(struct timeval *tvp) struct timehands *th; u_int gen; - ngetmicrouptime++; + TC_COUNT(ngetmicrouptime); do { th = timehands; gen = th->th_generation; @@ -286,7 +291,7 @@ getbintime(struct bintime *bt) struct timehands *th; u_int gen; - ngetbintime++; + TC_COUNT(ngetbintime); do { th = timehands; gen = th->th_generation; @@ -301,7 +306,7 @@ getnanotime(struct timespec *tsp) struct timehands *th; u_int gen; - ngetnanotime++; + TC_COUNT(ngetnanotime); do { th = timehands; gen = th->th_generation; @@ -315,7 +320,7 @@ getmicrotime(struct timeval *tvp) struct timehands *th; u_int gen; - ngetmicrotime++; + TC_COUNT(ngetmicrotime); do { th = timehands; gen = th->th_generation; @@ -406,7 +411,7 @@ tc_setclock(struct timespec *ts) struct bintime bt, bt2; cpu_tick_calibrate(1); - nsetclock++; + TC_COUNT(nsetclock); nanotime(&tbef); timespec2bintime(ts, &bt); binuptime(&bt2); From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 22:55:17 2009 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 AB6FB106566B; Sun, 8 Mar 2009 22:55:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99A7C8FC14; Sun, 8 Mar 2009 22:55:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28MtHwF001411; Sun, 8 Mar 2009 22:55:17 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28MtH7C001409; Sun, 8 Mar 2009 22:55:17 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903082255.n28MtH7C001409@svn.freebsd.org> From: Andrew Thompson Date: Sun, 8 Mar 2009 22:55: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: r189546 - head/sys/dev/usb/serial 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 Mar 2009 22:55:18 -0000 Author: thompsa Date: Sun Mar 8 22:55:17 2009 New Revision: 189546 URL: http://svn.freebsd.org/changeset/base/189546 Log: MFp4 //depot/projects/usb@158869 Fix sael init code. Reported by: Alberto Mijares Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/serial/u3g.c Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Sun Mar 8 22:19:28 2009 (r189545) +++ head/sys/dev/usb/serial/u3g.c Sun Mar 8 22:55:17 2009 (r189546) @@ -299,6 +299,7 @@ u3g_sael_m460_init(struct usb2_device *u }; struct usb2_device_request req; + usb2_error_t err; uint16_t len; uint8_t buf[0x300]; uint8_t n; @@ -320,25 +321,28 @@ u3g_sael_m460_init(struct usb2_device *u DPRINTFN(0, "too small buffer\n"); continue; } - if (usb2_do_request(udev, NULL, &req, buf)) { - DPRINTFN(0, "request %u failed\n", - (unsigned int)n); - break; - } + err = usb2_do_request(udev, NULL, &req, buf); } else { if (len > (sizeof(setup[0]) - 8)) { DPRINTFN(0, "too small buffer\n"); continue; } - if (usb2_do_request(udev, NULL, &req, - __DECONST(uint8_t *, &setup[n][8]))) { - DPRINTFN(0, "request %u failed\n", - (unsigned int)n); + err = usb2_do_request(udev, NULL, &req, + __DECONST(uint8_t *, &setup[n][8])); + } + if (err) { + DPRINTFN(1, "request %u failed\n", + (unsigned int)n); + /* + * Some of the requests will fail. Stop doing + * requests when we are getting timeouts so + * that we don't block the explore/attach + * thread forever. + */ + if (err == USB_ERR_TIMEOUT) break; - } } } - return; } static int From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 22:58:19 2009 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 CE0EC106566B; Sun, 8 Mar 2009 22:58:19 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBC1B8FC0C; Sun, 8 Mar 2009 22:58:19 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28MwJ56001732; Sun, 8 Mar 2009 22:58:19 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28MwJJq001730; Sun, 8 Mar 2009 22:58:19 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903082258.n28MwJJq001730@svn.freebsd.org> From: Andrew Thompson Date: Sun, 8 Mar 2009 22:58: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: r189547 - 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: Sun, 08 Mar 2009 22:58:20 -0000 Author: thompsa Date: Sun Mar 8 22:58:19 2009 New Revision: 189547 URL: http://svn.freebsd.org/changeset/base/189547 Log: MFp4 //depot/projects/usb@158868 Fix bugs and improve HID parsing. - fix possible memory leak found - fix possible NULL pointer access - fix possible invalid memory read - parsing improvements - reset item data position when a new report ID is detected. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_hid.c head/sys/dev/usb/usb_hid.h Modified: head/sys/dev/usb/usb_hid.c ============================================================================== --- head/sys/dev/usb/usb_hid.c Sun Mar 8 22:55:17 2009 (r189546) +++ head/sys/dev/usb/usb_hid.c Sun Mar 8 22:58:19 2009 (r189547) @@ -57,19 +57,25 @@ __FBSDID("$FreeBSD$"); #include static void hid_clear_local(struct hid_item *); +static uint8_t hid_get_byte(struct hid_data *s, const uint16_t wSize); -#define MAXUSAGE 100 +#define MAXUSAGE 64 +#define MAXPUSH 4 struct hid_data { const uint8_t *start; const uint8_t *end; const uint8_t *p; - struct hid_item cur; - int32_t usages[MAXUSAGE]; - int nu; - int minset; - int multi; - int multimax; + struct hid_item cur[MAXPUSH]; + int32_t usages_min[MAXUSAGE]; + int32_t usages_max[MAXUSAGE]; int kindset; + uint8_t pushlevel; /* current pushlevel */ + uint8_t ncount; /* end usage item count */ + uint8_t icount; /* current usage item count */ + uint8_t nusage; /* end "usages_min/max" index */ + uint8_t iusage; /* current "usages_min/max" index */ + uint8_t ousage; /* current "usages_min/max" offset */ + uint8_t susage; /* usage set flags */ }; /*------------------------------------------------------------------------* @@ -79,6 +85,8 @@ static void hid_clear_local(struct hid_item *c) { + c->loc.count = 0; + c->loc.size = 0; c->usage = 0; c->usage_minimum = 0; c->usage_maximum = 0; @@ -99,6 +107,12 @@ hid_start_parse(const void *d, int len, { struct hid_data *s; + if ((kindset-1) & kindset) { + DPRINTFN(0, "Only one bit can be " + "set in the kindset\n"); + return (NULL); + } + s = malloc(sizeof *s, M_TEMP, M_WAITOK | M_ZERO); s->start = s->p = d; s->end = ((const uint8_t *)d) + len; @@ -112,60 +126,103 @@ hid_start_parse(const void *d, int len, void hid_end_parse(struct hid_data *s) { + if (s == NULL) + return; - while (s->cur.next != NULL) { - struct hid_item *hi = s->cur.next->next; - - free(s->cur.next, M_TEMP); - s->cur.next = hi; - } free(s, M_TEMP); } /*------------------------------------------------------------------------* + * get byte from HID descriptor + *------------------------------------------------------------------------*/ +static uint8_t +hid_get_byte(struct hid_data *s, const uint16_t wSize) +{ + const uint8_t *ptr; + uint8_t retval; + + ptr = s->p; + + /* check if end is reached */ + if (ptr == s->end) + return (0); + + /* read out a byte */ + retval = *ptr; + + /* check if data pointer can be advanced by "wSize" bytes */ + if ((s->end - ptr) < wSize) + ptr = s->end; + else + ptr += wSize; + + /* update pointer */ + s->p = ptr; + + return (retval); +} + +/*------------------------------------------------------------------------* * hid_get_item *------------------------------------------------------------------------*/ int hid_get_item(struct hid_data *s, struct hid_item *h) { - struct hid_item *c = &s->cur; + struct hid_item *c; unsigned int bTag, bType, bSize; uint32_t oldpos; - const uint8_t *data; + int32_t mask; int32_t dval; - const uint8_t *p; - struct hid_item *hi; - int i; -top: - if (s->multimax != 0) { - if (s->multi < s->multimax) { - c->usage = s->usages[MIN(s->multi, s->nu - 1)]; - s->multi++; + if (s == NULL) + return (0); + + c = &s->cur[s->pushlevel]; + + top: + /* check if there is an array of items */ + if ((s->icount != s->ncount) && + (s->iusage != s->nusage)) { + dval = s->usages_min[s->iusage] + s->ousage; + c->usage = dval; + if (dval == s->usages_max[s->iusage]) { + s->iusage ++; + s->ousage = 0; + } else { + s->ousage ++; + } + s->icount ++; + /* + * Only copy HID item, increment position and return + * if correct kindset! + */ + if (s->kindset & (1 << c->kind)) { *h = *c; - c->loc.pos += c->loc.size; - h->next = 0; + DPRINTFN(1, "%u,%u,%u\n", h->loc.pos, + h->loc.size, h->loc.count); + c->loc.pos += c->loc.size * c->loc.count; return (1); - } else { - c->loc.count = s->multimax; - s->multimax = 0; - s->nu = 0; - hid_clear_local(c); } } - for (;;) { - p = s->p; - if ((p >= s->end) || (p < s->start)) - return (0); - bSize = *p++; + /* reset state variables */ + s->icount = 0; + s->ncount = 0; + s->iusage = 0; + s->nusage = 0; + s->susage = 0; + s->ousage = 0; + hid_clear_local(c); + + /* get next item */ + while (s->p != s->end) { + + bSize = hid_get_byte(s, 1); if (bSize == 0xfe) { /* long item */ - bSize = *p++; - bSize |= *p++ << 8; - bTag = *p++; - data = p; - p += bSize; + bSize = hid_get_byte(s, 1); + bSize |= hid_get_byte(s, 1) << 8; + bTag = hid_get_byte(s, 1); bType = 0xff; /* XXX what should it be */ } else { /* short item */ @@ -174,30 +231,33 @@ top: bSize &= 3; if (bSize == 3) bSize = 4; - data = p; - p += bSize; } - s->p = p; switch (bSize) { case 0: dval = 0; + mask = 0; break; case 1: - dval = (int8_t)*data++; + dval = (int8_t)hid_get_byte(s, 1); + mask = 0xFF; break; case 2: - dval = *data++; - dval |= *data++ << 8; + dval = hid_get_byte(s, 1); + dval |= hid_get_byte(s, 1) << 8; dval = (int16_t)dval; + mask = 0xFFFF; break; case 4: - dval = *data++; - dval |= *data++ << 8; - dval |= *data++ << 16; - dval |= *data++ << 24; + dval = hid_get_byte(s, 1); + dval |= hid_get_byte(s, 1) << 8; + dval |= hid_get_byte(s, 1) << 16; + dval |= hid_get_byte(s, 1) << 24; + mask = 0xFFFFFFFF; break; default: - printf("BAD LENGTH %d\n", bSize); + dval = hid_get_byte(s, bSize); + DPRINTFN(0, "bad length %u (data=0x%02x)\n", + bSize, dval); continue; } @@ -205,44 +265,35 @@ top: case 0: /* Main */ switch (bTag) { case 8: /* Input */ - if (!(s->kindset & (1 << hid_input))) { - if (s->nu > 0) - s->nu--; - continue; - } c->kind = hid_input; c->flags = dval; ret: if (c->flags & HIO_VARIABLE) { - s->multimax = c->loc.count; - s->multi = 0; + /* range check usage count */ + if (c->loc.count > 255) { + DPRINTFN(0, "Number of " + "items truncated to 255\n"); + s->ncount = 255; + } else + s->ncount = c->loc.count; + + /* + * The "top" loop will return + * one and one item: + */ c->loc.count = 1; - if (s->minset) { - for (i = c->usage_minimum; - i <= c->usage_maximum; - i++) { - s->usages[s->nu] = i; - if (s->nu < MAXUSAGE - 1) - s->nu++; - } - s->minset = 0; - } - goto top; } else { - *h = *c; - h->next = 0; - c->loc.pos += - c->loc.size * c->loc.count; - hid_clear_local(c); - s->minset = 0; - return (1); + /* make sure we have a usage */ + if (s->nusage == 0) { + s->usages_min[s->nusage] = 0; + s->usages_max[s->nusage] = 0; + s->nusage = 1; + } + s->ncount = 1; } + goto top; + case 9: /* Output */ - if (!(s->kindset & (1 << hid_output))) { - if (s->nu > 0) - s->nu--; - continue; - } c->kind = hid_output; c->flags = dval; goto ret; @@ -251,27 +302,22 @@ top: c->collection = dval; c->collevel++; *h = *c; - hid_clear_local(c); - s->nu = 0; return (1); case 11: /* Feature */ - if (!(s->kindset & (1 << hid_feature))) { - if (s->nu > 0) - s->nu--; - continue; - } c->kind = hid_feature; c->flags = dval; goto ret; case 12: /* End collection */ c->kind = hid_endcollection; + if (c->collevel == 0) { + DPRINTFN(0, "invalid end collection\n"); + return (0); + } c->collevel--; *h = *c; - hid_clear_local(c); - s->nu = 0; return (1); default: - printf("Main bTag=%d\n", bTag); + DPRINTFN(0, "Main bTag=%d\n", bTag); break; } break; @@ -303,53 +349,88 @@ top: break; case 8: c->report_ID = dval; + /* new report - reset position */ + c->loc.pos = 0; break; case 9: c->loc.count = dval; break; case 10: /* Push */ - hi = malloc(sizeof *hi, M_TEMP, M_WAITOK); - *hi = s->cur; - c->next = hi; + s->pushlevel ++; + if (s->pushlevel < MAXPUSH) { + s->cur[s->pushlevel] = *c; + c = &s->cur[s->pushlevel]; + } else { + DPRINTFN(0, "Cannot push " + "item @ %d!\n", s->pushlevel); + } break; case 11: /* Pop */ - hi = c->next; - oldpos = c->loc.pos; - s->cur = *hi; - c->loc.pos = oldpos; - free(hi, M_TEMP); + s->pushlevel --; + if (s->pushlevel < MAXPUSH) { + /* preserve position */ + oldpos = c->loc.pos; + c = &s->cur[s->pushlevel]; + c->loc.pos = oldpos; + } else { + DPRINTFN(0, "Cannot pop " + "item @ %d!\n", s->pushlevel); + } break; default: - printf("Global bTag=%d\n", bTag); + DPRINTFN(0, "Global bTag=%d\n", bTag); break; } break; case 2: /* Local */ switch (bTag) { case 0: - if (bSize == 1) - dval = c->_usage_page | (dval & 0xff); - else if (bSize == 2) - dval = c->_usage_page | (dval & 0xffff); - c->usage = dval; - if (s->nu < MAXUSAGE) - s->usages[s->nu++] = dval; - /* else XXX */ + if (bSize != 4) + dval = (dval & mask) | c->_usage_page; + + if (s->nusage < MAXUSAGE) { + s->usages_min[s->nusage] = dval; + s->usages_max[s->nusage] = dval; + s->nusage ++; + } else { + DPRINTFN(0, "max usage reached!\n"); + } + + /* clear any pending usage sets */ + s->susage = 0; break; case 1: - s->minset = 1; - if (bSize == 1) - dval = c->_usage_page | (dval & 0xff); - else if (bSize == 2) - dval = c->_usage_page | (dval & 0xffff); + s->susage |= 1; + + if (bSize != 4) + dval = (dval & mask) | c->_usage_page; c->usage_minimum = dval; - break; + + goto check_set; case 2: - if (bSize == 1) - dval = c->_usage_page | (dval & 0xff); - else if (bSize == 2) - dval = c->_usage_page | (dval & 0xffff); + s->susage |= 2; + + if (bSize != 4) + dval = (dval & mask) | c->_usage_page; c->usage_maximum = dval; + + check_set: + if (s->susage != 3) + break; + + /* sanity check */ + if ((s->nusage < MAXUSAGE) && + (c->usage_minimum < c->usage_maximum)) { + /* add usage range */ + s->usages_min[s->nusage] = + c->usage_minimum; + s->usages_max[s->nusage] = + c->usage_maximum; + s->nusage ++; + } else { + DPRINTFN(0, "Usage set dropped!\n"); + } + s->susage = 0; break; case 3: c->designator_index = dval; @@ -373,15 +454,16 @@ top: c->set_delimiter = dval; break; default: - printf("Local bTag=%d\n", bTag); + DPRINTFN(0, "Local bTag=%d\n", bTag); break; } break; default: - printf("default bType=%d\n", bType); + DPRINTFN(0, "default bType=%d\n", bType); break; } } + return (0); } /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/usb_hid.h ============================================================================== --- head/sys/dev/usb/usb_hid.h Sun Mar 8 22:55:17 2009 (r189546) +++ head/sys/dev/usb/usb_hid.h Sun Mar 8 22:58:19 2009 (r189547) @@ -70,8 +70,6 @@ struct hid_item { uint32_t flags; /* Location */ struct hid_location loc; - /* */ - struct hid_item *next; }; /* prototypes from "usb2_hid.c" */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 23:45:56 2009 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 B4DD01065678; Sun, 8 Mar 2009 23:45:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A373B8FC1A; Sun, 8 Mar 2009 23:45:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28Njuo3003262; Sun, 8 Mar 2009 23:45:56 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28NjuqX003261; Sun, 8 Mar 2009 23:45:56 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903082345.n28NjuqX003261@svn.freebsd.org> From: Sam Leffler Date: Sun, 8 Mar 2009 23:45: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: r189548 - head/sys/arm/xscale/ixp425 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 Mar 2009 23:45:57 -0000 Author: sam Date: Sun Mar 8 23:45:56 2009 New Revision: 189548 URL: http://svn.freebsd.org/changeset/base/189548 Log: o mark unexpected callbacks more clearly o unwrap some lines Modified: head/sys/arm/xscale/ixp425/ixp425_pci.c Modified: head/sys/arm/xscale/ixp425/ixp425_pci.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425_pci.c Sun Mar 8 22:58:19 2009 (r189547) +++ head/sys/arm/xscale/ixp425/ixp425_pci.c Sun Mar 8 23:45:56 2009 (r189548) @@ -97,10 +97,8 @@ static void ixp425_pci_conf_reg_write(struct ixppcib_softc *sc, uint32_t reg, uint32_t data) { - PCI_CSR_WRITE_4(sc, - PCI_CRP_AD_CBE, ((reg & ~3) | COMMAND_CRP_WRITE)); - PCI_CSR_WRITE_4(sc, - PCI_CRP_AD_WDATA, data); + PCI_CSR_WRITE_4(sc, PCI_CRP_AD_CBE, ((reg & ~3) | COMMAND_CRP_WRITE)); + PCI_CSR_WRITE_4(sc, PCI_CRP_AD_WDATA, data); } static int @@ -325,7 +323,8 @@ ixppcib_activate_resource(device_t bus, struct resource *r) { - device_printf(bus, "%s called activate_resource\n", device_get_nameunit(child)); + device_printf(bus, "%s called activate_resource (unexpected)\n", + device_get_nameunit(child)); return (ENXIO); } @@ -334,7 +333,8 @@ ixppcib_deactivate_resource(device_t bus struct resource *r) { - device_printf(bus, "%s called deactivate_resource\n", device_get_nameunit(child)); + device_printf(bus, "%s called deactivate_resource (unexpected)\n", + device_get_nameunit(child)); return (ENXIO); } @@ -343,7 +343,8 @@ ixppcib_release_resource(device_t bus, d struct resource *r) { - device_printf(bus, "%s called release_resource\n", device_get_nameunit(child)); + device_printf(bus, "%s called release_resource (unexpected)\n", + device_get_nameunit(child)); return (ENXIO); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 02:34:02 2009 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 844F31065672; Mon, 9 Mar 2009 02:34:02 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 727878FC0A; Mon, 9 Mar 2009 02:34:02 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n292Y29x006915; Mon, 9 Mar 2009 02:34:02 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n292Y2aC006913; Mon, 9 Mar 2009 02:34:02 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <200903090234.n292Y2aC006913@svn.freebsd.org> From: David Xu Date: Mon, 9 Mar 2009 02:34: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: r189549 - in head/lib/libthr: . thread 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 Mar 2009 02:34:02 -0000 Author: davidxu Date: Mon Mar 9 02:34:02 2009 New Revision: 189549 URL: http://svn.freebsd.org/changeset/base/189549 Log: Don't reference non-existent __fcntl_compat if WITHOUT_SYSCALL_COMPAT is defined. Submitted by: Pawel Worach "pawel dot worach at gmail dot com" Modified: head/lib/libthr/Makefile head/lib/libthr/thread/thr_syscalls.c Modified: head/lib/libthr/Makefile ============================================================================== --- head/lib/libthr/Makefile Sun Mar 8 23:45:56 2009 (r189548) +++ head/lib/libthr/Makefile Mon Mar 9 02:34:02 2009 (r189549) @@ -51,4 +51,8 @@ SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthr SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a .endif +.if !defined(WITHOUT_SYSCALL_COMPAT) +CFLAGS+=-DSYSCALL_COMPAT +.endif + .include Modified: head/lib/libthr/thread/thr_syscalls.c ============================================================================== --- head/lib/libthr/thread/thr_syscalls.c Sun Mar 8 23:45:56 2009 (r189548) +++ head/lib/libthr/thread/thr_syscalls.c Mon Mar 9 02:34:02 2009 (r189549) @@ -132,7 +132,9 @@ int __aio_suspend(const struct aiocb * c int __close(int); int __connect(int, const struct sockaddr *, socklen_t); int __fcntl(int, int,...); +#ifdef SYSCALL_COMPAT extern int __fcntl_compat(int, int,...); +#endif int __fsync(int); int __msync(void *, size_t, int); int __nanosleep(const struct timespec *, struct timespec *); @@ -253,7 +255,11 @@ __fcntl(int fd, int cmd,...) ret = __sys_fcntl(fd, cmd); break; default: +#ifdef SYSCALL_COMPAT ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); +#else + ret = EOPNOTSUPP; +#endif } va_end(ap); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 02:37:52 2009 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 9050C1065700; Mon, 9 Mar 2009 02:37:52 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EC2F8FC14; Mon, 9 Mar 2009 02:37:52 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n292bqWq007022; Mon, 9 Mar 2009 02:37:52 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n292bqUM007021; Mon, 9 Mar 2009 02:37:52 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903090237.n292bqUM007021@svn.freebsd.org> From: Sam Leffler Date: Mon, 9 Mar 2009 02:37: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: r189550 - head/sys/dev/if_ndis 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 Mar 2009 02:37:53 -0000 Author: sam Date: Mon Mar 9 02:37:52 2009 New Revision: 189550 URL: http://svn.freebsd.org/changeset/base/189550 Log: Fix TXPMGT handling: o correct dBm<->mW conversion logic o set net80211 TXPMGT capability only if driver reports it is capable PR: kern/132342 Submitted by: "Paul B. Mahol" Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Mon Mar 9 02:34:02 2009 (r189549) +++ head/sys/dev/if_ndis/if_ndis.c Mon Mar 9 02:37:52 2009 (r189550) @@ -102,7 +102,7 @@ SYSCTL_INT(_hw_ndisusb, OID_AUTO, halt, "Halt NDIS USB driver when it's attached"); /* 0 - 30 dBm to mW conversion table */ -const uint16_t dBm2mW[] = { +static const uint16_t dBm2mW[] = { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 25, 28, @@ -749,7 +749,7 @@ ndis_attach(dev) ic->ic_ifp = ifp; ic->ic_opmode = IEEE80211_M_STA; ic->ic_phytype = IEEE80211_T_DS; - ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_IBSS | IEEE80211_C_TXPMGT; + ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_IBSS; setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO); len = 0; r = ndis_get_info(sc, OID_802_11_NETWORK_TYPES_SUPPORTED, @@ -928,6 +928,11 @@ got_crypto: r = ndis_get_info(sc, OID_802_11_POWER_MODE, &arg, &i); if (r == 0) ic->ic_caps |= IEEE80211_C_PMGT; + + r = ndis_get_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &i); + if (r == 0) + ic->ic_caps |= IEEE80211_C_TXPMGT; + bcopy(eaddr, &ic->ic_myaddr, sizeof(eaddr)); ieee80211_ifattach(ic); ic->ic_raw_xmit = ndis_raw_xmit; @@ -2325,9 +2330,10 @@ ndis_setstate_80211(sc) ndis_set_info(sc, OID_802_11_POWER_MODE, &arg, &len); /* Set TX power */ - if (ic->ic_txpowlimit < sizeof(dBm2mW)) { - len = sizeof(arg); + if ((ic->ic_caps & IEEE80211_C_TXPMGT) && + ic->ic_txpowlimit < (sizeof(dBm2mW) / sizeof(dBm2mW[0]))) { arg = dBm2mW[ic->ic_txpowlimit]; + len = sizeof(arg); ndis_set_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &len); } @@ -2798,11 +2804,10 @@ ndis_getstate_80211(sc) } /* Get TX power */ - len = sizeof(arg); - rval = ndis_get_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &len); - - if (!rval) { - for (i = 0; i < sizeof(dBm2mW); i++) + if (ic->ic_caps & IEEE80211_C_TXPMGT) { + len = sizeof(arg); + ndis_get_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &len); + for (i = 0; i < (sizeof(dBm2mW) / sizeof(dBm2mW[0])); i++) if (dBm2mW[i] >= arg) break; ic->ic_txpowlimit = i; From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 03:35:26 2009 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 16E8E1065670; Mon, 9 Mar 2009 03:35:26 +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 057CE8FC12; Mon, 9 Mar 2009 03:35:26 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n293ZPDB008337; Mon, 9 Mar 2009 03:35:25 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n293ZPgA008336; Mon, 9 Mar 2009 03:35:25 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200903090335.n293ZPgA008336@svn.freebsd.org> From: Alan Cox Date: Mon, 9 Mar 2009 03:35: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: r189551 - head/sys/amd64/amd64 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 Mar 2009 03:35:26 -0000 Author: alc Date: Mon Mar 9 03:35:25 2009 New Revision: 189551 URL: http://svn.freebsd.org/changeset/base/189551 Log: Change pmap_enter_quick_locked() so that it uses the kernel's direct map instead of the pmap's recursive mapping to access the lowest level of the page table when it maps a user-space virtual address. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Mar 9 02:37:52 2009 (r189550) +++ head/sys/amd64/amd64/pmap.c Mon Mar 9 03:35:25 2009 (r189551) @@ -3253,17 +3253,12 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ return (mpte); } } + pte = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mpte)); + pte = &pte[pmap_pte_index(va)]; } else { mpte = NULL; + pte = vtopte(va); } - - /* - * This call to vtopte makes the assumption that we are - * entering the page into the current pmap. In order to support - * quick entry into any pmap, one would likely use pmap_pte. - * But that isn't as quick as vtopte. - */ - pte = vtopte(va); if (*pte) { if (mpte != NULL) { mpte->wire_count--; From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 05:41:05 2009 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 2F736106564A; Mon, 9 Mar 2009 05:41:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DBF48FC0C; Mon, 9 Mar 2009 05:41:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n295f4KH010810; Mon, 9 Mar 2009 05:41:04 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n295f4PO010809; Mon, 9 Mar 2009 05:41:04 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903090541.n295f4PO010809@svn.freebsd.org> From: Xin LI Date: Mon, 9 Mar 2009 05:41: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: r189552 - 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: Mon, 09 Mar 2009 05:41:05 -0000 Author: delphij Date: Mon Mar 9 05:41:04 2009 New Revision: 189552 URL: http://svn.freebsd.org/changeset/base/189552 Log: A system with plenty of memory would not require so much swap for generic usage. Discussed with: dillon Modified: head/share/man/man7/tuning.7 Modified: head/share/man/man7/tuning.7 ============================================================================== --- head/share/man/man7/tuning.7 Mon Mar 9 03:35:25 2009 (r189551) +++ head/share/man/man7/tuning.7 Mon Mar 9 05:41:04 2009 (r189552) @@ -51,7 +51,9 @@ I usually create, in order, a 128M root, and use any remaining space for .Pa /home . .Pp -You should typically size your swap space to approximately 2x main memory. +You should typically size your swap space to approximately 2x main memory +for systems with less than 2GB of RAM, or approximately 1x main memory +if you have more. If you do not have a lot of RAM, though, you will generally want a lot more swap. It is not recommended that you configure any less than From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 05:54:43 2009 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 87ED6106566C; Mon, 9 Mar 2009 05:54:43 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 762588FC14; Mon, 9 Mar 2009 05:54:43 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n295sh6b011116; Mon, 9 Mar 2009 05:54:43 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n295shJH011115; Mon, 9 Mar 2009 05:54:43 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <200903090554.n295shJH011115@svn.freebsd.org> From: David Xu Date: Mon, 9 Mar 2009 05:54: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: r189553 - head/lib/libthr/thread 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 Mar 2009 05:54:44 -0000 Author: davidxu Date: Mon Mar 9 05:54:43 2009 New Revision: 189553 URL: http://svn.freebsd.org/changeset/base/189553 Log: Don't ignore other fcntl functions, directly call __sys_fcntl if WITHOUT_SYSCALL_COMPAT is not defined. Reviewed by: deischen Modified: head/lib/libthr/thread/thr_syscalls.c Modified: head/lib/libthr/thread/thr_syscalls.c ============================================================================== --- head/lib/libthr/thread/thr_syscalls.c Mon Mar 9 05:41:04 2009 (r189552) +++ head/lib/libthr/thread/thr_syscalls.c Mon Mar 9 05:54:43 2009 (r189553) @@ -258,7 +258,7 @@ __fcntl(int fd, int cmd,...) #ifdef SYSCALL_COMPAT ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); #else - ret = EOPNOTSUPP; + ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); #endif } va_end(ap); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 06:02:55 2009 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 A816C1065672; Mon, 9 Mar 2009 06:02:55 +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 7B8668FC16; Mon, 9 Mar 2009 06:02:55 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2962t6c011408; Mon, 9 Mar 2009 06:02:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2962tfu011407; Mon, 9 Mar 2009 06:02:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903090602.n2962tfu011407@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Mar 2009 06:02: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: r189555 - head/sys/dev/re 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 Mar 2009 06:02:56 -0000 Author: yongari Date: Mon Mar 9 06:02:55 2009 New Revision: 189555 URL: http://svn.freebsd.org/changeset/base/189555 Log: Add a new tunable hw.re.prefer_iomap which disables memory register mapping. The tunable is OFF for all controllers except RTL8169SC family. RTL8169SC seems to require more magic to use memory register mapping. r187483 added a fix for RTL8169SCe controller but it does not looke like fix other variants of RTL8169SC. Tested by: Gavin Stone-Tolcher g.stone-tolcher <> its dot uq dot edu dot au Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Mar 9 06:02:05 2009 (r189554) +++ head/sys/dev/re/if_re.c Mon Mar 9 06:02:55 2009 (r189555) @@ -158,6 +158,8 @@ MODULE_DEPEND(re, miibus, 1, 1, 1); /* Tunables. */ static int msi_disable = 0; TUNABLE_INT("hw.re.msi_disable", &msi_disable); +static int prefer_iomap = 0; +TUNABLE_INT("hw.re.prefer_iomap", &prefer_iomap); #define RE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) @@ -1118,25 +1120,35 @@ re_attach(device_t dev) pci_enable_busmaster(dev); devid = pci_get_device(dev); - /* Prefer memory space register mapping over IO space. */ - sc->rl_res_id = PCIR_BAR(1); - sc->rl_res_type = SYS_RES_MEMORY; - /* RTL8168/8101E seems to use different BARs. */ - if (devid == RT_DEVICEID_8168 || devid == RT_DEVICEID_8101E) - sc->rl_res_id = PCIR_BAR(2); + /* + * Prefer memory space register mapping over IO space. + * Because RTL8169SC does not seem to work when memory mapping + * is used always activate io mapping. + */ + if (devid == RT_DEVICEID_8169SC) + prefer_iomap = 1; + if (prefer_iomap == 0) { + sc->rl_res_id = PCIR_BAR(1); + sc->rl_res_type = SYS_RES_MEMORY; + /* RTL8168/8101E seems to use different BARs. */ + if (devid == RT_DEVICEID_8168 || devid == RT_DEVICEID_8101E) + sc->rl_res_id = PCIR_BAR(2); + } else { + sc->rl_res_id = PCIR_BAR(0); + sc->rl_res_type = SYS_RES_IOPORT; + } sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, &sc->rl_res_id, RF_ACTIVE); - - if (sc->rl_res == NULL) { + if (sc->rl_res == NULL && prefer_iomap == 0) { sc->rl_res_id = PCIR_BAR(0); sc->rl_res_type = SYS_RES_IOPORT; sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, &sc->rl_res_id, RF_ACTIVE); - if (sc->rl_res == NULL) { - device_printf(dev, "couldn't map ports/memory\n"); - error = ENXIO; - goto fail; - } + } + if (sc->rl_res == NULL) { + device_printf(dev, "couldn't map ports/memory\n"); + error = ENXIO; + goto fail; } sc->rl_btag = rman_get_bustag(sc->rl_res); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 07:24:33 2009 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 4CC6B106566B; Mon, 9 Mar 2009 07:24:33 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B0528FC08; Mon, 9 Mar 2009 07:24:33 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n297OX8J012994; Mon, 9 Mar 2009 07:24:33 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n297OXPO012993; Mon, 9 Mar 2009 07:24:33 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903090724.n297OXPO012993@svn.freebsd.org> From: Robert Noland Date: Mon, 9 Mar 2009 07:24: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: r189557 - head/sys/dev/drm 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 Mar 2009 07:24:34 -0000 Author: rnoland Date: Mon Mar 9 07:24:32 2009 New Revision: 189557 URL: http://svn.freebsd.org/changeset/base/189557 Log: Call the right function for the right chipset. MFC after: 10 days Modified: head/sys/dev/drm/radeon_cp.c Modified: head/sys/dev/drm/radeon_cp.c ============================================================================== --- head/sys/dev/drm/radeon_cp.c Mon Mar 9 06:14:27 2009 (r189556) +++ head/sys/dev/drm/radeon_cp.c Mon Mar 9 07:24:32 2009 (r189557) @@ -1705,7 +1705,7 @@ void radeon_do_release(struct drm_device if (dev_priv) { if (dev_priv->cp_running) { /* Stop the cp */ - if ((dev_priv->flags & RADEON_FAMILY_MASK) < CHIP_R600) { + if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) { while ((ret = r600_do_cp_idle(dev_priv)) != 0) { DRM_DEBUG("radeon_do_cp_idle %d\n", ret); #ifdef __linux__ From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 07:33:35 2009 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 CD9CE1065675; Mon, 9 Mar 2009 07:33:35 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A17A48FC1B; Mon, 9 Mar 2009 07:33:35 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n297XZUC013182; Mon, 9 Mar 2009 07:33:35 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n297XZ32013181; Mon, 9 Mar 2009 07:33:35 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903090733.n297XZ32013181@svn.freebsd.org> From: Robert Noland Date: Mon, 9 Mar 2009 07:33: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: r189558 - head/sys/dev/drm 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 Mar 2009 07:33:37 -0000 Author: rnoland Date: Mon Mar 9 07:33:35 2009 New Revision: 189558 URL: http://svn.freebsd.org/changeset/base/189558 Log: -Make the PCI(E)/AGP calculations consistent -Calculate the scratch address correctly MFC after: 10 days Modified: head/sys/dev/drm/r600_cp.c Modified: head/sys/dev/drm/r600_cp.c ============================================================================== --- head/sys/dev/drm/r600_cp.c Mon Mar 9 07:24:32 2009 (r189557) +++ head/sys/dev/drm/r600_cp.c Mon Mar 9 07:33:35 2009 (r189558) @@ -1633,6 +1633,7 @@ static void r600_cp_init_ring_buffer(str struct drm_file *file_priv) { u32 ring_start; + u64 rptr_addr; if (((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770)) r700_gfx_init(dev, dev_priv); @@ -1687,27 +1688,20 @@ static void r600_cp_init_ring_buffer(str #if __OS_HAS_AGP if (dev_priv->flags & RADEON_IS_AGP) { - /* XXX */ - RADEON_WRITE(R600_CP_RB_RPTR_ADDR, - (dev_priv->ring_rptr->offset - - dev->agp->base + dev_priv->gart_vm_start) >> 8); - RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI, 0); + rptr_addr = dev_priv->ring_rptr->offset + - dev->agp->base + + dev_priv->gart_vm_start; } else #endif { - struct drm_sg_mem *entry = dev->sg; - unsigned long tmp_ofs, page_ofs; - - tmp_ofs = dev_priv->ring_rptr->offset - - (unsigned long)dev->sg->virtual; - page_ofs = tmp_ofs >> PAGE_SHIFT; - - RADEON_WRITE(R600_CP_RB_RPTR_ADDR, entry->busaddr[page_ofs] >> 8); - RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI, 0); - DRM_DEBUG("ring rptr: offset=0x%08lx handle=0x%08lx\n", - (unsigned long)entry->busaddr[page_ofs], - entry->handle + tmp_ofs); - } + rptr_addr = dev_priv->ring_rptr->offset + - ((unsigned long) dev->sg->virtual) + + dev_priv->gart_vm_start; + } + RADEON_WRITE(R600_CP_RB_RPTR_ADDR, + rptr_addr & 0xffffffff); + RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI, + upper_32_bits(rptr_addr)); #ifdef __BIG_ENDIAN RADEON_WRITE(R600_CP_RB_CNTL, @@ -1756,8 +1750,17 @@ static void r600_cp_init_ring_buffer(str * We simply put this behind the ring read pointer, this works * with PCI GART as well as (whatever kind of) AGP GART */ - RADEON_WRITE(R600_SCRATCH_ADDR, ((RADEON_READ(R600_CP_RB_RPTR_ADDR) << 8) - + R600_SCRATCH_REG_OFFSET) >> 8); + { + u64 scratch_addr; + + scratch_addr = RADEON_READ(R600_CP_RB_RPTR_ADDR); + scratch_addr |= ((u64)RADEON_READ(R600_CP_RB_RPTR_ADDR_HI)) << 32; + scratch_addr += R600_SCRATCH_REG_OFFSET; + scratch_addr >>= 8; + scratch_addr &= 0xffffffff; + + RADEON_WRITE(R600_SCRATCH_ADDR, (uint32_t)scratch_addr); + } RADEON_WRITE(R600_SCRATCH_UMSK, 0x7); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 07:38:22 2009 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 B62B61065754; Mon, 9 Mar 2009 07:38:22 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A26BF8FC08; Mon, 9 Mar 2009 07:38:22 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n297cMDB013306; Mon, 9 Mar 2009 07:38:22 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n297cMZl013305; Mon, 9 Mar 2009 07:38:22 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903090738.n297cMZl013305@svn.freebsd.org> From: Robert Noland Date: Mon, 9 Mar 2009 07:38: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: r189559 - head/sys/dev/drm 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 Mar 2009 07:38:23 -0000 Author: rnoland Date: Mon Mar 9 07:38:22 2009 New Revision: 189559 URL: http://svn.freebsd.org/changeset/base/189559 Log: Fix the flags to bus_dmamem_* to allow the allocation to sleep while waiting for resources. It is really the load that we can't defer. BUS_DMA_NOCACHE belongs on bus_dmamap_load() as well. MFC after: 3 days Modified: head/sys/dev/drm/drm_scatter.c Modified: head/sys/dev/drm/drm_scatter.c ============================================================================== --- head/sys/dev/drm/drm_scatter.c Mon Mar 9 07:33:35 2009 (r189558) +++ head/sys/dev/drm/drm_scatter.c Mon Mar 9 07:38:22 2009 (r189559) @@ -92,7 +92,7 @@ drm_sg_alloc(struct drm_device *dev, str } ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, - BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_NOCACHE, &dmah->map); + BUS_DMA_WAITOK | BUS_DMA_ZERO, &dmah->map); if (ret != 0) { bus_dma_tag_destroy(dmah->tag); free(dmah, DRM_MEM_DMA); @@ -102,7 +102,8 @@ drm_sg_alloc(struct drm_device *dev, str } ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr, - request->size, drm_sg_alloc_cb, entry, 0); + request->size, drm_sg_alloc_cb, entry, + BUS_DMA_NOWAIT | BUS_DMA_NOCACHE); if (ret != 0) { bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 07:47:03 2009 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 E20ED106564A; Mon, 9 Mar 2009 07:47:03 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D020B8FC08; Mon, 9 Mar 2009 07:47:03 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n297l34T013509; Mon, 9 Mar 2009 07:47:03 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n297l3tj013508; Mon, 9 Mar 2009 07:47:03 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903090747.n297l3tj013508@svn.freebsd.org> From: Robert Noland Date: Mon, 9 Mar 2009 07:47: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: r189560 - head/sys/dev/drm 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 Mar 2009 07:47:04 -0000 Author: rnoland Date: Mon Mar 9 07:47:03 2009 New Revision: 189560 URL: http://svn.freebsd.org/changeset/base/189560 Log: Change the flags to bus_dmamem around to allow it to sleep waiting for resources during allocation, but not during map load. Also, zero the buffers here. MFC after: 3 days Modified: head/sys/dev/drm/drm_pci.c Modified: head/sys/dev/drm/drm_pci.c ============================================================================== --- head/sys/dev/drm/drm_pci.c Mon Mar 9 07:38:22 2009 (r189559) +++ head/sys/dev/drm/drm_pci.c Mon Mar 9 07:47:03 2009 (r189560) @@ -83,15 +83,15 @@ drm_pci_alloc(struct drm_device *dev, si maxaddr, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */ NULL, NULL, /* filtfunc, filtfuncargs */ size, 1, size, /* maxsize, nsegs, maxsegsize */ - BUS_DMA_ALLOCNOW, NULL, NULL, /* flags, lockfunc, lockfuncargs */ + 0, NULL, NULL, /* flags, lockfunc, lockfuncargs */ &dmah->tag); if (ret != 0) { free(dmah, DRM_MEM_DMA); return NULL; } - ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, BUS_DMA_NOWAIT, - &dmah->map); + ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, + BUS_DMA_WAITOK | BUS_DMA_ZERO, &dmah->map); if (ret != 0) { bus_dma_tag_destroy(dmah->tag); free(dmah, DRM_MEM_DMA); @@ -99,7 +99,7 @@ drm_pci_alloc(struct drm_device *dev, si } ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr, size, - drm_pci_busdma_callback, dmah, 0); + drm_pci_busdma_callback, dmah, BUS_DMA_NOWAIT); if (ret != 0) { bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 07:49:13 2009 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 91EE41065709; Mon, 9 Mar 2009 07:49:13 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FF9C8FC24; Mon, 9 Mar 2009 07:49:13 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n297nDgd013580; Mon, 9 Mar 2009 07:49:13 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n297nDlH013579; Mon, 9 Mar 2009 07:49:13 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903090749.n297nDlH013579@svn.freebsd.org> From: Robert Noland Date: Mon, 9 Mar 2009 07:49: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: r189561 - head/sys/dev/drm 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 Mar 2009 07:49:14 -0000 Author: rnoland Date: Mon Mar 9 07:49:13 2009 New Revision: 189561 URL: http://svn.freebsd.org/changeset/base/189561 Log: There is no need to sync these buffers to swap. MFC after: 3 days Modified: head/sys/dev/drm/drm_bufs.c Modified: head/sys/dev/drm/drm_bufs.c ============================================================================== --- head/sys/dev/drm/drm_bufs.c Mon Mar 9 07:47:03 2009 (r189560) +++ head/sys/dev/drm/drm_bufs.c Mon Mar 9 07:49:13 2009 (r189561) @@ -1052,11 +1052,12 @@ int drm_mapbufs(struct drm_device *dev, vaddr = round_page((vm_offset_t)vms->vm_daddr + MAXDSIZ); #if __FreeBSD_version >= 600023 retcode = vm_mmap(&vms->vm_map, &vaddr, size, PROT_READ | PROT_WRITE, - VM_PROT_ALL, MAP_SHARED, OBJT_DEVICE, dev->devnode, foff); + VM_PROT_ALL, MAP_SHARED | MAP_NOSYNC, OBJT_DEVICE, + dev->devnode, foff); #else retcode = vm_mmap(&vms->vm_map, &vaddr, size, PROT_READ | PROT_WRITE, - VM_PROT_ALL, MAP_SHARED, SLIST_FIRST(&dev->devnode->si_hlist), - foff); + VM_PROT_ALL, MAP_SHARED | MAP_NOSYNC, + SLIST_FIRST(&dev->devnode->si_hlist), foff); #endif if (retcode) goto done; From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 07:50:28 2009 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 39F791065674; Mon, 9 Mar 2009 07:50:28 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27F5A8FC25; Mon, 9 Mar 2009 07:50:28 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n297oSGE013648; Mon, 9 Mar 2009 07:50:28 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n297oSBf013647; Mon, 9 Mar 2009 07:50:28 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903090750.n297oSBf013647@svn.freebsd.org> From: Robert Noland Date: Mon, 9 Mar 2009 07:50: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: r189562 - head/sys/dev/drm 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 Mar 2009 07:50:29 -0000 Author: rnoland Date: Mon Mar 9 07:50:27 2009 New Revision: 189562 URL: http://svn.freebsd.org/changeset/base/189562 Log: Clean up the printing on amd64. Should also be consistent on i386. MFC after: 3 days Modified: head/sys/dev/drm/drm_sysctl.c Modified: head/sys/dev/drm/drm_sysctl.c ============================================================================== --- head/sys/dev/drm/drm_sysctl.c Mon Mar 9 07:49:13 2009 (r189561) +++ head/sys/dev/drm/drm_sysctl.c Mon Mar 9 07:50:27 2009 (r189562) @@ -185,8 +185,8 @@ static int drm_vm_info DRM_SYSCTL_HANDLE DRM_UNLOCK(); - DRM_SYSCTL_PRINT("\nslot offset size type flags " - "address mtrr\n"); + DRM_SYSCTL_PRINT("\nslot offset size " + "type flags address mtrr\n"); for (i = 0; i < mapcount; i++) { map = &tempmaps[i]; @@ -202,7 +202,7 @@ static int drm_vm_info DRM_SYSCTL_HANDLE yesno = "yes"; DRM_SYSCTL_PRINT( - "%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx %s\n", i, + "%4d 0x%016lx 0x%08lx %4.4s 0x%02x 0x%016lx %s\n", i, map->offset, map->size, type, map->flags, (unsigned long)map->handle, yesno); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 07:55:19 2009 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 8BDE1106566B; Mon, 9 Mar 2009 07:55:19 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 793A48FC19; Mon, 9 Mar 2009 07:55:19 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n297tJMw013804; Mon, 9 Mar 2009 07:55:19 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n297tJRQ013794; Mon, 9 Mar 2009 07:55:19 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903090755.n297tJRQ013794@svn.freebsd.org> From: Robert Noland Date: Mon, 9 Mar 2009 07:55: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: r189563 - head/sys/dev/drm 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 Mar 2009 07:55:20 -0000 Author: rnoland Date: Mon Mar 9 07:55:18 2009 New Revision: 189563 URL: http://svn.freebsd.org/changeset/base/189563 Log: Consistently use kdev for the kernel device. Submitted by: vehemens MFC after: 3 days Modified: head/sys/dev/drm/drmP.h head/sys/dev/drm/drm_drv.c head/sys/dev/drm/i915_drv.c head/sys/dev/drm/mach64_drv.c head/sys/dev/drm/mga_drv.c head/sys/dev/drm/r128_drv.c head/sys/dev/drm/radeon_drv.c head/sys/dev/drm/savage_drv.c head/sys/dev/drm/sis_drv.c head/sys/dev/drm/tdfx_drv.c Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/drmP.h Mon Mar 9 07:55:18 2009 (r189563) @@ -720,10 +720,10 @@ static inline int drm_core_has_AGP(struc extern int drm_debug_flag; /* Device setup support (drm_drv.c) */ -int drm_probe(device_t nbdev, drm_pci_id_list_t *idlist); -int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist); +int drm_probe(device_t kdev, drm_pci_id_list_t *idlist); +int drm_attach(device_t kdev, drm_pci_id_list_t *idlist); void drm_close(void *data); -int drm_detach(device_t nbdev); +int drm_detach(device_t kdev); d_ioctl_t drm_ioctl; d_open_t drm_open; d_read_t drm_read; Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/drm_drv.c Mon Mar 9 07:55:18 2009 (r189563) @@ -158,53 +158,53 @@ static int drm_msi_is_blacklisted(int ve return 0; } -int drm_probe(device_t dev, drm_pci_id_list_t *idlist) +int drm_probe(device_t kdev, drm_pci_id_list_t *idlist) { drm_pci_id_list_t *id_entry; int vendor, device; #if __FreeBSD_version < 700010 device_t realdev; - if (!strcmp(device_get_name(dev), "drmsub")) - realdev = device_get_parent(dev); + if (!strcmp(device_get_name(kdev), "drmsub")) + realdev = device_get_parent(kdev); else - realdev = dev; + realdev = kdev; vendor = pci_get_vendor(realdev); device = pci_get_device(realdev); #else - vendor = pci_get_vendor(dev); - device = pci_get_device(dev); + vendor = pci_get_vendor(kdev); + device = pci_get_device(kdev); #endif - if (pci_get_class(dev) != PCIC_DISPLAY - || pci_get_subclass(dev) != PCIS_DISPLAY_VGA) + if (pci_get_class(kdev) != PCIC_DISPLAY + || pci_get_subclass(kdev) != PCIS_DISPLAY_VGA) return ENXIO; id_entry = drm_find_description(vendor, device, idlist); if (id_entry != NULL) { - device_set_desc(dev, id_entry->name); + device_set_desc(kdev, id_entry->name); return 0; } return ENXIO; } -int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist) +int drm_attach(device_t kdev, drm_pci_id_list_t *idlist) { struct drm_device *dev; drm_pci_id_list_t *id_entry; int unit, msicount; - unit = device_get_unit(nbdev); - dev = device_get_softc(nbdev); + unit = device_get_unit(kdev); + dev = device_get_softc(kdev); #if __FreeBSD_version < 700010 - if (!strcmp(device_get_name(nbdev), "drmsub")) - dev->device = device_get_parent(nbdev); + if (!strcmp(device_get_name(kdev), "drmsub")) + dev->device = device_get_parent(kdev); else - dev->device = nbdev; + dev->device = kdev; #else - dev->device = nbdev; + dev->device = kdev; #endif dev->devnode = make_dev(&drm_cdevsw, unit, @@ -259,11 +259,11 @@ int drm_attach(device_t nbdev, drm_pci_i return drm_load(dev); } -int drm_detach(device_t nbdev) +int drm_detach(device_t kdev) { struct drm_device *dev; - dev = device_get_softc(nbdev); + dev = device_get_softc(kdev); drm_unload(dev); Modified: head/sys/dev/drm/i915_drv.c ============================================================================== --- head/sys/dev/drm/i915_drv.c Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/i915_drv.c Mon Mar 9 07:55:18 2009 (r189563) @@ -43,9 +43,9 @@ static drm_pci_id_list_t i915_pciidlist[ i915_PCI_IDS }; -static int i915_suspend(device_t nbdev) +static int i915_suspend(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); struct drm_i915_private *dev_priv = dev->dev_private; if (!dev || !dev_priv) { @@ -57,16 +57,16 @@ static int i915_suspend(device_t nbdev) i915_save_state(dev); - return (bus_generic_suspend(nbdev)); + return (bus_generic_suspend(kdev)); } -static int i915_resume(device_t nbdev) +static int i915_resume(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); i915_restore_state(dev); - return (bus_generic_resume(nbdev)); + return (bus_generic_resume(kdev)); } static void i915_configure(struct drm_device *dev) @@ -100,31 +100,31 @@ static void i915_configure(struct drm_de } static int -i915_probe(device_t dev) +i915_probe(device_t kdev) { - return drm_probe(dev, i915_pciidlist); + return drm_probe(kdev, i915_pciidlist); } static int -i915_attach(device_t nbdev) +i915_attach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); i915_configure(dev); - return drm_attach(nbdev, i915_pciidlist); + return drm_attach(kdev, i915_pciidlist); } static int -i915_detach(device_t nbdev) +i915_detach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); int ret; - ret = drm_detach(nbdev); + ret = drm_detach(kdev); free(dev->driver, DRM_MEM_DRIVER); Modified: head/sys/dev/drm/mach64_drv.c ============================================================================== --- head/sys/dev/drm/mach64_drv.c Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/mach64_drv.c Mon Mar 9 07:55:18 2009 (r189563) @@ -77,22 +77,22 @@ static void mach64_configure(struct drm_ } static int -mach64_probe(device_t dev) +mach64_probe(device_t kdev) { - return drm_probe(dev, mach64_pciidlist); + return drm_probe(kdev, mach64_pciidlist); } static int -mach64_attach(device_t nbdev) +mach64_attach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); mach64_configure(dev); - return drm_attach(nbdev, mach64_pciidlist); + return drm_attach(kdev, mach64_pciidlist); } int @@ -102,12 +102,12 @@ mach64_driver_load(struct drm_device * d } static int -mach64_detach(device_t nbdev) +mach64_detach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); int ret; - ret = drm_detach(nbdev); + ret = drm_detach(kdev); free(dev->driver, DRM_MEM_DRIVER); Modified: head/sys/dev/drm/mga_drv.c ============================================================================== --- head/sys/dev/drm/mga_drv.c Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/mga_drv.c Mon Mar 9 07:55:18 2009 (r189563) @@ -120,31 +120,31 @@ static void mga_configure(struct drm_dev } static int -mga_probe(device_t dev) +mga_probe(device_t kdev) { - return drm_probe(dev, mga_pciidlist); + return drm_probe(kdev, mga_pciidlist); } static int -mga_attach(device_t nbdev) +mga_attach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); mga_configure(dev); - return drm_attach(nbdev, mga_pciidlist); + return drm_attach(kdev, mga_pciidlist); } static int -mga_detach(device_t nbdev) +mga_detach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); int ret; - ret = drm_detach(nbdev); + ret = drm_detach(kdev); free(dev->driver, DRM_MEM_DRIVER); Modified: head/sys/dev/drm/r128_drv.c ============================================================================== --- head/sys/dev/drm/r128_drv.c Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/r128_drv.c Mon Mar 9 07:55:18 2009 (r189563) @@ -76,22 +76,22 @@ static void r128_configure(struct drm_de } static int -r128_probe(device_t dev) +r128_probe(device_t kdev) { - return drm_probe(dev, r128_pciidlist); + return drm_probe(kdev, r128_pciidlist); } static int -r128_attach(device_t nbdev) +r128_attach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); r128_configure(dev); - return drm_attach(nbdev, r128_pciidlist); + return drm_attach(kdev, r128_pciidlist); } int r128_driver_load(struct drm_device * dev, unsigned long flags) @@ -100,12 +100,12 @@ int r128_driver_load(struct drm_device * } static int -r128_detach(device_t nbdev) +r128_detach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); int ret; - ret = drm_detach(nbdev); + ret = drm_detach(kdev); free(dev->driver, DRM_MEM_DRIVER); Modified: head/sys/dev/drm/radeon_drv.c ============================================================================== --- head/sys/dev/drm/radeon_drv.c Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/radeon_drv.c Mon Mar 9 07:55:18 2009 (r189563) @@ -80,31 +80,31 @@ static void radeon_configure(struct drm_ } static int -radeon_probe(device_t dev) +radeon_probe(device_t kdev) { - return drm_probe(dev, radeon_pciidlist); + return drm_probe(kdev, radeon_pciidlist); } static int -radeon_attach(device_t nbdev) +radeon_attach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); radeon_configure(dev); - return drm_attach(nbdev, radeon_pciidlist); + return drm_attach(kdev, radeon_pciidlist); } static int -radeon_detach(device_t nbdev) +radeon_detach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); int ret; - ret = drm_detach(nbdev); + ret = drm_detach(kdev); free(dev->driver, DRM_MEM_DRIVER); Modified: head/sys/dev/drm/savage_drv.c ============================================================================== --- head/sys/dev/drm/savage_drv.c Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/savage_drv.c Mon Mar 9 07:55:18 2009 (r189563) @@ -66,31 +66,31 @@ static void savage_configure(struct drm_ } static int -savage_probe(device_t dev) +savage_probe(device_t kdev) { - return drm_probe(dev, savage_pciidlist); + return drm_probe(kdev, savage_pciidlist); } static int -savage_attach(device_t nbdev) +savage_attach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); savage_configure(dev); - return drm_attach(nbdev, savage_pciidlist); + return drm_attach(kdev, savage_pciidlist); } static int -savage_detach(device_t nbdev) +savage_detach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); int ret; - ret = drm_detach(nbdev); + ret = drm_detach(kdev); free(dev->driver, DRM_MEM_DRIVER); Modified: head/sys/dev/drm/sis_drv.c ============================================================================== --- head/sys/dev/drm/sis_drv.c Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/sis_drv.c Mon Mar 9 07:55:18 2009 (r189563) @@ -60,31 +60,31 @@ static void sis_configure(struct drm_dev } static int -sis_probe(device_t dev) +sis_probe(device_t kdev) { - return drm_probe(dev, sis_pciidlist); + return drm_probe(kdev, sis_pciidlist); } static int -sis_attach(device_t nbdev) +sis_attach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); sis_configure(dev); - return drm_attach(nbdev, sis_pciidlist); + return drm_attach(kdev, sis_pciidlist); } static int -sis_detach(device_t nbdev) +sis_detach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); int ret; - ret = drm_detach(nbdev); + ret = drm_detach(kdev); free(dev->driver, DRM_MEM_DRIVER); Modified: head/sys/dev/drm/tdfx_drv.c ============================================================================== --- head/sys/dev/drm/tdfx_drv.c Mon Mar 9 07:50:27 2009 (r189562) +++ head/sys/dev/drm/tdfx_drv.c Mon Mar 9 07:55:18 2009 (r189563) @@ -62,31 +62,31 @@ static void tdfx_configure(struct drm_de } static int -tdfx_probe(device_t dev) +tdfx_probe(device_t kdev) { - return drm_probe(dev, tdfx_pciidlist); + return drm_probe(kdev, tdfx_pciidlist); } static int -tdfx_attach(device_t nbdev) +tdfx_attach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); tdfx_configure(dev); - return drm_attach(nbdev, tdfx_pciidlist); + return drm_attach(kdev, tdfx_pciidlist); } static int -tdfx_detach(device_t nbdev) +tdfx_detach(device_t kdev) { - struct drm_device *dev = device_get_softc(nbdev); + struct drm_device *dev = device_get_softc(kdev); int ret; - ret = drm_detach(nbdev); + ret = drm_detach(kdev); free(dev->driver, DRM_MEM_DRIVER); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 07:56:40 2009 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 9063F106566B; Mon, 9 Mar 2009 07:56:40 +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 7E88D8FC0C; Mon, 9 Mar 2009 07:56:40 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n297ueHJ013860; Mon, 9 Mar 2009 07:56:40 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n297ueU1013859; Mon, 9 Mar 2009 07:56:40 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903090756.n297ueU1013859@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Mar 2009 07:56: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: r189564 - head/sys/dev/mii 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 Mar 2009 07:56:41 -0000 Author: yongari Date: Mon Mar 9 07:56:40 2009 New Revision: 189564 URL: http://svn.freebsd.org/changeset/base/189564 Log: Report current link state while auto-negotiation is in progress. Modified: head/sys/dev/mii/ip1000phy.c Modified: head/sys/dev/mii/ip1000phy.c ============================================================================== --- head/sys/dev/mii/ip1000phy.c Mon Mar 9 07:55:18 2009 (r189563) +++ head/sys/dev/mii/ip1000phy.c Mon Mar 9 07:56:40 2009 (r189564) @@ -296,7 +296,7 @@ done: * Only retry autonegotiation every mii_anegticks seconds. */ if (sc->mii_ticks <= sc->mii_anegticks) - return (0); + break; sc->mii_ticks = 0; ip1000phy_mii_phy_auto(sc); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 08:01:40 2009 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 97625106566C; Mon, 9 Mar 2009 08:01:40 +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 843AC8FC08; Mon, 9 Mar 2009 08:01:40 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2981euj014020; Mon, 9 Mar 2009 08:01:40 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2981eEB014019; Mon, 9 Mar 2009 08:01:40 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903090801.n2981eEB014019@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Mar 2009 08:01: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: r189565 - head/sys/dev/mii 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 Mar 2009 08:01:41 -0000 Author: yongari Date: Mon Mar 9 08:01:40 2009 New Revision: 189565 URL: http://svn.freebsd.org/changeset/base/189565 Log: For unknown speed, explicitly set IFM_NONE. Modified: head/sys/dev/mii/ip1000phy.c Modified: head/sys/dev/mii/ip1000phy.c ============================================================================== --- head/sys/dev/mii/ip1000phy.c Mon Mar 9 07:56:40 2009 (r189564) +++ head/sys/dev/mii/ip1000phy.c Mon Mar 9 08:01:40 2009 (r189565) @@ -353,6 +353,9 @@ ip1000phy_status(struct mii_softc *sc) case IP1000PHY_LSR_SPEED_1000: mii->mii_media_active |= IFM_1000_T; break; + default: + mii->mii_media_active |= IFM_NONE; + return; } if ((stat & IP1000PHY_LSR_FULL_DUPLEX) != 0) mii->mii_media_active |= IFM_FDX; @@ -373,6 +376,9 @@ ip1000phy_status(struct mii_softc *sc) case PC_LinkSpeed_1000: mii->mii_media_active |= IFM_1000_T; break; + default: + mii->mii_media_active |= IFM_NONE; + return; } if ((stat & PC_PhyDuplexStatus) != 0) mii->mii_media_active |= IFM_FDX; From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 08:09:07 2009 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 7B9B7106566C; Mon, 9 Mar 2009 08:09:07 +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 4F83B8FC1E; Mon, 9 Mar 2009 08:09:07 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29896DM014226; Mon, 9 Mar 2009 08:09:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29896Hi014225; Mon, 9 Mar 2009 08:09:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903090809.n29896Hi014225@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Mar 2009 08:09: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: r189566 - head/sys/dev/mii 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 Mar 2009 08:09:08 -0000 Author: yongari Date: Mon Mar 9 08:09:06 2009 New Revision: 189566 URL: http://svn.freebsd.org/changeset/base/189566 Log: Use mii_phy_add_media() and remove setting each media type. While I'm here, don't set mii_anegticks as it's set by mii_phy_add_media(). Modified: head/sys/dev/mii/ip1000phy.c Modified: head/sys/dev/mii/ip1000phy.c ============================================================================== --- head/sys/dev/mii/ip1000phy.c Mon Mar 9 08:01:40 2009 (r189565) +++ head/sys/dev/mii/ip1000phy.c Mon Mar 9 08:09:06 2009 (r189566) @@ -118,7 +118,6 @@ ip1000phy_attach(device_t dev) sc->mii_phy = ma->mii_phyno; sc->mii_service = ip1000phy_service; sc->mii_pdata = mii; - sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_NOISOLATE; mii->mii_instance++; @@ -126,37 +125,14 @@ ip1000phy_attach(device_t dev) isc->model = MII_MODEL(ma->mii_id2); isc->revision = MII_REV(ma->mii_id2); + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + if (sc->mii_capabilities & BMSR_EXTSTAT) + sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); device_printf(dev, " "); -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), - BMCR_ISO); - - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), - IP1000PHY_BMCR_10); - printf("10baseT, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), - IP1000PHY_BMCR_10 | IP1000PHY_BMCR_FDX); - printf("10baseT-FDX, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), - IP1000PHY_BMCR_100); - printf("100baseTX, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), - IP1000PHY_BMCR_100 | IP1000PHY_BMCR_FDX); - printf("100baseTX-FDX, "); - /* 1000baseT half-duplex, really supported? */ - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, sc->mii_inst), - IP1000PHY_BMCR_1000); - printf("1000baseTX, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX, sc->mii_inst), - IP1000PHY_BMCR_1000 | IP1000PHY_BMCR_FDX); - printf("1000baseTX-FDX, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0); - printf("auto\n"); -#undef ADD - ip1000phy_reset(sc); + mii_phy_add_media(sc); + printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); return(0); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 08:17:47 2009 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 62536106564A; Mon, 9 Mar 2009 08:17:47 +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 35EDB8FC18; Mon, 9 Mar 2009 08:17:47 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n298HllE014585; Mon, 9 Mar 2009 08:17:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n298HljZ014583; Mon, 9 Mar 2009 08:17:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903090817.n298HljZ014583@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Mar 2009 08:17: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: r189567 - head/sys/dev/mii 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 Mar 2009 08:17:47 -0000 Author: yongari Date: Mon Mar 9 08:17:46 2009 New Revision: 189567 URL: http://svn.freebsd.org/changeset/base/189567 Log: For IP1001 PHYs, read auto-negotiation advertisement register to get default next page configuration. While I'm here explicitly set IP1000PHY_ANAR_CSMA bit. This bit is read-only and always set by hardware so setting it has no effect but it would clear the intention. With this change controllers that couldn't establish 1000baseT link should work. PR: kern/130846 Modified: head/sys/dev/mii/ip1000phy.c head/sys/dev/mii/ip1000phyreg.h Modified: head/sys/dev/mii/ip1000phy.c ============================================================================== --- head/sys/dev/mii/ip1000phy.c Mon Mar 9 08:09:06 2009 (r189566) +++ head/sys/dev/mii/ip1000phy.c Mon Mar 9 08:17:46 2009 (r189567) @@ -391,18 +391,24 @@ ip1000phy_status(struct mii_softc *sc) } static int -ip1000phy_mii_phy_auto(struct mii_softc *mii) +ip1000phy_mii_phy_auto(struct mii_softc *sc) { + struct ip1000phy_softc *isc; uint32_t reg; - PHY_WRITE(mii, IP1000PHY_MII_ANAR, - IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX | + isc = (struct ip1000phy_softc *)sc; + reg = 0; + if (isc->model == MII_MODEL_ICPLUS_IP1001) + reg = PHY_READ(sc, IP1000PHY_MII_ANAR); + reg |= IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX | IP1000PHY_ANAR_100TX | IP1000PHY_ANAR_100TX_FDX | - IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE); + IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE; + PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA); + reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX; reg |= IP1000PHY_1000CR_MASTER; - PHY_WRITE(mii, IP1000PHY_MII_1000CR, reg); - PHY_WRITE(mii, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX | + PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg); + PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX | IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG)); return (EJUSTRETURN); Modified: head/sys/dev/mii/ip1000phyreg.h ============================================================================== --- head/sys/dev/mii/ip1000phyreg.h Mon Mar 9 08:09:06 2009 (r189566) +++ head/sys/dev/mii/ip1000phyreg.h Mon Mar 9 08:17:46 2009 (r189567) @@ -61,6 +61,7 @@ /* Autonegotiation advertisement register */ #define IP1000PHY_MII_ANAR 0x04 +#define IP1000PHY_ANAR_CSMA 0x0001 #define IP1000PHY_ANAR_10T 0x0020 #define IP1000PHY_ANAR_10T_FDX 0x0040 #define IP1000PHY_ANAR_100TX 0x0080 From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 10:45:59 2009 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 38C0E106564A; Mon, 9 Mar 2009 10:45:59 +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 260B88FC14; Mon, 9 Mar 2009 10:45:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29Ajxwi020383; Mon, 9 Mar 2009 10:45:59 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29AjwEC020379; Mon, 9 Mar 2009 10:45:58 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903091045.n29AjwEC020379@svn.freebsd.org> From: Robert Watson Date: Mon, 9 Mar 2009 10:45: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: r189570 - in head/sys: security/audit 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: Mon, 09 Mar 2009 10:45:59 -0000 Author: rwatson Date: Mon Mar 9 10:45:58 2009 New Revision: 189570 URL: http://svn.freebsd.org/changeset/base/189570 Log: Add a new thread-private flag, TDP_AUDITREC, to indicate whether or not there is an audit record hung off of td_ar on the current thread. Test this flag instead of td_ar when auditing syscall arguments or checking for an audit record to commit on syscall return. Under these circumstances, td_pflags is much more likely to be in the cache (especially if there is no auditing of the current system call), so this should help reduce cache misses in the system call return path. MFC after: 1 week Reported by: kris Obtained from: TrustedBSD Project Modified: head/sys/security/audit/audit.c head/sys/security/audit/audit.h head/sys/security/audit/audit_syscalls.c head/sys/sys/proc.h Modified: head/sys/security/audit/audit.c ============================================================================== --- head/sys/security/audit/audit.c Mon Mar 9 08:25:05 2009 (r189569) +++ head/sys/security/audit/audit.c Mon Mar 9 10:45:58 2009 (r189570) @@ -492,6 +492,8 @@ audit_syscall_enter(unsigned short code, au_id_t auid; KASSERT(td->td_ar == NULL, ("audit_syscall_enter: td->td_ar != NULL")); + KASSERT((td->td_pflags & TDP_AUDITREC) == 0, + ("audit_syscall_enter: TDP_AUDITREC set")); /* * In FreeBSD, each ABI has its own system call table, and hence @@ -542,9 +544,13 @@ audit_syscall_enter(unsigned short code, panic("audit_failing_stop: thread continued"); } td->td_ar = audit_new(event, td); - } else if (audit_pipe_preselect(auid, event, class, AU_PRS_BOTH, 0)) + if (td->td_ar != NULL) + td->td_pflags |= TDP_AUDITREC; + } else if (audit_pipe_preselect(auid, event, class, AU_PRS_BOTH, 0)) { td->td_ar = audit_new(event, td); - else + if (td->td_ar != NULL) + td->td_pflags |= TDP_AUDITREC; + } else td->td_ar = NULL; } @@ -572,6 +578,7 @@ audit_syscall_exit(int error, struct thr audit_commit(td->td_ar, error, retval); td->td_ar = NULL; + td->td_pflags &= ~TDP_AUDITREC; } void @@ -626,6 +633,8 @@ audit_thread_free(struct thread *td) { KASSERT(td->td_ar == NULL, ("audit_thread_free: td_ar != NULL")); + KASSERT((td->td_pflags & TDP_AUDITREC) == 0, + ("audit_thread_free: TDP_AUDITREC set")); } void Modified: head/sys/security/audit/audit.h ============================================================================== --- head/sys/security/audit/audit.h Mon Mar 9 08:25:05 2009 (r189569) +++ head/sys/security/audit/audit.h Mon Mar 9 10:45:58 2009 (r189570) @@ -186,7 +186,7 @@ void audit_thread_free(struct thread *t * audit_enabled flag before performing the actual call. */ #define AUDIT_ARG(op, args...) do { \ - if (td->td_ar != NULL) \ + if (td->td_pflags & TDP_AUDITREC) \ audit_arg_ ## op (args); \ } while (0) @@ -202,7 +202,7 @@ void audit_thread_free(struct thread *t * auditing is disabled, so we don't just check audit_enabled here. */ #define AUDIT_SYSCALL_EXIT(error, td) do { \ - if (td->td_ar != NULL) \ + if (td->td_pflags & TDP_AUDITREC) \ audit_syscall_exit(error, td); \ } while (0) @@ -210,7 +210,7 @@ void audit_thread_free(struct thread *t * A Macro to wrap the audit_sysclose() function. */ #define AUDIT_SYSCLOSE(td, fd) do { \ - if (audit_enabled) \ + if (td->td_pflags & TDP_AUDITREC) \ audit_sysclose(td, fd); \ } while (0) Modified: head/sys/security/audit/audit_syscalls.c ============================================================================== --- head/sys/security/audit/audit_syscalls.c Mon Mar 9 08:25:05 2009 (r189569) +++ head/sys/security/audit/audit_syscalls.c Mon Mar 9 10:45:58 2009 (r189570) @@ -96,6 +96,7 @@ audit(struct thread *td, struct audit_ar td->td_ar = audit_new(AUE_NULL, td); if (td->td_ar == NULL) return (ENOTSUP); + td->td_pflags |= TDP_AUDITREC; ar = td->td_ar; } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Mar 9 08:25:05 2009 (r189569) +++ head/sys/sys/proc.h Mon Mar 9 10:45:58 2009 (r189570) @@ -368,6 +368,7 @@ do { \ #define TDP_KTHREAD 0x00200000 /* This is an official kernel thread */ #define TDP_CALLCHAIN 0x00400000 /* Capture thread's callchain */ #define TDP_IGNSUSP 0x00800000 /* Permission to ignore the MNTK_SUSPEND* */ +#define TDP_AUDITREC 0x01000000 /* Audit record pending on thread */ /* * Reasons that the current thread can not be run yet. From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 11:18:41 2009 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 EEFF11065678; Mon, 9 Mar 2009 11:18:41 +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 DD1718FC13; Mon, 9 Mar 2009 11:18:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29BIf50024913; Mon, 9 Mar 2009 11:18:41 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29BIfrS024912; Mon, 9 Mar 2009 11:18:41 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903091118.n29BIfrS024912@svn.freebsd.org> From: Robert Watson Date: Mon, 9 Mar 2009 11:18: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: r189571 - head/sys/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: Mon, 09 Mar 2009 11:18:42 -0000 Author: rwatson Date: Mon Mar 9 11:18:41 2009 New Revision: 189571 URL: http://svn.freebsd.org/changeset/base/189571 Log: Remove two now-defunct KSE fields from struct thread: td_uuticks and td_usticks. Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Mar 9 10:45:58 2009 (r189570) +++ head/sys/sys/proc.h Mon Mar 9 11:18:41 2009 (r189571) @@ -222,8 +222,6 @@ struct thread { u_int td_sticks; /* (t) Statclock hits in system mode. */ u_int td_iticks; /* (t) Statclock hits in intr mode. */ u_int td_uticks; /* (t) Statclock hits in user mode. */ - u_int td_uuticks; /* (k) Statclock hits (usr), for UTS. */ - u_int td_usticks; /* (k) Statclock hits (sys), for UTS. */ int td_intrval; /* (t) Return value for sleepq. */ sigset_t td_oldsigmask; /* (k) Saved mask from pre sigpause. */ sigset_t td_sigmask; /* (c) Current signal mask. */ From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:11:16 2009 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 ED9491065676; Mon, 9 Mar 2009 13:11:16 +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 D99908FC32; Mon, 9 Mar 2009 13:11:16 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DBGAG027073; Mon, 9 Mar 2009 13:11:16 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DBGCu027070; Mon, 9 Mar 2009 13:11:16 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903091311.n29DBGCu027070@svn.freebsd.org> From: Robert Watson Date: Mon, 9 Mar 2009 13:11: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: r189572 - in head/sys: amd64/amd64 i386/i386 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 Mar 2009 13:11:18 -0000 Author: rwatson Date: Mon Mar 9 13:11:16 2009 New Revision: 189572 URL: http://svn.freebsd.org/changeset/base/189572 Log: Trim comments about the MP-safety of various bits of the amd64/i386 system call entry path and i386 IP checksum generation: we now assume all code is MPSAFE unless explicitly marked otherwise. Remove XXX Giant comments along similar lines: the code by the comments either doesn't need or doesn't want Giant (especially the NMI handler). MFC after: 3 days Modified: head/sys/amd64/amd64/trap.c head/sys/i386/i386/in_cksum.c head/sys/i386/i386/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Mon Mar 9 11:18:41 2009 (r189571) +++ head/sys/amd64/amd64/trap.c Mon Mar 9 13:11:16 2009 (r189572) @@ -386,7 +386,6 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: /* machine/parity/power fail/"kitchen sink" faults */ - /* XXX Giant */ if (isa_nmi(code) == 0) { #ifdef KDB /* @@ -530,7 +529,6 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: - /* XXX Giant */ /* machine/parity/power fail/"kitchen sink" faults */ if (isa_nmi(code) == 0) { #ifdef KDB @@ -820,9 +818,6 @@ syscall(struct trapframe *frame) orig_tf_rflags = frame->tf_rflags; if (p->p_sysent->sv_prepsyscall) { - /* - * The prep code is MP aware. - */ (*p->p_sysent->sv_prepsyscall)(frame, (int *)args, &code, ¶ms); } else { if (code == SYS_syscall || code == SYS___syscall) { @@ -841,10 +836,6 @@ syscall(struct trapframe *frame) callp = &p->p_sysent->sv_table[code]; narg = callp->sy_narg; - - /* - * copyin and the ktrsyscall()/ktrsysret() code is MP-aware - */ KASSERT(narg <= sizeof(args) / sizeof(args[0]), ("Too many syscall arguments!")); error = 0; Modified: head/sys/i386/i386/in_cksum.c ============================================================================== --- head/sys/i386/i386/in_cksum.c Mon Mar 9 11:18:41 2009 (r189571) +++ head/sys/i386/i386/in_cksum.c Mon Mar 9 13:11:16 2009 (r189572) @@ -33,9 +33,6 @@ #include __FBSDID("$FreeBSD$"); -/* - * MPsafe: alfred - */ #include #include #include Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Mon Mar 9 11:18:41 2009 (r189571) +++ head/sys/i386/i386/trap.c Mon Mar 9 13:11:16 2009 (r189572) @@ -461,7 +461,6 @@ trap(struct trapframe *frame) goto userout; #else /* !POWERFAIL_NMI */ /* machine/parity/power fail/"kitchen sink" faults */ - /* XXX Giant */ if (isa_nmi(code) == 0) { #ifdef KDB /* @@ -658,7 +657,6 @@ trap(struct trapframe *frame) * in kernel space because that is useful when * debugging the kernel. */ - /* XXX Giant */ if (user_dbreg_trap() && !(PCPU_GET(curpcb)->pcb_flags & PCB_VM86CALL)) { /* @@ -692,7 +690,6 @@ trap(struct trapframe *frame) } goto out; #else /* !POWERFAIL_NMI */ - /* XXX Giant */ /* machine/parity/power fail/"kitchen sink" faults */ if (isa_nmi(code) == 0) { #ifdef KDB @@ -999,14 +996,10 @@ syscall(struct trapframe *frame) orig_tf_eflags = frame->tf_eflags; if (p->p_sysent->sv_prepsyscall) { - /* - * The prep code is MP aware. - */ (*p->p_sysent->sv_prepsyscall)(frame, args, &code, ¶ms); } else { /* * Need to check if this is a 32 bit or 64 bit syscall. - * fuword is MP aware. */ if (code == SYS_syscall) { /* @@ -1034,9 +1027,6 @@ syscall(struct trapframe *frame) narg = callp->sy_narg; - /* - * copyin and the ktrsyscall()/ktrsysret() code is MP-aware - */ if (params != NULL && narg != 0) error = copyin(params, (caddr_t)args, (u_int)(narg * sizeof(int))); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:12:48 2009 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 D84681065672; Mon, 9 Mar 2009 13:12:48 +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 C63718FC1B; Mon, 9 Mar 2009 13:12:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DCmkv027133; Mon, 9 Mar 2009 13:12:48 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DCmKw027132; Mon, 9 Mar 2009 13:12:48 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903091312.n29DCmKw027132@svn.freebsd.org> From: Robert Watson Date: Mon, 9 Mar 2009 13:12: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: r189573 - head/sys/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: Mon, 09 Mar 2009 13:12:49 -0000 Author: rwatson Date: Mon Mar 9 13:12:48 2009 New Revision: 189573 URL: http://svn.freebsd.org/changeset/base/189573 Log: Use a u_int for p_lock instead of a char: this avoids a (somewhat unlikely but not impossible given modern thread counts) wrap-around, and the compiler was padding it out to an int (at least) anyway. MFC after: 3 days (but confirm ABI impact) Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Mar 9 13:11:16 2009 (r189572) +++ head/sys/sys/proc.h Mon Mar 9 13:12:48 2009 (r189573) @@ -491,7 +491,7 @@ struct proc { struct vnode *p_tracevp; /* (c + o) Trace to vnode. */ struct ucred *p_tracecred; /* (o) Credentials to trace with. */ struct vnode *p_textvp; /* (b) Vnode of executable. */ - char p_lock; /* (c) Proclock (prevent swap) count. */ + u_int p_lock; /* (c) Proclock (prevent swap) count. */ struct sigiolst p_sigiolst; /* (c) List of sigio sources. */ int p_sigparent; /* (c) Signal to parent on exit. */ int p_sig; /* (n) For core dump/debugger XXX. */ From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:20:24 2009 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 089DB106567A; Mon, 9 Mar 2009 13:20:24 +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 EA0628FC1E; Mon, 9 Mar 2009 13:20:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DKNn8027312; Mon, 9 Mar 2009 13:20:23 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DKNT8027311; Mon, 9 Mar 2009 13:20:23 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903091320.n29DKNT8027311@svn.freebsd.org> From: Warner Losh Date: Mon, 9 Mar 2009 13:20: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: r189574 - 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 Mar 2009 13:20:24 -0000 Author: imp Date: Mon Mar 9 13:20:23 2009 New Revision: 189574 URL: http://svn.freebsd.org/changeset/base/189574 Log: Fix a long-standing bug in newbus. It was introduced when subclassing was introduced. If you have a bus, say cardbus, that is derived from a base-bus (say PCI), then ordinarily all PCI drivers would attach to cardbus devices. However, there had been one exception: kldload wouldn't work. The problem is in devclass_add_driver. In this routine, all we did was call to the pci device's BUS_DRIVER_ADDED routine. However, since cardbus bus instances had a different devclass, none of them were called. The solution is to call all subclass devclasses, recursively down the tree, of the class that was loaded. Since we don't have a 'children class' pointer, we search the whole list of devclasses for a class whose parent matches. Since just done a kldload time, this isn't as bad as it sounds. In addition, we short-circuit the whole process by marking those classes with subclasses with a flag. We'll likely have to reevaluate this method the number of devclasses with subclasses gets large. This means we can remove the "cardbus" lines from all the PCI drivers since we have no cardbus specific attach device attachments in the tree. # Also: minor tweak to an error message Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Mon Mar 9 13:12:48 2009 (r189573) +++ head/sys/kern/subr_bus.c Mon Mar 9 13:20:23 2009 (r189574) @@ -82,6 +82,8 @@ struct devclass { char *name; device_t *devices; /* array of devices indexed by unit */ int maxunit; /* size of devices array */ + int flags; +#define DC_HAS_CHILDREN 1 struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -813,6 +815,7 @@ devclass_find_internal(const char *class if (parentname && dc && !dc->parent && strcmp(classname, parentname) != 0) { dc->parent = devclass_find_internal(parentname, NULL, FALSE); + dc->parent->flags |= DC_HAS_CHILDREN; } return (dc); @@ -846,6 +849,52 @@ devclass_find(const char *classname) return (devclass_find_internal(classname, NULL, FALSE)); } + +/** + * @brief Register that a device driver has been added to a devclass + * + * Register that a device driver has been added to a devclass. This + * is called by devclass_add_driver to accomplish the recursive + * notification of all the children classes of dc, as well as dc. + * Each layer will have BUS_DRIVER_ADDED() called for all instances of + * the devclass. We do a full search here of the devclass list at + * each iteration level to save storing children-lists in the devclass + * structure. If we ever move beyond a few dozen devices doing this, + * we may need to reevaluate... + * + * @param dc the devclass to edit + * @param driver the driver that was just added + */ +static void +devclass_driver_added(devclass_t dc, driver_t *driver) +{ + int i; + devclass_t parent; + + /* + * Call BUS_DRIVER_ADDED for any existing busses in this class. + */ + for (i = 0; i < dc->maxunit; i++) + if (dc->devices[i]) + BUS_DRIVER_ADDED(dc->devices[i], driver); + + /* + * Walk through the children classes. Since we only keep a + * single parent pointer around, we walk the entire list of + * devclasses looking for children. We set the + * DC_HAS_CHILDREN flag when a child devclass is created on + * the parent, so we only walk thoe list for those devclasses + * that have children. + */ + if (!(dc->flags & DC_HAS_CHILDREN)) + return; + parent = dc; + TAILQ_FOREACH(dc, &devclasses, link) { + if (dc->parent == parent) + devclass_driver_added(dc, driver); + } +} + /** * @brief Add a device driver to a device class * @@ -861,7 +910,6 @@ int devclass_add_driver(devclass_t dc, driver_t *driver) { driverlink_t dl; - int i; PDEBUG(("%s", DRIVERNAME(driver))); @@ -886,13 +934,7 @@ devclass_add_driver(devclass_t dc, drive TAILQ_INSERT_TAIL(&dc->drivers, dl, link); driver->refs++; /* XXX: kobj_mtx */ - /* - * Call BUS_DRIVER_ADDED for any existing busses in this class. - */ - for (i = 0; i < dc->maxunit; i++) - if (dc->devices[i]) - BUS_DRIVER_ADDED(dc->devices[i], driver); - + devclass_driver_added(dc, driver); bus_data_generation_update(); return (0); } @@ -1758,7 +1800,9 @@ device_probe_child(device_t dev, device_ device_set_driver(child, dl->driver); if (!hasclass) { if (device_set_devclass(child, dl->driver->name)) { - PDEBUG(("Unable to set device class")); + printf("driver bug: Unable to set devclass (devname: %s)\n", + (child ? device_get_name(child) : + "no device")); device_set_driver(child, NULL); continue; } From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:23:56 2009 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 22D221065672; Mon, 9 Mar 2009 13:23:56 +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 0D3A58FC23; Mon, 9 Mar 2009 13:23:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DNt1E027431; Mon, 9 Mar 2009 13:23:55 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DNs6T027412; Mon, 9 Mar 2009 13:23:54 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903091323.n29DNs6T027412@svn.freebsd.org> From: Warner Losh Date: Mon, 9 Mar 2009 13:23: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: r189575 - in head/sys/dev: aic7xxx ath dc firewire fxp if_ndis ipw malo ral sio sound/pci uart usb/controller vge xl 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 Mar 2009 13:23:56 -0000 Author: imp Date: Mon Mar 9 13:23:54 2009 New Revision: 189575 URL: http://svn.freebsd.org/changeset/base/189575 Log: remove now-redunant cardbus attachment. Modified: head/sys/dev/aic7xxx/ahc_pci.c head/sys/dev/aic7xxx/ahd_pci.c head/sys/dev/ath/if_ath_pci.c head/sys/dev/dc/if_dc.c head/sys/dev/firewire/fwohci_pci.c head/sys/dev/fxp/if_fxp.c head/sys/dev/if_ndis/if_ndis_pci.c head/sys/dev/ipw/if_ipw.c head/sys/dev/malo/if_malo_pci.c head/sys/dev/ral/if_ral_pci.c head/sys/dev/sio/sio_pci.c head/sys/dev/sound/pci/emu10k1.c head/sys/dev/sound/pci/emu10kx.c head/sys/dev/uart/uart_bus_pci.c head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/ohci_pci.c head/sys/dev/usb/controller/uhci_pci.c head/sys/dev/vge/if_vge.c head/sys/dev/xl/if_xl.c Modified: head/sys/dev/aic7xxx/ahc_pci.c ============================================================================== --- head/sys/dev/aic7xxx/ahc_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/aic7xxx/ahc_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -54,7 +54,6 @@ static driver_t ahc_pci_driver = { }; DRIVER_MODULE(ahc_pci, pci, ahc_pci_driver, ahc_devclass, 0, 0); -DRIVER_MODULE(ahc_pci, cardbus, ahc_pci_driver, ahc_devclass, 0, 0); MODULE_DEPEND(ahc_pci, ahc, 1, 1, 1); MODULE_VERSION(ahc_pci, 1); Modified: head/sys/dev/aic7xxx/ahd_pci.c ============================================================================== --- head/sys/dev/aic7xxx/ahd_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/aic7xxx/ahd_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -56,7 +56,6 @@ static driver_t ahd_pci_driver = { static devclass_t ahd_devclass; DRIVER_MODULE(ahd, pci, ahd_pci_driver, ahd_devclass, 0, 0); -DRIVER_MODULE(ahd, cardbus, ahd_pci_driver, ahd_devclass, 0, 0); MODULE_DEPEND(ahd_pci, ahd, 1, 1, 1); MODULE_VERSION(ahd_pci, 1); Modified: head/sys/dev/ath/if_ath_pci.c ============================================================================== --- head/sys/dev/ath/if_ath_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/ath/if_ath_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -251,6 +251,5 @@ static driver_t ath_pci_driver = { }; static devclass_t ath_devclass; DRIVER_MODULE(if_ath, pci, ath_pci_driver, ath_devclass, 0, 0); -DRIVER_MODULE(if_ath, cardbus, ath_pci_driver, ath_devclass, 0, 0); MODULE_VERSION(if_ath, 1); MODULE_DEPEND(if_ath, wlan, 1, 1, 1); /* 802.11 media layer */ Modified: head/sys/dev/dc/if_dc.c ============================================================================== --- head/sys/dev/dc/if_dc.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/dc/if_dc.c Mon Mar 9 13:23:54 2009 (r189575) @@ -331,7 +331,6 @@ static driver_t dc_driver = { static devclass_t dc_devclass; -DRIVER_MODULE(dc, cardbus, dc_driver, dc_devclass, 0, 0); DRIVER_MODULE(dc, pci, dc_driver, dc_devclass, 0, 0); DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, 0, 0); Modified: head/sys/dev/firewire/fwohci_pci.c ============================================================================== --- head/sys/dev/firewire/fwohci_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/firewire/fwohci_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -553,4 +553,3 @@ static devclass_t fwohci_devclass; MODULE_DEPEND(fwohci, firewire, 1, 1, 1); #endif DRIVER_MODULE(fwohci, pci, fwohci_driver, fwohci_devclass, 0, 0); -DRIVER_MODULE(fwohci, cardbus, fwohci_driver, fwohci_devclass, 0, 0); Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/fxp/if_fxp.c Mon Mar 9 13:23:54 2009 (r189575) @@ -293,7 +293,6 @@ static driver_t fxp_driver = { static devclass_t fxp_devclass; DRIVER_MODULE(fxp, pci, fxp_driver, fxp_devclass, 0, 0); -DRIVER_MODULE(fxp, cardbus, fxp_driver, fxp_devclass, 0, 0); DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, 0, 0); static struct resource_spec fxp_res_spec_mem[] = { Modified: head/sys/dev/if_ndis/if_ndis_pci.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/if_ndis/if_ndis_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -103,7 +103,6 @@ static driver_t ndis_driver = { static devclass_t ndis_devclass; DRIVER_MODULE(ndis, pci, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); -DRIVER_MODULE(ndis, cardbus, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); static int ndis_devcompare(bustype, t, dev) Modified: head/sys/dev/ipw/if_ipw.c ============================================================================== --- head/sys/dev/ipw/if_ipw.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/ipw/if_ipw.c Mon Mar 9 13:23:54 2009 (r189575) @@ -203,7 +203,6 @@ static driver_t ipw_driver = { static devclass_t ipw_devclass; DRIVER_MODULE(ipw, pci, ipw_driver, ipw_devclass, 0, 0); -DRIVER_MODULE(ipw, cardbus, ipw_driver, ipw_devclass, 0, 0); static int ipw_probe(device_t dev) Modified: head/sys/dev/malo/if_malo_pci.c ============================================================================== --- head/sys/dev/malo/if_malo_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/malo/if_malo_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -367,7 +367,6 @@ static driver_t malo_pci_driver = { static devclass_t malo_devclass; DRIVER_MODULE(if_malo, pci, malo_pci_driver, malo_devclass, 0, 0); -DRIVER_MODULE(if_malo, cardbus, malo_pci_driver, malo_devclass, 0, 0); MODULE_VERSION(if_malo, 1); MODULE_DEPEND(if_malo, wlan, 1, 1, 1); /* 802.11 media layer */ MODULE_DEPEND(if_malo, malofw_fw, 1, 1, 1); Modified: head/sys/dev/ral/if_ral_pci.c ============================================================================== --- head/sys/dev/ral/if_ral_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/ral/if_ral_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -145,7 +145,6 @@ static driver_t ral_pci_driver = { static devclass_t ral_devclass; DRIVER_MODULE(ral, pci, ral_pci_driver, ral_devclass, 0, 0); -DRIVER_MODULE(ral, cardbus, ral_pci_driver, ral_devclass, 0, 0); static int ral_pci_probe(device_t dev) Modified: head/sys/dev/sio/sio_pci.c ============================================================================== --- head/sys/dev/sio/sio_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/sio/sio_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -124,4 +124,3 @@ sio_pci_probe(dev) } DRIVER_MODULE(sio, pci, sio_pci_driver, sio_devclass, 0, 0); -DRIVER_MODULE(sio, cardbus, sio_pci_driver, sio_devclass, 0, 0); Modified: head/sys/dev/sound/pci/emu10k1.c ============================================================================== --- head/sys/dev/sound/pci/emu10k1.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/sound/pci/emu10k1.c Mon Mar 9 13:23:54 2009 (r189575) @@ -2109,7 +2109,6 @@ static driver_t emu_driver = { }; DRIVER_MODULE(snd_emu10k1, pci, emu_driver, pcm_devclass, 0, 0); -DRIVER_MODULE(snd_emu10k1, cardbus, emu_driver, pcm_devclass, 0, 0); MODULE_DEPEND(snd_emu10k1, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); MODULE_VERSION(snd_emu10k1, 1); MODULE_DEPEND(snd_emu10k1, midi, 1, 1, 1); Modified: head/sys/dev/sound/pci/emu10kx.c ============================================================================== --- head/sys/dev/sound/pci/emu10kx.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/sound/pci/emu10kx.c Mon Mar 9 13:23:54 2009 (r189575) @@ -3556,5 +3556,4 @@ emu_modevent(module_t mod __unused, int static devclass_t emu_devclass; DRIVER_MODULE(snd_emu10kx, pci, emu_driver, emu_devclass, emu_modevent, NULL); -DRIVER_MODULE(snd_emu10kx, cardbus, emu_driver, emu_devclass, emu_modevent, NULL); MODULE_VERSION(snd_emu10kx, SND_EMU10KX_PREFVER); Modified: head/sys/dev/uart/uart_bus_pci.c ============================================================================== --- head/sys/dev/uart/uart_bus_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/uart/uart_bus_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -160,4 +160,3 @@ uart_pci_probe(device_t dev) } DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, 0, 0); -DRIVER_MODULE(uart, cardbus, uart_pci_driver, uart_devclass, 0, 0); Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/usb/controller/ehci_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -482,5 +482,4 @@ static driver_t ehci_driver = static devclass_t ehci_devclass; DRIVER_MODULE(ehci, pci, ehci_driver, ehci_devclass, 0, 0); -DRIVER_MODULE(ehci, cardbus, ehci_driver, ehci_devclass, 0, 0); MODULE_DEPEND(ehci, usb, 1, 1, 1); Modified: head/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ohci_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/usb/controller/ohci_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -383,5 +383,4 @@ static driver_t ohci_driver = static devclass_t ohci_devclass; DRIVER_MODULE(ohci, pci, ohci_driver, ohci_devclass, 0, 0); -DRIVER_MODULE(ohci, cardbus, ohci_driver, ohci_devclass, 0, 0); MODULE_DEPEND(ohci, usb, 1, 1, 1); Modified: head/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/uhci_pci.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/usb/controller/uhci_pci.c Mon Mar 9 13:23:54 2009 (r189575) @@ -439,5 +439,4 @@ static driver_t uhci_driver = static devclass_t uhci_devclass; DRIVER_MODULE(uhci, pci, uhci_driver, uhci_devclass, 0, 0); -DRIVER_MODULE(uhci, cardbus, uhci_driver, uhci_devclass, 0, 0); MODULE_DEPEND(uhci, usb, 1, 1, 1); Modified: head/sys/dev/vge/if_vge.c ============================================================================== --- head/sys/dev/vge/if_vge.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/vge/if_vge.c Mon Mar 9 13:23:54 2009 (r189575) @@ -221,7 +221,6 @@ static driver_t vge_driver = { static devclass_t vge_devclass; DRIVER_MODULE(vge, pci, vge_driver, vge_devclass, 0, 0); -DRIVER_MODULE(vge, cardbus, vge_driver, vge_devclass, 0, 0); DRIVER_MODULE(miibus, vge, miibus_driver, miibus_devclass, 0, 0); #ifdef VGE_EEPROM Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Mon Mar 9 13:20:23 2009 (r189574) +++ head/sys/dev/xl/if_xl.c Mon Mar 9 13:23:54 2009 (r189575) @@ -314,7 +314,6 @@ static driver_t xl_driver = { static devclass_t xl_devclass; -DRIVER_MODULE(xl, cardbus, xl_driver, xl_devclass, 0, 0); DRIVER_MODULE(xl, pci, xl_driver, xl_devclass, 0, 0); DRIVER_MODULE(miibus, xl, miibus_driver, miibus_devclass, 0, 0); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:25:34 2009 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 BE425106564A; Mon, 9 Mar 2009 13:25:34 +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 912828FC14; Mon, 9 Mar 2009 13:25:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DPYb0027509; Mon, 9 Mar 2009 13:25:34 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DPYXg027504; Mon, 9 Mar 2009 13:25:34 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903091325.n29DPYXg027504@svn.freebsd.org> From: Warner Losh Date: Mon, 9 Mar 2009 13:25: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: r189576 - in head/sys: dev/puc dev/re legacy/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: Mon, 09 Mar 2009 13:25:35 -0000 Author: imp Date: Mon Mar 9 13:25:34 2009 New Revision: 189576 URL: http://svn.freebsd.org/changeset/base/189576 Log: remove now-redunant cardbus attachment lines. Modified: head/sys/dev/puc/puc_pci.c head/sys/dev/re/if_re.c head/sys/legacy/dev/usb/ehci_pci.c head/sys/legacy/dev/usb/ohci_pci.c head/sys/legacy/dev/usb/uhci_pci.c Modified: head/sys/dev/puc/puc_pci.c ============================================================================== --- head/sys/dev/puc/puc_pci.c Mon Mar 9 13:23:54 2009 (r189575) +++ head/sys/dev/puc/puc_pci.c Mon Mar 9 13:25:34 2009 (r189576) @@ -144,4 +144,3 @@ static driver_t puc_pci_driver = { }; DRIVER_MODULE(puc, pci, puc_pci_driver, puc_devclass, 0, 0); -DRIVER_MODULE(puc, cardbus, puc_pci_driver, puc_devclass, 0, 0); Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Mar 9 13:23:54 2009 (r189575) +++ head/sys/dev/re/if_re.c Mon Mar 9 13:25:34 2009 (r189576) @@ -308,7 +308,6 @@ static driver_t re_driver = { static devclass_t re_devclass; DRIVER_MODULE(re, pci, re_driver, re_devclass, 0, 0); -DRIVER_MODULE(re, cardbus, re_driver, re_devclass, 0, 0); DRIVER_MODULE(miibus, re, miibus_driver, miibus_devclass, 0, 0); #define EE_SET(x) \ Modified: head/sys/legacy/dev/usb/ehci_pci.c ============================================================================== --- head/sys/legacy/dev/usb/ehci_pci.c Mon Mar 9 13:23:54 2009 (r189575) +++ head/sys/legacy/dev/usb/ehci_pci.c Mon Mar 9 13:25:34 2009 (r189576) @@ -632,5 +632,4 @@ static driver_t ehci_driver = { static devclass_t ehci_devclass; DRIVER_MODULE(ehci, pci, ehci_driver, ehci_devclass, 0, 0); -DRIVER_MODULE(ehci, cardbus, ehci_driver, ehci_devclass, 0, 0); MODULE_DEPEND(ehci, usb, 1, 1, 1); Modified: head/sys/legacy/dev/usb/ohci_pci.c ============================================================================== --- head/sys/legacy/dev/usb/ohci_pci.c Mon Mar 9 13:23:54 2009 (r189575) +++ head/sys/legacy/dev/usb/ohci_pci.c Mon Mar 9 13:25:34 2009 (r189576) @@ -407,5 +407,4 @@ static driver_t ohci_driver = { static devclass_t ohci_devclass; DRIVER_MODULE(ohci, pci, ohci_driver, ohci_devclass, 0, 0); -DRIVER_MODULE(ohci, cardbus, ohci_driver, ohci_devclass, 0, 0); MODULE_DEPEND(ohci, usb, 1, 1, 1); Modified: head/sys/legacy/dev/usb/uhci_pci.c ============================================================================== --- head/sys/legacy/dev/usb/uhci_pci.c Mon Mar 9 13:23:54 2009 (r189575) +++ head/sys/legacy/dev/usb/uhci_pci.c Mon Mar 9 13:25:34 2009 (r189576) @@ -520,5 +520,4 @@ static driver_t uhci_driver = { static devclass_t uhci_devclass; DRIVER_MODULE(uhci, pci, uhci_driver, uhci_devclass, 0, 0); -DRIVER_MODULE(uhci, cardbus, uhci_driver, uhci_devclass, 0, 0); MODULE_DEPEND(uhci, usb, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:26:56 2009 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 2FFB5106566B; Mon, 9 Mar 2009 13:26:56 +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 1DF678FC0A; Mon, 9 Mar 2009 13:26:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DQtx7027566; Mon, 9 Mar 2009 13:26:55 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DQtsF027565; Mon, 9 Mar 2009 13:26:55 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903091326.n29DQtsF027565@svn.freebsd.org> From: Warner Losh Date: Mon, 9 Mar 2009 13:26: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: r189577 - head/sys/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: Mon, 09 Mar 2009 13:26:56 -0000 Author: imp Date: Mon Mar 9 13:26:55 2009 New Revision: 189577 URL: http://svn.freebsd.org/changeset/base/189577 Log: o Add declarations for a few more nodes widely used. o Minor formatting nit. Modified: head/sys/sys/sysctl.h Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Mon Mar 9 13:25:34 2009 (r189576) +++ head/sys/sys/sysctl.h Mon Mar 9 13:26:55 2009 (r189577) @@ -223,7 +223,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ static struct sysctl_oid sysctl__##parent##_##name = { \ &sysctl_##parent##_children, { NULL }, nbr, kind, \ - a1, a2, #name, handler, fmt, 0, __DESCR(descr) }; \ + a1, a2, #name, handler, fmt, 0, __DESCR(descr) }; \ DATA_SET(sysctl_set, sysctl__##parent##_##name) #ifdef VIMAGE @@ -755,8 +755,11 @@ SYSCTL_DECL(_vfs); SYSCTL_DECL(_net); SYSCTL_DECL(_debug); SYSCTL_DECL(_debug_sizeof); +SYSCTL_DECL(_dev); SYSCTL_DECL(_hw); SYSCTL_DECL(_hw_bus); +SYSCTL_DECL(_hw_bus_devices); +SYSCTL_DECL(_hw_bus_info); SYSCTL_DECL(_machdep); SYSCTL_DECL(_user); SYSCTL_DECL(_compat); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:27:34 2009 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 450D310656C5; Mon, 9 Mar 2009 13:27:34 +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 3204E8FC21; Mon, 9 Mar 2009 13:27:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DRYY6027626; Mon, 9 Mar 2009 13:27:34 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DRXgF027620; Mon, 9 Mar 2009 13:27:33 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903091327.n29DRXgF027620@svn.freebsd.org> From: Warner Losh Date: Mon, 9 Mar 2009 13:27: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: r189578 - head/sys/dev/agp 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 Mar 2009 13:27:35 -0000 Author: imp Date: Mon Mar 9 13:27:33 2009 New Revision: 189578 URL: http://svn.freebsd.org/changeset/base/189578 Log: Fix prototypes to be consistent. Modified: head/sys/dev/agp/agp.c head/sys/dev/agp/agp_amd64.c head/sys/dev/agp/agp_i810.c head/sys/dev/agp/agp_intel.c head/sys/dev/agp/agp_via.c head/sys/dev/agp/agppriv.h Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Mon Mar 9 13:26:55 2009 (r189577) +++ head/sys/dev/agp/agp.c Mon Mar 9 13:27:33 2009 (r189578) @@ -295,7 +295,7 @@ agp_generic_detach(device_t dev) * Default AGP aperture size detection which simply returns the size of * the aperture's PCI resource. */ -int +u_int32_t agp_generic_get_aperture(device_t dev) { struct agp_softc *sc = device_get_softc(dev); Modified: head/sys/dev/agp/agp_amd64.c ============================================================================== --- head/sys/dev/agp/agp_amd64.c Mon Mar 9 13:26:55 2009 (r189577) +++ head/sys/dev/agp/agp_amd64.c Mon Mar 9 13:27:33 2009 (r189578) @@ -333,7 +333,7 @@ agp_amd64_set_aperture(device_t dev, uin } static int -agp_amd64_bind_page(device_t dev, int offset, vm_offset_t physical) +agp_amd64_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical) { struct agp_amd64_softc *sc = device_get_softc(dev); @@ -347,7 +347,7 @@ agp_amd64_bind_page(device_t dev, int of } static int -agp_amd64_unbind_page(device_t dev, int offset) +agp_amd64_unbind_page(device_t dev, vm_offset_t offset) { struct agp_amd64_softc *sc = device_get_softc(dev); Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Mon Mar 9 13:26:55 2009 (r189577) +++ head/sys/dev/agp/agp_i810.c Mon Mar 9 13:27:33 2009 (r189578) @@ -836,12 +836,12 @@ agp_i810_write_gtt_entry(device_t dev, i } static int -agp_i810_bind_page(device_t dev, int offset, vm_offset_t physical) +agp_i810_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical) { struct agp_i810_softc *sc = device_get_softc(dev); if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) { - device_printf(dev, "failed: offset is 0x%08x, shift is %d, entries is %d\n", offset, AGP_PAGE_SHIFT, sc->gatt->ag_entries); + device_printf(dev, "failed: offset is 0x%08jx, shift is %d, entries is %d\n", (intmax_t)offset, AGP_PAGE_SHIFT, sc->gatt->ag_entries); return EINVAL; } @@ -858,7 +858,7 @@ agp_i810_bind_page(device_t dev, int off } static int -agp_i810_unbind_page(device_t dev, int offset) +agp_i810_unbind_page(device_t dev, vm_offset_t offset) { struct agp_i810_softc *sc = device_get_softc(dev); Modified: head/sys/dev/agp/agp_intel.c ============================================================================== --- head/sys/dev/agp/agp_intel.c Mon Mar 9 13:26:55 2009 (r189577) +++ head/sys/dev/agp/agp_intel.c Mon Mar 9 13:27:33 2009 (r189578) @@ -365,7 +365,7 @@ agp_intel_set_aperture(device_t dev, u_i } static int -agp_intel_bind_page(device_t dev, int offset, vm_offset_t physical) +agp_intel_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical) { struct agp_intel_softc *sc; @@ -379,7 +379,7 @@ agp_intel_bind_page(device_t dev, int of } static int -agp_intel_unbind_page(device_t dev, int offset) +agp_intel_unbind_page(device_t dev, vm_offset_t offset) { struct agp_intel_softc *sc; Modified: head/sys/dev/agp/agp_via.c ============================================================================== --- head/sys/dev/agp/agp_via.c Mon Mar 9 13:26:55 2009 (r189577) +++ head/sys/dev/agp/agp_via.c Mon Mar 9 13:27:33 2009 (r189578) @@ -358,7 +358,7 @@ agp_via_set_aperture(device_t dev, u_int } static int -agp_via_bind_page(device_t dev, int offset, vm_offset_t physical) +agp_via_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical) { struct agp_via_softc *sc = device_get_softc(dev); @@ -370,7 +370,7 @@ agp_via_bind_page(device_t dev, int offs } static int -agp_via_unbind_page(device_t dev, int offset) +agp_via_unbind_page(device_t dev, vm_offset_t offset) { struct agp_via_softc *sc = device_get_softc(dev); Modified: head/sys/dev/agp/agppriv.h ============================================================================== --- head/sys/dev/agp/agppriv.h Mon Mar 9 13:26:55 2009 (r189577) +++ head/sys/dev/agp/agppriv.h Mon Mar 9 13:27:33 2009 (r189578) @@ -92,7 +92,7 @@ void agp_free_gatt(struct agp_g void agp_free_res(device_t dev); int agp_generic_attach(device_t dev); int agp_generic_detach(device_t dev); -int agp_generic_get_aperture(device_t dev); +u_int32_t agp_generic_get_aperture(device_t dev); int agp_generic_set_aperture(device_t dev, u_int32_t aperture); int agp_generic_enable(device_t dev, u_int32_t mode); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:29:17 2009 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 4D0841065741; Mon, 9 Mar 2009 13:29:17 +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 A19B18FC25; Mon, 9 Mar 2009 13:29:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DTDo6027693; Mon, 9 Mar 2009 13:29:13 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DTDWj027692; Mon, 9 Mar 2009 13:29:13 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903091329.n29DTDWj027692@svn.freebsd.org> From: Warner Losh Date: Mon, 9 Mar 2009 13:29: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: r189579 - head/sys/dev/exca 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 Mar 2009 13:29:27 -0000 Author: imp Date: Mon Mar 9 13:29:13 2009 New Revision: 189579 URL: http://svn.freebsd.org/changeset/base/189579 Log: __LP64__ is what's defined, not _LP64_, according to the manual (and also experience). Modified: head/sys/dev/exca/exca.c Modified: head/sys/dev/exca/exca.c ============================================================================== --- head/sys/dev/exca/exca.c Mon Mar 9 13:27:33 2009 (r189578) +++ head/sys/dev/exca/exca.c Mon Mar 9 13:29:13 2009 (r189579) @@ -257,7 +257,7 @@ exca_mem_map(struct exca_softc *sc, int if (win >= EXCA_MEM_WINS) return (ENOSPC); if (sc->flags & EXCA_HAS_MEMREG_WIN) { -#ifdef _LP64 +#ifdef __LP64__ if (rman_get_start(res) >> (EXCA_MEMREG_WIN_SHIFT + 8) != 0) { device_printf(sc->dev, "Does not support mapping above 4GB."); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:30:00 2009 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 CAAB4106576F; Mon, 9 Mar 2009 13:30:00 +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 B327C8FC18; Mon, 9 Mar 2009 13:30:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DU0sK027744; Mon, 9 Mar 2009 13:30:00 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DU0E2027742; Mon, 9 Mar 2009 13:30:00 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903091330.n29DU0E2027742@svn.freebsd.org> From: Warner Losh Date: Mon, 9 Mar 2009 13:30: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: r189580 - head/sys/dev/smbus 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 Mar 2009 13:30:05 -0000 Author: imp Date: Mon Mar 9 13:30:00 2009 New Revision: 189580 URL: http://svn.freebsd.org/changeset/base/189580 Log: Make generic_intr routines match prototype. Modified: head/sys/dev/smbus/smbus.c head/sys/dev/smbus/smbus.h Modified: head/sys/dev/smbus/smbus.c ============================================================================== --- head/sys/dev/smbus/smbus.c Mon Mar 9 13:29:13 2009 (r189579) +++ head/sys/dev/smbus/smbus.c Mon Mar 9 13:30:00 2009 (r189580) @@ -111,7 +111,7 @@ smbus_detach(device_t dev) } void -smbus_generic_intr(device_t dev, u_char devaddr, char low, char high) +smbus_generic_intr(device_t dev, u_char devaddr, char low, char high, int err) { } Modified: head/sys/dev/smbus/smbus.h ============================================================================== --- head/sys/dev/smbus/smbus.h Mon Mar 9 13:29:13 2009 (r189579) +++ head/sys/dev/smbus/smbus.h Mon Mar 9 13:30:00 2009 (r189580) @@ -34,6 +34,6 @@ struct smbus_softc { struct mtx lock; }; -void smbus_generic_intr(device_t dev, u_char devaddr, char low, char high); +void smbus_generic_intr(device_t dev, u_char devaddr, char low, char high, int err); #endif From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 13:32:20 2009 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 3BCC910656E9; Mon, 9 Mar 2009 13:32:20 +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 294CD8FC1C; Mon, 9 Mar 2009 13:32:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29DWKX9027838; Mon, 9 Mar 2009 13:32:20 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29DWKwK027837; Mon, 9 Mar 2009 13:32:20 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903091332.n29DWKwK027837@svn.freebsd.org> From: Warner Losh Date: Mon, 9 Mar 2009 13:32: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: r189581 - head/sys/ddb 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 Mar 2009 13:32:21 -0000 Author: imp Date: Mon Mar 9 13:32:19 2009 New Revision: 189581 URL: http://svn.freebsd.org/changeset/base/189581 Log: Prefer prototypes to k&r definitions. Modified: head/sys/ddb/db_expr.c Modified: head/sys/ddb/db_expr.c ============================================================================== --- head/sys/ddb/db_expr.c Mon Mar 9 13:30:00 2009 (r189580) +++ head/sys/ddb/db_expr.c Mon Mar 9 13:32:19 2009 (r189581) @@ -45,8 +45,7 @@ static boolean_t db_term(db_expr_t *valu static boolean_t db_unary(db_expr_t *valuep); static boolean_t -db_term(valuep) - db_expr_t *valuep; +db_term(db_expr_t *valuep) { int t; @@ -100,8 +99,7 @@ db_term(valuep) } static boolean_t -db_unary(valuep) - db_expr_t *valuep; +db_unary(db_expr_t *valuep) { int t; @@ -128,8 +126,7 @@ db_unary(valuep) } static boolean_t -db_mult_expr(valuep) - db_expr_t *valuep; +db_mult_expr(db_expr_t *valuep) { db_expr_t lhs, rhs; int t; @@ -165,8 +162,7 @@ db_mult_expr(valuep) } static boolean_t -db_add_expr(valuep) - db_expr_t *valuep; +db_add_expr(db_expr_t *valuep) { db_expr_t lhs, rhs; int t; @@ -192,8 +188,7 @@ db_add_expr(valuep) } static boolean_t -db_shift_expr(valuep) - db_expr_t *valuep; +db_shift_expr(db_expr_t *valuep) { db_expr_t lhs, rhs; int t; @@ -225,8 +220,7 @@ db_shift_expr(valuep) } int -db_expression(valuep) - db_expr_t *valuep; +db_expression(db_expr_t *valuep) { return (db_shift_expr(valuep)); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 15:25:47 2009 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 404421065675; Mon, 9 Mar 2009 15:25:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C45D8FC26; Mon, 9 Mar 2009 15:25:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29FPl0v030220; Mon, 9 Mar 2009 15:25:47 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29FPlVv030219; Mon, 9 Mar 2009 15:25:47 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903091525.n29FPlVv030219@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Mar 2009 15:25: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: r189583 - head/sys/dev/usb/input 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 Mar 2009 15:25:47 -0000 Author: thompsa Date: Mon Mar 9 15:25:46 2009 New Revision: 189583 URL: http://svn.freebsd.org/changeset/base/189583 Log: MFp4 //depot/projects/usb@158916 USB mouse patch to address complicated data reporting descriptors. Reported by: Boris Kotzev Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Mon Mar 9 14:04:18 2009 (r189582) +++ head/sys/dev/usb/input/ums.c Mon Mar 9 15:25:46 2009 (r189583) @@ -117,6 +117,12 @@ struct ums_softc { uint8_t sc_buttons; uint8_t sc_iid; + uint8_t sc_iid_w; + uint8_t sc_iid_x; + uint8_t sc_iid_y; + uint8_t sc_iid_z; + uint8_t sc_iid_t; + uint8_t sc_iid_btn[UMS_BUTTON_MAX]; uint8_t sc_temp[64]; }; @@ -168,6 +174,7 @@ ums_intr_callback(struct usb2_xfer *xfer int32_t dz; int32_t dt; uint8_t i; + uint8_t id; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -190,42 +197,14 @@ ums_intr_callback(struct usb2_xfer *xfer (len > 4) ? buf[4] : 0, (len > 5) ? buf[5] : 0, (len > 6) ? buf[6] : 0, (len > 7) ? buf[7] : 0); - /* - * The M$ Wireless Intellimouse 2.0 sends 1 extra - * leading byte of data compared to most USB - * mice. This byte frequently switches from 0x01 - * (usual state) to 0x02. I assume it is to allow - * extra, non-standard, reporting (say battery-life). - * - * However at the same time it generates a left-click - * message on the button byte which causes spurious - * left-click's where there shouldn't be. This should - * sort that. Currently it's the only user of - * UMS_FLAG_T_AXIS so use it as an identifier. - * - * - * UPDATE: This problem affects the M$ Wireless - * Notebook Optical Mouse, too. However, the leading - * byte for this mouse is normally 0x11, and the - * phantom mouse click occurs when its 0x14. - * - * We probably should switch to some more official quirk. - */ if (sc->sc_iid) { - if (sc->sc_flags & UMS_FLAG_T_AXIS) { - if (*buf == 0x02) { - goto tr_setup; - } - } else { - if (*buf != sc->sc_iid) { - goto tr_setup; - } - } + id = *buf; len--; buf++; } else { + id = 0; if (sc->sc_flags & UMS_FLAG_SBU) { if ((*buf == 0x14) || (*buf == 0x15)) { goto tr_setup; @@ -233,25 +212,37 @@ ums_intr_callback(struct usb2_xfer *xfer } } - dw = (sc->sc_flags & UMS_FLAG_W_AXIS) ? - hid_get_data(buf, len, &sc->sc_loc_w) : 0; - - dx = (sc->sc_flags & UMS_FLAG_X_AXIS) ? - hid_get_data(buf, len, &sc->sc_loc_x) : 0; - - dy = (sc->sc_flags & UMS_FLAG_Y_AXIS) ? - -hid_get_data(buf, len, &sc->sc_loc_y) : 0; + if ((sc->sc_flags & UMS_FLAG_W_AXIS) && (id == sc->sc_iid_w)) + dw = hid_get_data(buf, len, &sc->sc_loc_w); + else + dw = 0; + + if ((sc->sc_flags & UMS_FLAG_X_AXIS) && (id == sc->sc_iid_x)) + dx = hid_get_data(buf, len, &sc->sc_loc_x); + else + dx = 0; + + if ((sc->sc_flags & UMS_FLAG_Y_AXIS) && (id == sc->sc_iid_y)) + dy = -hid_get_data(buf, len, &sc->sc_loc_y); + else + dy = 0; + + if ((sc->sc_flags & UMS_FLAG_Z_AXIS) && (id == sc->sc_iid_z)) + dz = -hid_get_data(buf, len, &sc->sc_loc_z); + else + dz = 0; - dz = (sc->sc_flags & UMS_FLAG_Z_AXIS) ? - -hid_get_data(buf, len, &sc->sc_loc_z) : 0; - - if (sc->sc_flags & UMS_FLAG_REVZ) { + if (sc->sc_flags & UMS_FLAG_REVZ) dz = -dz; - } - dt = (sc->sc_flags & UMS_FLAG_T_AXIS) ? - -hid_get_data(buf, len, &sc->sc_loc_t): 0; + + if ((sc->sc_flags & UMS_FLAG_T_AXIS) && (id == sc->sc_iid_t)) + dt = -hid_get_data(buf, len, &sc->sc_loc_t); + else + dt = 0; for (i = 0; i < sc->sc_buttons; i++) { + if (id != sc->sc_iid_btn[i]) + continue; if (hid_get_data(buf, len, &sc->sc_loc_btn[i])) { buttons |= (1 << UMS_BUT(i)); } @@ -413,14 +404,14 @@ ums_attach(device_t dev) goto detach; } if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - hid_input, &sc->sc_loc_x, &flags, &sc->sc_iid)) { + hid_input, &sc->sc_loc_x, &flags, &sc->sc_iid_x)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { sc->sc_flags |= UMS_FLAG_X_AXIS; } } if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - hid_input, &sc->sc_loc_y, &flags, &sc->sc_iid)) { + hid_input, &sc->sc_loc_y, &flags, &sc->sc_iid_y)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { sc->sc_flags |= UMS_FLAG_Y_AXIS; @@ -428,9 +419,9 @@ ums_attach(device_t dev) } /* Try the wheel first as the Z activator since it's tradition. */ if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, - HUG_WHEEL), hid_input, &sc->sc_loc_z, &flags, &sc->sc_iid) || + HUG_WHEEL), hid_input, &sc->sc_loc_z, &flags, &sc->sc_iid_z) || hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, - HUG_TWHEEL), hid_input, &sc->sc_loc_z, &flags, &sc->sc_iid)) { + HUG_TWHEEL), hid_input, &sc->sc_loc_z, &flags, &sc->sc_iid_z)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { sc->sc_flags |= UMS_FLAG_Z_AXIS; } @@ -439,14 +430,14 @@ ums_attach(device_t dev) * put the Z on the W coordinate. */ if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, - HUG_Z), hid_input, &sc->sc_loc_w, &flags, &sc->sc_iid)) { + HUG_Z), hid_input, &sc->sc_loc_w, &flags, &sc->sc_iid_w)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { sc->sc_flags |= UMS_FLAG_W_AXIS; } } } else if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, - HUG_Z), hid_input, &sc->sc_loc_z, &flags, &sc->sc_iid)) { + HUG_Z), hid_input, &sc->sc_loc_z, &flags, &sc->sc_iid_z)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { sc->sc_flags |= UMS_FLAG_Z_AXIS; @@ -460,7 +451,7 @@ ums_attach(device_t dev) * TWHEEL */ if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_TWHEEL), - hid_input, &sc->sc_loc_t, &flags, &sc->sc_iid)) { + hid_input, &sc->sc_loc_t, &flags, &sc->sc_iid_t)) { sc->sc_loc_t.pos += 8; @@ -472,14 +463,14 @@ ums_attach(device_t dev) for (i = 0; i < UMS_BUTTON_MAX; i++) { if (!hid_locate(d_ptr, d_len, HID_USAGE2(HUP_BUTTON, (i + 1)), - hid_input, &sc->sc_loc_btn[i], NULL, &sc->sc_iid)) { + hid_input, &sc->sc_loc_btn[i], NULL, &sc->sc_iid_btn[i])) { break; } } sc->sc_buttons = i; - isize = hid_report_size(d_ptr, d_len, hid_input, NULL); + isize = hid_report_size(d_ptr, d_len, hid_input, &sc->sc_iid); /* * The Microsoft Wireless Notebook Optical Mouse seems to be in worse @@ -495,6 +486,12 @@ ums_attach(device_t dev) sc->sc_buttons = 3; isize = 5; sc->sc_iid = 0; + sc->sc_iid_x = 0; + sc->sc_iid_y = 0; + sc->sc_iid_z = 0; + sc->sc_iid_btn[0] = 0; + sc->sc_iid_btn[1] = 0; + sc->sc_iid_btn[2] = 0; /* 1st byte of descriptor report contains garbage */ sc->sc_loc_x.pos = 16; sc->sc_loc_y.pos = 24; @@ -544,15 +541,21 @@ ums_attach(device_t dev) #if USB_DEBUG DPRINTF("sc=%p\n", sc); - DPRINTF("X\t%d/%d\n", sc->sc_loc_x.pos, sc->sc_loc_x.size); - DPRINTF("Y\t%d/%d\n", sc->sc_loc_y.pos, sc->sc_loc_y.size); - DPRINTF("Z\t%d/%d\n", sc->sc_loc_z.pos, sc->sc_loc_z.size); - DPRINTF("T\t%d/%d\n", sc->sc_loc_t.pos, sc->sc_loc_t.size); - DPRINTF("W\t%d/%d\n", sc->sc_loc_w.pos, sc->sc_loc_w.size); + DPRINTF("X\t%d/%d id=%d\n", sc->sc_loc_x.pos, + sc->sc_loc_x.size, sc->sc_iid_x); + DPRINTF("Y\t%d/%d id=%d\n", sc->sc_loc_y.pos, + sc->sc_loc_y.size, sc->sc_iid_y); + DPRINTF("Z\t%d/%d id=%d\n", sc->sc_loc_z.pos, + sc->sc_loc_z.size, sc->sc_iid_z); + DPRINTF("T\t%d/%d id=%d\n", sc->sc_loc_t.pos, + sc->sc_loc_t.size, sc->sc_iid_t); + DPRINTF("W\t%d/%d id=%d\n", sc->sc_loc_w.pos, + sc->sc_loc_w.size, sc->sc_iid_w); for (i = 0; i < sc->sc_buttons; i++) { - DPRINTF("B%d\t%d/%d\n", - i + 1, sc->sc_loc_btn[i].pos, sc->sc_loc_btn[i].size); + DPRINTF("B%d\t%d/%d id=%d\n", + i + 1, sc->sc_loc_btn[i].pos, + sc->sc_loc_btn[i].size, sc->sc_iid_btn[i]); } DPRINTF("size=%d, id=%d\n", isize, sc->sc_iid); #endif From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 16:51:40 2009 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 E0817106568F; Mon, 9 Mar 2009 16:51:40 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD4F68FC1F; Mon, 9 Mar 2009 16:51:40 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29GpemK031939; Mon, 9 Mar 2009 16:51:40 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29GpecS031938; Mon, 9 Mar 2009 16:51:40 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903091651.n29GpecS031938@svn.freebsd.org> From: Bruce M Simpson Date: Mon, 9 Mar 2009 16:51:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189584 - 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: Mon, 09 Mar 2009 16:51:41 -0000 Author: bms Date: Mon Mar 9 16:51:40 2009 New Revision: 189584 URL: http://svn.freebsd.org/changeset/base/189584 Log: Add igmp(4) man page, do not connect to build yet. Added: head/share/man/man4/igmp.4 (contents, props changed) Added: head/share/man/man4/igmp.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/igmp.4 Mon Mar 9 16:51:40 2009 (r189584) @@ -0,0 +1,139 @@ +.\" +.\" Copyright (c) 2009 Bruce Simpson. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the project nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 9, 2009 +.Dt IGMP 4 +.Os +.Sh NAME +.Nm igmp +.Nd Internet Group Management Protocol +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In netinet/in.h +.In netinet/in_systm.h +.In netinet/ip.h +.In netinet/igmp.h +.Ft int +.Fn socket AF_INET SOCK_RAW IPPROTO_IGMP +.Sh DESCRIPTION +.Tn IGMP +is a control plane protocol used by IPv4 hosts and routers to +propagate multicast group membership information. +Normally this protocol is not used directly, except by the kernel +itself, in response to multicast membership requests by user +applications. +Routing protocols may open a raw socket to directly interact with +.Nm . +.Pp +As of +.Fx 8.0 , +IGMP version 3 is implemented. +This adds support for Source-Specific Multicast (SSM), whereby +applications may communicate to upstream multicast routers that +they are only interested in receiving multicast streams from +particular sources. +.\" +.Sh SYSCTL VARIABLES +.Pp +.Bl -tag -width indent +.\" +.It net.inet.igmp.stats +This opaque read-only variable exposes the stack-wide IGMPv3 +protocol statistics to +.Xr netstat 1 . +.\" +.It net.inet.igmp.ifinfo +This opaque read-only variable exposes the per-link IGMPv3 status to +.Xr ifmcstat 8 . +.\" +.It net.inet.igmp.gsrdelay +This variable specifies the time threshold, in seconds, for processing +Group-and-Source Specific Queries (GSR). +As GSR query processing requires maintaining state on the host, +it may cause memory to be allocated, and is therefore a potential +attack point for Denial-of-Service (DoS). +If more than one GSR query is received within this threshold, +it will be dropped, to mitigate the potential for DoS. +.\" +.It net.inet.igmp.default_version +This variable controls the default version of IGMP to be used on all links. +This sysctl is normally set to 3 by default. +.\" +.It net.inet.igmp.legacysupp +If this variable is non-zero, then IGMP v1 and v2 membership reports +received on a link will be allowed to suppress the IGMP v3 state-change +reports which would otherwise be issued by this host. +This sysctl is normally enabled by default. +.\" +.It net.inet.igmp.v2enable +If this variable is non-zero, then IGMP v2 membership queries will be +processed by this host, and backwards compatibility will be enabled +until the v2 'Old Querier Present' timer expires. +This sysctl is normally enabled by default. +.\" +.It net.inet.igmp.v1enable +If this variable is non-zero, then IGMP v1 membership queries will be +processed by this host, and backwards compatibility will be enabled +until the v1 'Old Querier Present' timer expires. +This sysctl is normally enabled by default. +.\" +.It net.inet.igmp.sendlocal +If this variable is non-zero, then IGMP state-changes for groups in +the 224.0.0.0/24 link-scope prefix will be issued. +This behaviour is recommended if deploying +.Fx +in a network environment with layer 2 devices which snoop IGMP traffic +to mitigate multicast propagation throughout the network. +This sysctl is normally enabled by default. +.\" +.It net.inet.igmp.sendra +If this variable is non-zero, then IGMP v2 and v3 reports will contain +the IP Router Alert option. +This sysctl is normally enabled by default. +.\" +.It net.inet.igmp.recvifkludge +If this variable is non-zero, then received IGMP reports which contain +0.0.0.0 as their source will be rewritten to contain the subnet address. +This is useful when there are hosts on-link which have not yet been +configured with a primary IPv4 address. +This sysctl is normally enabled by default. +.\" +.El +.Sh SEE ALSO +.Xr ifmcstat 8 , +.Xr inet 4 , +.Xr multicast 4 , +.Xr netstat 1 , +.Xr sourcefilter 3 +.Sh HISTORY +The +.Nm +manual page re-appeared in +.Fx 8.0 . From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 17:05:32 2009 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 2990F106571D; Mon, 9 Mar 2009 17:05:32 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 144D48FC22; Mon, 9 Mar 2009 17:05:32 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29H5W2s032236; Mon, 9 Mar 2009 17:05:32 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29H5VTc032222; Mon, 9 Mar 2009 17:05:31 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903091705.n29H5VTc032222@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Mar 2009 17:05: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: r189585 - in head: . lib/libusb20 release/amd64 release/i386 release/ia64 release/powerpc release/sparc64 release/sun4v sys/sys usr.sbin/usbconfig 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 Mar 2009 17:05:33 -0000 Author: thompsa Date: Mon Mar 9 17:05:31 2009 New Revision: 189585 URL: http://svn.freebsd.org/changeset/base/189585 Log: Install libusb20.so.1 as libusb.so.1, there will be a followup commit to the ports tree so that programs use libusb from the base by default. Thanks to Stanislav Sedov for sorting out the ports build. Bump __FreeBSD_version to 800069 Help and testing by: stas Added: head/lib/libusb20/usb.h (props changed) - copied unchanged from r189583, head/lib/libusb20/libusb20_compat01.h Deleted: head/lib/libusb20/libusb20_compat01.h Modified: head/ObsoleteFiles.inc head/UPDATING head/lib/libusb20/Makefile head/lib/libusb20/libusb20_compat01.c head/release/amd64/boot_crunch.conf head/release/i386/boot_crunch.conf head/release/ia64/boot_crunch.conf head/release/powerpc/boot_crunch.conf head/release/sparc64/boot_crunch.conf head/release/sun4v/boot_crunch.conf head/sys/sys/param.h head/usr.sbin/usbconfig/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Mar 9 16:51:40 2009 (r189584) +++ head/ObsoleteFiles.inc Mon Mar 9 17:05:31 2009 (r189585) @@ -14,6 +14,9 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090308: libusb.so.1 renamed +OLD_LIBS+=usr/lib/libusb20.so.1 +OLD_FILES+=usr/include/libusb20_compat01.h # 20090226: libmp(3) functions renamed OLD_LIBS+=usr/lib/libmp.so.6 # 20090223: changeover of USB stacks Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 9 16:51:40 2009 (r189584) +++ head/UPDATING Mon Mar 9 17:05:31 2009 (r189585) @@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090309: + libusb20.so.1 is now installed as libusb.so.1 and the ports system + updated to use it. This requires a buildworld/installworld in order to + update the library and dependencies (usbconfig, etc). Its advisable to + update your ports as the affected programs have had a revision bump. + 20090302: A workaround is committed to allow the creation of System V shared memory segment of size > 2 GB on the 64-bit architectures. Modified: head/lib/libusb20/Makefile ============================================================================== --- head/lib/libusb20/Makefile Mon Mar 9 16:51:40 2009 (r189584) +++ head/lib/libusb20/Makefile Mon Mar 9 17:05:31 2009 (r189585) @@ -4,7 +4,7 @@ # Makefile for the FreeBSD specific LibUSB 2.0 # -LIB= usb20 +LIB= usb SHLIB_MAJOR= 1 SHLIB_MINOR= 0 SRCS= libusb20.c @@ -14,11 +14,12 @@ SRCS+= libusb20_compat01.c SRCS+= libusb20_compat10.c INCS+= libusb20.h INCS+= libusb20_desc.h -INCS+= libusb20_compat01.h -INCS+= libusb20_compat10.h MAN= libusb20.3 MKLINT= no NOGCCERROR= +# libusb 0.1 compat +INCS+= usb.h + .include Modified: head/lib/libusb20/libusb20_compat01.c ============================================================================== --- head/lib/libusb20/libusb20_compat01.c Mon Mar 9 16:51:40 2009 (r189584) +++ head/lib/libusb20/libusb20_compat01.c Mon Mar 9 17:05:31 2009 (r189585) @@ -37,7 +37,7 @@ #include "libusb20.h" #include "libusb20_desc.h" #include "libusb20_int.h" -#include "libusb20_compat01.h" +#include "usb.h" /* * The two following macros were taken from the original LibUSB v0.1 Copied: head/lib/libusb20/usb.h (from r189583, head/lib/libusb20/libusb20_compat01.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libusb20/usb.h Mon Mar 9 17:05:31 2009 (r189585, copy of r189583, head/lib/libusb20/libusb20_compat01.h) @@ -0,0 +1,310 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUSB20_COMPAT_01_H_ +#define _LIBUSB20_COMPAT_01_H_ + +#include +#include +#include +#include + +/* USB interface class codes */ + +#define USB_CLASS_PER_INTERFACE 0 +#define USB_CLASS_AUDIO 1 +#define USB_CLASS_COMM 2 +#define USB_CLASS_HID 3 +#define USB_CLASS_PRINTER 7 +#define USB_CLASS_PTP 6 +#define USB_CLASS_MASS_STORAGE 8 +#define USB_CLASS_HUB 9 +#define USB_CLASS_DATA 10 +#define USB_CLASS_VENDOR_SPEC 0xff + +/* USB descriptor types */ + +#define USB_DT_DEVICE 0x01 +#define USB_DT_CONFIG 0x02 +#define USB_DT_STRING 0x03 +#define USB_DT_INTERFACE 0x04 +#define USB_DT_ENDPOINT 0x05 + +#define USB_DT_HID 0x21 +#define USB_DT_REPORT 0x22 +#define USB_DT_PHYSICAL 0x23 +#define USB_DT_HUB 0x29 + +/* USB descriptor type sizes */ + +#define USB_DT_DEVICE_SIZE 18 +#define USB_DT_CONFIG_SIZE 9 +#define USB_DT_INTERFACE_SIZE 9 +#define USB_DT_ENDPOINT_SIZE 7 +#define USB_DT_ENDPOINT_AUDIO_SIZE 9 +#define USB_DT_HUB_NONVAR_SIZE 7 + +/* USB descriptor header */ +struct usb_descriptor_header { + uint8_t bLength; + uint8_t bDescriptorType; +}; + +/* USB string descriptor */ +struct usb_string_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t wData[1]; +}; + +/* USB HID descriptor */ +struct usb_hid_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdHID; + uint8_t bCountryCode; + uint8_t bNumDescriptors; + /* uint8_t bReportDescriptorType; */ + /* uint16_t wDescriptorLength; */ + /* ... */ +}; + +/* USB endpoint descriptor */ +#define USB_MAXENDPOINTS 32 +struct usb_endpoint_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bEndpointAddress; +#define USB_ENDPOINT_ADDRESS_MASK 0x0f +#define USB_ENDPOINT_DIR_MASK 0x80 + uint8_t bmAttributes; +#define USB_ENDPOINT_TYPE_MASK 0x03 +#define USB_ENDPOINT_TYPE_CONTROL 0 +#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1 +#define USB_ENDPOINT_TYPE_BULK 2 +#define USB_ENDPOINT_TYPE_INTERRUPT 3 + uint16_t wMaxPacketSize; + uint8_t bInterval; + uint8_t bRefresh; + uint8_t bSynchAddress; + + uint8_t *extra; /* Extra descriptors */ + int extralen; +}; + +/* USB interface descriptor */ +#define USB_MAXINTERFACES 32 +struct usb_interface_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; + + struct usb_endpoint_descriptor *endpoint; + + uint8_t *extra; /* Extra descriptors */ + int extralen; +}; + +#define USB_MAXALTSETTING 128 /* Hard limit */ +struct usb_interface { + struct usb_interface_descriptor *altsetting; + + int num_altsetting; +}; + +/* USB configuration descriptor */ +#define USB_MAXCONFIG 8 +struct usb_config_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t wTotalLength; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t MaxPower; + + struct usb_interface *interface; + + uint8_t *extra; /* Extra descriptors */ + int extralen; +}; + +/* USB device descriptor */ +struct usb_device_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint16_t idVendor; + uint16_t idProduct; + uint16_t bcdDevice; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; +}; + +/* USB setup packet */ +struct usb_ctrl_setup { + uint8_t bRequestType; +#define USB_RECIP_DEVICE 0x00 +#define USB_RECIP_INTERFACE 0x01 +#define USB_RECIP_ENDPOINT 0x02 +#define USB_RECIP_OTHER 0x03 +#define USB_TYPE_STANDARD (0x00 << 5) +#define USB_TYPE_CLASS (0x01 << 5) +#define USB_TYPE_VENDOR (0x02 << 5) +#define USB_TYPE_RESERVED (0x03 << 5) +#define USB_ENDPOINT_IN 0x80 +#define USB_ENDPOINT_OUT 0x00 + uint8_t bRequest; +#define USB_REQ_GET_STATUS 0x00 +#define USB_REQ_CLEAR_FEATURE 0x01 +#define USB_REQ_SET_FEATURE 0x03 +#define USB_REQ_SET_ADDRESS 0x05 +#define USB_REQ_GET_DESCRIPTOR 0x06 +#define USB_REQ_SET_DESCRIPTOR 0x07 +#define USB_REQ_GET_CONFIGURATION 0x08 +#define USB_REQ_SET_CONFIGURATION 0x09 +#define USB_REQ_GET_INTERFACE 0x0A +#define USB_REQ_SET_INTERFACE 0x0B +#define USB_REQ_SYNCH_FRAME 0x0C + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; +}; + +/* Error codes */ +#define USB_ERROR_BEGIN 500000 + +/* Byte swapping */ +#define USB_LE16_TO_CPU(x) le16toh(x) + +/* Data types */ +struct usb_device; +struct usb_bus; + +/* + * To maintain compatibility with applications already built with libusb, + * we must only add entries to the end of this structure. NEVER delete or + * move members and only change types if you really know what you're doing. + */ +struct usb_device { + struct usb_device *next; + struct usb_device *prev; + + char filename[PATH_MAX + 1]; + + struct usb_bus *bus; + + struct usb_device_descriptor descriptor; + struct usb_config_descriptor *config; + + void *dev; + + uint8_t devnum; + + uint8_t num_children; + struct usb_device **children; +}; + +struct usb_bus { + struct usb_bus *next; + struct usb_bus *prev; + + char dirname[PATH_MAX + 1]; + + struct usb_device *devices; + uint32_t location; + + struct usb_device *root_dev; +}; + +struct usb_dev_handle; +typedef struct usb_dev_handle usb_dev_handle; + +/* Variables */ +extern struct usb_bus *usb_busses; + +#ifdef __cplusplus +extern "C" { +#endif +#if 0 +} /* style */ + +#endif + +/* Function prototypes from "libusb20_compat01.c" */ + +usb_dev_handle *usb_open(struct usb_device *dev); +int usb_close(usb_dev_handle * dev); +int usb_get_string(usb_dev_handle * dev, int index, int langid, char *buf, size_t buflen); +int usb_get_string_simple(usb_dev_handle * dev, int index, char *buf, size_t buflen); +int usb_get_descriptor_by_endpoint(usb_dev_handle * udev, int ep, uint8_t type, uint8_t index, void *buf, int size); +int usb_get_descriptor(usb_dev_handle * udev, uint8_t type, uint8_t index, void *buf, int size); +int usb_parse_descriptor(uint8_t *source, char *description, void *dest); +int usb_parse_configuration(struct usb_config_descriptor *config, uint8_t *buffer); +void usb_destroy_configuration(struct usb_device *dev); +void usb_fetch_and_parse_descriptors(usb_dev_handle * udev); +int usb_bulk_write(usb_dev_handle * dev, int ep, char *bytes, int size, int timeout); +int usb_bulk_read(usb_dev_handle * dev, int ep, char *bytes, int size, int timeout); +int usb_interrupt_write(usb_dev_handle * dev, int ep, char *bytes, int size, int timeout); +int usb_interrupt_read(usb_dev_handle * dev, int ep, char *bytes, int size, int timeout); +int usb_control_msg(usb_dev_handle * dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout); +int usb_set_configuration(usb_dev_handle * dev, int configuration); +int usb_claim_interface(usb_dev_handle * dev, int interface); +int usb_release_interface(usb_dev_handle * dev, int interface); +int usb_set_altinterface(usb_dev_handle * dev, int alternate); +int usb_resetep(usb_dev_handle * dev, unsigned int ep); +int usb_clear_halt(usb_dev_handle * dev, unsigned int ep); +int usb_reset(usb_dev_handle * dev); +const char *usb_strerror(void); +void usb_init(void); +void usb_set_debug(int level); +int usb_find_busses(void); +int usb_find_devices(void); +struct usb_device *usb_device(usb_dev_handle * dev); +struct usb_bus *usb_get_busses(void); + +#if 0 +{ /* style */ +#endif +#ifdef __cplusplus +} + +#endif + +#endif /* _LIBUSB20_COMPAT01_H_ */ Modified: head/release/amd64/boot_crunch.conf ============================================================================== --- head/release/amd64/boot_crunch.conf Mon Mar 9 16:51:40 2009 (r189584) +++ head/release/amd64/boot_crunch.conf Mon Mar 9 17:05:31 2009 (r189585) @@ -42,4 +42,4 @@ progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo -libs -lbsdxml -larchive -lbz2 -lusb20 +libs -lbsdxml -larchive -lbz2 -lusb Modified: head/release/i386/boot_crunch.conf ============================================================================== --- head/release/i386/boot_crunch.conf Mon Mar 9 16:51:40 2009 (r189584) +++ head/release/i386/boot_crunch.conf Mon Mar 9 17:05:31 2009 (r189585) @@ -42,4 +42,4 @@ progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo -libs -lbsdxml -larchive -lbz2 -lusb20 +libs -lbsdxml -larchive -lbz2 -lusb Modified: head/release/ia64/boot_crunch.conf ============================================================================== --- head/release/ia64/boot_crunch.conf Mon Mar 9 16:51:40 2009 (r189584) +++ head/release/ia64/boot_crunch.conf Mon Mar 9 17:05:31 2009 (r189585) @@ -46,4 +46,4 @@ progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -ldevinfo -libs -lgeom -lbsdxml -larchive -lbz2 -lusb20 +libs -lgeom -lbsdxml -larchive -lbz2 -lusb Modified: head/release/powerpc/boot_crunch.conf ============================================================================== --- head/release/powerpc/boot_crunch.conf Mon Mar 9 16:51:40 2009 (r189584) +++ head/release/powerpc/boot_crunch.conf Mon Mar 9 17:05:31 2009 (r189585) @@ -44,4 +44,4 @@ progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -libs -lbsdxml -larchive -lbz2 -lusb20 +libs -lbsdxml -larchive -lbz2 -lusb Modified: head/release/sparc64/boot_crunch.conf ============================================================================== --- head/release/sparc64/boot_crunch.conf Mon Mar 9 16:51:40 2009 (r189584) +++ head/release/sparc64/boot_crunch.conf Mon Mar 9 17:05:31 2009 (r189585) @@ -42,4 +42,4 @@ progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml -libs -larchive -lbz2 -lusb20 +libs -larchive -lbz2 -lusb Modified: head/release/sun4v/boot_crunch.conf ============================================================================== --- head/release/sun4v/boot_crunch.conf Mon Mar 9 16:51:40 2009 (r189584) +++ head/release/sun4v/boot_crunch.conf Mon Mar 9 17:05:31 2009 (r189585) @@ -42,4 +42,4 @@ progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml -libs -larchive -lbz2 -lusb20 +libs -larchive -lbz2 -lusb Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Mar 9 16:51:40 2009 (r189584) +++ head/sys/sys/param.h Mon Mar 9 17:05:31 2009 (r189585) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800068 /* Master, propagated to newvers */ +#define __FreeBSD_version 800069 /* Master, propagated to newvers */ #ifndef LOCORE #include Modified: head/usr.sbin/usbconfig/Makefile ============================================================================== --- head/usr.sbin/usbconfig/Makefile Mon Mar 9 16:51:40 2009 (r189584) +++ head/usr.sbin/usbconfig/Makefile Mon Mar 9 17:05:31 2009 (r189585) @@ -4,6 +4,6 @@ PROG= usbconfig MAN= usbconfig.8 SRCS= usbconfig.c dump.c -LDADD+= -lusb20 +LDADD+= -lusb .include From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 17:09:47 2009 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 6FF5210656F4; Mon, 9 Mar 2009 17:09:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 431D18FC1D; Mon, 9 Mar 2009 17:09:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29H9lud032401; Mon, 9 Mar 2009 17:09:47 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29H9lJA032400; Mon, 9 Mar 2009 17:09:47 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903091709.n29H9lJA032400@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Mar 2009 17:09: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: r189587 - in head/lib: libusb libusb20 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 Mar 2009 17:09:49 -0000 Author: thompsa Date: Mon Mar 9 17:09:46 2009 New Revision: 189587 URL: http://svn.freebsd.org/changeset/base/189587 Log: libusb20 is now installed as libusb, remove the version number from the directory name. Added: head/lib/libusb/ (props changed) - copied from r189586, head/lib/libusb20/ Deleted: head/lib/libusb20/ From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 17:16:30 2009 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 6A5DA106567B; Mon, 9 Mar 2009 17:16:30 +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 5534F8FC20; Mon, 9 Mar 2009 17:16:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29HGUIw032591; Mon, 9 Mar 2009 17:16:30 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29HGUL8032586; Mon, 9 Mar 2009 17:16:30 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903091716.n29HGUL8032586@svn.freebsd.org> From: John Baldwin Date: Mon, 9 Mar 2009 17:16: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: r189588 - in head/sys/boot/i386: libi386 loader 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 Mar 2009 17:16:32 -0000 Author: jhb Date: Mon Mar 9 17:16:29 2009 New Revision: 189588 URL: http://svn.freebsd.org/changeset/base/189588 Log: - Make it possible to disable GPT support by setting LOADER_NO_GPT_SUPPORT in make.conf or src.conf. - When GPT is enabled (which it is by default), use memory above 1 MB and leave the memory from the end of the bss to the end of the 640k window purely for the stack. The loader has grown and now it is much more common for the heap and stack to grow into each other when both are located in the 640k window. PR: kern/129526 MFC after: 1 week Modified: head/sys/boot/i386/libi386/Makefile head/sys/boot/i386/libi386/biosdisk.c head/sys/boot/i386/libi386/devicename.c head/sys/boot/i386/loader/Makefile head/sys/boot/i386/loader/main.c Modified: head/sys/boot/i386/libi386/Makefile ============================================================================== --- head/sys/boot/i386/libi386/Makefile Mon Mar 9 17:09:46 2009 (r189587) +++ head/sys/boot/i386/libi386/Makefile Mon Mar 9 17:16:29 2009 (r189588) @@ -33,6 +33,10 @@ CFLAGS+= -DDISK_DEBUG CFLAGS+= -DSMBIOS_SERIAL_NUMBERS .endif +.if !defined(LOADER_NO_GPT_SUPPORT) +CFLAGS+= -DLOADER_GPT_SUPPORT +.endif + # Include simple terminal emulation (cons25-compatible) CFLAGS+= -DTERM_EMU Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Mon Mar 9 17:09:46 2009 (r189587) +++ head/sys/boot/i386/libi386/biosdisk.c Mon Mar 9 17:16:29 2009 (r189588) @@ -68,12 +68,14 @@ __FBSDID("$FreeBSD$"); # define DEBUG(fmt, args...) #endif +#ifdef LOADER_GPT_SUPPORT struct gpt_part { int gp_index; uuid_t gp_type; uint64_t gp_start; uint64_t gp_end; }; +#endif struct open_disk { int od_dkunit; /* disk unit number */ @@ -90,25 +92,31 @@ struct open_disk { #define BD_FLOPPY 0x0004 #define BD_LABELOK 0x0008 #define BD_PARTTABOK 0x0010 +#ifdef LOADER_GPT_SUPPORT #define BD_GPTOK 0x0020 +#endif union { struct { struct disklabel mbr_disklabel; int mbr_nslices; /* slice count */ struct dos_partition mbr_slicetab[NEXTDOSPART]; } _mbr; +#ifdef LOADER_GPT_SUPPORT struct { int gpt_nparts; struct gpt_part *gpt_partitions; } _gpt; +#endif } _data; }; #define od_disklabel _data._mbr.mbr_disklabel #define od_nslices _data._mbr.mbr_nslices #define od_slicetab _data._mbr.mbr_slicetab +#ifdef LOADER_GPT_SUPPORT #define od_nparts _data._gpt.gpt_nparts #define od_partitions _data._gpt.gpt_partitions +#endif /* * List of BIOS devices, translation from disk unit number to @@ -130,8 +138,10 @@ static int bd_write(struct open_disk *od static int bd_int13probe(struct bdinfo *bd); +#ifdef LOADER_GPT_SUPPORT static void bd_printgptpart(struct open_disk *od, struct gpt_part *gp, char *prefix, int verbose); +#endif static void bd_printslice(struct open_disk *od, struct dos_partition *dp, char *prefix, int verbose); static void bd_printbsdslice(struct open_disk *od, daddr_t offset, @@ -163,8 +173,10 @@ static void bd_closedisk(struct open_dis static int bd_open_mbr(struct open_disk *od, struct i386_devdesc *dev); static int bd_bestslice(struct open_disk *od); static void bd_checkextended(struct open_disk *od, int slicenum); +#ifdef LOADER_GPT_SUPPORT static int bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev); static struct gpt_part *bd_best_gptpart(struct open_disk *od); +#endif /* * Translate between BIOS device numbers and our private unit numbers. @@ -286,6 +298,7 @@ bd_print(int verbose) if (!bd_opendisk(&od, &dev)) { +#ifdef LOADER_GPT_SUPPORT /* Do we have a GPT table? */ if (od->od_flags & BD_GPTOK) { for (j = 0; j < od->od_nparts; j++) { @@ -293,9 +306,10 @@ bd_print(int verbose) od->od_partitions[j].gp_index); bd_printgptpart(od, &od->od_partitions[j], line, verbose); } - + } else +#endif /* Do we have a partition table? */ - } else if (od->od_flags & BD_PARTTABOK) { + if (od->od_flags & BD_PARTTABOK) { dptr = &od->od_slicetab[0]; /* Check for a "dedicated" disk */ @@ -339,6 +353,7 @@ display_size(uint64_t size) return (buf); } +#ifdef LOADER_GPT_SUPPORT static uuid_t efi = GPT_ENT_TYPE_EFI; static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; @@ -380,6 +395,7 @@ bd_printgptpart(struct open_disk *od, st stats); pager_output(line); } +#endif /* * Print information about slices on a disk. For the size calculations we @@ -561,8 +577,10 @@ bd_opendisk(struct open_disk **odp, stru } /* Determine disk layout. */ +#ifdef LOADER_GPT_SUPPORT error = bd_open_gpt(od, dev); if (error) +#endif error = bd_open_mbr(od, dev); out: @@ -826,6 +844,7 @@ bd_bestslice(struct open_disk *od) return (prefslice); } +#ifdef LOADER_GPT_SUPPORT static int bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev) { @@ -1003,6 +1022,7 @@ bd_best_gptpart(struct open_disk *od) } return (prefpart); } +#endif static int bd_close(struct open_file *f) @@ -1022,8 +1042,10 @@ bd_closedisk(struct open_disk *od) if (od->od_flags & BD_FLOPPY) delay(3000000); #endif +#ifdef LOADER_GPT_SUPPORT if (od->od_flags & BD_GPTOK) free(od->od_partitions); +#endif free(od); } Modified: head/sys/boot/i386/libi386/devicename.c ============================================================================== --- head/sys/boot/i386/libi386/devicename.c Mon Mar 9 17:09:46 2009 (r189587) +++ head/sys/boot/i386/libi386/devicename.c Mon Mar 9 17:16:29 2009 (r189588) @@ -120,6 +120,7 @@ i386_parsedev(struct i386_devdesc **dev, err = EUNIT; goto fail; } +#ifdef LOADER_GPT_SUPPORT if (*cp == 'p') { /* got a GPT partition */ np = cp + 1; slice = strtol(np, &cp, 10); @@ -133,6 +134,7 @@ i386_parsedev(struct i386_devdesc **dev, } partition = 0xff; } else { +#endif if (*cp == 's') { /* got a slice number */ np = cp + 1; slice = strtol(np, &cp, 10); @@ -149,7 +151,9 @@ i386_parsedev(struct i386_devdesc **dev, } cp++; } +#ifdef LOADER_GPT_SUPPORT } +#endif } else { cp = np; } @@ -227,14 +231,18 @@ i386_fmtdev(void *vdev) case DEVT_DISK: cp = buf; cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit); +#ifdef LOADER_GPT_SUPPORT if (dev->d_kind.biosdisk.partition == 0xff) { cp += sprintf(cp, "p%d", dev->d_kind.biosdisk.slice); } else { +#endif if (dev->d_kind.biosdisk.slice > 0) cp += sprintf(cp, "s%d", dev->d_kind.biosdisk.slice); if (dev->d_kind.biosdisk.partition >= 0) cp += sprintf(cp, "%c", dev->d_kind.biosdisk.partition + 'a'); +#ifdef LOADER_GPT_SUPPORT } +#endif strcat(cp, ":"); break; Modified: head/sys/boot/i386/loader/Makefile ============================================================================== --- head/sys/boot/i386/loader/Makefile Mon Mar 9 17:09:46 2009 (r189587) +++ head/sys/boot/i386/loader/Makefile Mon Mar 9 17:16:29 2009 (r189588) @@ -51,6 +51,9 @@ CFLAGS+= -DLOADER_BZIP2_SUPPORT .if !defined(LOADER_NO_GZIP_SUPPORT) CFLAGS+= -DLOADER_GZIP_SUPPORT .endif +.if !defined(LOADER_NO_GPT_SUPPORT) +CFLAGS+= -DLOADER_GPT_SUPPORT +.endif # Always add MI sources .PATH: ${.CURDIR}/../../common Modified: head/sys/boot/i386/loader/main.c ============================================================================== --- head/sys/boot/i386/loader/main.c Mon Mar 9 17:09:46 2009 (r189587) +++ head/sys/boot/i386/loader/main.c Mon Mar 9 17:16:29 2009 (r189588) @@ -102,7 +102,7 @@ main(void) */ bios_getmem(); -#if defined(LOADER_BZIP2_SUPPORT) || defined(LOADER_FIREWIRE_SUPPORT) || defined(LOADER_ZFS_SUPPORT) +#if defined(LOADER_BZIP2_SUPPORT) || defined(LOADER_FIREWIRE_SUPPORT) || defined(LOADER_GPT_SUPPORT) || defined(LOADER_ZFS_SUPPORT) heap_top = PTOV(memtop_copyin); memtop_copyin -= 0x300000; heap_bottom = PTOV(memtop_copyin); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 17:38:15 2009 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 0C1FA10660AF; Mon, 9 Mar 2009 17:38:15 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB2E78FC14; Mon, 9 Mar 2009 17:38:14 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29HcEPl033035; Mon, 9 Mar 2009 17:38:14 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29HcEru033034; Mon, 9 Mar 2009 17:38:14 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903091738.n29HcEru033034@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Mar 2009 17:38: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: r189589 - head/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: Mon, 09 Mar 2009 17:38:32 -0000 Author: thompsa Date: Mon Mar 9 17:38:14 2009 New Revision: 189589 URL: http://svn.freebsd.org/changeset/base/189589 Log: Commit missed file in r189587, update directory name for libusb. Spotted by: rdivacky Modified: head/lib/Makefile Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Mon Mar 9 17:16:29 2009 (r189588) +++ head/lib/Makefile Mon Mar 9 17:38:14 2009 (r189589) @@ -40,7 +40,7 @@ SUBDIR= ${_csu} libc libbsm libauditd li ${_libpmc} libproc librt ${_libsdp} ${_libsm} ${_libsmb} \ ${_libsmdb} \ ${_libsmutil} libstand ${_libtelnet} ${_libthr} libthread_db libufs \ - libugidfw ${_libusbhid} ${_libusb20} ${_libvgl} libwrap liby libz \ + libugidfw ${_libusbhid} ${_libusb} ${_libvgl} libwrap liby libz \ ${_bind} .if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf) @@ -139,7 +139,7 @@ _libtelnet= libtelnet .if ${MK_USB} != "no" _libusbhid= libusbhid -_libusb20= libusb20 +_libusb= libusb .endif .include From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 17:42:18 2009 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 8FE151065719; Mon, 9 Mar 2009 17:42:18 +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 752D48FC1A; Mon, 9 Mar 2009 17:42:18 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29HgI19033165; Mon, 9 Mar 2009 17:42:18 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29HgILX033164; Mon, 9 Mar 2009 17:42:18 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <200903091742.n29HgILX033164@svn.freebsd.org> From: "Christian S.J. Peron" Date: Mon, 9 Mar 2009 17:42: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: r189590 - head/sys/security/mac_bsdextended 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 Mar 2009 17:42:32 -0000 Author: csjp Date: Mon Mar 9 17:42:18 2009 New Revision: 189590 URL: http://svn.freebsd.org/changeset/base/189590 Log: Mark the bsdextended rules sysctl as being mpsafe. Discussed with: rwatson Modified: head/sys/security/mac_bsdextended/mac_bsdextended.c Modified: head/sys/security/mac_bsdextended/mac_bsdextended.c ============================================================================== --- head/sys/security/mac_bsdextended/mac_bsdextended.c Mon Mar 9 17:38:14 2009 (r189589) +++ head/sys/security/mac_bsdextended/mac_bsdextended.c Mon Mar 9 17:42:18 2009 (r189590) @@ -202,8 +202,8 @@ out: return (error); } -SYSCTL_NODE(_security_mac_bsdextended, OID_AUTO, rules, CTLFLAG_RW, - sysctl_rule, "BSD extended MAC rules"); +SYSCTL_NODE(_security_mac_bsdextended, OID_AUTO, rules, + CTLFLAG_MPSAFE | CTLFLAG_RW, sysctl_rule, "BSD extended MAC rules"); static void ugidfw_init(struct mac_policy_conf *mpc) From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 17:53:06 2009 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 E14601065747; Mon, 9 Mar 2009 17:53:05 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9D388FC12; Mon, 9 Mar 2009 17:53:05 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29Hr5Rr033463; Mon, 9 Mar 2009 17:53:05 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29Hr5Jm033456; Mon, 9 Mar 2009 17:53:05 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903091753.n29Hr5Jm033456@svn.freebsd.org> From: Bruce M Simpson Date: Mon, 9 Mar 2009 17:53: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: r189592 - in head: . share/man/man4 sys/netinet sys/sys usr.bin/netstat usr.sbin/ifmcstat 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 Mar 2009 17:53:09 -0000 Author: bms Date: Mon Mar 9 17:53:05 2009 New Revision: 189592 URL: http://svn.freebsd.org/changeset/base/189592 Log: Merge IGMPv3 and Source-Specific Multicast (SSM) to the FreeBSD IPv4 stack. Diffs are minimized against p4. PCS has been used for some protocol verification, more widespread testing of recorded sources in Group-and-Source queries is needed. sizeof(struct igmpstat) has changed. __FreeBSD_version is bumped to 800070. Modified: head/UPDATING head/share/man/man4/Makefile head/share/man/man4/ip.4 head/share/man/man4/multicast.4 head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/igmp_var.h head/sys/netinet/in.c head/sys/netinet/in.h head/sys/netinet/in_mcast.c head/sys/netinet/in_proto.c head/sys/netinet/in_var.h head/sys/netinet/ip_input.c head/sys/netinet/ip_var.h head/sys/netinet/raw_ip.c head/sys/netinet/udp_usrreq.c head/sys/netinet/vinet.h head/sys/sys/param.h head/sys/sys/vimage.h head/usr.bin/netstat/inet.c head/usr.sbin/ifmcstat/Makefile head/usr.sbin/ifmcstat/ifmcstat.8 head/usr.sbin/ifmcstat/ifmcstat.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 9 17:42:34 2009 (r189591) +++ head/UPDATING Mon Mar 9 17:53:05 2009 (r189592) @@ -23,6 +23,45 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. ln -s aj /etc/malloc.conf.) 20090309: + IGMPv3 and Source-Specific Multicast (SSM) have been merged + to the IPv4 stack. VIMAGE hooks are in but not yet used. + + For kernel developers, the most important changes are that the + ip_output() and ip_input() paths no longer take the IN_MULTI_LOCK(), + and this lock has been downgraded to a non-recursive mutex. + + Transport protocols (UDP, Raw IP) are now responsible for filtering + inbound multicast traffic according to group membership and source + filters. The imo_multicast_filter() KPI exists for this purpose. + Transports which do not use multicast (SCTP, TCP) already reject + multicast by default. Forwarding and receive performance may improve + as a mutex acquisition is no longer needed in the ip_input() + low-level input path. in_addmulti() and in_delmulti() are shimmed + to new KPIs which exist to support SSM in-kernel. + + For application developers, it is recommended that loopback of + multicast datagrams be disabled for best performance, as this + will still cause the lock to be taken for each looped-back + datagram transmission. The net.inet.ip.mcast.loop sysctl may + be tuned to 0 to disable loopback by default; it defaults to 1 + to preserve the existing behaviour. + + For systems administrators, to obtain best performance with + multicast reception and multiple groups, it is always recommended + that a card with a suitably precise hash filter is used. Hash + collisions will still result in the lock being taken within the + transport protocol input path to check group membership. + + If deploying FreeBSD in an environment with IGMP snooping switches, + it is recommended that the net.inet.igmp.sendlocal sysctl remain + enabled; this forces 224.0.0.0/24 group membership to be announced + via IGMP. + + The size of 'struct igmpstat' has changed; netstat needs to be + recompiled to reflect this. + Bump __FreeBSD_version to 800070. + +20090309: libusb20.so.1 is now installed as libusb.so.1 and the ports system updated to use it. This requires a buildworld/installworld in order to update the library and dependencies (usbconfig, etc). Its advisable to Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Mar 9 17:42:34 2009 (r189591) +++ head/share/man/man4/Makefile Mon Mar 9 17:53:05 2009 (r189592) @@ -128,6 +128,7 @@ MAN= aac.4 \ if_bridge.4 \ ifmib.4 \ igb.4 \ + igmp.4 \ iic.4 \ iicbb.4 \ iicbus.4 \ Modified: head/share/man/man4/ip.4 ============================================================================== --- head/share/man/man4/ip.4 Mon Mar 9 17:42:34 2009 (r189591) +++ head/share/man/man4/ip.4 Mon Mar 9 17:53:05 2009 (r189592) @@ -32,7 +32,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd February 13, 2009 +.Dd March 9, 2009 .Dt IP 4 .Os .Sh NAME @@ -466,13 +466,19 @@ setsockopt(s, IPPROTO_IP, IP_MULTICAST_L .Pp This option improves performance for applications that may have no more than one -instance on a single host (such as a router daemon), by eliminating +instance on a single host (such as a routing daemon), by eliminating the overhead of receiving their own transmissions. It should generally not be used by applications for which there may be more than one instance on a single host (such as a conferencing program) or for which the sender does not belong to the destination group (such as a time querying program). .Pp +The sysctl setting +.Va net.inet.ip.mcast.loop +controls the default setting of the +.Dv IP_MULTICAST_LOOP +socket option for new sockets. +.Pp A multicast datagram sent with an initial TTL greater than 1 may be delivered to the sending host on a different interface from that on which it was sent, if the host belongs to the destination group on that other interface. @@ -650,6 +656,13 @@ documented in RFC 3678. For management of source filter lists using this API, please refer to .Xr sourcefilter 3 . +.Pp +The sysctl settings +.Va net.inet.ip.mcast.maxsocksrc +and +.Va net.inet.ip.mcast.maxgrpsrc +are used to specify an upper limit on the number of per-socket and per-group +source filter entries which the kernel may allocate. .\"----------------------- .Ss "Raw IP Sockets" .Pp @@ -795,6 +808,7 @@ field was not equal to the length of the .Xr send 2 , .Xr byteorder 3 , .Xr icmp 4 , +.Xr igmp 4 , .Xr inet 4 , .Xr intro 4 , .Xr multicast 4 , Modified: head/share/man/man4/multicast.4 ============================================================================== --- head/share/man/man4/multicast.4 Mon Mar 9 17:42:34 2009 (r189591) +++ head/share/man/man4/multicast.4 Mon Mar 9 17:53:05 2009 (r189592) @@ -956,6 +956,7 @@ after the previous upcall. .Xr socket 2 , .Xr sourcefilter 3 , .Xr icmp6 4 , +.Xr igmp 4 , .Xr inet 4 , .Xr inet6 4 , .Xr intro 4 , Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Mon Mar 9 17:42:34 2009 (r189591) +++ head/sys/netinet/if_ether.c Mon Mar 9 17:53:05 2009 (r189592) @@ -81,7 +81,8 @@ __FBSDID("$FreeBSD$"); #define SIN(s) ((struct sockaddr_in *)s) #define SDL(s) ((struct sockaddr_dl *)s) -#define LLTABLE(ifp) ((struct lltable *)(ifp)->if_afdata[AF_INET]) +#define LLTABLE(ifp) \ + ((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt SYSCTL_DECL(_net_link_ether); SYSCTL_NODE(_net_link_ether, PF_INET, inet, CTLFLAG_RW, 0, ""); Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Mon Mar 9 17:42:34 2009 (r189591) +++ head/sys/netinet/igmp.c Mon Mar 9 17:53:05 2009 (r189592) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2007-2009 Bruce Simpson. * Copyright (c) 1988 Stephen Deering. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -35,11 +36,13 @@ /* * Internet Group Management Protocol (IGMP) routines. + * [RFC1112, RFC2236, RFC3376] * * Written by Steve Deering, Stanford, May 1988. * Modified by Rosen Sharma, Stanford, Aug 1994. * Modified by Bill Fenner, Xerox PARC, Feb 1995. * Modified to fully comply to IGMPv2 by Bill Fenner, Oct 1995. + * Significantly rewritten for IGMPv3, VIMAGE, and SMP by Bruce Simpson. * * MULTICAST Revision: 3.5.1.4 */ @@ -52,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -59,8 +63,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include +#include #include #include @@ -78,464 +85,3608 @@ __FBSDID("$FreeBSD$"); #include -static MALLOC_DEFINE(M_IGMP, "igmp", "igmp state"); +#ifndef KTR_IGMPV3 +#define KTR_IGMPV3 KTR_SUBSYS +#endif + +static struct igmp_ifinfo * + igi_alloc_locked(struct ifnet *); +static void igi_delete_locked(const struct ifnet *); +static void igmp_dispatch_queue(struct ifqueue *, int, const int); +static void igmp_fasttimo_vnet(void); +static void igmp_final_leave(struct in_multi *, struct igmp_ifinfo *); +static int igmp_handle_state_change(struct in_multi *, + struct igmp_ifinfo *); +static int igmp_initial_join(struct in_multi *, struct igmp_ifinfo *); +static int igmp_input_v1_query(struct ifnet *, const struct ip *); +static int igmp_input_v2_query(struct ifnet *, const struct ip *, + const struct igmp *); +static int igmp_input_v3_query(struct ifnet *, const struct ip *, + /*const*/ struct igmpv3 *); +static int igmp_input_v3_group_query(struct in_multi *, + struct igmp_ifinfo *, int, /*const*/ struct igmpv3 *); +static int igmp_input_v1_report(struct ifnet *, /*const*/ struct ip *, + /*const*/ struct igmp *); +static int igmp_input_v2_report(struct ifnet *, /*const*/ struct ip *, + /*const*/ struct igmp *); +static void igmp_intr(struct mbuf *); +static int igmp_isgroupreported(const struct in_addr); +static struct mbuf * + igmp_ra_alloc(void); +#ifdef KTR +static char * igmp_rec_type_to_str(const int); +#endif +static void igmp_set_version(struct igmp_ifinfo *, const int); +static void igmp_slowtimo_vnet(void); +static void igmp_sysinit(void); +static int igmp_v1v2_queue_report(struct in_multi *, const int); +static void igmp_v1v2_process_group_timer(struct in_multi *, const int); +static void igmp_v1v2_process_querier_timers(struct igmp_ifinfo *); +static void igmp_v2_update_group(struct in_multi *, const int); +static void igmp_v3_cancel_link_timers(struct igmp_ifinfo *); +static void igmp_v3_dispatch_general_query(struct igmp_ifinfo *); +static struct mbuf * + igmp_v3_encap_report(struct ifnet *, struct mbuf *); +static int igmp_v3_enqueue_group_record(struct ifqueue *, + struct in_multi *, const int, const int, const int); +static int igmp_v3_enqueue_filter_change(struct ifqueue *, + struct in_multi *); +static void igmp_v3_process_group_timers(struct igmp_ifinfo *, + struct ifqueue *, struct ifqueue *, struct in_multi *, + const int); +static int igmp_v3_merge_state_changes(struct in_multi *, + struct ifqueue *); +static void igmp_v3_suppress_group_record(struct in_multi *); +static int sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS); +static int sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS); +static int sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS); + +#ifdef VIMAGE +static vnet_attach_fn vnet_igmp_iattach; +static vnet_detach_fn vnet_igmp_idetach; +#else +static int vnet_igmp_iattach(const void *); +static int vnet_igmp_idetach(const void *); +#endif /* VIMAGE */ + +/* + * System-wide globals. + * + * Unlocked access to these is OK, except for the global IGMP output + * queue. The IGMP subsystem lock ends up being system-wide for the moment, + * because all VIMAGEs have to share a global output queue, as netisrs + * themselves are not virtualized. + * + * Locking: + * * The permitted lock order is: IN_MULTI_LOCK, IGMP_LOCK, IF_ADDR_LOCK. + * Any may be taken independently; if any are held at the same + * time, the above lock order must be followed. + * * All output is delegated to the netisr to handle IFF_NEEDSGIANT. + * Most of the time, direct dispatch will be fine. + * * IN_MULTI_LOCK covers in_multi. + * * IGMP_LOCK covers igmp_ifinfo and any global variables in this file, + * including the output queue. + * * IF_ADDR_LOCK covers if_multiaddrs, which is used for a variety of + * per-link state iterators. + * * igmp_ifinfo is valid as long as PF_INET is attached to the interface, + * therefore it is not refcounted. + * We allow unlocked reads of igmp_ifinfo when accessed via in_multi. + * + * Reference counting + * * IGMP acquires its own reference every time an in_multi is passed to + * it and the group is being joined for the first time. + * * IGMP releases its reference(s) on in_multi in a deferred way, + * because the operations which process the release run as part of + * a loop whose control variables are directly affected by the release + * (that, and not recursing on the IF_ADDR_LOCK). + * + * VIMAGE: Each in_multi corresponds to an ifp, and each ifp corresponds + * to a vnet in ifp->if_vnet. + * + */ +struct mtx igmp_mtx; +int mpsafe_igmp = 0; +SYSCTL_INT(_debug, OID_AUTO, mpsafe_igmp, CTLFLAG_RDTUN, &mpsafe_igmp, 0, + "Enable SMP-safe IGMPv3"); + +struct mbuf *m_raopt; /* Router Alert option */ +MALLOC_DEFINE(M_IGMP, "igmp", "igmp state"); + +/* + * Global netisr output queue. + * This is only used as a last resort if we cannot directly dispatch. + * As IN_MULTI_LOCK is no longer in the bottom half of IP, we can do + * this, providing mpsafe_igmp is set. If it is not, we take Giant, + * and queueing is forced. + */ +struct ifqueue igmpoq; + +/* + * VIMAGE-wide globals. + * + * The IGMPv3 timers themselves need to run per-image, however, + * protosw timers run globally (see tcp). + * An ifnet can only be in one vimage at a time, and the loopback + * ifnet, loif, is itself virtualized. + * It would otherwise be possible to seriously hose IGMP state, + * and create inconsistencies in upstream multicast routing, if you have + * multiple VIMAGEs running on the same link joining different multicast + * groups, UNLESS the "primary IP address" is different. This is because + * IGMP for IPv4 does not force link-local addresses to be used for each + * node, unlike MLD for IPv6. + * Obviously the IGMPv3 per-interface state has per-vimage granularity + * also as a result. + * + * FUTURE: Stop using IFP_TO_IA/INADDR_ANY, and use source address selection + * policy to control the address used by IGMP on the link. + */ +#ifdef VIMAGE_GLOBALS +int interface_timers_running; /* IGMPv3 general query response */ +int state_change_timers_running; /* IGMPv3 state-change retransmit */ +int current_state_timers_running; /* IGMPv1/v2 host report; + * IGMPv3 g/sg query response */ + +LIST_HEAD(, igmp_ifinfo) igi_head; +struct igmpstat igmpstat; +struct timeval igmp_gsrdelay; + +int igmp_recvifkludge; +int igmp_sendra; +int igmp_sendlocal; +int igmp_v1enable; +int igmp_v2enable; +int igmp_legacysupp; +int igmp_default_version; +#endif /* VIMAGE_GLOBALS */ + +/* + * Virtualized sysctls. + */ +SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_igmp, IGMPCTL_STATS, stats, + CTLFLAG_RW, igmpstat, igmpstat, ""); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_igmp, OID_AUTO, recvifkludge, + CTLFLAG_RW, igmp_recvifkludge, 0, + "Rewrite IGMPv1/v2 reports from 0.0.0.0 to contain subnet address"); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_igmp, OID_AUTO, sendra, + CTLFLAG_RW, igmp_sendra, 0, + "Send IP Router Alert option in IGMPv2/v3 messages"); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_igmp, OID_AUTO, sendlocal, + CTLFLAG_RW, igmp_sendlocal, 0, + "Send IGMP membership reports for 224.0.0.0/24 groups"); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_igmp, OID_AUTO, v1enable, + CTLFLAG_RW, igmp_v1enable, 0, + "Enable backwards compatibility with IGMPv1"); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_igmp, OID_AUTO, v2enable, + CTLFLAG_RW, igmp_v2enable, 0, + "Enable backwards compatibility with IGMPv2"); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_igmp, OID_AUTO, legacysupp, + CTLFLAG_RW, igmp_legacysupp, 0, + "Allow v1/v2 reports to suppress v3 group responses"); +SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_igmp, OID_AUTO, default_version, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, igmp_default_version, 0, + sysctl_igmp_default_version, "I", + "Default version of IGMP to run on each interface"); +SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_igmp, OID_AUTO, gsrdelay, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, igmp_gsrdelay.tv_sec, 0, + sysctl_igmp_gsr, "I", + "Rate limit for IGMPv3 Group-and-Source queries in seconds"); + +/* + * Non-virtualized sysctls. + */ +SYSCTL_NODE(_net_inet_igmp, OID_AUTO, ifinfo, CTLFLAG_RD | CTLFLAG_MPSAFE, + sysctl_igmp_ifinfo, "Per-interface IGMPv3 state"); + +static __inline void +igmp_save_context(struct mbuf *m, struct ifnet *ifp) +{ + +#ifdef VIMAGE + m->m_pkthdr.header = ifp->if_vnet; +#endif /* VIMAGE */ + m->m_pkthdr.flowid = ifp->if_index; +} + +static __inline void +igmp_scrub_context(struct mbuf *m) +{ + + m->m_pkthdr.header = NULL; + m->m_pkthdr.flowid = 0; +} + +#ifdef KTR +static __inline char * +inet_ntoa_haddr(in_addr_t haddr) +{ + struct in_addr ia; + + ia.s_addr = htonl(haddr); + return (inet_ntoa(ia)); +} +#endif + +/* + * Restore context from a queued IGMP output chain. + * Return saved ifindex. + * + * VIMAGE: The assertion is there to make sure that we + * actually called CURVNET_SET() with what's in the mbuf chain. + */ +static __inline uint32_t +igmp_restore_context(struct mbuf *m) +{ + +#ifdef notyet +#if defined(VIMAGE) && defined(INVARIANTS) + KASSERT(curvnet == (m->m_pkthdr.header), + ("%s: called when curvnet was not restored", __func__)); +#endif +#endif + return (m->m_pkthdr.flowid); +} + +/* + * Retrieve or set default IGMP version. + * + * VIMAGE: Assume curvnet set by caller. + * SMPng: NOTE: Serialized by IGMP lock. + */ +static int +sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS) +{ + int error; + int new; + + error = sysctl_wire_old_buffer(req, sizeof(int)); + if (error) + return (error); + + IGMP_LOCK(); + + new = V_igmp_default_version; + + error = sysctl_handle_int(oidp, &new, 0, req); + if (error || !req->newptr) + goto out_locked; + + if (new < IGMP_VERSION_1 || new > IGMP_VERSION_3) { + error = EINVAL; + goto out_locked; + } + + CTR2(KTR_IGMPV3, "change igmp_default_version from %d to %d", + V_igmp_default_version, new); + + V_igmp_default_version = new; + +out_locked: + IGMP_UNLOCK(); + return (error); +} + +/* + * Retrieve or set threshold between group-source queries in seconds. + * + * VIMAGE: Assume curvnet set by caller. + * SMPng: NOTE: Serialized by IGMP lock. + */ +static int +sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS) +{ + int error; + int i; + + error = sysctl_wire_old_buffer(req, sizeof(int)); + if (error) + return (error); + + IGMP_LOCK(); + + i = V_igmp_gsrdelay.tv_sec; + + error = sysctl_handle_int(oidp, &i, 0, req); + if (error || !req->newptr) + goto out_locked; + + if (i < -1 || i >= 60) { + error = EINVAL; + goto out_locked; + } + + CTR2(KTR_IGMPV3, "change igmp_gsrdelay from %d to %d", + V_igmp_gsrdelay.tv_sec, i); + V_igmp_gsrdelay.tv_sec = i; + +out_locked: + IGMP_UNLOCK(); + return (error); +} + +/* + * Expose struct igmp_ifinfo to userland, keyed by ifindex. + * For use by ifmcstat(8). + * + * SMPng: NOTE: Does an unlocked ifindex space read. + * VIMAGE: Assume curvnet set by caller. The node handler itself + * is not directly virtualized. + */ +static int +sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS) +{ + INIT_VNET_NET(curvnet); + int *name; + int error; + u_int namelen; + struct ifnet *ifp; + struct igmp_ifinfo *igi; + + name = (int *)arg1; + namelen = arg2; + + if (req->newptr != NULL) + return (EPERM); + + if (namelen != 1) + return (EINVAL); + + error = sysctl_wire_old_buffer(req, sizeof(struct igmp_ifinfo)); + if (error) + return (error); + + IN_MULTI_LOCK(); + IGMP_LOCK(); + + if (name[0] <= 0 || name[0] > V_if_index) { + error = ENOENT; + goto out_locked; + } + + error = ENOENT; + + ifp = ifnet_byindex(name[0]); + if (ifp == NULL) + goto out_locked; + + LIST_FOREACH(igi, &V_igi_head, igi_link) { + if (ifp == igi->igi_ifp) { + error = SYSCTL_OUT(req, igi, + sizeof(struct igmp_ifinfo)); + break; + } + } + +out_locked: + IGMP_UNLOCK(); + IN_MULTI_UNLOCK(); + return (error); +} + +/* + * Dispatch an entire queue of pending packet chains + * using the netisr. + * VIMAGE: Assumes the vnet pointer has been set. + */ +static void +igmp_dispatch_queue(struct ifqueue *ifq, int limit, const int loop) +{ + struct mbuf *m; + + for (;;) { + _IF_DEQUEUE(ifq, m); + if (m == NULL) + break; + CTR3(KTR_IGMPV3, "%s: dispatch %p from %p", __func__, ifq, m); + if (loop) + m->m_flags |= M_IGMP_LOOP; + netisr_dispatch(NETISR_IGMP, m); + if (--limit == 0) + break; + } +} + +/* + * Filter outgoing IGMP report state by group. + * + * Reports are ALWAYS suppressed for ALL-HOSTS (224.0.0.1). + * If the net.inet.igmp.sendlocal sysctl is 0, then IGMP reports are + * disabled for all groups in the 224.0.0.0/24 link-local scope. However, + * this may break certain IGMP snooping switches which rely on the old + * report behaviour. + * + * Return zero if the given group is one for which IGMP reports + * should be suppressed, or non-zero if reports should be issued. + */ +static __inline int +igmp_isgroupreported(const struct in_addr addr) +{ + + if (in_allhosts(addr) || + ((!V_igmp_sendlocal && IN_LOCAL_GROUP(ntohl(addr.s_addr))))) + return (0); + + return (1); +} + +/* + * Construct a Router Alert option to use in outgoing packets. + */ +static struct mbuf * +igmp_ra_alloc(void) +{ + struct mbuf *m; + struct ipoption *p; + + MGET(m, M_DONTWAIT, MT_DATA); + p = mtod(m, struct ipoption *); + p->ipopt_dst.s_addr = INADDR_ANY; + p->ipopt_list[0] = IPOPT_RA; /* Router Alert Option */ + p->ipopt_list[1] = 0x04; /* 4 bytes long */ + p->ipopt_list[2] = IPOPT_EOL; /* End of IP option list */ + p->ipopt_list[3] = 0x00; /* pad byte */ + m->m_len = sizeof(p->ipopt_dst) + p->ipopt_list[1]; + + return (m); +} + +/* + * Attach IGMP when PF_INET is attached to an interface. + * + * VIMAGE: Currently we set the vnet pointer, although it is + * likely that it was already set by our caller. + */ +struct igmp_ifinfo * +igmp_domifattach(struct ifnet *ifp) +{ + struct igmp_ifinfo *igi; + + CTR3(KTR_IGMPV3, "%s: called for ifp %p(%s)", + __func__, ifp, ifp->if_xname); + + CURVNET_SET(ifp->if_vnet); + IGMP_LOCK(); + + igi = igi_alloc_locked(ifp); + if (!(ifp->if_flags & IFF_MULTICAST)) + igi->igi_flags |= IGIF_SILENT; + + IGMP_UNLOCK(); + CURVNET_RESTORE(); + + return (igi); +} + +/* + * VIMAGE: assume curvnet set by caller. + */ +static struct igmp_ifinfo * +igi_alloc_locked(/*const*/ struct ifnet *ifp) +{ + struct igmp_ifinfo *igi; + + IGMP_LOCK_ASSERT(); + + igi = malloc(sizeof(struct igmp_ifinfo), M_IGMP, M_NOWAIT|M_ZERO); + if (igi == NULL) + goto out; + + igi->igi_ifp = ifp; + igi->igi_version = V_igmp_default_version; + igi->igi_flags = 0; + igi->igi_rv = IGMP_RV_INIT; + igi->igi_qi = IGMP_QI_INIT; + igi->igi_qri = IGMP_QRI_INIT; + igi->igi_uri = IGMP_URI_INIT; + + SLIST_INIT(&igi->igi_relinmhead); + + /* + * Responses to general queries are subject to bounds. + */ + IFQ_SET_MAXLEN(&igi->igi_gq, IGMP_MAX_RESPONSE_PACKETS); + + LIST_INSERT_HEAD(&V_igi_head, igi, igi_link); + + CTR2(KTR_IGMPV3, "allocate igmp_ifinfo for ifp %p(%s)", + ifp, ifp->if_xname); + +out: + return (igi); +} + +/* + * Hook for ifdetach. + * + * NOTE: Some finalization tasks need to run before the protocol domain + * is detached, but also before the link layer does its cleanup. + * + * SMPNG: igmp_ifdetach() needs to take IF_ADDR_LOCK(). + * + * VIMAGE: curvnet should have been set by caller, but let's not assume + * that for now. + */ +void +igmp_ifdetach(struct ifnet *ifp) +{ + struct igmp_ifinfo *igi; + struct ifmultiaddr *ifma; + struct in_multi *inm, *tinm; + + CTR3(KTR_IGMPV3, "%s: called for ifp %p(%s)", __func__, ifp, + ifp->if_xname); + + CURVNET_SET(ifp->if_vnet); + + IGMP_LOCK(); + + igi = ((struct in_ifinfo *)ifp->if_afdata[AF_INET])->ii_igmp; + if (igi->igi_version == IGMP_VERSION_3) { + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_INET) + continue; + inm = (struct in_multi *)ifma->ifma_protospec; + if (inm->inm_state == IGMP_LEAVING_MEMBER) { + SLIST_INSERT_HEAD(&igi->igi_relinmhead, + inm, inm_nrele); + } + inm_clear_recorded(inm); + } + IF_ADDR_UNLOCK(ifp); + /* + * Free the in_multi reference(s) for this IGMP lifecycle. + */ + SLIST_FOREACH_SAFE(inm, &igi->igi_relinmhead, inm_nrele, + tinm) { + SLIST_REMOVE_HEAD(&igi->igi_relinmhead, inm_nrele); + inm_release_locked(inm); + } + } + + IGMP_UNLOCK(); + +#ifdef VIMAGE + /* + * Plug the potential race which may occur when a VIMAGE + * is detached and we are forced to queue pending IGMP output for + * output netisr processing due to !mpsafe_igmp. In this case it + * is possible that igmp_intr() is about to see mbuf chains with + * invalid cached curvnet pointers. + * This is a rare condition, so just blow them all away. + * FUTURE: This may in fact not be needed, because IFF_NEEDSGIANT + * is being removed in 8.x and the netisr may then be eliminated; + * it is needed only if VIMAGE and IFF_NEEDSGIANT need to co-exist + */ + if (!mpsafe_igmp) { + int drops; + + IF_LOCK(&igmpoq); + drops = igmpoq.ifq_len; + _IF_DRAIN(&igmpoq); + IF_UNLOCK(&igmpoq); + if (bootverbose && drops) { + printf("%s: dropped %d pending IGMP output packets\n", + __func__, drops); + } + } +#endif /* VIMAGE */ + + CURVNET_RESTORE(); +} + +/* + * Hook for domifdetach. + * + * VIMAGE: curvnet should have been set by caller, but let's not assume + * that for now. + */ +void +igmp_domifdetach(struct ifnet *ifp) +{ + struct igmp_ifinfo *igi; + + CTR3(KTR_IGMPV3, "%s: called for ifp %p(%s)", + __func__, ifp, ifp->if_xname); + + CURVNET_SET(ifp->if_vnet); + IGMP_LOCK(); + + igi = ((struct in_ifinfo *)ifp->if_afdata[AF_INET])->ii_igmp; + igi_delete_locked(ifp); + + IGMP_UNLOCK(); + CURVNET_RESTORE(); +} + +static void +igi_delete_locked(const struct ifnet *ifp) +{ + struct igmp_ifinfo *igi, *tigi; + + CTR3(KTR_IGMPV3, "%s: freeing igmp_ifinfo for ifp %p(%s)", + __func__, ifp, ifp->if_xname); + + IGMP_LOCK_ASSERT(); + + LIST_FOREACH_SAFE(igi, &V_igi_head, igi_link, tigi) { + if (igi->igi_ifp == ifp) { + /* + * Free deferred General Query responses. + */ + _IF_DRAIN(&igi->igi_gq); + + LIST_REMOVE(igi, igi_link); + + KASSERT(SLIST_EMPTY(&igi->igi_relinmhead), + ("%s: there are dangling in_multi references", + __func__)); + + free(igi, M_IGMP); + return; + } + } + +#ifdef INVARIANTS + panic("%s: igmp_ifinfo not found for ifp %p\n", __func__, ifp); +#endif +} + +/* + * Process a received IGMPv1 query. + * Return non-zero if the message should be dropped. + * + * VIMAGE: The curvnet pointer is derived from the input ifp. + */ +static int +igmp_input_v1_query(struct ifnet *ifp, const struct ip *ip) +{ + INIT_VNET_INET(ifp->if_vnet); + struct ifmultiaddr *ifma; + struct igmp_ifinfo *igi; + struct in_multi *inm; + + /* + * IGMPv1 General Queries SHOULD always addressed to 224.0.0.1. + * igmp_group is always ignored. Do not drop it as a userland + * daemon may wish to see it. + */ + if (!in_allhosts(ip->ip_dst)) { + ++V_igmpstat.igps_rcv_badqueries; + return (0); + } + + ++V_igmpstat.igps_rcv_gen_queries; + + /* + * Switch to IGMPv1 host compatibility mode. + */ + IN_MULTI_LOCK(); + IGMP_LOCK(); + + igi = ((struct in_ifinfo *)ifp->if_afdata[AF_INET])->ii_igmp; + KASSERT(igi != NULL, ("%s: no igmp_ifinfo for ifp %p", __func__, ifp)); + + if (igi->igi_flags & IGIF_LOOPBACK) { + CTR2(KTR_IGMPV3, "ignore v1 query on IGIF_LOOPBACK ifp %p(%s)", + ifp, ifp->if_xname); + goto out_locked; + } + + igmp_set_version(igi, IGMP_VERSION_1); + + CTR2(KTR_IGMPV3, "process v1 query on ifp %p(%s)", ifp, ifp->if_xname); + + /* + * Start the timers in all of our group records + * for the interface on which the query arrived, + * except those which are already running. + */ + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_INET) + continue; + inm = (struct in_multi *)ifma->ifma_protospec; + if (inm->inm_timer != 0) + continue; + switch (inm->inm_state) { + case IGMP_NOT_MEMBER: + case IGMP_SILENT_MEMBER: + break; + case IGMP_G_QUERY_PENDING_MEMBER: + case IGMP_SG_QUERY_PENDING_MEMBER: + case IGMP_REPORTING_MEMBER: + case IGMP_IDLE_MEMBER: + case IGMP_LAZY_MEMBER: + case IGMP_SLEEPING_MEMBER: + case IGMP_AWAKENING_MEMBER: + inm->inm_state = IGMP_REPORTING_MEMBER; + inm->inm_timer = IGMP_RANDOM_DELAY( + IGMP_V1V2_MAX_RI * PR_FASTHZ); + V_current_state_timers_running = 1; + break; + case IGMP_LEAVING_MEMBER: + break; + } + } + IF_ADDR_UNLOCK(ifp); + +out_locked: + IGMP_UNLOCK(); + IN_MULTI_UNLOCK(); + + return (0); +} + +/* + * Process a received IGMPv2 general or group-specific query. + */ +static int +igmp_input_v2_query(struct ifnet *ifp, const struct ip *ip, + const struct igmp *igmp) +{ + struct ifmultiaddr *ifma; + struct igmp_ifinfo *igi; + struct in_multi *inm; + uint16_t timer; + + /* + * Perform lazy allocation of IGMP link info if required, + * and switch to IGMPv2 host compatibility mode. + */ + IN_MULTI_LOCK(); + IGMP_LOCK(); + + igi = ((struct in_ifinfo *)ifp->if_afdata[AF_INET])->ii_igmp; + KASSERT(igi != NULL, ("%s: no igmp_ifinfo for ifp %p", __func__, ifp)); + + if (igi->igi_flags & IGIF_LOOPBACK) { + CTR2(KTR_IGMPV3, "ignore v2 query on IGIF_LOOPBACK ifp %p(%s)", + ifp, ifp->if_xname); + goto out_locked; + } + + igmp_set_version(igi, IGMP_VERSION_2); + + timer = igmp->igmp_code * PR_FASTHZ / IGMP_TIMER_SCALE; + if (timer == 0) + timer = 1; + + if (!in_nullhost(igmp->igmp_group)) { + /* + * IGMPv2 Group-Specific Query. + * If this is a group-specific IGMPv2 query, we need only + * look up the single group to process it. + */ + inm = inm_lookup(ifp, igmp->igmp_group); + if (inm != NULL) { + CTR3(KTR_IGMPV3, "process v2 query %s on ifp %p(%s)", + inet_ntoa(igmp->igmp_group), ifp, ifp->if_xname); + igmp_v2_update_group(inm, timer); + } + ++V_igmpstat.igps_rcv_group_queries; + } else { + /* + * IGMPv2 General Query. + * If this was not sent to the all-hosts group, ignore it. + */ + if (in_allhosts(ip->ip_dst)) { + /* + * For each reporting group joined on this + * interface, kick the report timer. + */ + CTR2(KTR_IGMPV3, + "process v2 general query on ifp %p(%s)", + ifp, ifp->if_xname); + + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_INET) + continue; + inm = (struct in_multi *)ifma->ifma_protospec; + igmp_v2_update_group(inm, timer); + } + IF_ADDR_UNLOCK(ifp); + } + ++V_igmpstat.igps_rcv_gen_queries; + } + +out_locked: + IGMP_UNLOCK(); + IN_MULTI_UNLOCK(); + + return (0); +} + +/* + * Update the report timer on a group in response to an IGMPv2 query. + * + * If we are becoming the reporting member for this group, start the timer. + * If we already are the reporting member for this group, and timer is + * below the threshold, reset it. + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 19:04:54 2009 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 8641E106566B; Mon, 9 Mar 2009 19:04:54 +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 74FD08FC15; Mon, 9 Mar 2009 19:04:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29J4sO7034942; Mon, 9 Mar 2009 19:04:54 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29J4svr034941; Mon, 9 Mar 2009 19:04:54 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903091904.n29J4svr034941@svn.freebsd.org> From: John Baldwin Date: Mon, 9 Mar 2009 19:04: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: r189593 - 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 Mar 2009 19:04:55 -0000 Author: jhb Date: Mon Mar 9 19:04:53 2009 New Revision: 189593 URL: http://svn.freebsd.org/changeset/base/189593 Log: Move the debug.hashstat sysctl tree under DIAGNOSTIC. I measured the debug.hashstat.rawnchash sysctl in particular as taking 7 milliseconds on a 3GHz Intel Xeon (4x2) running 7.1. It accounted for almost a quarter of the total runtime of 'sysctl -a'. It also performs lots of copyout's while holding the namecache lock (this does not attempt to fix that). MFC after: 2 weeks Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Mar 9 17:53:05 2009 (r189592) +++ head/sys/kern/vfs_cache.c Mon Mar 9 19:04:53 2009 (r189593) @@ -184,6 +184,7 @@ static MALLOC_DEFINE(M_VFSCACHE, "vfscac */ #define NCF_WHITE 1 +#ifdef DIAGNOSTIC /* * Grab an atomic snapshot of the name cache hash chain lengths */ @@ -268,6 +269,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND SYSCTL_PROC(_debug_hashstat, OID_AUTO, nchash, CTLTYPE_INT|CTLFLAG_RD| CTLFLAG_MPSAFE, 0, 0, sysctl_debug_hashstat_nchash, "I", "nchash chain lengths"); +#endif /* * cache_zap(): From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 19:22:46 2009 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 2DFA510656F7; Mon, 9 Mar 2009 19:22:46 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CF598FC17; Mon, 9 Mar 2009 19:22:46 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29JMjIv035307; Mon, 9 Mar 2009 19:22:45 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29JMjLR035306; Mon, 9 Mar 2009 19:22:45 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200903091922.n29JMjLR035306@svn.freebsd.org> From: Stanislav Sedov Date: Mon, 9 Mar 2009 19:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189594 - 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: Mon, 09 Mar 2009 19:22:46 -0000 Author: stas Date: Mon Mar 9 19:22:45 2009 New Revision: 189594 URL: http://svn.freebsd.org/changeset/base/189594 Log: - Point libusb users to the ports collection UPDATING file. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 9 19:04:53 2009 (r189593) +++ head/UPDATING Mon Mar 9 19:22:45 2009 (r189594) @@ -65,7 +65,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. libusb20.so.1 is now installed as libusb.so.1 and the ports system updated to use it. This requires a buildworld/installworld in order to update the library and dependencies (usbconfig, etc). Its advisable to - update your ports as the affected programs have had a revision bump. + rebuid all ports which uses libusb. More specific directions are given + in the ports collection UPDATING file. 20090302: A workaround is committed to allow the creation of System V shared From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 19:35:22 2009 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 102F01065673; Mon, 9 Mar 2009 19:35:22 +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 F16518FC15; Mon, 9 Mar 2009 19:35:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29JZLAU035583; Mon, 9 Mar 2009 19:35:21 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29JZL3d035574; Mon, 9 Mar 2009 19:35:21 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903091935.n29JZL3d035574@svn.freebsd.org> From: John Baldwin Date: Mon, 9 Mar 2009 19:35: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: r189595 - in head/sys: kern sys ufs/ffs 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: Mon, 09 Mar 2009 19:35:22 -0000 Author: jhb Date: Mon Mar 9 19:35:20 2009 New Revision: 189595 URL: http://svn.freebsd.org/changeset/base/189595 Log: Adjust some variables (mostly related to the buffer cache) that hold address space sizes to be longs instead of ints. Specifically, the follow values are now longs: runningbufspace, bufspace, maxbufspace, bufmallocspace, maxbufmallocspace, lobufspace, hibufspace, lorunningspace, hirunningspace, maxswzone, maxbcache, and maxpipekva. Previously, a relatively small number (~ 44000) of buffers set in kern.nbuf would result in integer overflows resulting either in hangs or bogus values of hidirtybuffers and lodirtybuffers. Now one has to overflow a long to see such problems. There was a check for a nbuf setting that would cause overflows in the auto-tuning of nbuf. I've changed it to always check and cap nbuf but warn if a user-supplied tunable would cause overflow. Note that this changes the ABI of several sysctls that are used by things like top(1), etc., so any MFC would probably require a some gross shims to allow for that. MFC after: 1 month Modified: head/sys/kern/subr_param.c head/sys/kern/sys_pipe.c head/sys/kern/vfs_bio.c head/sys/sys/buf.h head/sys/sys/pipe.h head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/vm/vm_init.c head/sys/vm/vnode_pager.c Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Mon Mar 9 19:22:45 2009 (r189594) +++ head/sys/kern/subr_param.c Mon Mar 9 19:35:20 2009 (r189595) @@ -89,9 +89,9 @@ int maxfilesperproc; /* per-proc open f int ncallout; /* maximum # of timer events */ int nbuf; int nswbuf; -int maxswzone; /* max swmeta KVA storage */ -int maxbcache; /* max buffer cache KVA storage */ -int maxpipekva; /* Limit on pipe KVA */ +long maxswzone; /* max swmeta KVA storage */ +long maxbcache; /* max buffer cache KVA storage */ +u_long maxpipekva; /* Limit on pipe KVA */ int vm_guest; /* Running as virtual machine guest? */ u_long maxtsiz; /* max text size */ u_long dfldsiz; /* initial data size limit */ @@ -203,11 +203,11 @@ init_param1(void) #ifdef VM_SWZONE_SIZE_MAX maxswzone = VM_SWZONE_SIZE_MAX; #endif - TUNABLE_INT_FETCH("kern.maxswzone", &maxswzone); + TUNABLE_LONG_FETCH("kern.maxswzone", &maxswzone); #ifdef VM_BCACHE_SIZE_MAX maxbcache = VM_BCACHE_SIZE_MAX; #endif - TUNABLE_INT_FETCH("kern.maxbcache", &maxbcache); + TUNABLE_LONG_FETCH("kern.maxbcache", &maxbcache); maxtsiz = MAXTSIZ; TUNABLE_ULONG_FETCH("kern.maxtsiz", &maxtsiz); @@ -282,7 +282,7 @@ init_param3(long kmempages) maxpipekva = (kmempages / 20) * PAGE_SIZE; if (maxpipekva < 512 * 1024) maxpipekva = 512 * 1024; - TUNABLE_INT_FETCH("kern.ipc.maxpipekva", &maxpipekva); + TUNABLE_ULONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); } /* Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Mon Mar 9 19:22:45 2009 (r189594) +++ head/sys/kern/sys_pipe.c Mon Mar 9 19:35:20 2009 (r189595) @@ -184,7 +184,7 @@ static int pipeallocfail; static int piperesizefail; static int piperesizeallowed = 1; -SYSCTL_INT(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN, +SYSCTL_ULONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN, &maxpipekva, 0, "Pipe KVA limit"); SYSCTL_INT(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD, &amountpipekva, 0, "Pipe KVA usage"); Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon Mar 9 19:22:45 2009 (r189594) +++ head/sys/kern/vfs_bio.c Mon Mar 9 19:35:20 2009 (r189595) @@ -112,26 +112,26 @@ static void bremfreel(struct buf *bp); int vmiodirenable = TRUE; SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, &vmiodirenable, 0, "Use the VM system for directory writes"); -int runningbufspace; -SYSCTL_INT(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0, +long runningbufspace; +SYSCTL_LONG(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0, "Amount of presently outstanding async buffer io"); -static int bufspace; -SYSCTL_INT(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0, +static long bufspace; +SYSCTL_LONG(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0, "KVA memory used for bufs"); -static int maxbufspace; -SYSCTL_INT(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, +static long maxbufspace; +SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, "Maximum allowed value of bufspace (including buf_daemon)"); -static int bufmallocspace; -SYSCTL_INT(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0, +static long bufmallocspace; +SYSCTL_LONG(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0, "Amount of malloced memory for buffers"); -static int maxbufmallocspace; -SYSCTL_INT(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, 0, +static long maxbufmallocspace; +SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, 0, "Maximum amount of malloced memory for buffers"); -static int lobufspace; -SYSCTL_INT(_vfs, OID_AUTO, lobufspace, CTLFLAG_RD, &lobufspace, 0, +static long lobufspace; +SYSCTL_LONG(_vfs, OID_AUTO, lobufspace, CTLFLAG_RD, &lobufspace, 0, "Minimum amount of buffers we want to have"); -int hibufspace; -SYSCTL_INT(_vfs, OID_AUTO, hibufspace, CTLFLAG_RD, &hibufspace, 0, +long hibufspace; +SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RD, &hibufspace, 0, "Maximum allowed value of bufspace (excluding buf_daemon)"); static int bufreusecnt; SYSCTL_INT(_vfs, OID_AUTO, bufreusecnt, CTLFLAG_RW, &bufreusecnt, 0, @@ -142,11 +142,11 @@ SYSCTL_INT(_vfs, OID_AUTO, buffreekvacnt static int bufdefragcnt; SYSCTL_INT(_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW, &bufdefragcnt, 0, "Number of times we have had to repeat buffer allocation to defragment"); -static int lorunningspace; -SYSCTL_INT(_vfs, OID_AUTO, lorunningspace, CTLFLAG_RW, &lorunningspace, 0, +static long lorunningspace; +SYSCTL_LONG(_vfs, OID_AUTO, lorunningspace, CTLFLAG_RW, &lorunningspace, 0, "Minimum preferred space used for in-progress I/O"); -static int hirunningspace; -SYSCTL_INT(_vfs, OID_AUTO, hirunningspace, CTLFLAG_RW, &hirunningspace, 0, +static long hirunningspace; +SYSCTL_LONG(_vfs, OID_AUTO, hirunningspace, CTLFLAG_RW, &hirunningspace, 0, "Maximum amount of space to use for in-progress I/O"); int dirtybufferflushes; SYSCTL_INT(_vfs, OID_AUTO, dirtybufferflushes, CTLFLAG_RW, &dirtybufferflushes, @@ -324,7 +324,7 @@ runningbufwakeup(struct buf *bp) { if (bp->b_runningbufspace) { - atomic_subtract_int(&runningbufspace, bp->b_runningbufspace); + atomic_subtract_long(&runningbufspace, bp->b_runningbufspace); bp->b_runningbufspace = 0; mtx_lock(&rbreqlock); if (runningbufreq && runningbufspace <= lorunningspace) { @@ -444,7 +444,8 @@ bd_speedup(void) caddr_t kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) { - int maxbuf; + int tuned_nbuf; + long maxbuf; /* * physmem_est is in pages. Convert it to kilobytes (assumes @@ -474,11 +475,17 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon if (maxbcache && nbuf > maxbcache / BKVASIZE) nbuf = maxbcache / BKVASIZE; + tuned_nbuf = 1; + } else + tuned_nbuf = 0; - /* XXX Avoid integer overflows later on with maxbufspace. */ - maxbuf = (INT_MAX / 3) / BKVASIZE; - if (nbuf > maxbuf) - nbuf = maxbuf; + /* XXX Avoid unsigned long overflows later on with maxbufspace. */ + maxbuf = (LONG_MAX / 3) / BKVASIZE; + if (nbuf > maxbuf) { + if (!tuned_nbuf) + printf("Warning: nbufs lowered from %d to %ld\n", nbuf, + maxbuf); + nbuf = maxbuf; } /* @@ -548,8 +555,8 @@ bufinit(void) * this may result in KVM fragmentation which is not handled optimally * by the system. */ - maxbufspace = nbuf * BKVASIZE; - hibufspace = imax(3 * maxbufspace / 4, maxbufspace - MAXBSIZE * 10); + maxbufspace = (long)nbuf * BKVASIZE; + hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - MAXBSIZE * 10); lobufspace = hibufspace - MAXBSIZE; lorunningspace = 512 * 1024; @@ -577,7 +584,7 @@ bufinit(void) * be met. We try to size hidirtybuffers to 3/4 our buffer space assuming * BKVASIZE'd (8K) buffers. */ - while (hidirtybuffers * BKVASIZE > 3 * hibufspace / 4) { + while ((long)hidirtybuffers * BKVASIZE > 3 * hibufspace / 4) { hidirtybuffers >>= 1; } lodirtybuffers = hidirtybuffers / 2; @@ -613,7 +620,7 @@ bfreekva(struct buf *bp) if (bp->b_kvasize) { atomic_add_int(&buffreekvacnt, 1); - atomic_subtract_int(&bufspace, bp->b_kvasize); + atomic_subtract_long(&bufspace, bp->b_kvasize); vm_map_remove(buffer_map, (vm_offset_t) bp->b_kvabase, (vm_offset_t) bp->b_kvabase + bp->b_kvasize); bp->b_kvasize = 0; @@ -837,7 +844,7 @@ bufwrite(struct buf *bp) * Normal bwrites pipeline writes */ bp->b_runningbufspace = bp->b_bufsize; - atomic_add_int(&runningbufspace, bp->b_runningbufspace); + atomic_add_long(&runningbufspace, bp->b_runningbufspace); if (!TD_IS_IDLETHREAD(curthread)) curthread->td_ru.ru_oublock++; @@ -1983,7 +1990,7 @@ restart: bp->b_kvabase = (caddr_t) addr; bp->b_kvasize = maxsize; - atomic_add_int(&bufspace, bp->b_kvasize); + atomic_add_long(&bufspace, bp->b_kvasize); atomic_add_int(&bufreusecnt, 1); } vm_map_unlock(buffer_map); @@ -2707,7 +2714,7 @@ allocbuf(struct buf *bp, int size) } else { free(bp->b_data, M_BIOBUF); if (bp->b_bufsize) { - atomic_subtract_int( + atomic_subtract_long( &bufmallocspace, bp->b_bufsize); bufspacewakeup(); @@ -2744,7 +2751,7 @@ allocbuf(struct buf *bp, int size) bp->b_bufsize = mbsize; bp->b_bcount = size; bp->b_flags |= B_MALLOC; - atomic_add_int(&bufmallocspace, mbsize); + atomic_add_long(&bufmallocspace, mbsize); return 1; } origbuf = NULL; @@ -2758,7 +2765,7 @@ allocbuf(struct buf *bp, int size) origbufsize = bp->b_bufsize; bp->b_data = bp->b_kvabase; if (bp->b_bufsize) { - atomic_subtract_int(&bufmallocspace, + atomic_subtract_long(&bufmallocspace, bp->b_bufsize); bufspacewakeup(); bp->b_bufsize = 0; Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Mon Mar 9 19:22:45 2009 (r189594) +++ head/sys/sys/buf.h Mon Mar 9 19:35:20 2009 (r189595) @@ -446,10 +446,10 @@ buf_countdeps(struct buf *bp, int i) #ifdef _KERNEL extern int nbuf; /* The number of buffer headers */ -extern int maxswzone; /* Max KVA for swap structures */ -extern int maxbcache; /* Max KVA for buffer cache */ -extern int runningbufspace; -extern int hibufspace; +extern long maxswzone; /* Max KVA for swap structures */ +extern long maxbcache; /* Max KVA for buffer cache */ +extern long runningbufspace; +extern long hibufspace; extern int dirtybufthresh; extern int bdwriteskip; extern int dirtybufferflushes; Modified: head/sys/sys/pipe.h ============================================================================== --- head/sys/sys/pipe.h Mon Mar 9 19:22:45 2009 (r189594) +++ head/sys/sys/pipe.h Mon Mar 9 19:35:20 2009 (r189595) @@ -56,7 +56,7 @@ /* * See sys_pipe.c for info on what these limits mean. */ -extern int maxpipekva; +extern u_long maxpipekva; /* * Pipe buffer information. Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Mon Mar 9 19:22:45 2009 (r189594) +++ head/sys/ufs/ffs/ffs_snapshot.c Mon Mar 9 19:35:20 2009 (r189595) @@ -2229,7 +2229,7 @@ ffs_copyonwrite(devvp, bp) VI_UNLOCK(devvp); if (saved_runningbufspace != 0) { bp->b_runningbufspace = saved_runningbufspace; - atomic_add_int(&runningbufspace, + atomic_add_long(&runningbufspace, bp->b_runningbufspace); } return (0); /* Snapshot gone */ @@ -2354,7 +2354,7 @@ ffs_copyonwrite(devvp, bp) */ if (saved_runningbufspace != 0) { bp->b_runningbufspace = saved_runningbufspace; - atomic_add_int(&runningbufspace, bp->b_runningbufspace); + atomic_add_long(&runningbufspace, bp->b_runningbufspace); } return (error); } Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Mon Mar 9 19:22:45 2009 (r189594) +++ head/sys/ufs/ffs/ffs_vfsops.c Mon Mar 9 19:35:20 2009 (r189595) @@ -1915,7 +1915,7 @@ ffs_geom_strategy(struct bufobj *bo, str } } bp->b_runningbufspace = bp->b_bufsize; - atomic_add_int(&runningbufspace, + atomic_add_long(&runningbufspace, bp->b_runningbufspace); } else { error = ffs_copyonwrite(vp, bp); Modified: head/sys/vm/vm_init.c ============================================================================== --- head/sys/vm/vm_init.c Mon Mar 9 19:22:45 2009 (r189594) +++ head/sys/vm/vm_init.c Mon Mar 9 19:35:20 2009 (r189595) @@ -186,12 +186,12 @@ again: panic("startup: table size inconsistency"); clean_map = kmem_suballoc(kernel_map, &kmi->clean_sva, &kmi->clean_eva, - nbuf * BKVASIZE + nswbuf * MAXPHYS, FALSE); + (long)nbuf * BKVASIZE + (long)nswbuf * MAXPHYS, FALSE); buffer_map = kmem_suballoc(clean_map, &kmi->buffer_sva, - &kmi->buffer_eva, nbuf * BKVASIZE, FALSE); + &kmi->buffer_eva, (long)nbuf * BKVASIZE, FALSE); buffer_map->system_map = 1; pager_map = kmem_suballoc(clean_map, &kmi->pager_sva, &kmi->pager_eva, - nswbuf * MAXPHYS, FALSE); + (long)nswbuf * MAXPHYS, FALSE); pager_map->system_map = 1; exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, exec_map_entries * (ARG_MAX + (PAGE_SIZE * 3)), FALSE); Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Mon Mar 9 19:22:45 2009 (r189594) +++ head/sys/vm/vnode_pager.c Mon Mar 9 19:35:20 2009 (r189595) @@ -525,7 +525,7 @@ vnode_pager_input_smlfs(object, m) bp->b_bcount = bsize; bp->b_bufsize = bsize; bp->b_runningbufspace = bp->b_bufsize; - atomic_add_int(&runningbufspace, bp->b_runningbufspace); + atomic_add_long(&runningbufspace, bp->b_runningbufspace); /* do the input */ bp->b_iooffset = dbtob(bp->b_blkno); @@ -905,7 +905,7 @@ vnode_pager_generic_getpages(vp, m, byte bp->b_bcount = size; bp->b_bufsize = size; bp->b_runningbufspace = bp->b_bufsize; - atomic_add_int(&runningbufspace, bp->b_runningbufspace); + atomic_add_long(&runningbufspace, bp->b_runningbufspace); PCPU_INC(cnt.v_vnodein); PCPU_ADD(cnt.v_vnodepgsin, count); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 19:43:39 2009 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 6CF03106568B; Mon, 9 Mar 2009 19:43:39 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id 340F38FC16; Mon, 9 Mar 2009 19:43:39 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.3/8.14.3) with ESMTP id n29JhcJ9048635; Mon, 9 Mar 2009 12:43:38 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.3/8.14.3/Submit) id n29Jhcpm048634; Mon, 9 Mar 2009 12:43:38 -0700 (PDT) (envelope-from sgk) Date: Mon, 9 Mar 2009 12:43:38 -0700 From: Steve Kargl To: Stanislav Sedov Message-ID: <20090309194338.GA48593@troutmask.apl.washington.edu> References: <200903091922.n29JMjLR035306@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200903091922.n29JMjLR035306@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: r189594 - 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: Mon, 09 Mar 2009 19:43:40 -0000 On Mon, Mar 09, 2009 at 07:22:45PM +0000, Stanislav Sedov wrote: > Author: stas > Date: Mon Mar 9 19:22:45 2009 > New Revision: 189594 > URL: http://svn.freebsd.org/changeset/base/189594 > > Log: > - Point libusb users to the ports collection UPDATING file. > > Modified: > head/UPDATING > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Mon Mar 9 19:04:53 2009 (r189593) > +++ head/UPDATING Mon Mar 9 19:22:45 2009 (r189594) > @@ -65,7 +65,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. > libusb20.so.1 is now installed as libusb.so.1 and the ports system > updated to use it. This requires a buildworld/installworld in order to > update the library and dependencies (usbconfig, etc). Its advisable to > - update your ports as the affected programs have had a revision bump. > + rebuid all ports which uses libusb. More specific directions are given > + in the ports collection UPDATING file. > 1) 'rebuid' should be 'rebuild' 2) There is no information in /usr/ports/UPDATING concerning the problems caused by USB2. -- Steve From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 19:46:20 2009 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 3EA561065688; Mon, 9 Mar 2009 19:46:20 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CA3C8FC2F; Mon, 9 Mar 2009 19:46:20 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29JkKNL035807; Mon, 9 Mar 2009 19:46:20 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29JkKjA035806; Mon, 9 Mar 2009 19:46:20 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200903091946.n29JkKjA035806@svn.freebsd.org> From: Ed Schouten Date: Mon, 9 Mar 2009 19:46: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: r189596 - head/sys/dev/syscons 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 Mar 2009 19:46:22 -0000 Author: ed Date: Mon Mar 9 19:46:19 2009 New Revision: 189596 URL: http://svn.freebsd.org/changeset/base/189596 Log: Don't call into the TTY layer when inside kdb. We should just leave the underlying TTY objects alone when scrolling around in KDB. It should be handled by Syscons exclusively. Reported by: pluknet gmail com Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Mon Mar 9 19:35:20 2009 (r189595) +++ head/sys/dev/syscons/syscons.c Mon Mar 9 19:46:19 2009 (r189596) @@ -3277,7 +3277,7 @@ next_code: sc_draw_cursor_image(scp); } tp = SC_DEV(sc, scp->index); - if (tty_opened(tp)) + if (!kdb_active && tty_opened(tp)) sctty_outwakeup(tp); #endif } From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 19:56:01 2009 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 B1AE01065686; Mon, 9 Mar 2009 19:56:01 +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 6FCC78FC24; Mon, 9 Mar 2009 19:56:01 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 0351E46BA4; Mon, 9 Mar 2009 15:56:00 -0400 (EDT) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n29JttVk019789; Mon, 9 Mar 2009 15:55:55 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: src-committers@freebsd.org Date: Mon, 9 Mar 2009 15:55:52 -0400 User-Agent: KMail/1.9.7 References: <200903091935.n29JZL3d035574@svn.freebsd.org> In-Reply-To: <200903091935.n29JZL3d035574@svn.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200903091555.53181.jhb@freebsd.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 09 Mar 2009 15:55:55 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9081/Mon Mar 9 13:51:30 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r189595 - in head/sys: kern sys ufs/ffs 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: Mon, 09 Mar 2009 19:56:03 -0000 On Monday 09 March 2009 3:35:20 pm John Baldwin wrote: > Author: jhb > Date: Mon Mar 9 19:35:20 2009 > New Revision: 189595 > URL: http://svn.freebsd.org/changeset/base/189595 > > Log: > Adjust some variables (mostly related to the buffer cache) that hold > address space sizes to be longs instead of ints. Specifically, the follow > values are now longs: runningbufspace, bufspace, maxbufspace, > bufmallocspace, maxbufmallocspace, lobufspace, hibufspace, lorunningspace, > hirunningspace, maxswzone, maxbcache, and maxpipekva. Previously, a > relatively small number (~ 44000) of buffers set in kern.nbuf would result > in integer overflows resulting either in hangs or bogus values of > hidirtybuffers and lodirtybuffers. Now one has to overflow a long to see > such problems. There was a check for a nbuf setting that would cause > overflows in the auto-tuning of nbuf. I've changed it to always check and > cap nbuf but warn if a user-supplied tunable would cause overflow. > > Note that this changes the ABI of several sysctls that are used by things > like top(1), etc., so any MFC would probably require a some gross shims > to allow for that. > > MFC after: 1 month I was able to boot with kern.nbuf=132000 with a buffer cache a little over 2GB with this change on amd64 (thanks to Alan's changes to bump the kernel_map to 6GB). It gave this layout for kernel_map: (kgdb) kvm fffffffe40000000 - fffffffe40012000 kmem_alloc() / contigmalloc() fffffffe40012000 - fffffffe4003c000 AP stacks fffffffe4003c000 - fffffffe400f5000 kmem_alloc_nofault() (kstack/mapdev) fffffffe400f5000 - fffffffe40200000 kmem_alloc() / contigmalloc() fffffffe40200000 - fffffffee5565000 kmem_map fffffffee5565000 - fffffffee56e20a0 callouts fffffffee56e20a0 - fffffffee57078a0 swbuf fffffffee57078a0 - fffffffeea290000 buf fffffffeea290000 - ffffffff6d110000 buffer_map + pager_map ffffffff6d110000 - ffffffff6d540000 exec_map ffffffff6d540000 - ffffffff7596b000 pipe_map ffffffff7596b000 - ffffffff7777d000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7777d000 - ffffffff7aab7000 kmem_alloc() / contigmalloc() ffffffff7aab7000 - ffffffff7aada000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7aada000 - ffffffff7b6da000 kmem_alloc() / contigmalloc() ffffffff7b6da000 - ffffffff7b6fd000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7b6fd000 - ffffffff7b883000 kmem_alloc() / contigmalloc() ffffffff7b883000 - ffffffff7b888000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7b888000 - ffffffff7ba0e000 kmem_alloc() / contigmalloc() ffffffff7ba0e000 - ffffffff7ba13000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7ba13000 - ffffffff7bb99000 kmem_alloc() / contigmalloc() ffffffff7bb99000 - ffffffff7bb9e000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7bb9e000 - ffffffff7bd24000 kmem_alloc() / contigmalloc() ffffffff7bd24000 - ffffffff7bd29000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7bd29000 - ffffffff7bf13000 kmem_alloc() / contigmalloc() ffffffff7bf13000 - ffffffff7bf22000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7bf22000 - ffffffff7bf2c000 kmem_alloc() / contigmalloc() ffffffff7bf2c000 - ffffffff7bf9d000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7bf9d000 - ffffffff7bfc5000 kmem_alloc() / contigmalloc() ffffffff7bfc5000 - ffffffff7c146000 kmem_alloc_nofault() (kstack/mapdev) ffffffff7c146000 - ffffffff80000000 ---- ffffffff80000000 - ffffffff80dd2c88 text/data/bss ffffffff80dd2c88 - ffffffff8639a000 bootstrap data ffffffff8639a000 - ffffffff86400000 ---- As far as an ABI fixup, I imagine that will involve having a hack where there is a new flag that sysctl_handle_long() checks and will truncate a value if the flag is set (CTLFLAG_INTABI or some such) and req->oldlen is sizeof(int) < sizeof(long) rather than failing. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 19:56:38 2009 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 3E2171065723; Mon, 9 Mar 2009 19:56:38 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C5CD8FC25; Mon, 9 Mar 2009 19:56:38 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29Jucq3036024; Mon, 9 Mar 2009 19:56:38 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29JucGa036023; Mon, 9 Mar 2009 19:56:38 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200903091956.n29JucGa036023@svn.freebsd.org> From: Stanislav Sedov Date: Mon, 9 Mar 2009 19:56:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189597 - 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: Mon, 09 Mar 2009 19:56:39 -0000 Author: stas Date: Mon Mar 9 19:56:37 2009 New Revision: 189597 URL: http://svn.freebsd.org/changeset/base/189597 Log: - Fix a typo. Spotted by: Steve Kargl Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 9 19:46:19 2009 (r189596) +++ head/UPDATING Mon Mar 9 19:56:37 2009 (r189597) @@ -65,7 +65,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. libusb20.so.1 is now installed as libusb.so.1 and the ports system updated to use it. This requires a buildworld/installworld in order to update the library and dependencies (usbconfig, etc). Its advisable to - rebuid all ports which uses libusb. More specific directions are given + rebuild all ports which uses libusb. More specific directions are given in the ports collection UPDATING file. 20090302: From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 19:58:11 2009 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 A5C721065722; Mon, 9 Mar 2009 19:58:11 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 41ED88FC15; Mon, 9 Mar 2009 19:58:11 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 7C29FFF68; Tue, 10 Mar 2009 08:58:10 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4weKfwWAHvY0; Tue, 10 Mar 2009 08:58:06 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Tue, 10 Mar 2009 08:58:06 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 241601142F; Tue, 10 Mar 2009 08:58:06 +1300 (NZDT) Date: Mon, 9 Mar 2009 12:58:06 -0700 From: Andrew Thompson To: Steve Kargl Message-ID: <20090309195805.GA53225@citylink.fud.org.nz> References: <200903091922.n29JMjLR035306@svn.freebsd.org> <20090309194338.GA48593@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090309194338.GA48593@troutmask.apl.washington.edu> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189594 - 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: Mon, 09 Mar 2009 19:58:12 -0000 On Mon, Mar 09, 2009 at 12:43:38PM -0700, Steve Kargl wrote: > On Mon, Mar 09, 2009 at 07:22:45PM +0000, Stanislav Sedov wrote: > > Author: stas > > Date: Mon Mar 9 19:22:45 2009 > > New Revision: 189594 > > URL: http://svn.freebsd.org/changeset/base/189594 > > > > Log: > > - Point libusb users to the ports collection UPDATING file. > > > > Modified: > > head/UPDATING > > > > Modified: head/UPDATING > > ============================================================================== > > --- head/UPDATING Mon Mar 9 19:04:53 2009 (r189593) > > +++ head/UPDATING Mon Mar 9 19:22:45 2009 (r189594) > > @@ -65,7 +65,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. > > libusb20.so.1 is now installed as libusb.so.1 and the ports system > > updated to use it. This requires a buildworld/installworld in order to > > update the library and dependencies (usbconfig, etc). Its advisable to > > - update your ports as the affected programs have had a revision bump. > > + rebuid all ports which uses libusb. More specific directions are given > > + in the ports collection UPDATING file. > > > > 1) 'rebuid' should be 'rebuild' > > 2) There is no information in /usr/ports/UPDATING concerning > the problems caused by USB2. Not sure if the problems you are referring to extend beyond your previous mail about it being rushed, if so please advise. While the merge hasnt been perfect it couldnt have really been done differently due to finite resources and I dont believe it was unreasonable for a change in HEAD. cheers, Andrew From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 20:05:47 2009 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 57AC21065676; Mon, 9 Mar 2009 20:05:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44DFF8FC0C; Mon, 9 Mar 2009 20:05:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29K5lQU036223; Mon, 9 Mar 2009 20:05:47 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29K5lmK036222; Mon, 9 Mar 2009 20:05:47 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903092005.n29K5lmK036222@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Mar 2009 20:05: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: r189598 - 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: Mon, 09 Mar 2009 20:05:48 -0000 Author: thompsa Date: Mon Mar 9 20:05:46 2009 New Revision: 189598 URL: http://svn.freebsd.org/changeset/base/189598 Log: Fix musb_otg.h include filename. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/musb_otg_atmelarm.c Modified: head/sys/dev/usb/controller/musb_otg_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Mar 9 19:56:37 2009 (r189597) +++ head/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Mar 9 20:05:46 2009 (r189598) @@ -36,7 +36,7 @@ #include #include -#include +#include #include From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 20:06:38 2009 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 20C121065696 for ; Mon, 9 Mar 2009 20:06:38 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id AAF848FC21 for ; Mon, 9 Mar 2009 20:06:27 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id 7B1208FC51 for ; Mon, 9 Mar 2009 22:55:26 +0300 (MSK) Received: from orion.SpringDaemons.com (drsun1.static.corbina.ru [85.21.245.235]) by mx0.deglitch.com (Postfix) with ESMTPA id BFB6A8FC1D; Mon, 9 Mar 2009 22:55:23 +0300 (MSK) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 716D139B2B; Mon, 9 Mar 2009 22:55:48 +0300 (MSK) Date: Mon, 9 Mar 2009 22:55:42 +0300 From: Stanislav Sedov To: Steve Kargl Message-Id: <20090309225542.b5d717c3.stas@FreeBSD.org> In-Reply-To: <20090309194338.GA48593@troutmask.apl.washington.edu> References: <200903091922.n29JMjLR035306@svn.freebsd.org> <20090309194338.GA48593@troutmask.apl.washington.edu> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Mon Mar 9 22:55:26 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 49b5742e967002262191136 Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189594 - 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: Mon, 09 Mar 2009 20:06:39 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, 9 Mar 2009 12:43:38 -0700 Steve Kargl mentioned: > On Mon, Mar 09, 2009 at 07:22:45PM +0000, Stanislav Sedov wrote: > > Author: stas > > Date: Mon Mar 9 19:22:45 2009 > > New Revision: 189594 > > URL: http://svn.freebsd.org/changeset/base/189594 > > > > Log: > > - Point libusb users to the ports collection UPDATING file. > > > > Modified: > > head/UPDATING > > > > Modified: head/UPDATING > > ============================================================================== > > --- head/UPDATING Mon Mar 9 19:04:53 2009 (r189593) > > +++ head/UPDATING Mon Mar 9 19:22:45 2009 (r189594) > > @@ -65,7 +65,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. > > libusb20.so.1 is now installed as libusb.so.1 and the ports system > > updated to use it. This requires a buildworld/installworld in order to > > update the library and dependencies (usbconfig, etc). Its advisable to > > - update your ports as the affected programs have had a revision bump. > > + rebuid all ports which uses libusb. More specific directions are given > > + in the ports collection UPDATING file. > > > > 1) 'rebuid' should be 'rebuild' > Thanks for noticing! > 2) There is no information in /usr/ports/UPDATING concerning > the problems caused by USB2. > I've added it there before this commit. - -- Stanislav Sedov ST4096-RIPE -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAkm1dEQACgkQK/VZk+smlYFyKQCcD39i+zLlmYtjWCDXc1VJXWIp DIEAnj20vOsNUPE7uwglavbXGXToXa4a =qp0g -----END PGP SIGNATURE----- !DSPAM:49b5742e967002262191136! From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 20:08:09 2009 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 1AFAE106564A; Mon, 9 Mar 2009 20:08:09 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08B548FC0A; Mon, 9 Mar 2009 20:08:09 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29K88Cx036298; Mon, 9 Mar 2009 20:08:08 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29K88Ys036295; Mon, 9 Mar 2009 20:08:08 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903092008.n29K88Ys036295@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Mar 2009 20:08: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: r189599 - 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: Mon, 09 Mar 2009 20:08:09 -0000 Author: thompsa Date: Mon Mar 9 20:08:08 2009 New Revision: 189599 URL: http://svn.freebsd.org/changeset/base/189599 Log: MFp4 //depot/projects/usb 158942,158948 Allow USB to be compiled without ugen support. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/usb_core.h ============================================================================== --- head/sys/dev/usb/usb_core.h Mon Mar 9 20:05:46 2009 (r189598) +++ head/sys/dev/usb/usb_core.h Mon Mar 9 20:08:08 2009 (r189599) @@ -38,6 +38,10 @@ #define USB_USE_CONDVAR 0 #endif +#ifndef USB_HAVE_UGEN +#define USB_HAVE_UGEN 1 +#endif + #ifndef USB_TD_GET_PROC #define USB_TD_GET_PROC(td) (td)->td_proc #endif @@ -46,24 +50,6 @@ #define USB_PROC_GET_GID(td) (td)->p_pgid #endif -#ifndef USB_VNOPS_FO_CLOSE -#define USB_VNOPS_FO_CLOSE(fp, td, perr) do { \ - (td)->td_fpop = (fp); \ - *(perr) = vnops.fo_close(fp, td); \ - (td)->td_fpop = NULL; \ -} while (0) -#endif - -#ifndef USB_VNOPS_FO_STAT -#define USB_VNOPS_FO_STAT(fp, sb, cred, td) \ - vnops.fo_stat(fp, sb, cred, td) -#endif - -#ifndef USB_VNOPS_FO_TRUNCATE -#define USB_VNOPS_FO_TRUNCATE(fp, length, cred, td) \ - vnops.fo_truncate(fp, length, cred, td) -#endif - /* Include files */ #include Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Mon Mar 9 20:05:46 2009 (r189598) +++ head/sys/dev/usb/usb_device.c Mon Mar 9 20:08:08 2009 (r189599) @@ -73,11 +73,14 @@ static void usb2_check_strings(struct us static usb2_error_t usb2_fill_iface_data(struct usb2_device *, uint8_t, uint8_t); static void usb2_notify_addq(const char *type, struct usb2_device *); + +#if USB_HAVE_UGEN static void usb2_fifo_free_wrap(struct usb2_device *, uint8_t, uint8_t); static struct cdev *usb2_make_dev(struct usb2_device *, int, int); static void usb2_cdev_create(struct usb2_device *); static void usb2_cdev_free(struct usb2_device *); static void usb2_cdev_cleanup(void *); +#endif /* This variable is global to allow easy access to it: */ @@ -543,11 +546,13 @@ usb2_set_config_index(struct usb2_device /* detach all interface drivers */ usb2_detach_device(udev, USB_IFACE_INDEX_ANY, 1); +#if USB_HAVE_UGEN /* free all FIFOs except control endpoint FIFOs */ usb2_fifo_free_wrap(udev, USB_IFACE_INDEX_ANY, 0); /* free all configuration data structures */ usb2_cdev_free(udev); +#endif usb2_free_iface_data(udev); if (index == USB_UNCONFIG_INDEX) { @@ -657,13 +662,17 @@ usb2_set_config_index(struct usb2_device goto done; } } +#if USB_HAVE_UGEN /* create device nodes for each endpoint */ usb2_cdev_create(udev); +#endif done: DPRINTF("error=%s\n", usb2_errstr(err)); if (err) { +#if USB_HAVE_UGEN usb2_cdev_free(udev); +#endif usb2_free_iface_data(udev); } if (do_unlock) { @@ -717,11 +726,13 @@ usb2_set_alt_interface_index(struct usb2 goto done; } } +#if USB_HAVE_UGEN /* * Free all generic FIFOs for this interface, except control * endpoint FIFOs: */ usb2_fifo_free_wrap(udev, iface_index, 0); +#endif err = usb2_fill_iface_data(udev, iface_index, alt_index); if (err) { @@ -1433,13 +1444,17 @@ usb2_alloc_device(device_t parent_dev, s /* set device index */ udev->device_index = device_index; - /* Create the control endpoint device */ - udev->default_dev = usb2_make_dev(udev, 0, FREAD|FWRITE); - /* Create a link from /dev/ugenX.X to the default endpoint */ + /* Create ugen name */ snprintf(udev->ugen_name, sizeof(udev->ugen_name), USB_GENERIC_NAME "%u.%u", device_get_unit(bus->bdev), device_index); +#if USB_HAVE_UGEN + /* Create the control endpoint device */ + udev->default_dev = usb2_make_dev(udev, 0, FREAD|FWRITE); + + /* Create a link from /dev/ugenX.X to the default endpoint */ make_dev_alias(udev->default_dev, udev->ugen_name); +#endif if (udev->flags.usb2_mode == USB_MODE_HOST) { @@ -1692,7 +1707,9 @@ repeat_set_config: parent_hub->hub->ports + port_index : NULL, udev, device_index); /* Link and announce the ugen device name */ +#if USB_HAVE_UGEN udev->ugen_symlink = usb2_alloc_symlink(udev->ugen_name); +#endif printf("%s: <%s> at %s\n", udev->ugen_name, udev->manufacturer, device_get_nameunit(udev->bus->bdev)); @@ -1706,6 +1723,7 @@ done: return (udev); } +#if USB_HAVE_UGEN static struct cdev * usb2_make_dev(struct usb2_device *udev, int ep, int mode) { @@ -1812,6 +1830,7 @@ usb2_cdev_cleanup(void* arg) { free(arg, M_USBDEV); } +#endif /*------------------------------------------------------------------------* * usb2_free_device @@ -1832,7 +1851,9 @@ usb2_free_device(struct usb2_device *ude /* Destroy UGEN symlink, if any */ if (udev->ugen_symlink) { +#if USB_HAVE_UGEN usb2_free_symlink(udev->ugen_symlink); +#endif udev->ugen_symlink = NULL; } /* @@ -1843,6 +1864,7 @@ usb2_free_device(struct usb2_device *ude udev->parent_hub->hub->ports + udev->port_index : NULL, NULL, USB_ROOT_HUB_ADDR); +#if USB_HAVE_UGEN /* wait for all pending references to go away: */ mtx_lock(&usb2_ref_lock); @@ -1851,11 +1873,13 @@ usb2_free_device(struct usb2_device *ude usb2_cv_wait(udev->default_cv + 1, &usb2_ref_lock); } mtx_unlock(&usb2_ref_lock); +#endif if (udev->flags.usb2_mode == USB_MODE_DEVICE) { /* stop receiving any control transfers (Device Side Mode) */ usb2_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX); } +#if USB_HAVE_UGEN /* free all FIFOs */ usb2_fifo_free_wrap(udev, USB_IFACE_INDEX_ANY, 1); @@ -1863,9 +1887,12 @@ usb2_free_device(struct usb2_device *ude * Free all interface related data and FIFOs, if any. */ usb2_cdev_free(udev); +#endif usb2_free_iface_data(udev); +#if USB_HAVE_UGEN destroy_dev_sched_cb(udev->default_dev, usb2_cdev_cleanup, udev->default_dev->si_drv1); +#endif /* unsetup any leftover default USB transfers */ usb2_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX); @@ -2263,6 +2290,7 @@ usb2_notify_addq(const char *type, struc devctl_queue_data(data); } +#if USB_HAVE_UGEN /*------------------------------------------------------------------------* * usb2_fifo_free_wrap * @@ -2319,6 +2347,7 @@ usb2_fifo_free_wrap(struct usb2_device * usb2_fifo_free(f); } } +#endif /*------------------------------------------------------------------------* * usb2_peer_can_wakeup Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Mon Mar 9 20:05:46 2009 (r189598) +++ head/sys/dev/usb/usb_hub.c Mon Mar 9 20:08:08 2009 (r189599) @@ -1324,9 +1324,13 @@ usb2_bus_port_set_device(struct usb2_bus * Make relationships to our new device */ if (device_index != 0) { +#if USB_HAVE_UGEN mtx_lock(&usb2_ref_lock); +#endif bus->devices[device_index] = udev; +#if USB_HAVE_UGEN mtx_unlock(&usb2_ref_lock); +#endif } /* * Debug print From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 20:48:57 2009 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 9CFEA1065900; Mon, 9 Mar 2009 20:48:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89ADD8FC22; Mon, 9 Mar 2009 20:48:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29Kmvom037051; Mon, 9 Mar 2009 20:48:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29KmvWf037048; Mon, 9 Mar 2009 20:48:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200903092048.n29KmvWf037048@svn.freebsd.org> From: Alexander Motin Date: Mon, 9 Mar 2009 20:48: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: r189600 - head/sys/dev/ata 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 Mar 2009 20:49:01 -0000 Author: mav Date: Mon Mar 9 20:48:57 2009 New Revision: 189600 URL: http://svn.freebsd.org/changeset/base/189600 Log: Add type specific suspend/resume ata channel functions. Add checks to avoid crash on detached channel resume. Add placeholder for possible type-specific suspend/resume routines. Modified: head/sys/dev/ata/ata-cbus.c head/sys/dev/ata/ata-isa.c head/sys/dev/ata/ata-pci.c Modified: head/sys/dev/ata/ata-cbus.c ============================================================================== --- head/sys/dev/ata/ata-cbus.c Mon Mar 9 20:08:08 2009 (r189599) +++ head/sys/dev/ata/ata-cbus.c Mon Mar 9 20:48:57 2009 (r189600) @@ -314,6 +314,28 @@ ata_cbuschannel_detach(device_t dev) } static int +ata_cbuschannel_suspend(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (!ch->attached) + return (0); + + return ata_suspend(dev); +} + +static int +ata_cbuschannel_resume(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (!ch->attached) + return (0); + + return ata_resume(dev); +} + +static int ata_cbuschannel_banking(device_t dev, int flags) { struct ata_cbus_controller *ctlr = device_get_softc(device_get_parent(dev)); @@ -360,8 +382,8 @@ static device_method_t ata_cbuschannel_m DEVMETHOD(device_probe, ata_cbuschannel_probe), DEVMETHOD(device_attach, ata_cbuschannel_attach), DEVMETHOD(device_detach, ata_cbuschannel_detach), - DEVMETHOD(device_suspend, ata_suspend), - DEVMETHOD(device_resume, ata_resume), + DEVMETHOD(device_suspend, ata_cbuschannel_suspend), + DEVMETHOD(device_resume, ata_cbuschannel_resume), /* ATA methods */ DEVMETHOD(ata_locking, ata_cbuschannel_banking), Modified: head/sys/dev/ata/ata-isa.c ============================================================================== --- head/sys/dev/ata/ata-isa.c Mon Mar 9 20:08:08 2009 (r189599) +++ head/sys/dev/ata/ata-isa.c Mon Mar 9 20:48:57 2009 (r189600) @@ -163,13 +163,36 @@ ata_isa_detach(device_t dev) return (error); } +static int +ata_isa_suspend(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (!ch->attached) + return (0); + + return ata_suspend(dev); +} + +static int +ata_isa_resume(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (!ch->attached) + return (0); + + return ata_resume(dev); +} + + static device_method_t ata_isa_methods[] = { /* device interface */ DEVMETHOD(device_probe, ata_isa_probe), DEVMETHOD(device_attach, ata_isa_attach), DEVMETHOD(device_detach, ata_isa_detach), - DEVMETHOD(device_suspend, ata_suspend), - DEVMETHOD(device_resume, ata_resume), + DEVMETHOD(device_suspend, ata_isa_suspend), + DEVMETHOD(device_resume, ata_isa_resume), { 0, 0 } }; Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Mon Mar 9 20:08:08 2009 (r189599) +++ head/sys/dev/ata/ata-pci.c Mon Mar 9 20:48:57 2009 (r189600) @@ -581,6 +581,28 @@ ata_pcichannel_detach(device_t dev) return (0); } +static int +ata_pcichannel_suspend(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (!ch->attached) + return (0); + + return ata_suspend(dev); +} + +static int +ata_pcichannel_resume(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (!ch->attached) + return (0); + + return ata_resume(dev); +} + static int ata_pcichannel_locking(device_t dev, int mode) @@ -629,8 +651,8 @@ static device_method_t ata_pcichannel_me DEVMETHOD(device_attach, ata_pcichannel_attach), DEVMETHOD(device_detach, ata_pcichannel_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, ata_suspend), - DEVMETHOD(device_resume, ata_resume), + DEVMETHOD(device_suspend, ata_pcichannel_suspend), + DEVMETHOD(device_resume, ata_pcichannel_resume), /* ATA methods */ DEVMETHOD(ata_setmode, ata_pcichannel_setmode), From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 22:27:06 2009 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 200861065751; Mon, 9 Mar 2009 22:27:06 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id D33AE8FC21; Mon, 9 Mar 2009 22:27:05 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.3/8.14.3) with ESMTP id n29MR5fW050037; Mon, 9 Mar 2009 15:27:05 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.3/8.14.3/Submit) id n29MR5K2050036; Mon, 9 Mar 2009 15:27:05 -0700 (PDT) (envelope-from sgk) Date: Mon, 9 Mar 2009 15:27:05 -0700 From: Steve Kargl To: Andrew Thompson Message-ID: <20090309222705.GA49870@troutmask.apl.washington.edu> References: <200903091922.n29JMjLR035306@svn.freebsd.org> <20090309194338.GA48593@troutmask.apl.washington.edu> <20090309195805.GA53225@citylink.fud.org.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090309195805.GA53225@citylink.fud.org.nz> User-Agent: Mutt/1.4.2.3i Cc: Stanislav Sedov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189594 - 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: Mon, 09 Mar 2009 22:27:09 -0000 On Mon, Mar 09, 2009 at 12:58:06PM -0700, Andrew Thompson wrote: > Not sure if the problems you are referring to extend beyond your > previous mail about it being rushed, if so please advise. > > While the merge hasnt been perfect it couldnt have really been done > differently due to finite resources and I dont believe it was > unreasonable for a change in HEAD. > I have no problems with a transition for old USB to USB2 in HEAD. The manner of execution of the transition leaves much to desire. Don't the 20090215 and 20090216 entries in src/UPDATING send up a red flag that perhaps the people rushing USB2 into the tree might want to ask portmngr to build the port collection on pointyhat to gauge the damager? When Mark Linimon, a member of portmngr, posts on Feb 26th (http://lists.freebsd.org/pipermail/freebsd-ports/2009-February/053282.html There appears to be a disconnect with USB2 development and the rest of FreeBSD. Don't the 20090223, 20090227, and 20090309 entries suggest to you that USB2 is going to get very limited testing by the actual user community? Asking users to rebuild world/kernel 2 or 3 times in a span of 20 days, and all the ports that use USB (with the hope that the ports actuall build) seems destiny to limit testing. After a complete build{world,kernel}/install{world,kernel} dance, including a 'make delete-old-libs' and a reboot. REMOVE:root[214] ll /usr/lib/libusb* -r--r--r-- 1 root wheel - 32136 Mar 9 14:33 /usr/lib/libusb.so.1 -r--r--r-- 1 root wheel - 37580 Mar 5 05:01 /usr/lib/libusb20.a lrwxr-xr-x 1 root wheel - 13 Mar 5 05:01 /usr/lib/libusb20.so@ -> libusb20.so.1 -r--r--r-- 1 root wheel - 39960 Mar 5 05:01 /usr/lib/libusb20_p.a -r--r--r-- 1 root wheel - 11874 Mar 9 14:33 /usr/lib/libusbhid.a lrwxr-xr-x 1 root wheel - 14 Mar 9 14:33 /usr/lib/libusbhid.so@ -> libusbhid.so.3 -r--r--r-- 1 root wheel - 11284 Mar 9 14:33 /usr/lib/libusbhid.so.3 -r--r--r-- 1 root wheel - 12240 Mar 9 14:33 /usr/lib/libusbhid_p.a It seems that libusb20 lives. -- Steve From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 22:42:01 2009 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 B6CE31065670; Mon, 9 Mar 2009 22:42:01 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4EF28FC1A; Mon, 9 Mar 2009 22:42:01 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29Mg1xV039352; Mon, 9 Mar 2009 22:42:01 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29Mg1Lg039351; Mon, 9 Mar 2009 22:42:01 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903092242.n29Mg1Lg039351@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Mar 2009 22:42: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: r189601 - 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: Mon, 09 Mar 2009 22:42:02 -0000 Author: thompsa Date: Mon Mar 9 22:42:01 2009 New Revision: 189601 URL: http://svn.freebsd.org/changeset/base/189601 Log: Update 20090309 to say that libmap.conf entries for libusb are no longer needed. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 9 20:48:57 2009 (r189600) +++ head/UPDATING Mon Mar 9 22:42:01 2009 (r189601) @@ -66,7 +66,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. updated to use it. This requires a buildworld/installworld in order to update the library and dependencies (usbconfig, etc). Its advisable to rebuild all ports which uses libusb. More specific directions are given - in the ports collection UPDATING file. + in the ports collection UPDATING file. Any /etc/libmap.conf entries for + libsub are no longer required and can be removed. 20090302: A workaround is committed to allow the creation of System V shared From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 22:43:01 2009 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 2883B1065726; Mon, 9 Mar 2009 22:43:01 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1669F8FC27; Mon, 9 Mar 2009 22:43:01 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29Mh0I0039404; Mon, 9 Mar 2009 22:43:00 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29Mh0cf039403; Mon, 9 Mar 2009 22:43:00 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903092243.n29Mh0cf039403@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Mar 2009 22:43: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: r189602 - 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: Mon, 09 Mar 2009 22:43:02 -0000 Author: thompsa Date: Mon Mar 9 22:43:00 2009 New Revision: 189602 URL: http://svn.freebsd.org/changeset/base/189602 Log: Fix spelling. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 9 22:42:01 2009 (r189601) +++ head/UPDATING Mon Mar 9 22:43:00 2009 (r189602) @@ -67,7 +67,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. update the library and dependencies (usbconfig, etc). Its advisable to rebuild all ports which uses libusb. More specific directions are given in the ports collection UPDATING file. Any /etc/libmap.conf entries for - libsub are no longer required and can be removed. + libusb are no longer required and can be removed. 20090302: A workaround is committed to allow the creation of System V shared From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 22:54:18 2009 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 26EB1106564A; Mon, 9 Mar 2009 22:54:18 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1509D8FC0A; Mon, 9 Mar 2009 22:54:18 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29MsHku039628; Mon, 9 Mar 2009 22:54:17 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29MsHpb039627; Mon, 9 Mar 2009 22:54:17 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903092254.n29MsHpb039627@svn.freebsd.org> From: Bruce M Simpson Date: Mon, 9 Mar 2009 22:54: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: r189603 - 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: Mon, 09 Mar 2009 22:54:18 -0000 Author: bms Date: Mon Mar 9 22:54:17 2009 New Revision: 189603 URL: http://svn.freebsd.org/changeset/base/189603 Log: Fix uninitialized use of ifp for ii. Found by: Peter Holm Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Mon Mar 9 22:43:00 2009 (r189602) +++ head/sys/netinet/in.c Mon Mar 9 22:54:17 2009 (r189603) @@ -223,7 +223,6 @@ in_control(struct socket *so, u_long cmd int iaIsFirst; ia = NULL; - ii = ((struct in_ifinfo *)ifp->if_afdata[AF_INET]); iaIsFirst = 0; iaIsNew = 0; allhosts_addr.s_addr = htonl(INADDR_ALLHOSTS_GROUP); @@ -428,6 +427,7 @@ in_control(struct socket *so, u_long cmd if (error != 0 && iaIsNew) break; if (error == 0) { + ii = ((struct in_ifinfo *)ifp->if_afdata[AF_INET]); if (iaIsFirst && (ifp->if_flags & IFF_MULTICAST) != 0) { error = in_joingroup(ifp, &allhosts_addr, @@ -478,6 +478,7 @@ in_control(struct socket *so, u_long cmd (ifra->ifra_broadaddr.sin_family == AF_INET)) ia->ia_broadaddr = ifra->ifra_broadaddr; if (error == 0) { + ii = ((struct in_ifinfo *)ifp->if_afdata[AF_INET]); if (iaIsFirst && (ifp->if_flags & IFF_MULTICAST) != 0) { error = in_joingroup(ifp, &allhosts_addr, @@ -529,6 +530,7 @@ in_control(struct socket *so, u_long cmd oia = NULL; IFP_TO_IA(ifp, oia); if (oia == NULL) { + ii = ((struct in_ifinfo *)ifp->if_afdata[AF_INET]); IFF_LOCKGIANT(ifp); IN_MULTI_LOCK(); if (ii->ii_allhosts) { From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 22:59:09 2009 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 8A6811065672 for ; Mon, 9 Mar 2009 22:59:09 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 388B38FC1D for ; Mon, 9 Mar 2009 22:59:09 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id 0B2128FC67 for ; Tue, 10 Mar 2009 01:59:07 +0300 (MSK) Received: from orion.SpringDaemons.com (drsun1.static.corbina.ru [85.21.245.235]) by mx0.deglitch.com (Postfix) with ESMTPA id 6741F8FC60; Tue, 10 Mar 2009 01:59:05 +0300 (MSK) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 6647B39B2B; Tue, 10 Mar 2009 01:59:18 +0300 (MSK) Date: Tue, 10 Mar 2009 01:59:07 +0300 From: Stanislav Sedov To: Steve Kargl Message-Id: <20090310015907.dfc2105c.stas@FreeBSD.org> In-Reply-To: <20090309222705.GA49870@troutmask.apl.washington.edu> References: <200903091922.n29JMjLR035306@svn.freebsd.org> <20090309194338.GA48593@troutmask.apl.washington.edu> <20090309195805.GA53225@citylink.fud.org.nz> <20090309222705.GA49870@troutmask.apl.washington.edu> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Innocent X-DSPAM-Processed: Tue Mar 10 01:59:07 2009 X-DSPAM-Confidence: 1.0000 X-DSPAM-Improbability: 1 in 98689409 chance of being spam X-DSPAM-Probability: 0.0023 X-DSPAM-Signature: 49b59f3b967001187212242 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andrew Thompson Subject: Re: svn commit: r189594 - 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: Mon, 09 Mar 2009 22:59:10 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, 9 Mar 2009 15:27:05 -0700 Steve Kargl mentioned: > Don't the 20090223, 20090227, and 20090309 entries suggest to you > that USB2 is going to get very limited testing by the actual user > community? Asking users to rebuild world/kernel 2 or 3 times in > a span of 20 days, and all the ports that use USB (with the hope > that the ports actuall build) seems destiny to limit testing. > All dependent ports have been fixed and tested before the actual commit. You should not have problems building any of them. Why would you think we didn't catch up libusb20 rename in ports collection? > > After a complete build{world,kernel}/install{world,kernel} dance, including > a 'make delete-old-libs' and a reboot. > > REMOVE:root[214] ll /usr/lib/libusb* > -r--r--r-- 1 root wheel - 32136 Mar 9 14:33 /usr/lib/libusb.so.1 > -r--r--r-- 1 root wheel - 37580 Mar 5 05:01 /usr/lib/libusb20.a > lrwxr-xr-x 1 root wheel - 13 Mar 5 05:01 /usr/lib/libusb20.so@ -> libusb20.so.1 > -r--r--r-- 1 root wheel - 39960 Mar 5 05:01 /usr/lib/libusb20_p.a > -r--r--r-- 1 root wheel - 11874 Mar 9 14:33 /usr/lib/libusbhid.a > lrwxr-xr-x 1 root wheel - 14 Mar 9 14:33 /usr/lib/libusbhid.so@ -> libusbhid.so.3 > -r--r--r-- 1 root wheel - 11284 Mar 9 14:33 /usr/lib/libusbhid.so.3 > -r--r--r-- 1 root wheel - 12240 Mar 9 14:33 /usr/lib/libusbhid_p.a > > It seems that libusb20 lives. > Seems we forgotten to add all entries to ObsoleteFiles.inc. Thanks for reporting. In the meantime, you can drop all libusb20* by hand. - -- Stanislav Sedov ST4096-RIPE -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAkm1n0YACgkQK/VZk+smlYHmdwCgga6Q0BJzyG6BKMAQTEtkUnO3 iB8AnRu49Vapslt2mJ5smfQ+LYsGKthO =nBcD -----END PGP SIGNATURE----- !DSPAM:49b59f3b967001187212242! From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 23:04:06 2009 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 65CD31065676; Mon, 9 Mar 2009 23:04:06 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53C9F8FC1E; Mon, 9 Mar 2009 23:04:06 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29N46kS039861; Mon, 9 Mar 2009 23:04:06 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29N469r039860; Mon, 9 Mar 2009 23:04:06 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903092304.n29N469r039860@svn.freebsd.org> From: Sam Leffler Date: Mon, 9 Mar 2009 23:04: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: r189604 - head/sys/dev/ath/ath_hal/ar5416 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 Mar 2009 23:04:07 -0000 Author: sam Date: Mon Mar 9 23:04:06 2009 New Revision: 189604 URL: http://svn.freebsd.org/changeset/base/189604 Log: remove ar9160Detach; it does nothing Modified: head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c Mon Mar 9 22:54:17 2009 (r189603) +++ head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c Mon Mar 9 23:04:06 2009 (r189604) @@ -57,7 +57,6 @@ static const HAL_PERCAL_DATA ar9160_adc_ .calPostProc = ar5416AdcDcCalibration }; -static void ar9160Detach(struct ath_hal *); static HAL_BOOL ar9160FillCapabilityInfo(struct ath_hal *ah); static void @@ -116,7 +115,6 @@ ar9160Attach(uint16_t devid, HAL_SOFTC s /* XXX override with 9160 specific state */ /* override 5416 methods for our needs */ - ah->ah_detach = ar9160Detach; AH5416(ah)->ah_cal.iqCalData.calData = &ar9160_iq_cal; AH5416(ah)->ah_cal.adcGainCalData.calData = &ar9160_adc_gain_cal; @@ -258,23 +256,12 @@ ar9160Attach(uint16_t devid, HAL_SOFTC s return ah; bad: if (ahp) - ar9160Detach((struct ath_hal *) ahp); + ar5416Detach((struct ath_hal *) ahp); if (status) *status = ecode; return AH_NULL; } -void -ar9160Detach(struct ath_hal *ah) -{ - HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s:\n", __func__); - - HALASSERT(ah != AH_NULL); - HALASSERT(ah->ah_magic == AR5416_MAGIC); - - ar5416Detach(ah); -} - /* * Fill all software cached or static hardware state information. * Return failure if capabilities are to come from EEPROM and From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 23:10:19 2009 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 BAE611065740; Mon, 9 Mar 2009 23:10:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8E108FC25; Mon, 9 Mar 2009 23:10:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29NAJ78040017; Mon, 9 Mar 2009 23:10:19 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29NAJSX040014; Mon, 9 Mar 2009 23:10:19 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903092310.n29NAJSX040014@svn.freebsd.org> From: Sam Leffler Date: Mon, 9 Mar 2009 23:10: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: r189605 - 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: Mon, 09 Mar 2009 23:10:20 -0000 Author: sam Date: Mon Mar 9 23:10:19 2009 New Revision: 189605 URL: http://svn.freebsd.org/changeset/base/189605 Log: replace if_watchdog w/ private callout; probably can merge this with the calibration work sometime in the future Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Mar 9 23:04:06 2009 (r189604) +++ head/sys/dev/ath/if_ath.c Mon Mar 9 23:10:19 2009 (r189605) @@ -130,7 +130,7 @@ static void ath_start(struct ifnet *); static int ath_reset(struct ifnet *); static int ath_reset_vap(struct ieee80211vap *, u_long); static int ath_media_change(struct ifnet *); -static void ath_watchdog(struct ifnet *); +static void ath_watchdog(void *); static int ath_ioctl(struct ifnet *, u_long, caddr_t); static void ath_fatal_proc(void *, int); static void ath_bmiss_vap(struct ieee80211vap *); @@ -458,7 +458,8 @@ ath_attach(u_int16_t devid, struct ath_s if_printf(ifp, "failed to allocate descriptors: %d\n", error); goto bad; } - callout_init(&sc->sc_cal_ch, CALLOUT_MPSAFE); + callout_init_mtx(&sc->sc_cal_ch, &sc->sc_mtx, 0); + callout_init_mtx(&sc->sc_wd_ch, &sc->sc_mtx, 0); ATH_TXBUF_LOCK_INIT(sc); @@ -567,7 +568,7 @@ ath_attach(u_int16_t devid, struct ath_s ifp->if_softc = sc; ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; ifp->if_start = ath_start; - ifp->if_watchdog = ath_watchdog; + ifp->if_watchdog = NULL; ifp->if_ioctl = ath_ioctl; ifp->if_init = ath_init; IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); @@ -1528,6 +1529,7 @@ ath_init(void *arg) sc->sc_imask |= HAL_INT_MIB; ifp->if_drv_flags |= IFF_DRV_RUNNING; + callout_reset(&sc->sc_wd_ch, hz, ath_watchdog, sc); ath_hal_intrset(ah, sc->sc_imask); ATH_UNLOCK(sc); @@ -1570,8 +1572,9 @@ ath_stop_locked(struct ifnet *ifp) if (sc->sc_tx99 != NULL) sc->sc_tx99->stop(sc->sc_tx99); #endif + callout_stop(&sc->sc_wd_ch); + sc->sc_wd_timer = 0; ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - ifp->if_timer = 0; if (!sc->sc_invalid) { if (sc->sc_softled) { callout_stop(&sc->sc_ledtimer); @@ -2195,7 +2198,7 @@ ath_start(struct ifnet *ifp) goto nextfrag; } - ifp->if_timer = 5; + sc->sc_wd_timer = 5; #if 0 /* * Flush stale frames from the fast-frame staging queue. @@ -5372,7 +5375,7 @@ ath_tx_proc_q0(void *arg, int npending) if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum)) ath_tx_processq(sc, sc->sc_cabq); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_timer = 0; + sc->sc_wd_timer = 0; if (sc->sc_softled) ath_led_event(sc, sc->sc_txrix); @@ -5409,7 +5412,7 @@ ath_tx_proc_q0123(void *arg, int npendin sc->sc_lastrx = ath_hal_gettsf64(sc->sc_ah); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_timer = 0; + sc->sc_wd_timer = 0; if (sc->sc_softled) ath_led_event(sc, sc->sc_txrix); @@ -5438,7 +5441,7 @@ ath_tx_proc(void *arg, int npending) sc->sc_lastrx = ath_hal_gettsf64(sc->sc_ah); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_timer = 0; + sc->sc_wd_timer = 0; if (sc->sc_softled) ath_led_event(sc, sc->sc_txrix); @@ -5557,7 +5560,7 @@ ath_draintxq(struct ath_softc *sc) } #endif /* ATH_DEBUG */ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_timer = 0; + sc->sc_wd_timer = 0; } /* @@ -5902,7 +5905,7 @@ ath_newstate(struct ieee80211vap *vap, e ieee80211_state_name[vap->iv_state], ieee80211_state_name[nstate]); - callout_stop(&sc->sc_cal_ch); + callout_drain(&sc->sc_cal_ch); ath_hal_setledstate(ah, leds[nstate]); /* set LED */ if (nstate == IEEE80211_S_SCAN) { @@ -6436,11 +6439,12 @@ ath_printtxbuf(struct ath_softc *sc, con #endif /* ATH_DEBUG */ static void -ath_watchdog(struct ifnet *ifp) +ath_watchdog(void *arg) { - struct ath_softc *sc = ifp->if_softc; + struct ath_softc *sc = arg; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->sc_invalid) { + if (sc->sc_wd_timer != 0 && --sc->sc_wd_timer == 0) { + struct ifnet *ifp = sc->sc_ifp; uint32_t hangs; if (ath_hal_gethangstate(sc->sc_ah, 0xffff, &hangs) && @@ -6453,6 +6457,7 @@ ath_watchdog(struct ifnet *ifp) ifp->if_oerrors++; sc->sc_stats.ast_watchdog++; } + callout_schedule(&sc->sc_wd_ch, hz); } #ifdef ATH_DIAGAPI @@ -7272,7 +7277,7 @@ ath_raw_xmit(struct ieee80211_node *ni, if (ath_tx_raw_start(sc, ni, bf, m, params)) goto bad; } - ifp->if_timer = 5; + sc->sc_wd_timer = 5; return 0; bad: Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Mar 9 23:04:06 2009 (r189604) +++ head/sys/dev/ath/if_athvar.h Mon Mar 9 23:10:19 2009 (r189605) @@ -321,6 +321,8 @@ struct ath_softc { struct ath_txq sc_txq[HAL_NUM_TX_QUEUES]; struct ath_txq *sc_ac2q[5]; /* WME AC -> h/w q map */ struct task sc_txtask; /* tx int processing */ + int sc_wd_timer; /* count down for wd timer */ + struct callout sc_wd_ch; /* tx watchdog timer */ struct ath_descdma sc_bdma; /* beacon descriptors */ ath_bufhead sc_bbuf; /* beacon buffers */ From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 23:16:02 2009 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 BB95F106564A; Mon, 9 Mar 2009 23:16:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A89E48FC12; Mon, 9 Mar 2009 23:16:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29NG2Y2040165; Mon, 9 Mar 2009 23:16:02 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29NG2wI040160; Mon, 9 Mar 2009 23:16:02 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903092316.n29NG2wI040160@svn.freebsd.org> From: Sam Leffler Date: Mon, 9 Mar 2009 23:16: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: r189606 - in head/sys: conf dev/cfi 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 Mar 2009 23:16:03 -0000 Author: sam Date: Mon Mar 9 23:16:02 2009 New Revision: 189606 URL: http://svn.freebsd.org/changeset/base/189606 Log: Add cfid, a disk interface to CFI flash devices; this enables construction of flash-based filesystems. Note this is not interlocked against the raw CFI device. Added: head/sys/dev/cfi/cfi_disk.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cfi/cfi_core.c head/sys/dev/cfi/cfi_dev.c head/sys/dev/cfi/cfi_var.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Mar 9 23:10:19 2009 (r189605) +++ head/sys/conf/files Mon Mar 9 23:16:02 2009 (r189606) @@ -702,6 +702,7 @@ dev/cardbus/cardbus_cis.c optional cardb dev/cardbus/cardbus_device.c optional cardbus dev/cfi/cfi_core.c optional cfi dev/cfi/cfi_dev.c optional cfi +dev/cfi/cfi_disk.c optional cfid dev/ciss/ciss.c optional ciss dev/cm/smc90cx6.c optional cm dev/cmx/cmx.c optional cmx Modified: head/sys/dev/cfi/cfi_core.c ============================================================================== --- head/sys/dev/cfi/cfi_core.c Mon Mar 9 23:10:19 2009 (r189605) +++ head/sys/dev/cfi/cfi_core.c Mon Mar 9 23:16:02 2009 (r189606) @@ -51,6 +51,7 @@ extern struct cdevsw cfi_cdevsw; char cfi_driver_name[] = "cfi"; devclass_t cfi_devclass; +devclass_t cfi_diskclass; uint32_t cfi_read(struct cfi_softc *sc, u_int ofs) @@ -284,6 +285,10 @@ cfi_attach(device_t dev) "%s%u", cfi_driver_name, u); sc->sc_nod->si_drv1 = sc; + device_add_child(dev, "cfid", + devclass_find_free_unit(cfi_diskclass, 0)); + bus_generic_attach(dev); + return (0); } Modified: head/sys/dev/cfi/cfi_dev.c ============================================================================== --- head/sys/dev/cfi/cfi_dev.c Mon Mar 9 23:10:19 2009 (r189605) +++ head/sys/dev/cfi/cfi_dev.c Mon Mar 9 23:16:02 2009 (r189606) @@ -74,7 +74,7 @@ struct cdevsw cfi_cdevsw = { * or the process stops writing. At that time we write the whole * sector to flash (see cfi_block_finish). */ -static int +int cfi_block_start(struct cfi_softc *sc, u_int ofs) { union { @@ -124,7 +124,7 @@ cfi_block_start(struct cfi_softc *sc, u_ * Finish updating the current block/sector by writing the compound * set of changes to the flash. */ -static int +int cfi_block_finish(struct cfi_softc *sc) { int error; Added: head/sys/dev/cfi/cfi_disk.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cfi/cfi_disk.c Mon Mar 9 23:16:02 2009 (r189606) @@ -0,0 +1,319 @@ +/*- + * Copyright (c) 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. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +struct cfi_disk_softc { + struct cfi_softc *parent; + struct disk *disk; + int flags; +#define CFI_DISK_OPEN 0x0001 + struct bio_queue_head bioq; /* bio queue */ + struct mtx qlock; /* bioq lock */ + struct taskqueue *tq; /* private task queue for i/o request */ + struct task iotask; /* i/o processing */ +}; + +#define CFI_DISK_SECSIZE 512 +#define CFI_DISK_MAXIOSIZE 65536 + +static int cfi_disk_detach(device_t); +static int cfi_disk_open(struct disk *); +static int cfi_disk_close(struct disk *); +static void cfi_io_proc(void *, int); +static void cfi_disk_strategy(struct bio *); +static int cfi_disk_ioctl(struct disk *, u_long, void *, int, struct thread *); + +static int +cfi_disk_probe(device_t dev) +{ + return 0; +} + +static int +cfi_disk_attach(device_t dev) +{ + struct cfi_disk_softc *sc = device_get_softc(dev); + + sc->parent = device_get_softc(device_get_parent(dev)); + /* validate interface width; assumed by other code */ + if (sc->parent->sc_width != 1 && + sc->parent->sc_width != 2 && + sc->parent->sc_width != 4) + return EINVAL; + + sc->disk = disk_alloc(); + if (sc->disk == NULL) + return ENOMEM; + sc->disk->d_name = "cfid"; + sc->disk->d_unit = device_get_unit(dev); + sc->disk->d_open = cfi_disk_open; + sc->disk->d_close = cfi_disk_close; + sc->disk->d_strategy = cfi_disk_strategy; + sc->disk->d_ioctl = cfi_disk_ioctl; + sc->disk->d_dump = NULL; /* NB: no dumps */ + sc->disk->d_sectorsize = CFI_DISK_SECSIZE; + sc->disk->d_mediasize = sc->parent->sc_size; + sc->disk->d_maxsize = CFI_DISK_MAXIOSIZE; + /* NB: use stripesize to hold the erase/region size */ + if (sc->parent->sc_regions) + sc->disk->d_stripesize = sc->parent->sc_region->r_blksz; + else + sc->disk->d_stripesize = sc->disk->d_mediasize; + sc->disk->d_drv1 = sc; + disk_create(sc->disk, DISK_VERSION); + + mtx_init(&sc->qlock, "CFID I/O lock", NULL, MTX_DEF); + bioq_init(&sc->bioq); + + sc->tq = taskqueue_create("cfid_taskq", M_NOWAIT, + taskqueue_thread_enqueue, &sc->tq); + taskqueue_start_threads(&sc->tq, 1, PI_DISK, "cfid taskq"); + + TASK_INIT(&sc->iotask, 0, cfi_io_proc, sc); + + return 0; +} + +static int +cfi_disk_detach(device_t dev) +{ + struct cfi_disk_softc *sc = device_get_softc(dev); + + if (sc->flags & CFI_DISK_OPEN) + return EBUSY; + taskqueue_free(sc->tq); + /* XXX drain bioq */ + disk_destroy(sc->disk); + mtx_destroy(&sc->qlock); + return 0; +} + +static int +cfi_disk_open(struct disk *dp) +{ + struct cfi_disk_softc *sc = dp->d_drv1; + + /* XXX no interlock with /dev/cfi */ + sc->flags |= CFI_DISK_OPEN; + return 0; +} + +static int +cfi_disk_close(struct disk *dp) +{ + struct cfi_disk_softc *sc = dp->d_drv1; + + sc->flags &= ~CFI_DISK_OPEN; + return 0; +} + +static void +cfi_disk_read(struct cfi_softc *sc, struct bio *bp) +{ + long resid; + + KASSERT(sc->sc_width == 1 || sc->sc_width == 2 || sc->sc_width == 4, + ("sc_width %d", sc->sc_width)); + + if (sc->sc_writing) { + bp->bio_error = cfi_block_finish(sc); + if (bp->bio_error) { + bp->bio_flags |= BIO_ERROR; + goto done; + } + } + if (bp->bio_offset > sc->sc_size) { + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EIO; + goto done; + } + resid = bp->bio_bcount; + if (sc->sc_width == 1) { + uint8_t *dp = (uint8_t *)bp->bio_data; + while (resid > 0 && bp->bio_offset < sc->sc_size) { + *dp++ = cfi_read(sc, bp->bio_offset); + bp->bio_offset += 1, resid -= 1; + } + } else if (sc->sc_width == 2) { + uint16_t *dp = (uint16_t *)bp->bio_data; + while (resid > 0 && bp->bio_offset < sc->sc_size) { + *dp++ = cfi_read(sc, bp->bio_offset); + bp->bio_offset += 2, resid -= 2; + } + } else { + uint32_t *dp = (uint32_t *)bp->bio_data; + while (resid > 0 && bp->bio_offset < sc->sc_size) { + *dp++ = cfi_read(sc, bp->bio_offset); + bp->bio_offset += 4, resid -= 4; + } + } + bp->bio_resid = resid; +done: + biodone(bp); +} + +static void +cfi_disk_write(struct cfi_softc *sc, struct bio *bp) +{ + long resid; + u_int top; + + KASSERT(sc->sc_width == 1 || sc->sc_width == 2 || sc->sc_width == 4, + ("sc_width %d", sc->sc_width)); + + if (bp->bio_offset > sc->sc_size) { + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EIO; + goto done; + } + resid = bp->bio_bcount; + while (resid > 0) { + /* + * Finish the current block if we're about to write + * to a different block. + */ + if (sc->sc_writing) { + top = sc->sc_wrofs + sc->sc_wrbufsz; + if (bp->bio_offset < sc->sc_wrofs || + bp->bio_offset >= top) + cfi_block_finish(sc); + } + + /* Start writing to a (new) block if applicable. */ + if (!sc->sc_writing) { + bp->bio_error = cfi_block_start(sc, bp->bio_offset); + if (bp->bio_error) { + bp->bio_flags |= BIO_ERROR; + goto done; + } + } + + top = sc->sc_wrofs + sc->sc_wrbufsz; + bcopy(bp->bio_data, + sc->sc_wrbuf + bp->bio_offset - sc->sc_wrofs, + MIN(top - bp->bio_offset, resid)); + resid -= MIN(top - bp->bio_offset, resid); + } + bp->bio_resid = resid; +done: + biodone(bp); +} + +static void +cfi_io_proc(void *arg, int pending) +{ + struct cfi_disk_softc *sc = arg; + struct cfi_softc *cfi = sc->parent; + struct bio *bp; + + for (;;) { + mtx_lock(&sc->qlock); + bp = bioq_takefirst(&sc->bioq); + mtx_unlock(&sc->qlock); + if (bp == NULL) + break; + + switch (bp->bio_cmd) { + case BIO_READ: + cfi_disk_read(cfi, bp); + break; + case BIO_WRITE: + cfi_disk_write(cfi, bp); + break; + } + } +} + +static void +cfi_disk_strategy(struct bio *bp) +{ + struct cfi_disk_softc *sc = bp->bio_disk->d_drv1; + + if (sc == NULL) + goto invalid; + if (bp->bio_bcount == 0) { + bp->bio_resid = bp->bio_bcount; + biodone(bp); + return; + } + switch (bp->bio_cmd) { + case BIO_READ: + case BIO_WRITE: + mtx_lock(&sc->qlock); + /* no value in sorting requests? */ + bioq_insert_tail(&sc->bioq, bp); + mtx_unlock(&sc->qlock); + taskqueue_enqueue(sc->tq, &sc->iotask); + return; + } + /* fall thru... */ +invalid: + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EINVAL; + biodone(bp); +} + +static int +cfi_disk_ioctl(struct disk *dp, u_long cmd, void *data, int fflag, + struct thread *td) +{ + return EINVAL; +} + +static device_method_t cfi_disk_methods[] = { + DEVMETHOD(device_probe, cfi_disk_probe), + DEVMETHOD(device_attach, cfi_disk_attach), + DEVMETHOD(device_detach, cfi_disk_detach), + + { 0, 0 } +}; +static driver_t cfi_disk_driver = { + "cfid", + cfi_disk_methods, + sizeof(struct cfi_disk_softc), +}; +DRIVER_MODULE(cfid, cfi, cfi_disk_driver, cfi_diskclass, 0, NULL); Modified: head/sys/dev/cfi/cfi_var.h ============================================================================== --- head/sys/dev/cfi/cfi_var.h Mon Mar 9 23:10:19 2009 (r189605) +++ head/sys/dev/cfi/cfi_var.h Mon Mar 9 23:16:02 2009 (r189606) @@ -65,6 +65,7 @@ struct cfi_softc { extern char cfi_driver_name[]; extern devclass_t cfi_devclass; +extern devclass_t cfi_diskclass; int cfi_probe(device_t); int cfi_attach(device_t); @@ -73,6 +74,8 @@ int cfi_detach(device_t); uint32_t cfi_read(struct cfi_softc *, u_int); uint8_t cfi_read_qry(struct cfi_softc *, u_int); int cfi_write_block(struct cfi_softc *); +int cfi_block_start(struct cfi_softc *, u_int); +int cfi_block_finish(struct cfi_softc *); #ifdef CFI_SUPPORT_STRATAFLASH int cfi_intel_get_factory_pr(struct cfi_softc *sc, uint64_t *); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 23:18:07 2009 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 658ED106566B; Mon, 9 Mar 2009 23:18:07 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53F7C8FC20; Mon, 9 Mar 2009 23:18:07 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29NI79K040237; Mon, 9 Mar 2009 23:18:07 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29NI7oZ040235; Mon, 9 Mar 2009 23:18:07 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903092318.n29NI7oZ040235@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Mar 2009 23:18: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: r189607 - 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: Mon, 09 Mar 2009 23:18:07 -0000 Author: thompsa Date: Mon Mar 9 23:18:07 2009 New Revision: 189607 URL: http://svn.freebsd.org/changeset/base/189607 Log: Fix up the entries for libusb, it seems it existed back in 2002 so it was getting removed again. Reported by: Steve Kargl Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Mar 9 23:16:02 2009 (r189606) +++ head/ObsoleteFiles.inc Mon Mar 9 23:18:07 2009 (r189607) @@ -16,6 +16,9 @@ # 20090308: libusb.so.1 renamed OLD_LIBS+=usr/lib/libusb20.so.1 +OLD_FILES+=usr/lib/libusb20.a +OLD_FILES+=usr/lib/libusb20.so +OLD_FILES+=usr/lib/libusb20_p.a OLD_FILES+=usr/include/libusb20_compat01.h # 20090226: libmp(3) functions renamed OLD_LIBS+=usr/lib/libmp.so.6 @@ -1769,9 +1772,6 @@ OLD_FILES+=usr/lib/libss.a OLD_FILES+=usr/lib/libss_p.a OLD_FILES+=usr/lib/libtelnet.a OLD_FILES+=usr/lib/libtelnet_p.a -OLD_FILES+=usr/lib/libusb.a -OLD_FILES+=usr/lib/libusb.so -OLD_FILES+=usr/lib/libusb_p.a OLD_FILES+=usr/sbin/diskpart # 200202XX OLD_FILES+=usr/bin/gprof4 From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 23:18:37 2009 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 4DCC31065672; Mon, 9 Mar 2009 23:18:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AEE28FC21; Mon, 9 Mar 2009 23:18:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29NIbq7040281; Mon, 9 Mar 2009 23:18:37 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29NIbV8040279; Mon, 9 Mar 2009 23:18:37 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903092318.n29NIbV8040279@svn.freebsd.org> From: Sam Leffler Date: Mon, 9 Mar 2009 23:18: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: r189608 - in head/sys: conf geom 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 Mar 2009 23:18:37 -0000 Author: sam Date: Mon Mar 9 23:18:36 2009 New Revision: 189608 URL: http://svn.freebsd.org/changeset/base/189608 Log: add geom_redboot, a geom module that exports RedBoot FIS partitions as named slices in dev/redboot/* Added: head/sys/geom/geom_redboot.c (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Mar 9 23:18:07 2009 (r189607) +++ head/sys/conf/files Mon Mar 9 23:18:36 2009 (r189608) @@ -1802,6 +1802,7 @@ geom/geom_mbr.c optional geom_mbr geom/geom_mbr_enc.c optional geom_mbr geom/geom_pc98.c optional geom_pc98 geom/geom_pc98_enc.c optional geom_pc98 +geom/geom_redboot.c optional geom_redboot geom/geom_slice.c standard geom/geom_subr.c standard geom/geom_sunlabel.c optional geom_sunlabel Added: head/sys/geom/geom_redboot.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/geom/geom_redboot.c Mon Mar 9 23:18:36 2009 (r189608) @@ -0,0 +1,321 @@ +/*- + * Copyright (c) 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define REDBOOT_CLASS_NAME "REDBOOT" + +struct fis_image_desc { + uint8_t name[16]; /* null-terminated name */ + uint32_t offset; /* offset in flash */ + uint32_t addr; /* address in memory */ + uint32_t size; /* image size in bytes */ + uint32_t entry; /* offset in image for entry point */ + uint32_t dsize; /* data size in bytes */ + uint8_t pad[256-(16+7*sizeof(uint32_t)+sizeof(void*))]; + struct fis_image_desc *next; /* linked list (in memory) */ + uint32_t dsum; /* descriptor checksum */ + uint32_t fsum; /* checksum over image data */ +}; + +#define FISDIR_NAME "FIS directory" +#define REDBCFG_NAME "RedBoot config" + +#define REDBOOT_MAXSLICE 64 +#define REDBOOT_MAXOFF \ + (REDBOOT_MAXSLICE*sizeof(struct fis_image_desc)) + +struct g_redboot_softc { + uint32_t entry[REDBOOT_MAXSLICE]; + uint32_t dsize[REDBOOT_MAXSLICE]; +}; + +static void +g_redboot_print(int i, struct fis_image_desc *fd) +{ + + printf("[%2d] \"%-15.15s\" %08x:%08x", i, fd->name, + fd->offset, fd->size); + printf(" addr %08x entry %08x\n", fd->addr, fd->entry); + printf(" dsize 0x%x dsum 0x%x fsum 0x%x\n", fd->dsize, + fd->dsum, fd->fsum); +} + +static int +g_redboot_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td) +{ + return (ENOIOCTL); +} + +static int +g_redboot_start(struct bio *bp) +{ + struct g_provider *pp; + struct g_geom *gp; + struct g_redboot_softc *sc; + struct g_slicer *gsp; + int idx; + + pp = bp->bio_to; + idx = pp->index; + gp = pp->geom; + gsp = gp->softc; + sc = gsp->softc; + if (bp->bio_cmd == BIO_GETATTR) { + if (g_handleattr_int(bp, REDBOOT_CLASS_NAME "::entry", + sc->entry[idx])) + return (1); + if (g_handleattr_int(bp, REDBOOT_CLASS_NAME "::dsize", + sc->dsize[idx])) + return (1); + } + + return (0); +} + +static void +g_redboot_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, + struct g_consumer *cp __unused, struct g_provider *pp) +{ + struct g_redboot_softc *sc; + struct g_slicer *gsp; + + gsp = gp->softc; + sc = gsp->softc; + g_slice_dumpconf(sb, indent, gp, cp, pp); + if (pp != NULL) { + if (indent == NULL) { + sbuf_printf(sb, " entry %d", sc->entry[pp->index]); + sbuf_printf(sb, " dsize %d", sc->dsize[pp->index]); + } else { + sbuf_printf(sb, "%s%d\n", indent, + sc->entry[pp->index]); + sbuf_printf(sb, "%s%d\n", indent, + sc->dsize[pp->index]); + } + } +} + +#include + +static int +nameok(const char name[16]) +{ + int i; + + /* descriptor names are null-terminated printable ascii */ + for (i = 0; i < 15; i++) + if (!isprint(name[i])) + break; + return (name[i] == '\0'); +} + +static struct fis_image_desc * +parse_fis_directory(u_char *buf, size_t bufsize, off_t offset, uint32_t offmask) +{ +#define match(a,b) \ + (bcmp(fd->name, FISDIR_NAME, sizeof(FISDIR_NAME)-1) == 0) + struct fis_image_desc *fd, *efd; + struct fis_image_desc *fisdir, *redbcfg; + struct fis_image_desc *head, **tail; + int i; + + fd = (struct fis_image_desc *)buf; + efd = fd + (bufsize / sizeof(struct fis_image_desc)); +#if 0 + /* + * Find the start of the FIS table. + */ + while (fd < efd && fd->name[0] != 0xff) + fd++; + if (fd == efd) + return (NULL); + if (bootverbose) + printf("RedBoot FIS table starts at 0x%jx\n", + offset + fd - (struct fis_image_desc *) buf); +#endif + /* + * Scan forward collecting entries in a list. + */ + fisdir = redbcfg = NULL; + *(tail = &head) = NULL; + for (i = 0; fd < efd && fd->name[0] != 0xff; i++, fd++) { + if (match(fd->name, FISDIR_NAME)) + fisdir = fd; + else if (match(fd->name, REDBCFG_NAME)) + redbcfg = fd; + if (nameok(fd->name)) { + /* + * NB: flash address includes platform mapping; + * strip it so we have only a flash offset. + */ + fd->offset &= offmask; + if (bootverbose) + g_redboot_print(i, fd); + *tail = fd; + *(tail = &fd->next) = NULL; + } + } + if (fisdir == NULL) { + if (bootverbose) + printf("No RedBoot FIS table located at %lu\n", + (long) offset); + return (NULL); + } + if (redbcfg != NULL && + fisdir->offset + fisdir->size == redbcfg->offset) { + /* + * Merged FIS/RedBoot config directory. + */ + if (bootverbose) + printf("FIS/RedBoot merged at 0x%jx (not yet)\n", + offset + fisdir->offset); + /* XXX */ + } + return head; +#undef match +} + +static struct g_geom * +g_redboot_taste(struct g_class *mp, struct g_provider *pp, int insist) +{ + struct g_geom *gp; + struct g_consumer *cp; + struct g_redboot_softc *sc; + int error, sectorsize, i; + struct fis_image_desc *fd, *head; + uint32_t offmask; + u_int blksize; /* NB: flash block size stored as stripesize */ + u_char *buf; + off_t offset; + + g_trace(G_T_TOPOLOGY, "redboot_taste(%s,%s)", mp->name, pp->name); + g_topology_assert(); + if (!strcmp(pp->geom->class->name, REDBOOT_CLASS_NAME)) + return (NULL); + /* XXX only taste flash providers */ + if (strncmp(pp->name, "cfi", 3)) + return (NULL); + gp = g_slice_new(mp, REDBOOT_MAXSLICE, pp, &cp, &sc, sizeof(*sc), + g_redboot_start); + if (gp == NULL) + return (NULL); + sectorsize = cp->provider->sectorsize; + blksize = cp->provider->stripesize; + if (powerof2(cp->provider->mediasize)) + offmask = cp->provider->mediasize-1; + else + offmask = 0xffffffff; /* XXX */ + if (bootverbose) + printf("%s: mediasize %ld secsize %d blksize %d offmask 0x%x\n", + __func__, (long) cp->provider->mediasize, sectorsize, + blksize, offmask); + if (sectorsize < sizeof(struct fis_image_desc) || + (sectorsize % sizeof(struct fis_image_desc))) + return (NULL); + g_topology_unlock(); + head = NULL; + offset = cp->provider->mediasize - blksize; +again: + buf = g_read_data(cp, offset, blksize, NULL); + if (buf != NULL) + head = parse_fis_directory(buf, blksize, offset, offmask); + if (head == NULL && offset != 0) { + if (buf != NULL) + g_free(buf); + offset = 0; /* check the front */ + goto again; + } + g_topology_lock(); + if (head == NULL) { + if (buf != NULL) + g_free(buf); + return NULL; + } + /* + * Craft a slice for each entry. + */ + for (fd = head, i = 0; fd != NULL; fd = fd->next) { + if (fd->name[0] == '\0') + continue; + error = g_slice_config(gp, i, G_SLICE_CONFIG_SET, + fd->offset, fd->size, sectorsize, "redboot/%s", fd->name); + if (error) + printf("%s: g_slice_config returns %d for \"%s\"\n", + __func__, error, fd->name); + sc->entry[i] = fd->entry; + sc->dsize[i] = fd->dsize; + i++; + } + g_free(buf); + g_access(cp, -1, 0, 0); + if (LIST_EMPTY(&gp->provider)) { + g_slice_spoiled(cp); + return (NULL); + } + return (gp); +} + +static void +g_redboot_config(struct gctl_req *req, struct g_class *mp, const char *verb) +{ + struct g_geom *gp; + + g_topology_assert(); + gp = gctl_get_geom(req, mp, "geom"); + if (gp == NULL) + return; + gctl_error(req, "Unknown verb"); +} + +static struct g_class g_redboot_class = { + .name = REDBOOT_CLASS_NAME, + .version = G_VERSION, + .taste = g_redboot_taste, + .dumpconf = g_redboot_dumpconf, + .ctlreq = g_redboot_config, + .ioctl = g_redboot_ioctl, +}; +DECLARE_GEOM_CLASS(g_redboot_class, g_redboot); From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 23:20:06 2009 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 7AAC7106567A for ; Mon, 9 Mar 2009 23:20:06 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mx1.freebsd.org (Postfix) with ESMTP id ED17C8FC1A for ; Mon, 9 Mar 2009 23:20:05 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-067-232-026.pools.arcor-ip.net [88.67.232.26]) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis) id 0ML2xA-1LgoZF3pmg-0006VG; Tue, 10 Mar 2009 00:07:30 +0100 Received: (qmail 42134 invoked from network); 9 Mar 2009 23:07:29 -0000 Received: from fbsd8.laiers.local (192.168.4.200) by mx.laiers.local with SMTP; 9 Mar 2009 23:07:29 -0000 From: Max Laier Organization: FreeBSD To: Steve Kargl Date: Tue, 10 Mar 2009 00:07:28 +0100 User-Agent: KMail/1.11.0 (FreeBSD/8.0-CURRENT; KDE/4.2.0; i386; ; ) References: <200903091922.n29JMjLR035306@svn.freebsd.org> <20090309195805.GA53225@citylink.fud.org.nz> <20090309222705.GA49870@troutmask.apl.washington.edu> In-Reply-To: <20090309222705.GA49870@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903100007.28979.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1+bec9PKChRginhYDyVQgn1NP0xXzuayOxvx+1 jPQ8jzKmV7zCS1TAX+KJ1K5Odcv8/bu8YW05jYxJhblqHwdkxg eNjNpW5Q3SRRDankhRMcQ== Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Thompson Subject: Re: svn commit: r189594 - 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: Mon, 09 Mar 2009 23:20:07 -0000 On Monday 09 March 2009 23:27:05 Steve Kargl wrote: > On Mon, Mar 09, 2009 at 12:58:06PM -0700, Andrew Thompson wrote: > > Not sure if the problems you are referring to extend beyond your > > previous mail about it being rushed, if so please advise. > > > > While the merge hasnt been perfect it couldnt have really been done > > differently due to finite resources and I dont believe it was > > unreasonable for a change in HEAD. > > I have no problems with a transition for old USB to USB2 in HEAD. > The manner of execution of the transition leaves much to desire. > Don't the 20090215 and 20090216 entries in src/UPDATING send up > a red flag that perhaps the people rushing USB2 into the tree > might want to ask portmngr to build the port collection on pointyhat There is a clear chicken-egg problem here. This is current (aka the bleeding edge) for a reason. This is the place where painful operations like this happen from time to time and users can either live with the pain that sometimes comes with running current or hold off on updating while the problems are being worked out. Better yet, pitch in with constructive reports on specific problems and maybe possible solutions. Complaining, esp. without specific problem reports, is - IMHO - not an option. Remember that all this is done so that things will be in order when 8.0 comes. Judging from my experience with USB2 - things will not only be in order, but also in far better shape then they have been for a long time now. So please, get off the back of those that stepped up to take care of this vital piece of software and let them do their work - better yet, help with this truly thankless job with specific problem reports and maybe investigating solutions. All this nay-saying isn't helping at all. > to gauge the damager? When Mark Linimon, a member of portmngr, posts > on Feb 26th > > (http://lists.freebsd.org/pipermail/freebsd-ports/2009-February/053282.html > > There appears to be a disconnect with USB2 development and the > rest of FreeBSD. > > Don't the 20090223, 20090227, and 20090309 entries suggest to you > that USB2 is going to get very limited testing by the actual user > community? Asking users to rebuild world/kernel 2 or 3 times in > a span of 20 days, and all the ports that use USB (with the hope > that the ports actuall build) seems destiny to limit testing. > > > After a complete build{world,kernel}/install{world,kernel} dance, including > a 'make delete-old-libs' and a reboot. > > REMOVE:root[214] ll /usr/lib/libusb* > -r--r--r-- 1 root wheel - 32136 Mar 9 14:33 /usr/lib/libusb.so.1 > -r--r--r-- 1 root wheel - 37580 Mar 5 05:01 /usr/lib/libusb20.a > lrwxr-xr-x 1 root wheel - 13 Mar 5 05:01 /usr/lib/libusb20.so@ -> > libusb20.so.1 -r--r--r-- 1 root wheel - 39960 Mar 5 05:01 > /usr/lib/libusb20_p.a -r--r--r-- 1 root wheel - 11874 Mar 9 14:33 > /usr/lib/libusbhid.a lrwxr-xr-x 1 root wheel - 14 Mar 9 14:33 > /usr/lib/libusbhid.so@ -> libusbhid.so.3 -r--r--r-- 1 root wheel - 11284 > Mar 9 14:33 /usr/lib/libusbhid.so.3 -r--r--r-- 1 root wheel - 12240 Mar > 9 14:33 /usr/lib/libusbhid_p.a > > It seems that libusb20 lives. -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News From owner-svn-src-head@FreeBSD.ORG Mon Mar 9 23:25:34 2009 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 78818106566B; Mon, 9 Mar 2009 23:25:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 670F48FC13; Mon, 9 Mar 2009 23:25:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n29NPY89040465; Mon, 9 Mar 2009 23:25:34 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n29NPYpv040463; Mon, 9 Mar 2009 23:25:34 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903092325.n29NPYpv040463@svn.freebsd.org> From: Sam Leffler Date: Mon, 9 Mar 2009 23:25: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: r189609 - head/sys/arm/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 Mar 2009 23:25:35 -0000 Author: sam Date: Mon Mar 9 23:25:34 2009 New Revision: 189609 URL: http://svn.freebsd.org/changeset/base/189609 Log: add cfid and geom_redboot Modified: head/sys/arm/conf/AVILA head/sys/arm/conf/CAMBRIA Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Mon Mar 9 23:18:36 2009 (r189608) +++ head/sys/arm/conf/AVILA Mon Mar 9 23:25:34 2009 (r189609) @@ -68,6 +68,8 @@ device uart device ixpwdog # watchdog timer device cfi # flash support +device cfid # flash disk support +device geom_redboot # redboot fis parser # I2C Bus device iicbus Modified: head/sys/arm/conf/CAMBRIA ============================================================================== --- head/sys/arm/conf/CAMBRIA Mon Mar 9 23:18:36 2009 (r189608) +++ head/sys/arm/conf/CAMBRIA Mon Mar 9 23:25:34 2009 (r189609) @@ -66,13 +66,17 @@ options VERBOSE_INIT_ARM device pci device uart +device ixpwdog # watchdog timer +device cfi # flash support +device cfid # flash disk support +device geom_redboot # redboot fis parser + # I2C Bus device iicbus device iicbb device iic device ixpiic # I2C bus glue -device ixpwdog # watchdog timer device ds1672 # DS1672 on I2C bus device ad7418 # AD7418 on I2C bus From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 01:54:14 2009 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 E29B91065670; Tue, 10 Mar 2009 01:54:14 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (lefty.soaustin.net [66.135.55.46]) by mx1.freebsd.org (Postfix) with ESMTP id BFA848FC14; Tue, 10 Mar 2009 01:54:14 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: by mail.soaustin.net (Postfix, from userid 502) id 11BB48C074; Mon, 9 Mar 2009 20:38:10 -0500 (CDT) Date: Mon, 9 Mar 2009 20:38:10 -0500 From: Mark Linimon To: Steve Kargl Message-ID: <20090310013810.GC22633@lonesome.com> References: <200903091922.n29JMjLR035306@svn.freebsd.org> <20090309194338.GA48593@troutmask.apl.washington.edu> <20090309195805.GA53225@citylink.fud.org.nz> <20090309222705.GA49870@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090309222705.GA49870@troutmask.apl.washington.edu> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Stanislav Sedov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andrew Thompson Subject: Re: svn commit: r189594 - 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: Tue, 10 Mar 2009 01:54:15 -0000 On Mon, Mar 09, 2009 at 03:27:05PM -0700, Steve Kargl wrote: > When Mark Linimon, a member of portmgr, posts on Feb 26th > > (http://lists.freebsd.org/pipermail/freebsd-ports/2009-February/053282.html > > There appears to be a disconnect with USB2 development and the > rest of FreeBSD. Within 2 days after posting that, we had a list created of all the ports the ports that were broken by known commits to -current, and people started working through them. I am very encouraged by the response. In theory, there would be enough volunteers and spare machines to regression-test every change that might be disruptive before commit. In practice, it's simply not possible. As it is, since 7.1 went out the door we (portmgr) have been continually running -exp runs to try to work through our backlog. We have several more in the queue that are also high priority. (In particular, we spent time on the xorg upgrade, which we knew would affect all users, not just -current). I suppose portmgr could have objected to the merge -- but note, it had been in the planning stage for quite some time, and the window to get this massive change into the src base before 8.0 was starting to close. Now that the commit has gone in, all we can do is ask people to help in fixing problems. In this, I think we could hardly have done better. As mlaier has pointed out, -current has sharp edges. It's one of 3 choices open to you, the other two being -stable (which will still have ports regressions from time to time -- see xorg -- and sometimes even src regressions), and a release, which is the best we can do with respect to QA. If you can't deal with having your system out of commission on occasion, then -current isn't for you. mcl From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 02:12:03 2009 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 98202106564A; Tue, 10 Mar 2009 02:12:03 +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 86BF18FC0C; Tue, 10 Mar 2009 02:12:03 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2A2C3jI043696; Tue, 10 Mar 2009 02:12:03 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2A2C3nL043695; Tue, 10 Mar 2009 02:12:03 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200903100212.n2A2C3nL043695@svn.freebsd.org> From: Alan Cox Date: Tue, 10 Mar 2009 02:12: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: r189610 - head/sys/amd64/amd64 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 Mar 2009 02:12:04 -0000 Author: alc Date: Tue Mar 10 02:12:03 2009 New Revision: 189610 URL: http://svn.freebsd.org/changeset/base/189610 Log: Eliminate the last use of the recursive mapping to access user-space page table pages. Now, all accesses to user-space page table pages are performed through the direct map. (The recursive mapping is only used to access kernel-space page table pages.) Eliminate the TLB invalidation on the recursive mapping when a user-space page table page is removed from the page table and when a user-space superpage is demoted. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Mar 9 23:25:34 2009 (r189609) +++ head/sys/amd64/amd64/pmap.c Tue Mar 10 02:12:03 2009 (r189610) @@ -1278,7 +1278,6 @@ static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t *free) { - vm_offset_t pteva; /* * unmap the page table page @@ -1287,19 +1286,16 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of /* PDP page */ pml4_entry_t *pml4; pml4 = pmap_pml4e(pmap, va); - pteva = (vm_offset_t) PDPmap + amd64_ptob(m->pindex - (NUPDE + NUPDPE)); *pml4 = 0; } else if (m->pindex >= NUPDE) { /* PD page */ pdp_entry_t *pdp; pdp = pmap_pdpe(pmap, va); - pteva = (vm_offset_t) PDmap + amd64_ptob(m->pindex - NUPDE); *pdp = 0; } else { /* PTE page */ pd_entry_t *pd; pd = pmap_pde(pmap, va); - pteva = (vm_offset_t) PTmap + amd64_ptob(m->pindex); *pd = 0; } --pmap->pm_stats.resident_count; @@ -1325,12 +1321,6 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of */ atomic_subtract_rel_int(&cnt.v_wire_count, 1); - /* - * Do an invltlb to make the invalidated mapping - * take effect immediately. - */ - pmap_invalidate_page(pmap, pteva); - /* * Put page on a list so that it is released after * *ALL* TLB shootdown is done @@ -2277,9 +2267,10 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t pde_store(pde, newpde); /* - * Invalidate a stale mapping of the page table page. + * Invalidate a stale recursive mapping of the page table page. */ - pmap_invalidate_page(pmap, (vm_offset_t)vtopte(va)); + if (va >= VM_MAXUSER_ADDRESS) + pmap_invalidate_page(pmap, (vm_offset_t)vtopte(va)); /* * Demote the pv entry. This depends on the earlier demotion @@ -3762,7 +3753,7 @@ pmap_page_is_mapped(vm_page_t m) void pmap_remove_pages(pmap_t pmap) { - pd_entry_t *pde; + pd_entry_t ptepde; pt_entry_t *pte, tpte; vm_page_t free = NULL; vm_page_t m, mpte, mt; @@ -3791,23 +3782,19 @@ pmap_remove_pages(pmap_t pmap) pv = &pc->pc_pventry[idx]; inuse &= ~bitmask; - pde = vtopde(pv->pv_va); - tpte = *pde; - if ((tpte & PG_PS) != 0) - pte = pde; - else { + pte = pmap_pdpe(pmap, pv->pv_va); + ptepde = *pte; + pte = pmap_pdpe_to_pde(pte, pv->pv_va); + tpte = *pte; + if ((tpte & (PG_PS | PG_V)) == PG_V) { + ptepde = tpte; pte = (pt_entry_t *)PHYS_TO_DMAP(tpte & PG_FRAME); pte = &pte[pmap_pte_index(pv->pv_va)]; tpte = *pte & ~PG_PTE_PAT; } - - if (tpte == 0) { - printf( - "TPTE at %p IS ZERO @ VA %08lx\n", - pte, pv->pv_va); + if ((tpte & PG_V) == 0) panic("bad pte"); - } /* * We cannot remove wired pages from a process' mapping at this time @@ -3863,8 +3850,6 @@ pmap_remove_pages(pmap_t pmap) pmap_add_delayed_free_list(mpte, &free, FALSE); atomic_subtract_int(&cnt.v_wire_count, 1); } - pmap_unuse_pt(pmap, pv->pv_va, - *pmap_pdpe(pmap, pv->pv_va), &free); } else { pmap->pm_stats.resident_count--; TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); @@ -3873,8 +3858,8 @@ pmap_remove_pages(pmap_t pmap) if (TAILQ_EMPTY(&pvh->pv_list)) vm_page_flag_clear(m, PG_WRITEABLE); } - pmap_unuse_pt(pmap, pv->pv_va, *pde, &free); } + pmap_unuse_pt(pmap, pv->pv_va, ptepde, &free); } } if (allfree) { From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 02:19:27 2009 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 59B931065674; Tue, 10 Mar 2009 02:19:27 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id 36A6D8FC08; Tue, 10 Mar 2009 02:19:27 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.3/8.14.3) with ESMTP id n2A2JQ69051506; Mon, 9 Mar 2009 19:19:27 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.3/8.14.3/Submit) id n2A2JQKi051505; Mon, 9 Mar 2009 19:19:26 -0700 (PDT) (envelope-from sgk) Date: Mon, 9 Mar 2009 19:19:26 -0700 From: Steve Kargl To: Mark Linimon Message-ID: <20090310021926.GA51405@troutmask.apl.washington.edu> References: <200903091922.n29JMjLR035306@svn.freebsd.org> <20090309194338.GA48593@troutmask.apl.washington.edu> <20090309195805.GA53225@citylink.fud.org.nz> <20090309222705.GA49870@troutmask.apl.washington.edu> <20090310013810.GC22633@lonesome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090310013810.GC22633@lonesome.com> User-Agent: Mutt/1.4.2.3i Cc: Stanislav Sedov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andrew Thompson Subject: Re: svn commit: r189594 - 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: Tue, 10 Mar 2009 02:19:27 -0000 On Mon, Mar 09, 2009 at 08:38:10PM -0500, Mark Linimon wrote: > > As mlaier has pointed out, -current has sharp edges. It's one of > 3 choices open to you, the other two being -stable (which will still > have ports regressions from time to time -- see xorg -- and sometimes > even src regressions), and a release, which is the best we can do with > respect to QA. If you can't deal with having your system out of > commission on occasion, then -current isn't for you. > Oh Please! I've run -current since it was called 386bsd+patchkit. I've lived through the gcc 2.6.3 to gcc 3.x transition, the replacement of devfs by phk with a new improved devfs, the problems with libm and the changes to stdio.h among many others. The facts remain that the USB2 transistion was poorly executed. Contrast USB2 with Ed's new TTY layer. Ed gave a month or more headsup that a new TTY layer was coming. He enumerated the drivers that were broken and actively solicited people with the affected hardware for help. He furthermore helped those people fix as many driver as possible before committing the new TTY layer. As part of portmngr, you know Ed also actively fixed many ports broken by the new TTY layer and/or helped others fix the ports before the new layer became standard. The fact that USB2 broke such a fundamentally important port as Xorg suggests a lack of testing and planning by those who rushed the USB2 transition. If you and others take off your rose colored glasses, you'll see that the USB2 transition could have been handled better. Hopefully, you're willing to learn from your mistakes. -- Steve From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 03:25:27 2009 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 ECED6106566C; Tue, 10 Mar 2009 03:25:27 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (lefty.soaustin.net [66.135.55.46]) by mx1.freebsd.org (Postfix) with ESMTP id C6FB58FC0A; Tue, 10 Mar 2009 03:25:27 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: by mail.soaustin.net (Postfix, from userid 502) id 72C478C074; Mon, 9 Mar 2009 22:25:27 -0500 (CDT) Date: Mon, 9 Mar 2009 22:25:27 -0500 From: Mark Linimon To: Steve Kargl Message-ID: <20090310032527.GA24125@lonesome.com> References: <200903091922.n29JMjLR035306@svn.freebsd.org> <20090309194338.GA48593@troutmask.apl.washington.edu> <20090309195805.GA53225@citylink.fud.org.nz> <20090309222705.GA49870@troutmask.apl.washington.edu> <20090310013810.GC22633@lonesome.com> <20090310021926.GA51405@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090310021926.GA51405@troutmask.apl.washington.edu> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Stanislav Sedov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andrew Thompson Subject: Re: svn commit: r189594 - 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: Tue, 10 Mar 2009 03:25:28 -0000 On Mon, Mar 09, 2009 at 07:19:26PM -0700, Steve Kargl wrote: > Ed gave a month or more headsup that a new TTY layer was coming. He > enumerated the drivers that were broken and actively solicited people > with the affected hardware for help. He furthermore helped those > people fix as many driver as possible before committing the new TTY > layer. As part of portmgr, you know Ed also actively fixed many ports > broken by the new TTY layer and/or helped others fix the ports before > the new layer became standard. Yes, and I would like to thank Ed for this and hold him up as a model for how things ought to be done. My own approach is to do that rather than be critical. > If you and others take off your rose colored glasses, you'll see > that the USB2 transition could have been handled better. I already agreed that it could have been, so you're just putting words in my mouth at this point. Given the amount of work Andrew put in on this, I don't really feel like kicking him around. All that would do is demotivate the next person who picks up a rather large and thankless task. mcl From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 06:21:53 2009 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 10AC1106564A; Tue, 10 Mar 2009 06:21:53 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3D9E8FC19; Tue, 10 Mar 2009 06:21:52 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2A6LqfX049001; Tue, 10 Mar 2009 06:21:52 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2A6LqdZ049000; Tue, 10 Mar 2009 06:21:52 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200903100621.n2A6LqdZ049000@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 10 Mar 2009 06:21: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: r189611 - head/sys/dev/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: Tue, 10 Mar 2009 06:21:53 -0000 Author: marcel Date: Tue Mar 10 06:21:52 2009 New Revision: 189611 URL: http://svn.freebsd.org/changeset/base/189611 Log: Fix a buglet in revision 189401: when restoring a 64-bit BAR, write the upper 32-bits in the adjacent bar. The consequences of the buglet were severe enough though: a machine check. Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Tue Mar 10 02:12:03 2009 (r189610) +++ head/sys/dev/pci/pci.c Tue Mar 10 06:21:52 2009 (r189611) @@ -3464,7 +3464,7 @@ pci_alloc_map(device_t dev, device_t chi */ pci_write_config(child, *rid, map, 4); if (maprange == 64) - pci_write_config(child, *rid + 4, map, 4); + pci_write_config(child, *rid + 4, map >> 32, 4); pci_write_config(child, PCIR_COMMAND, cmd, 2); /* Ignore a BAR with a base of 0. */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 09:26:48 2009 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 CAB3E1065672; Tue, 10 Mar 2009 09:26:48 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 367348FC08; Tue, 10 Mar 2009 09:26:48 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 459E2EB51D5; Tue, 10 Mar 2009 11:03:14 +0200 (EET) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 49799450C6; Tue, 10 Mar 2009 11:03:14 +0200 (EET) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UPuYwyiLp6iR; Tue, 10 Mar 2009 11:03:14 +0200 (EET) Received: from kobe.laptop (ppp079166006185.dsl.hol.gr [79.166.6.185]) by mail.ceid.upatras.gr (Postfix) with ESMTP id AB99145088; Tue, 10 Mar 2009 11:03:13 +0200 (EET) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n2A93CiZ002704; Tue, 10 Mar 2009 11:03:12 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n2A93BFP002703; Tue, 10 Mar 2009 11:03:11 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Joe Marcus Clarke References: <200903081905.n28J5sFQ092475@svn.freebsd.org> Date: Tue, 10 Mar 2009 11:03:09 +0200 In-Reply-To: <200903081905.n28J5sFQ092475@svn.freebsd.org> (Joe Marcus Clarke's message of "Sun, 8 Mar 2009 19:05:54 +0000 (UTC)") Message-ID: <878wndeomq.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189539 - 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: Tue, 10 Mar 2009 09:26:49 -0000 On Sun, 8 Mar 2009 19:05:54 +0000 (UTC), Joe Marcus Clarke wrote: > Author: marcus (doc,ports committer) > Date: Sun Mar 8 19:05:53 2009 > New Revision: 189539 > URL: http://svn.freebsd.org/changeset/base/189539 > > Log: > Add a default implementation for VOP_VPTOCNP(9) which scans the parent > directory of a vnode to find a dirent with a matching file number. The > name from that dirent is then used to provide the component name. > > Note: if the initial vnode argument is not a directory itself, then > the default VOP_VPTOCNP(9) implementation still returns ENOENT. > > Reviewed by: kib > Approved by: kib > Tested by: pho I think this panics nullfs mounts. I have a kernel build from subversion changeset /head@189540 that panics instantly with: panic: vrele: negative ref cnt inside nullfs, every time I do something like: # mount -t nullfs /home/build/obj /usr/obj # mount -t nullfs /home/build/src /usr/src # cd /usr/src/usr.sbin/fwcontrol # make clean # make all The `make all' command never returns, and the resulting kgdb backtrace is something like: (kgdb) bt #0 doadump () at pcpu.h:246 #1 0xc063d4be in boot (howto=3D260) at /usr/src/sys/kern/kern_shutdown.c= :420 #2 0xc063d792 in panic (fmt=3DVariable "fmt" is not available. ) at /usr/src/sys/kern/kern_shutdown.c:576 #3 0xc06c8fb1 in vrele (vp=3D0xc8896648) at /usr/src/sys/kern/vfs_subr.c= :2191 #4 0xc6761610 in null_nodeget (mp=3D0xc674f000, lowervp=3D0xc8896648, vpp=3D0xe9081bf0) at /usr/src/sys/modules/nullfs/../../fs/nullfs/null_subr.c:204 #5 0xc6762601 in null_bypass (ap=3D0xe9081bdc) at /usr/src/sys/modules/nullfs/../../fs/nullfs/null_vnops.c:325 #6 0xc08d7173 in VOP_VPTOCNP_APV (vop=3D0xc6763240, a=3D0xe9081bdc) at vnode_if.c:2871 #7 0xc06b4e89 in vn_vptocnp (vp=3D0xe9081c24, bp=3D0xe9081c28, buf=3D0xc63ce000 "=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE= =AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE= =CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE= =90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90= =C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2= =AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD= =CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE= =AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE= =CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE= =AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE= =CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE= =90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90= =C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2= =AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD= =CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE= =AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE=CE=AE=CE=90=C2=AD=CE=AE= =CE=AE=CE=90=C2=AD=CE=AE"..., buflen=3D0xe9081c48) at vnode_if.h:1541 #8 0xc06b520a in vn_fullpath1 (td=3DVariable "td" is not available. ) at /usr/src/sys/kern/vfs_cache.c:1001 #9 0xc06b55a0 in kern___getcwd (td=3D0xc6de56c0, buf=3D0xbfbfddf6
, bufseg=3DUIO_USE= RSPACE, buflen=3D1024) at /usr/src/sys/kern/vfs_cache.c:795 #10 0xc06b5749 in __getcwd (td=3D0xc6de56c0, uap=3D0xe9081cf8) at /usr/src/sys/kern/vfs_cache.c:769 #11 0xc08cc973 in syscall (frame=3D0xe9081d38) at /usr/src/sys/i386/i386/trap.c:1076 ---Type to continue, or q to quit--- #12 0xc08b0eb0 in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception= .s:261 #13 0x00000033 in ?? () Previous frame inner to this frame (corrupt stack?) (kgdb) q root@kobe:/var/crash# exit exit From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 09:33:23 2009 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 861E3106564A; Tue, 10 Mar 2009 09:33:23 +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 738148FC08; Tue, 10 Mar 2009 09:33:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2A9XNFU052704; Tue, 10 Mar 2009 09:33:23 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2A9XNRj052701; Tue, 10 Mar 2009 09:33:23 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903100933.n2A9XNRj052701@svn.freebsd.org> From: Robert Watson Date: Tue, 10 Mar 2009 09:33: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: r189613 - head/tools/regression/usr.bin/pkill 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 Mar 2009 09:33:24 -0000 Author: rwatson Date: Tue Mar 10 09:33:22 2009 New Revision: 189613 URL: http://svn.freebsd.org/changeset/base/189613 Log: Rename files that collide on case-insensitive file systems by encoding colliding upper case letters as the lower case letter with a '_' in front. MFC after: 3 days Discussed with: ed Spotted by: Michael David Crawford Added: head/tools/regression/usr.bin/pkill/pgrep-_g.t (props changed) - copied unchanged from r189289, head/tools/regression/usr.bin/pkill/pgrep-G.t head/tools/regression/usr.bin/pkill/pgrep-_s.t (props changed) - copied unchanged from r189289, head/tools/regression/usr.bin/pkill/pgrep-S.t head/tools/regression/usr.bin/pkill/pkill-_g.t (props changed) - copied unchanged from r189289, head/tools/regression/usr.bin/pkill/pkill-G.t Deleted: head/tools/regression/usr.bin/pkill/pgrep-G.t head/tools/regression/usr.bin/pkill/pgrep-S.t head/tools/regression/usr.bin/pkill/pkill-G.t Copied: head/tools/regression/usr.bin/pkill/pgrep-_g.t (from r189289, head/tools/regression/usr.bin/pkill/pgrep-G.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/pkill/pgrep-_g.t Tue Mar 10 09:33:22 2009 (r189613, copy of r189289, head/tools/regression/usr.bin/pkill/pgrep-G.t) @@ -0,0 +1,38 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pgrep -G " +rgid=`id -gr` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -G $rgid $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +kill $chpid +rm -f $sleep + +name="pgrep -G " +rgid=`id -grn` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -G $rgid $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +kill $chpid +rm -f $sleep Copied: head/tools/regression/usr.bin/pkill/pgrep-_s.t (from r189289, head/tools/regression/usr.bin/pkill/pgrep-S.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/pkill/pgrep-_s.t Tue Mar 10 09:33:22 2009 (r189613, copy of r189289, head/tools/regression/usr.bin/pkill/pgrep-S.t) @@ -0,0 +1,20 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pgrep -S" +pid=`pgrep -Sx g_event` +if [ "$pid" = "2" ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +pid=`pgrep -x g_event` +if [ "$pid" != "2" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi Copied: head/tools/regression/usr.bin/pkill/pkill-_g.t (from r189289, head/tools/regression/usr.bin/pkill/pkill-G.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/pkill/pkill-_g.t Tue Mar 10 09:33:22 2009 (r189613, copy of r189289, head/tools/regression/usr.bin/pkill/pkill-G.t) @@ -0,0 +1,42 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pkill -G " +rgid=`id -gr` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -G $rgid $sleep +ec=$? +case $ec in +0) + echo "ok 1 - $name" + ;; +*) + echo "not ok 1 - $name" + ;; +esac +rm -f $sleep + +name="pkill -G " +rgid=`id -grn` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -G $rgid $sleep +ec=$? +case $ec in +0) + echo "ok 2 - $name" + ;; +*) + echo "not ok 2 - $name" + ;; +esac +rm -f $sleep From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 11:04:20 2009 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 089E710656D6; Tue, 10 Mar 2009 11:04:20 +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 EACD68FC1F; Tue, 10 Mar 2009 11:04:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AB4JCA060139; Tue, 10 Mar 2009 11:04:19 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AB4JYg060138; Tue, 10 Mar 2009 11:04:19 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903101104.n2AB4JYg060138@svn.freebsd.org> From: Robert Watson Date: Tue, 10 Mar 2009 11:04: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: r189615 - 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: Tue, 10 Mar 2009 11:04:20 -0000 Author: rwatson Date: Tue Mar 10 11:04:19 2009 New Revision: 189615 URL: http://svn.freebsd.org/changeset/base/189615 Log: Remove now-unused INP_UNMAPPABLEOPTS. MFC after: 3 days Discussed with: bz Modified: head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Tue Mar 10 10:59:30 2009 (r189614) +++ head/sys/netinet/in_pcb.h Tue Mar 10 11:04:19 2009 (r189615) @@ -433,8 +433,6 @@ void inp_4tuple_get(struct inpcb *inp, IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\ IN6P_MTU) -#define INP_UNMAPPABLEOPTS (IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR|\ - IN6P_TCLASS|IN6P_AUTOFLOWLABEL) /* for KAME src sync over BSD*'s */ #define IN6P_HIGHPORT INP_HIGHPORT From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 11:14:03 2009 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 D8F1A106566B; Tue, 10 Mar 2009 11:14:03 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7B498FC26; Tue, 10 Mar 2009 11:14:03 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ABE3nI060370; Tue, 10 Mar 2009 11:14:03 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ABE3Lm060369; Tue, 10 Mar 2009 11:14:03 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200903101114.n2ABE3Lm060369@svn.freebsd.org> From: Takahashi Yoshihiro Date: Tue, 10 Mar 2009 11: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: r189616 - 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: Tue, 10 Mar 2009 11:14:04 -0000 Author: nyan Date: Tue Mar 10 11:14:03 2009 New Revision: 189616 URL: http://svn.freebsd.org/changeset/base/189616 Log: Restore the return statement. It was accidentally removed by rev 188429. Modified: head/sys/geom/part/g_part_pc98.c Modified: head/sys/geom/part/g_part_pc98.c ============================================================================== --- head/sys/geom/part/g_part_pc98.c Tue Mar 10 11:04:19 2009 (r189615) +++ head/sys/geom/part/g_part_pc98.c Tue Mar 10 11:14:03 2009 (r189616) @@ -268,6 +268,7 @@ g_part_pc98_dumpconf(struct g_part_table entry = (struct g_part_pc98_entry *)baseentry; if (entry == NULL) { /* confxml: scheme information */ + return; } type = entry->ent.dp_mid + (entry->ent.dp_sid << 8); From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 11:28:55 2009 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 844A51065672; Tue, 10 Mar 2009 11:28:55 +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 715B58FC1B; Tue, 10 Mar 2009 11:28:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ABStvW060920; Tue, 10 Mar 2009 11:28:55 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ABSsvZ060914; Tue, 10 Mar 2009 11:28:54 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200903101128.n2ABSsvZ060914@svn.freebsd.org> From: Ed Schouten Date: Tue, 10 Mar 2009 11:28: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: r189617 - in head/sys: dev/syscons dev/syscons/teken pc98/cbus 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 Mar 2009 11:28:55 -0000 Author: ed Date: Tue Mar 10 11:28:54 2009 New Revision: 189617 URL: http://svn.freebsd.org/changeset/base/189617 Log: Make a 1:1 mapping between syscons stats and terminal emulators. After I imported libteken into the source tree, I noticed syscons didn't store the cursor position inside the terminal emulator, but inside the virtual terminal stat. This is not very useful, because when you implement more complex forms of line wrapping, you need to keep track of more state than just the cursor position. Because the kernel messages didn't share the same terminal emulator as ttyv0, this caused a lot of strange things, like kernel messages being misplaced and a missing notification to resize the terminal emulator for kernel messages never to be resized when using vidcontrol. This patch just removes kernel_console_ts and adds a special parameter to te_puts to determine whether messages should be printed using regular colors or the ones for kernel messages. Reported by: ache Tested by: nyan, garga (older version) Modified: head/sys/dev/syscons/scterm-teken.c head/sys/dev/syscons/syscons.c head/sys/dev/syscons/syscons.h head/sys/dev/syscons/teken/teken.c head/sys/dev/syscons/teken/teken.h head/sys/pc98/cbus/scterm-sck.c Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Tue Mar 10 11:14:03 2009 (r189616) +++ head/sys/dev/syscons/scterm-teken.c Tue Mar 10 11:28:54 2009 (r189617) @@ -153,12 +153,23 @@ scteken_term(scr_stat *scp, void **softc } static void -scteken_puts(scr_stat *scp, u_char *buf, int len) +scteken_puts(scr_stat *scp, u_char *buf, int len, int kernel) { teken_stat *ts = scp->ts; + teken_attr_t backup, kattr; scp->sc->write_in_progress++; - teken_input(&ts->ts_teken, buf, len); + if (kernel) { + /* Use special colors for kernel messages. */ + backup = *teken_get_curattr(&ts->ts_teken); + scteken_revattr(SC_KERNEL_CONS_ATTR, &kattr); + teken_set_curattr(&ts->ts_teken, &kattr); + teken_input(&ts->ts_teken, buf, len); + teken_set_curattr(&ts->ts_teken, &backup); + } else { + /* Print user messages with regular colors. */ + teken_input(&ts->ts_teken, buf, len); + } scp->sc->write_in_progress--; } Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Tue Mar 10 11:14:03 2009 (r189616) +++ head/sys/dev/syscons/syscons.c Tue Mar 10 11:28:54 2009 (r189617) @@ -95,16 +95,10 @@ static default_attr user_default = { SC_NORM_REV_ATTR, }; -static default_attr kernel_default = { - SC_KERNEL_CONS_ATTR, - SC_KERNEL_CONS_REV_ATTR, -}; - static int sc_console_unit = -1; static int sc_saver_keyb_only = 1; static scr_stat *sc_console; static struct consdev *sc_consptr; -static void *kernel_console_ts; static scr_stat main_console; static struct tty *main_devs[MAXCONS]; @@ -323,7 +317,7 @@ sctty_outwakeup(struct tty *tp) len = ttydisc_getc(tp, buf, sizeof buf); if (len == 0) break; - sc_puts(scp, buf, len); + sc_puts(scp, buf, len, 0); } } @@ -373,22 +367,8 @@ sc_attach_unit(int unit, int flags) /* assert(sc_console != NULL) */ flags |= SC_KERNEL_CONSOLE; scmeminit(NULL); - - scinit(unit, flags); - - if (sc_console->tsw->te_size > 0) { - /* assert(sc_console->ts != NULL); */ - kernel_console_ts = sc_console->ts; - sc_console->ts = malloc(sc_console->tsw->te_size, - M_DEVBUF, M_WAITOK); - bcopy(kernel_console_ts, sc_console->ts, sc_console->tsw->te_size); - (*sc_console->tsw->te_default_attr)(sc_console, - user_default.std_color, - user_default.rev_color); - } - } else { - scinit(unit, flags); } + scinit(unit, flags); sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE); sc->config = flags; @@ -1507,7 +1487,6 @@ sc_cnputc(struct consdev *cd, int c) { u_char buf[1]; scr_stat *scp = sc_console; - void *save; #ifndef SC_NO_HISTORY #if 0 struct tty *tp; @@ -1543,12 +1522,8 @@ sc_cnputc(struct consdev *cd, int c) } #endif /* !SC_NO_HISTORY */ - save = scp->ts; - if (kernel_console_ts != NULL) - scp->ts = kernel_console_ts; buf[0] = c; - sc_puts(scp, buf, 1); - scp->ts = save; + sc_puts(scp, buf, 1, 1); s = spltty(); /* block sckbdevent and scrn_timer */ sccnupdate(scp); @@ -2492,7 +2467,7 @@ exchange_scr(sc_softc_t *sc) } void -sc_puts(scr_stat *scp, u_char *buf, int len) +sc_puts(scr_stat *scp, u_char *buf, int len, int kernel) { int need_unlock = 0; @@ -2507,7 +2482,7 @@ sc_puts(scr_stat *scp, u_char *buf, int need_unlock = 1; mtx_lock_spin(&scp->scr_lock); } - (*scp->tsw->te_puts)(scp, buf, len); + (*scp->tsw->te_puts)(scp, buf, len, kernel); if (need_unlock) mtx_unlock_spin(&scp->scr_lock); } @@ -2754,8 +2729,8 @@ scinit(int unit, int flags) if (sc_init_emulator(scp, SC_DFLT_TERM)) sc_init_emulator(scp, "*"); (*scp->tsw->te_default_attr)(scp, - kernel_default.std_color, - kernel_default.rev_color); + user_default.std_color, + user_default.rev_color); } else { /* assert(sc_malloc) */ sc->dev = malloc(sizeof(struct tty *)*sc->vtys, M_DEVBUF, Modified: head/sys/dev/syscons/syscons.h ============================================================================== --- head/sys/dev/syscons/syscons.h Tue Mar 10 11:14:03 2009 (r189616) +++ head/sys/dev/syscons/syscons.h Tue Mar 10 11:28:54 2009 (r189617) @@ -368,7 +368,7 @@ typedef int sc_term_init_t(scr_stat *scp #define SC_TE_COLD_INIT 0 #define SC_TE_WARM_INIT 1 typedef int sc_term_term_t(scr_stat *scp, void **tcp); -typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len); +typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len, int kernel); typedef int sc_term_ioctl_t(scr_stat *scp, struct tty *tp, u_long cmd, caddr_t data, struct thread *td); typedef int sc_term_reset_t(scr_stat *scp, int code); @@ -553,7 +553,7 @@ void sc_save_font(scr_stat *scp, int pa void sc_show_font(scr_stat *scp, int page); void sc_touch_scrn_saver(void); -void sc_puts(scr_stat *scp, u_char *buf, int len); +void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel); void sc_draw_cursor_image(scr_stat *scp); void sc_remove_cursor_image(scr_stat *scp); void sc_set_cursor_image(scr_stat *scp); Modified: head/sys/dev/syscons/teken/teken.c ============================================================================== --- head/sys/dev/syscons/teken/teken.c Tue Mar 10 11:14:03 2009 (r189616) +++ head/sys/dev/syscons/teken/teken.c Tue Mar 10 11:28:54 2009 (r189617) @@ -336,6 +336,13 @@ teken_get_curattr(teken_t *t) return (&t->t_curattr); } +void +teken_set_curattr(teken_t *t, const teken_attr_t *a) +{ + + t->t_curattr = *a; +} + const teken_attr_t * teken_get_defattr(teken_t *t) { Modified: head/sys/dev/syscons/teken/teken.h ============================================================================== --- head/sys/dev/syscons/teken/teken.h Tue Mar 10 11:14:03 2009 (r189616) +++ head/sys/dev/syscons/teken/teken.h Tue Mar 10 11:28:54 2009 (r189617) @@ -174,6 +174,7 @@ void teken_input(teken_t *, const void * const teken_attr_t *teken_get_curattr(teken_t *); const teken_attr_t *teken_get_defattr(teken_t *); void teken_set_cursor(teken_t *, const teken_pos_t *); +void teken_set_curattr(teken_t *, const teken_attr_t *); void teken_set_defattr(teken_t *, const teken_attr_t *); void teken_set_winsize(teken_t *, const teken_pos_t *); Modified: head/sys/pc98/cbus/scterm-sck.c ============================================================================== --- head/sys/pc98/cbus/scterm-sck.c Tue Mar 10 11:14:03 2009 (r189616) +++ head/sys/pc98/cbus/scterm-sck.c Tue Mar 10 11:28:54 2009 (r189617) @@ -907,18 +907,24 @@ scterm_scan_esc(scr_stat *scp, term_stat } static void -scterm_puts(scr_stat *scp, u_char *buf, int len) +scterm_puts(scr_stat *scp, u_char *buf, int len, int kernel) { term_stat *tcp; u_char *ptr; #ifdef KANJI u_short kanji_code; #endif + color_t backup; tcp = scp->ts; ptr = buf; outloop: scp->sc->write_in_progress++; + backup = tcp->cur_color; + if (kernel) { + tcp->cur_color.fg = SC_KERNEL_CONS_ATTR & 0x0f; + tcp->cur_color.bg = (SC_KERNEL_CONS_ATTR >> 4) & 0x0f; + } if (tcp->esc) { scterm_scan_esc(scp, tcp, *ptr++); @@ -1101,6 +1107,8 @@ ascii_end: sc_term_gen_scroll(scp, scp->sc->scr_map[0x20], tcp->cur_attr); + if (kernel) + tcp->cur_color = backup; scp->sc->write_in_progress--; if (len) goto outloop; From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 11:46:42 2009 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 6E8F8106566B; Tue, 10 Mar 2009 11:46:42 +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 5D1318FC29; Tue, 10 Mar 2009 11:46:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ABkgxB061293; Tue, 10 Mar 2009 11:46:42 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ABkgSq061292; Tue, 10 Mar 2009 11:46:42 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903101146.n2ABkgSq061292@svn.freebsd.org> From: Robert Watson Date: Tue, 10 Mar 2009 11: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: r189618 - head/contrib/top 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 Mar 2009 11:46:43 -0000 Author: rwatson Date: Tue Mar 10 11:46:41 2009 New Revision: 189618 URL: http://svn.freebsd.org/changeset/base/189618 Log: Merge r183430 from vendor/top/dist to head/contrib/top, although with record-only mergeinfo because an automated merge is confused by the flattening that took place: Move install to install-sh to prevent name-clashes. MFC after: 3 days Added: head/contrib/top/install-sh (props changed) - copied unchanged from r189617, head/contrib/top/install Deleted: head/contrib/top/install Modified: head/contrib/top/ (props changed) Copied: head/contrib/top/install-sh (from r189617, head/contrib/top/install) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/top/install-sh Tue Mar 10 11:46:41 2009 (r189618, copy of r189617, head/contrib/top/install) @@ -0,0 +1,69 @@ +#!/bin/sh +# +# this shell script is amazingly similar to the old and lamented +# BSD "install" command. It recognized the following options: +# +# -o target file owner +# -m target file mode +# -g target file group owner +# +# +# scan the options +# +while [ $# -gt 0 ]; do + case $1 in + -o) + owner=$2 + shift ; shift + ;; + + -m) + mode=$2 + shift; shift + ;; + + -g) + group=$2 + shift ; shift + ;; + + -*) + echo "install: unknown option $1" + exit + ;; + + *) + break + ;; + esac +done +# +# we need two more: filename and destination +# +if [ $# -ne 2 ]; then + echo "Usage: install [ -o owner ] [ -m mode ] [ -g group ] file destination" + exit +fi +# +# first, copy +# +cp $1 $2 +# +# normalize the name +# +dest=$2 +if [ -d $2 ]; then + dest=$2/`basename $1` +fi +# +# do optional things +# +if [ "$owner" ]; then + chown $owner $dest +fi +if [ "$group" ]; then + chgrp $group $dest +fi +if [ "$mode" ]; then + chmod $mode $dest +fi From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 12:10:51 2009 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 3F45F1065704; Tue, 10 Mar 2009 12:10:51 +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 181F68FC1E; Tue, 10 Mar 2009 12:10:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ACApot061839; Tue, 10 Mar 2009 12:10:51 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ACApQ0061838; Tue, 10 Mar 2009 12:10:51 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903101210.n2ACApQ0061838@svn.freebsd.org> From: Warner Losh Date: Tue, 10 Mar 2009 12:10: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: r189619 - head/sys/dev/cardbus 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 Mar 2009 12:11:01 -0000 Author: imp Date: Tue Mar 10 12:10:50 2009 New Revision: 189619 URL: http://svn.freebsd.org/changeset/base/189619 Log: When freeing all the resources of the card, it is better to turn off the PORTEN and MEMEN bits in the command register than to zero the bars. Use pci_write_ivar directly instead of a one-line wrapper that adds no value. Track verbosity changes in pci. Remove a stray blank line. Modified: head/sys/dev/cardbus/cardbus.c Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Tue Mar 10 11:46:41 2009 (r189618) +++ head/sys/dev/cardbus/cardbus.c Tue Mar 10 12:10:50 2009 (r189619) @@ -221,7 +221,6 @@ cardbus_detach_card(device_t cbdev) if (device_get_children(cbdev, &devlist, &numdevs) != 0) return (ENOENT); - if (numdevs == 0) { free(devlist, M_TEMP); return (ENOENT); @@ -269,13 +268,16 @@ cardbus_driver_added(device_t cbdev, dri } if (i > 0 && i == numdevs) POWER_ENABLE_SOCKET(device_get_parent(cbdev), cbdev); - /* XXX Should I wait for power to become good? */ for (i = 0; i < numdevs; i++) { dev = devlist[i]; if (device_get_state(dev) != DS_NOTPRESENT) continue; dinfo = device_get_ivars(dev); pci_print_verbose(&dinfo->pci); + if (bootverbose) + printf("pci%d:%d:%d:%d: reprobing on driver added\n", + dinfo->pci.cfg.domain, dinfo->pci.cfg.bus, + dinfo->pci.cfg.slot, dinfo->pci.cfg.func); pci_cfg_restore(dinfo->pci.cfg.dev, &dinfo->pci); if (device_probe_and_attach(dev) != 0) pci_cfg_save(dev, &dinfo->pci, 1); @@ -287,6 +289,7 @@ static void cardbus_release_all_resources(device_t cbdev, struct cardbus_devinfo *dinfo) { struct resource_list_entry *rle; + device_t dev; /* Free all allocated resources */ STAILQ_FOREACH(rle, &dinfo->pci.resources, link) { @@ -294,15 +297,14 @@ cardbus_release_all_resources(device_t c BUS_RELEASE_RESOURCE(device_get_parent(cbdev), cbdev, rle->type, rle->rid, rle->res); rle->res = NULL; - /* - * zero out config so the card won't acknowledge - * access to the space anymore. XXX doesn't handle - * 64-bit bars. - */ - pci_write_config(dinfo->pci.cfg.dev, rle->rid, 0, 4); } } resource_list_free(&dinfo->pci.resources); + /* turn off the card's decoding now that the resources are done */ + dev = dinfo->pci.cfg.dev; + pci_write_config(dev, PCIR_COMMAND, + pci_read_config(dev, PCIR_COMMAND, 2) & + ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2); } /************************************************************************/ @@ -336,12 +338,6 @@ cardbus_read_ivar(device_t cbdev, device return 0; } -static int -cardbus_write_ivar(device_t cbdev, device_t child, int which, uintptr_t value) -{ - return(pci_write_ivar(cbdev, child, which, value)); -} - static device_method_t cardbus_methods[] = { /* Device interface */ DEVMETHOD(device_probe, cardbus_probe), @@ -352,7 +348,7 @@ static device_method_t cardbus_methods[] /* Bus interface */ DEVMETHOD(bus_read_ivar, cardbus_read_ivar), - DEVMETHOD(bus_write_ivar, cardbus_write_ivar), + DEVMETHOD(bus_write_ivar, pci_write_ivar), DEVMETHOD(bus_driver_added, cardbus_driver_added), /* Card Interface */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 13:13:46 2009 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 4B2A4106566B; Tue, 10 Mar 2009 13:13:46 +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 1B5158FC1D; Tue, 10 Mar 2009 13:13:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 88F6D46B58; Tue, 10 Mar 2009 09:13:45 -0400 (EDT) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n2ADDdl1026220; Tue, 10 Mar 2009 09:13:39 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Warner Losh Date: Tue, 10 Mar 2009 09:04:38 -0400 User-Agent: KMail/1.9.7 References: <200903101210.n2ACApQ0061838@svn.freebsd.org> In-Reply-To: <200903101210.n2ACApQ0061838@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903100904.38679.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 10 Mar 2009 09:13:39 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9084/Tue Mar 10 03:11:13 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189619 - head/sys/dev/cardbus 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 Mar 2009 13:13:46 -0000 On Tuesday 10 March 2009 8:10:50 am Warner Losh wrote: > Author: imp > Date: Tue Mar 10 12:10:50 2009 > New Revision: 189619 > URL: http://svn.freebsd.org/changeset/base/189619 > > Log: > When freeing all the resources of the card, it is better to turn off > the PORTEN and MEMEN bits in the command register than to zero the > bars. > > Modified: > head/sys/dev/cardbus/cardbus.c > > Modified: head/sys/dev/cardbus/cardbus.c > ============================================================================== > --- head/sys/dev/cardbus/cardbus.c Tue Mar 10 11:46:41 2009 (r189618) > +++ head/sys/dev/cardbus/cardbus.c Tue Mar 10 12:10:50 2009 (r189619) > @@ -287,6 +289,7 @@ static void > cardbus_release_all_resources(device_t cbdev, struct cardbus_devinfo *dinfo) > { > struct resource_list_entry *rle; > + device_t dev; > > /* Free all allocated resources */ > STAILQ_FOREACH(rle, &dinfo->pci.resources, link) { > @@ -294,15 +297,14 @@ cardbus_release_all_resources(device_t c > BUS_RELEASE_RESOURCE(device_get_parent(cbdev), > cbdev, rle->type, rle->rid, rle->res); > rle->res = NULL; > - /* > - * zero out config so the card won't acknowledge > - * access to the space anymore. XXX doesn't handle > - * 64-bit bars. > - */ > - pci_write_config(dinfo->pci.cfg.dev, rle->rid, 0, 4); > } > } > resource_list_free(&dinfo->pci.resources); > + /* turn off the card's decoding now that the resources are done */ > + dev = dinfo->pci.cfg.dev; > + pci_write_config(dev, PCIR_COMMAND, > + pci_read_config(dev, PCIR_COMMAND, 2) & > + ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2); > } It might be best to do this before releasing the resources rather than afterwards. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 14:28:19 2009 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 9F666106564A; Tue, 10 Mar 2009 14:28:19 +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 8EC278FC25; Tue, 10 Mar 2009 14:28:19 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AESJPP064488; Tue, 10 Mar 2009 14:28:19 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AESJ7m064487; Tue, 10 Mar 2009 14:28:19 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <200903101428.n2AESJ7m064487@svn.freebsd.org> From: "Christian S.J. Peron" Date: Tue, 10 Mar 2009 14:28: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: r189620 - 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 Mar 2009 14:28:20 -0000 Author: csjp Date: Tue Mar 10 14:28:19 2009 New Revision: 189620 URL: http://svn.freebsd.org/changeset/base/189620 Log: Disable zerocopy by default for now. It's causing some problems in pcap consumers which fork after the shared pages have been setup. pflogd(8) is an example. The problem is understood and there is a fix coming in shortly. Folks who want to continue using it can do so by setting net.bpf.zerocopy_enable to 1. Discussed with: rwatson Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Tue Mar 10 12:10:50 2009 (r189619) +++ head/sys/net/bpf.c Tue Mar 10 14:28:19 2009 (r189620) @@ -124,7 +124,7 @@ SYSCTL_NODE(_net, OID_AUTO, bpf, CTLFLAG int bpf_maxinsns = BPF_MAXINSNS; SYSCTL_INT(_net_bpf, OID_AUTO, maxinsns, CTLFLAG_RW, &bpf_maxinsns, 0, "Maximum bpf program instructions"); -static int bpf_zerocopy_enable = 1; +static int bpf_zerocopy_enable = 0; SYSCTL_INT(_net_bpf, OID_AUTO, zerocopy_enable, CTLFLAG_RW, &bpf_zerocopy_enable, 0, "Enable new zero-copy BPF buffer sessions"); SYSCTL_NODE(_net_bpf, OID_AUTO, stats, CTLFLAG_MPSAFE | CTLFLAG_RW, From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 14:29:34 2009 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 C080D1065676; Tue, 10 Mar 2009 14:29:34 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFE3D8FC22; Tue, 10 Mar 2009 14:29:34 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AETYNI064547; Tue, 10 Mar 2009 14:29:34 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AETYuY064546; Tue, 10 Mar 2009 14:29:34 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903101429.n2AETYuY064546@svn.freebsd.org> From: Andrew Thompson Date: Tue, 10 Mar 2009 14:29: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: r189621 - head/lib/libusb 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 Mar 2009 14:29:35 -0000 Author: thompsa Date: Tue Mar 10 14:29:34 2009 New Revision: 189621 URL: http://svn.freebsd.org/changeset/base/189621 Log: Be compatible with LibUSB from sourceforge and close the handle after reset Submitted by: Hans Petter Selasky Modified: head/lib/libusb/libusb20_compat01.c Modified: head/lib/libusb/libusb20_compat01.c ============================================================================== --- head/lib/libusb/libusb20_compat01.c Tue Mar 10 14:28:19 2009 (r189620) +++ head/lib/libusb/libusb20_compat01.c Tue Mar 10 14:29:34 2009 (r189621) @@ -816,7 +816,11 @@ usb_reset(usb_dev_handle * dev) if (err) return (-1); - return (0); + /* + * Be compatible with LibUSB from sourceforge and close the + * handle after reset! + */ + return (usb_close(dev)); } const char * From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 14:35:22 2009 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 520F9106566B; Tue, 10 Mar 2009 14:35:22 +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 41BA08FC17; Tue, 10 Mar 2009 14:35:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AEZMti064724; Tue, 10 Mar 2009 14:35:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AEZMGB064723; Tue, 10 Mar 2009 14:35:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903101435.n2AEZMGB064723@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 10 Mar 2009 14:35: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: r189622 - head/sys/fs/nullfs 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 Mar 2009 14:35:22 -0000 Author: kib Date: Tue Mar 10 14:35:21 2009 New Revision: 189622 URL: http://svn.freebsd.org/changeset/base/189622 Log: Do not use bypass for vop_vptocnp() from nullfs, call standard implementation instead. The bypass does not assume that returned vnode is only held. Reported by: Paul B. Mahol , pluknet Reviewed by: jhb Tested by: pho, pluknet Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Tue Mar 10 14:29:34 2009 (r189621) +++ head/sys/fs/nullfs/null_vnops.c Tue Mar 10 14:35:21 2009 (r189622) @@ -742,5 +742,6 @@ struct vop_vector null_vnodeops = { .vop_setattr = null_setattr, .vop_strategy = VOP_EOPNOTSUPP, .vop_unlock = null_unlock, + .vop_vptocnp = vop_stdvptocnp, .vop_vptofh = null_vptofh, }; From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 14:52:17 2009 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 C1A28106566B; Tue, 10 Mar 2009 14:52:17 +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 AE5C78FC0C; Tue, 10 Mar 2009 14:52:17 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AEqHZu065113; Tue, 10 Mar 2009 14:52:17 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AEqHZ5065106; Tue, 10 Mar 2009 14:52:17 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903101452.n2AEqHZ5065106@svn.freebsd.org> From: Robert Watson Date: Tue, 10 Mar 2009 14:52: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: r189623 - head/tools/tools/netrate/tcpp 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 Mar 2009 14:52:18 -0000 Author: rwatson Date: Tue Mar 10 14:52:17 2009 New Revision: 189623 URL: http://svn.freebsd.org/changeset/base/189623 Log: Add tcpp -- TCP parallelism microbenchmark. This tool creates large numbers of TCP connections, each of which will transmit a fixed amount of data, between client and server hosts. tcpp can use multiple workers (typically up to the number of hardware cores), and can use multiple source IPs in order to use an expanded port/IP 4-tuple space to avoid problems from reusing 4-tuples too quickly. Aggregate bandwidth use will be reported after a client run. While by no means a perfect tool, it has proven quite useful in generating and optimizing TCP stack lock contention by easily generating high-intensity workloads. It also proves surprisingly good at finding device driver bugs. Added: head/tools/tools/netrate/tcpp/ head/tools/tools/netrate/tcpp/Makefile (contents, props changed) head/tools/tools/netrate/tcpp/README (contents, props changed) head/tools/tools/netrate/tcpp/tcpp.c (contents, props changed) head/tools/tools/netrate/tcpp/tcpp.h (contents, props changed) head/tools/tools/netrate/tcpp/tcpp_client.c (contents, props changed) head/tools/tools/netrate/tcpp/tcpp_server.c (contents, props changed) head/tools/tools/netrate/tcpp/tcpp_util.c (contents, props changed) Added: head/tools/tools/netrate/tcpp/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/netrate/tcpp/Makefile Tue Mar 10 14:52:17 2009 (r189623) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG= tcpp +INCS= tcpp.h +NO_MAN= +SRCS= tcpp.c tcpp_client.c tcpp_server.c tcpp_util.c +WARNS= 3 + +.include Added: head/tools/tools/netrate/tcpp/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/netrate/tcpp/README Tue Mar 10 14:52:17 2009 (r189623) @@ -0,0 +1,99 @@ +tcpp -- Parallel TCP Exercise Tool + +This is a new tool, and is rife with bugs. However, it appears to create +even more problems for device drivers and the kernel, so that's OK. + +This tool generates large numbers of TCP connections and stuffs lots of data +into them. One binary encapsulates both a client and a server. Each of the +client and the server generates a certain number of worker processes, each of +which in turn uses its own TCP port. The number of server processes must be +>= the number of client processes, or some of the ports required by the +client won't have a listener. The client then proceeds to make connections +and send data to the server. Each worker multiplexes many connections at +once, up to a maximum parallelism limit. The client can use one or many IP +addresses, in order to make more 4-tuples available for testing, and will +automatically spread the load of new connections across available source +addresses. + +You will need to retune your TCP stack for high volume, see Configuration +Notes below. + +The server has very little to configure, use the following command line +flags: + + -s Select server mode + -p Number of workers, should be >= client -p arg + -r Non-default base TCP port, should match client + -T Print CPU usage every ten seconds + -m Maximum simultaneous connections/proc, should + be >= client setting. + +Typical use: + + ./tcpp -s -p 4 -m 1000000 + +This selects server mode, four workers, and at most 1 million TCP connections +per worker at a time. + +The client has more to configure, with the following flags: + + -c Select client mode, and specific dest IP + -C Print connections/second instead of GBps + -M Number of sequential local IPs to use; req. -l + -T Include CPU use summary in stats at end of run + -b Data bytes per connection + -l Starting local IP address to bind + -m Max simultaneous conn/worker (see server -m) + -p Number of workers, should be <= server -p + -r Non-default base TCP port, should match server + -t How many connections to use per worker + +Typical use: + + ./tcpp -c 192.168.100.201 -p 4 -t 100000 -m 10000 -b 100000 \ + -l 192.168.100.101 -M 4 + +This creates four workers, each of which will (over its lifetime) set up and +use 100,000 TCP connections carrying 100K of data, up to 10,000 simultaneous +connection at any given moment. tcpp will use four source IP addresses, +starting with 192.168.100.101, and all connections will be to the single +destination IP of 192.168.100.201. + +Having (p) <= the number of cores is advisable. When multiple IPs are used +on the client, they will be sequential starting with the localIPbase set with +-l. + +Known Issues +------------ + +The bandwidth estimate doesn't handle failures well. It also has serious +rounding errors and probably conceptual problems. + +It's not clear that kevent() is "fair" to multiple connections. + +Rather than passing the length for each connection, we might want to pass +it once with a control connection up front. On the other hand, the server +is quite dumb right now, so we could take advantage of this to do size +mixes. + +Configuration Notes +------------------- + +In my testing, I use sysctl.conf entries of: + +net.inet.ip.portrange.first=100 +kern.ipc.maxsockets=1000000 +net.inet.tcp.maxtcptw=3000000 +kern.ipc.somaxconn=49152 + +# For running !multiq, do this before loading the driver: +kenv hw.cxgb.singleq="1" + +kldload if_cxgb + +# Consider turning off TSO and/or adjusting the MTU for some scenarios: +ifconfig cxgb0 -tso +ifconfig cxgb0 mtu 1500 + + +$FreeBSD$ Added: head/tools/tools/netrate/tcpp/tcpp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/netrate/tcpp/tcpp.c Tue Mar 10 14:52:17 2009 (r189623) @@ -0,0 +1,204 @@ +/*- + * Copyright (c) 2008-2009 Robert N. M. Watson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "tcpp.h" + +#define BYTES_DEFAULT 10*1024*1024 /* Data per connection. */ +#define MAXTCPS_DEFAULT 32 /* Number of TCPs at a time per proc. */ +#define PROCS_DEFAULT 1 /* Processes used in run. */ +#define TCPS_DEFAULT 1 /* Number of connections per process. */ +#define BASEPORT_DEFAULT 10000 + +struct sockaddr_in remoteip; /* Base target address. */ +struct sockaddr_in localipbase; /* Base local address, if -l. */ +int cflag, lflag, mflag, pflag, sflag, tflag, Cflag, Mflag, Tflag; +uint64_t bflag; +u_short rflag; + +static void +usage(void) +{ + + fprintf(stderr, "client: tcpp" + " -c remoteIP" + " [-CT]" + " [-M localIPcount]" + " [-l localIPbase]" + " [-b bytespertcp]" + " [-m maxtcpsatonce]" + "\n" + "\t" + " [-p procs]" + " [-t tcpsperproc]" + " [-r baseport]" + "\n"); + + fprintf(stderr, "server: tcpp" + " -s" + " [-T]" + " [-l localIPbase]" + " [-m maxtcpsatonce]" + " [-p procs]" + " [-r baseport]" + "\n"); + exit(EX_USAGE); +} + +int +main(int argc, char *argv[]) +{ + long long ll; + char *dummy; + int ch; + + bzero(&localipbase, sizeof(localipbase)); + localipbase.sin_len = sizeof(localipbase); + localipbase.sin_family = AF_INET; + localipbase.sin_addr.s_addr = htonl(INADDR_ANY); /* Default. */ + localipbase.sin_port = htons(0); /* Default. */ + + bzero(&remoteip, sizeof(remoteip)); + remoteip.sin_len = sizeof(remoteip); + remoteip.sin_family = AF_INET; + remoteip.sin_addr.s_addr = htonl(INADDR_LOOPBACK); /* Default. */ + remoteip.sin_port = htons(0); /* Default. */ + + bflag = BYTES_DEFAULT; + mflag = MAXTCPS_DEFAULT; + pflag = PROCS_DEFAULT; + rflag = BASEPORT_DEFAULT; + tflag = TCPS_DEFAULT; + Mflag = 1; + while ((ch = getopt(argc, argv, "b:c:l:m:p:r:st:CM:T")) != -1) { + switch (ch) { + case 'b': + ll = strtoll(optarg, &dummy, 10); + if (*dummy != '\0' || ll <= 0) + usage(); + bflag = ll; + break; + + case 'c': + cflag++; + if (inet_aton(optarg, &remoteip.sin_addr) != 1) + err(-1, "inet_aton: %s", optarg); + break; + + case 'l': + lflag++; + if (inet_aton(optarg, &localipbase.sin_addr) != 1) + err(-1, "inet_aton: %s", optarg); + break; + + case 'm': + ll = strtoll(optarg, &dummy, 10); + if (*dummy != '\0' || ll <= 0) + usage(); + mflag = ll; + break; + + case 'p': + ll = strtoll(optarg, &dummy, 10); + if (*dummy != '\0' || ll <= 0) + usage(); + pflag = ll; + break; + + case 'r': + ll = strtol(optarg, &dummy, 10); + if (*dummy != '\0' || ll < 1 || ll > 65535) + usage(); + rflag = ll; + break; + + case 's': + sflag++; + break; + + case 't': + ll = strtoll(optarg, &dummy, 10); + if (*dummy != '\0' || ll <= 0) + usage(); + tflag = ll; + break; + + case 'C': + Cflag++; + break; + + case 'M': + ll = strtoll(optarg, &dummy, 10); + if (*dummy != '\0' || ll <= 1) + usage(); + Mflag = ll; + break; + + case 'T': + Tflag++; + break; + + default: + usage(); + } + } + + /* Exactly one of client and server. */ + if (cflag > 1 || sflag > 1) + usage(); + if ((cflag && sflag) || (!cflag && !sflag)) + usage(); + + /* If Mflag is specified, we must have the lflag for a local IP. */ + if (Mflag > 1 && !lflag) + usage(); + + /* Several flags are valid only on the client, disallow if server. */ + if (sflag && (Cflag || Mflag > 1)) + usage(); + + if (cflag) + tcpp_client(); + else + tcpp_server(); + exit(0); +} Added: head/tools/tools/netrate/tcpp/tcpp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/netrate/tcpp/tcpp.h Tue Mar 10 14:52:17 2009 (r189623) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2008-2009 Robert N. M. Watson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef TCPP_H +#define TCPP_H + +extern struct sockaddr_in localipbase, remoteip; +extern int cflag, lflag, mflag, pflag, sflag, tflag; +extern int Cflag, Iflag, Mflag, Tflag; +extern uint64_t bflag; +extern u_short rflag; + +#define TCPP_MAGIC 0x84e812f7 +struct tcpp_header { + u_int32_t th_magic; + u_int64_t th_len; +} __packed; + +void tcpp_client(void); +void tcpp_header_encode(struct tcpp_header *thp); +void tcpp_header_decode(struct tcpp_header *thp); +void tcpp_server(void); + +#define SYSCTLNAME_CPUS "kern.smp.cpus" +#define SYSCTLNAME_CPTIME "kern.cp_time" + +#endif /* TCPP_H */ Added: head/tools/tools/netrate/tcpp/tcpp_client.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/netrate/tcpp/tcpp_client.c Tue Mar 10 14:52:17 2009 (r189623) @@ -0,0 +1,346 @@ +/*- + * Copyright (c) 2008-2009 Robert N. M. Watson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tcpp.h" + +#define min(x, y) (x < y ? x : y) + +#define timespecsub(vvp, uvp) \ + do { \ + (vvp)->tv_sec -= (uvp)->tv_sec; \ + (vvp)->tv_nsec -= (uvp)->tv_nsec; \ + if ((vvp)->tv_nsec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_nsec += 1000000000; \ + } \ + } while (0) + + +/* + * Gist of each client worker: build up to mflag connections at a time, and + * pump data in to them somewhat fairly until tflag connections have been + * completed. + */ +#define CONNECTION_MAGIC 0x87a3f56e +struct connection { + uint32_t conn_magic; /* Just magic. */ + int conn_fd; + struct tcpp_header conn_header; /* Header buffer. */ + u_int conn_header_sent; /* Header bytes sent. */ + u_int64_t conn_data_sent; /* Data bytes sent.*/ +}; + +static u_char buffer[256 * 1024]; /* Buffer to send. */ +static pid_t *pid_list; +static int kq; +static int started; /* Number started so far. */ +static int finished; /* Number finished so far. */ +static int counter; /* IP number offset. */ + +static struct connection * +tcpp_client_newconn(void) +{ + struct sockaddr_in sin; + struct connection *conn; + struct kevent kev; + int fd, i; + + /* + * Spread load over available IPs, roating through them as we go. No + * attempt to localize IPs to particular workers. + */ + sin = localipbase; + sin.sin_addr.s_addr = htonl(ntohl(localipbase.sin_addr.s_addr) + + (counter++ % Mflag)); + + fd = socket(PF_INET, SOCK_STREAM, 0); + if (fd < 0) + err(-1, "socket"); + + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) + err(-1, "fcntl"); + + i = 1; + if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof(i)) < 0) + err(-1, "setsockopt"); +#if 0 + i = 1; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i)) < 0) + err(-1, "setsockopt"); +#endif + + if (lflag) { + if (bind(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) + err(-1, "bind"); + } + + if (connect(fd, (struct sockaddr *)&remoteip, sizeof(remoteip)) < 0 && + errno != EINPROGRESS) + err(-1, "connect"); + + conn = malloc(sizeof(*conn)); + if (conn == NULL) + return (NULL); + bzero(conn, sizeof(*conn)); + conn->conn_magic = CONNECTION_MAGIC; + conn->conn_fd = fd; + conn->conn_header.th_magic = TCPP_MAGIC; + conn->conn_header.th_len = bflag; + tcpp_header_encode(&conn->conn_header); + + EV_SET(&kev, fd, EVFILT_WRITE, EV_ADD, 0, 0, conn); + if (kevent(kq, &kev, 1, NULL, 0, NULL) < 0) + err(-1, "newconn kevent"); + + started++; + return (conn); +} + +static void +tcpp_client_closeconn(struct connection *conn) +{ + + close(conn->conn_fd); + bzero(conn, sizeof(*conn)); + free(conn); + finished++; +} + +static void +tcpp_client_handleconn(struct kevent *kev) +{ + struct connection *conn; + ssize_t len; + + conn = kev->udata; + if (conn->conn_magic != CONNECTION_MAGIC) + errx(-1, "tcpp_client_handleconn: magic"); + + if (conn->conn_header_sent < sizeof(conn->conn_header)) { + len = write(conn->conn_fd, ((u_char *)&conn->conn_header) + + conn->conn_header_sent, sizeof(conn->conn_header) - + conn->conn_header_sent); + if (len < 0) { + tcpp_client_closeconn(conn); + err(-1, "tcpp_client_handleconn: header write"); + } + if (len == 0) { + tcpp_client_closeconn(conn); + errx(-1, "tcpp_client_handleconn: header write " + "premature EOF"); + } + conn->conn_header_sent += len; + } else { + len = write(conn->conn_fd, buffer, min(sizeof(buffer), + bflag - conn->conn_data_sent)); + if (len < 0) { + tcpp_client_closeconn(conn); + err(-1, "tcpp_client_handleconn: data write"); + } + if (len == 0) { + tcpp_client_closeconn(conn); + errx(-1, "tcpp_client_handleconn: data write: " + "premature EOF"); + } + conn->conn_data_sent += len; + if (conn->conn_data_sent >= bflag) { + /* + * All is well. + */ + tcpp_client_closeconn(conn); + } + } +} + +static void +tcpp_client_worker(int workernum) +{ + struct kevent *kev_array; + int i, numevents, kev_bytes; +#if defined(CPU_SETSIZE) && 0 + cpu_set_t mask; + int ncpus; + size_t len; + + len = sizeof(ncpus); + if (sysctlbyname(SYSCTLNAME_CPUS, &ncpus, &len, NULL, 0) < 0) + err(-1, "sysctlbyname: %s", SYSCTLNAME_CPUS); + if (len != sizeof(ncpus)) + errx(-1, "sysctlbyname: %s: len %jd", SYSCTLNAME_CPUS, + (intmax_t)len); + + CPU_ZERO(&mask); + CPU_SET(workernum % ncpus, &mask); + if (sched_setaffinity(0, CPU_SETSIZE, &mask) < 0) + err(-1, "sched_setaffinity"); +#endif + setproctitle("tcpp_client %d", workernum); + + /* + * Add the worker number to the remote port. + */ + remoteip.sin_port = htons(rflag + workernum); + + kev_bytes = sizeof(*kev_array) * mflag; + kev_array = malloc(kev_bytes); + if (kev_array == NULL) + err(-1, "malloc"); + bzero(kev_array, kev_bytes); + + kq = kqueue(); + if (kq < 0) + err(-1, "kqueue"); + + while (finished < tflag) { + while ((started - finished < mflag) && (started < tflag)) + (void)tcpp_client_newconn(); + numevents = kevent(kq, NULL, 0, kev_array, mflag, NULL); + if (numevents < 0) + err(-1, "kevent"); + if (numevents > mflag) + errx(-1, "kevent: %d", numevents); + for (i = 0; i < numevents; i++) + tcpp_client_handleconn(&kev_array[i]); + } + /* printf("Worker %d done - %d finished\n", workernum, finished); */ +} + +void +tcpp_client(void) +{ + struct timespec ts_start, ts_finish; + long cp_time_start[CPUSTATES], cp_time_finish[CPUSTATES]; + long ticks; + size_t size; + pid_t pid; + int i, failed, status; + + pid_list = malloc(sizeof(*pid_list) * pflag); + if (pid_list == NULL) + err(-1, "malloc pid_list"); + bzero(pid_list, sizeof(*pid_list) * pflag); + + /* + * Start workers. + */ + size = sizeof(cp_time_start); + if (sysctlbyname(SYSCTLNAME_CPTIME, &cp_time_start, &size, NULL, 0) + < 0) + err(-1, "sysctlbyname: %s", SYSCTLNAME_CPTIME); + if (clock_gettime(CLOCK_REALTIME, &ts_start) < 0) + err(-1, "clock_gettime"); + for (i = 0; i < pflag; i++) { + pid = fork(); + if (pid < 0) { + warn("fork"); + for (i = 0; i < pflag; i++) { + if (pid_list[i] != 0) + (void)kill(pid_list[i], SIGKILL); + } + exit(-1); + } + if (pid == 0) { + tcpp_client_worker(i); + exit(0); + } + pid_list[i] = pid; + } + + /* + * GC workers. + */ + failed = 0; + for (i = 0; i < pflag; i++) { + if (pid_list[i] != 0) { + while (waitpid(pid_list[i], &status, 0) != pid_list[i]); + if (WEXITSTATUS(status) != 0) + failed = 1; + } + } + if (clock_gettime(CLOCK_REALTIME, &ts_finish) < 0) + err(-1, "clock_gettime"); + size = sizeof(cp_time_finish); + if (sysctlbyname(SYSCTLNAME_CPTIME, &cp_time_finish, &size, NULL, 0) + < 0) + err(-1, "sysctlbyname: %s", SYSCTLNAME_CPTIME); + timespecsub(&ts_finish, &ts_start); + + if (failed) + errx(-1, "Too many errors"); + + printf("%jd bytes transferred in %jd.%09jd seconds\n", + (bflag * tflag * pflag), (intmax_t)ts_finish.tv_sec, + (intmax_t)(ts_finish.tv_nsec)); + + if (Tflag) + printf("%d procs ", pflag); + if (Cflag) { + printf("%f cps%s", (double)(pflag * tflag)/ + (ts_finish.tv_sec + ts_finish.tv_nsec * 1e-9), + Tflag ? " " : "\n"); + } else { + printf("%f Gbps%s", (double)(bflag * tflag * pflag * 8) / + (ts_finish.tv_sec + ts_finish.tv_nsec * 1e-9) * 1e-9, + Tflag ? " " : "\n"); + } + if (Tflag) { + ticks = 0; + for (i = 0; i < CPUSTATES; i++) { + cp_time_finish[i] -= cp_time_start[i]; + ticks += cp_time_finish[i]; + } + printf("user%% %lu nice%% %lu sys%% %lu intr%% %lu " + "idle%% %lu\n", + (100 * cp_time_finish[CP_USER]) / ticks, + (100 * cp_time_finish[CP_NICE]) / ticks, + (100 * cp_time_finish[CP_SYS]) / ticks, + (100 * cp_time_finish[CP_INTR]) / ticks, + (100 * cp_time_finish[CP_IDLE]) / ticks); + } +} Added: head/tools/tools/netrate/tcpp/tcpp_server.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/netrate/tcpp/tcpp_server.c Tue Mar 10 14:52:17 2009 (r189623) @@ -0,0 +1,340 @@ +/*- + * Copyright (c) 2008-2009 Robert N. M. Watson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tcpp.h" + +/* + * Server side -- create a pool of processes, each listening on its own TCP + * port number for new connections. The first 8 bytes of each connection + * will be a network byte order length, then there will be that number of + * bytes of data. We use non-blocking sockets with kqueue to to avoid the + * overhead of threading or more than one process per processor, which makes + * things a bit awkward when dealing with data we care about. As such, we + * read into a small character buffer which we then convert to a length once + * we have all the data. + */ +#define CONNECTION_MAGIC 0x6392af27 +struct connection { + uint32_t conn_magic; /* Just magic. */ + int conn_fd; + struct tcpp_header conn_header; /* Header buffer. */ + u_int conn_header_len; /* Bytes so far. */ + u_int64_t conn_data_len; /* How much to sink. */ + u_int64_t conn_data_received; /* How much so far. */ +}; + +static pid_t *pid_list; +static int kq; + +static struct connection * +tcpp_server_newconn(int listen_fd) +{ + struct connection *conn; + struct kevent kev; + int fd; + + fd = accept(listen_fd, NULL, NULL); + if (fd < 0) { + warn("accept"); + return (NULL); + } + + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) + err(-1, "fcntl"); + + conn = malloc(sizeof(*conn)); + if (conn == NULL) + return (NULL); + bzero(conn, sizeof(*conn)); + conn->conn_magic = CONNECTION_MAGIC; + conn->conn_fd = fd; + + /* + * Register to read on the socket, and set our conn pointer as the + * udata so we can find it quickly in the future. + */ + EV_SET(&kev, fd, EVFILT_READ, EV_ADD, 0, 0, conn); + if (kevent(kq, &kev, 1, NULL, 0, NULL) < 0) + err(-1, "kevent"); + + return (conn); +} + +static void +tcpp_server_closeconn(struct connection *conn) +{ + + /* + * Kqueue cleans up after itself once we close the socket, and since + * we are processing only one kevent at a time, we don't need to + * worry about watching out for future kevents referring to it. + * + * ... right? + */ + close(conn->conn_fd); + bzero(conn, sizeof(*conn)); + free(conn); +} + +static u_char buffer[256*1024]; /* Buffer in which to sink data. */ +static void +tcpp_server_handleconn(struct kevent *kev) +{ + struct connection *conn; + ssize_t len; + + conn = kev->udata; + if (conn->conn_magic != CONNECTION_MAGIC) + errx(-1, "tcpp_server_handleconn: magic"); + + if (conn->conn_header_len < sizeof(conn->conn_header)) { + len = read(conn->conn_fd, + ((u_char *)&conn->conn_header) + conn->conn_header_len, + sizeof(conn->conn_header) - conn->conn_header_len); + if (len < 0) { + warn("tcpp_server_handleconn: header read"); + tcpp_server_closeconn(conn); + return; + } + if (len == 0) { + warnx("tcpp_server_handleconn: header premature eof"); + tcpp_server_closeconn(conn); + return; + } + conn->conn_header_len += len; + if (conn->conn_header_len == sizeof(conn->conn_header)) { + tcpp_header_decode(&conn->conn_header); + if (conn->conn_header.th_magic != TCPP_MAGIC) { + warnx("tcpp_server_handleconn: bad magic"); + tcpp_server_closeconn(conn); + return; + } + } + } else { + /* + * Drain up to a buffer from the connection, so that we pay + * attention to other connections too. + */ + len = read(conn->conn_fd, buffer, sizeof(buffer)); + if (len < 0) { + warn("tcpp_server_handleconn: data bad read"); + tcpp_server_closeconn(conn); + return; + } + if (len == 0 && conn->conn_data_received < + conn->conn_header.th_len) { + warnx("tcpp_server_handleconn: data premature eof"); + tcpp_server_closeconn(conn); + return; + } + conn->conn_data_received += len; + if (conn->conn_data_received > conn->conn_header.th_len) { + warnx("tcpp_server_handleconn: too much data"); + tcpp_server_closeconn(conn); + return; + } + if (conn->conn_data_received == conn->conn_header.th_len) { + /* + * All is well. + */ + tcpp_server_closeconn(conn); + return; + } + } +} + +static void +tcpp_server_worker(int workernum) +{ + int i, listen_sock, numevents; + struct kevent kev, *kev_array; + int kev_bytes; +#if defined(CPU_SETSIZE) && 0 + cpu_set_t mask; + int ncpus; + ssize_t len; + + len = sizeof(ncpus); + if (sysctlbyname(SYSCTLNAME_CPUS, &ncpus, &len, NULL, 0) < 0) + err(-1, "sysctlbyname: %s", SYSCTLNAME_CPUS); + if (len != sizeof(ncpus)) + errx(-1, "sysctlbyname: %s: len %jd", SYSCTLNAME_CPUS, + (intmax_t)len); + + CPU_ZERO(&mask); + CPU_SET(workernum % ncpus, &mask); + if (sched_setaffinity(0, CPU_SETSIZE, &mask) < 0) + err(-1, "sched_setaffinity"); +#endif + setproctitle("tcpp_server %d", workernum); + + /* Allow an extra kevent for the listen socket. */ + kev_bytes = sizeof(*kev_array) * (mflag + 1); + kev_array = malloc(kev_bytes); + if (kev_array == NULL) + err(-1, "malloc"); + bzero(kev_array, kev_bytes); + + /* XXXRW: Want to set and pin the CPU here. */ + + /* + * Add the worker number to the local port. + */ + localipbase.sin_port = htons(rflag + workernum); + + listen_sock = socket(PF_INET, SOCK_STREAM, 0); + if (listen_sock < 0) + err(-1, "socket"); + i = 1; + if (setsockopt(listen_sock, SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof(i)) + < 0) + err(-1, "setsockopt"); + i = 1; + if (setsockopt(listen_sock, SOL_SOCKET, SO_REUSEPORT, &i, sizeof(i)) + < 0) + err(-1, "setsockopt"); + if (bind(listen_sock, (struct sockaddr *)&localipbase, + sizeof(localipbase)) < 0) + err(-1, "bind"); + if (listen(listen_sock, 16384)) + err(-1, "listen"); + if (fcntl(listen_sock, F_SETFL, O_NONBLOCK) < 0) + err(-1, "fcntl"); + + kq = kqueue(); + if (kq < 0) + err(-1, "kqueue"); + + EV_SET(&kev, listen_sock, EVFILT_READ, EV_ADD, 0, 0, NULL); + if (kevent(kq, &kev, 1, NULL, 0, NULL) < 0) + err(-1, "kevent"); + + while ((numevents = kevent(kq, NULL, 0, kev_array, mflag + 1, NULL)) + > 0) { + for (i = 0; i < numevents; i++) { + if (kev_array[i].ident == (u_int)listen_sock) + (void)tcpp_server_newconn(listen_sock); + else + tcpp_server_handleconn(&kev_array[i]); + } + } + printf("Worker %d done\n", workernum); +} + +void +tcpp_server(void) +{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 15:19:50 2009 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 50E2F10656BA; Tue, 10 Mar 2009 15:19:50 +0000 (UTC) (envelope-from guido@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4028B8FC0C; Tue, 10 Mar 2009 15:19:50 +0000 (UTC) (envelope-from guido@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AFJoWW065744; Tue, 10 Mar 2009 15:19:50 GMT (envelope-from guido@svn.freebsd.org) Received: (from guido@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AFJovP065743; Tue, 10 Mar 2009 15:19:50 GMT (envelope-from guido@svn.freebsd.org) Message-Id: <200903101519.n2AFJovP065743@svn.freebsd.org> From: Guido van Rooij Date: Tue, 10 Mar 2009 15:19: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: r189624 - 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: Tue, 10 Mar 2009 15:19:51 -0000 Author: guido Date: Tue Mar 10 15:19:49 2009 New Revision: 189624 URL: http://svn.freebsd.org/changeset/base/189624 Log: When swap resides on a mirror and it is not stopped, the mirror is degraded upon the next reboot and will have to be rebuild. Thus call swapoff when rebooting (read: when stopping swap1) Modified: head/etc/rc.d/swap1 Modified: head/etc/rc.d/swap1 ============================================================================== --- head/etc/rc.d/swap1 Tue Mar 10 14:52:17 2009 (r189623) +++ head/etc/rc.d/swap1 Tue Mar 10 15:19:49 2009 (r189624) @@ -11,7 +11,7 @@ name="swap1" start_cmd='swapon -aq' -stop_cmd=':' +stop_cmd='swapoff -aq' load_rc_config swap run_rc_command "$1" From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 15:23:44 2009 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 4F7501065691; Tue, 10 Mar 2009 15:23:44 +0000 (UTC) (envelope-from guido@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7308FC24; Tue, 10 Mar 2009 15:23:44 +0000 (UTC) (envelope-from guido@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AFNhXe065868; Tue, 10 Mar 2009 15:23:43 GMT (envelope-from guido@svn.freebsd.org) Received: (from guido@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AFNhs1065867; Tue, 10 Mar 2009 15:23:43 GMT (envelope-from guido@svn.freebsd.org) Message-Id: <200903101523.n2AFNhs1065867@svn.freebsd.org> From: Guido van Rooij Date: Tue, 10 Mar 2009 15:23: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: r189625 - head/sys/geom/eli 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 Mar 2009 15:23:45 -0000 Author: guido Date: Tue Mar 10 15:23:43 2009 New Revision: 189625 URL: http://svn.freebsd.org/changeset/base/189625 Log: When attaching a geli on boot make sure that it is detached upon last close. (needed for a gmirror to properly shutdown upon reboot when a geli is on top the gmirror) Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Tue Mar 10 15:19:49 2009 (r189624) +++ head/sys/geom/eli/g_eli.c Tue Mar 10 15:23:43 2009 (r189625) @@ -996,6 +996,7 @@ g_eli_taste(struct g_class *mp, struct g /* * We have correct key, let's attach provider. */ + md.md_flags |= G_ELI_FLAG_WO_DETACH; gp = g_eli_create(NULL, mp, pp, &md, mkey, nkey); bzero(mkey, sizeof(mkey)); bzero(&md, sizeof(md)); From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 15:25:20 2009 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 24D4E1065712; Tue, 10 Mar 2009 15:25:20 +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 133CC8FC20; Tue, 10 Mar 2009 15:25:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AFPJ2Q065941; Tue, 10 Mar 2009 15:25:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AFPJsY065939; Tue, 10 Mar 2009 15:25:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903101525.n2AFPJsY065939@svn.freebsd.org> From: John Baldwin Date: Tue, 10 Mar 2009 15:25: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: r189626 - in head/usr.bin: systat top 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 Mar 2009 15:25:21 -0000 Author: jhb Date: Tue Mar 10 15:25:19 2009 New Revision: 189626 URL: http://svn.freebsd.org/changeset/base/189626 Log: Update top and systat for vfs.bufcache now being a long rather than an int. Modified: head/usr.bin/systat/vmstat.c head/usr.bin/top/machine.c Modified: head/usr.bin/systat/vmstat.c ============================================================================== --- head/usr.bin/systat/vmstat.c Tue Mar 10 15:23:43 2009 (r189625) +++ head/usr.bin/systat/vmstat.c Tue Mar 10 15:25:19 2009 (r189626) @@ -115,7 +115,7 @@ static struct Info { struct nchstats nchstats; long nchcount; long *intrcnt; - int bufspace; + long bufspace; int desiredvnodes; long numvnodes; long freevnodes; Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Tue Mar 10 15:23:43 2009 (r189625) +++ head/usr.bin/top/machine.c Tue Mar 10 15:25:19 2009 (r189626) @@ -433,7 +433,7 @@ get_system_info(struct system_info *si) static unsigned int swap_delay = 0; static int swapavail = 0; static int swapfree = 0; - static int bufspace = 0; + static long bufspace = 0; static int nspgsin, nspgsout; GETSYSCTL("vfs.bufspace", bufspace); From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 15:26:51 2009 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 518411065690; Tue, 10 Mar 2009 15:26:51 +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 262138FC17; Tue, 10 Mar 2009 15:26:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AFQpjV066014; Tue, 10 Mar 2009 15:26:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AFQpS8066013; Tue, 10 Mar 2009 15:26:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903101526.n2AFQpS8066013@svn.freebsd.org> From: John Baldwin Date: Tue, 10 Mar 2009 15:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189627 - 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: Tue, 10 Mar 2009 15:26:53 -0000 Author: jhb Date: Tue Mar 10 15:26:50 2009 New Revision: 189627 URL: http://svn.freebsd.org/changeset/base/189627 Log: Add an ABI compat shim for the vfs.bufspace sysctl for sysctl requests that try to fetch it as an int rather than a long. If the current value is greater than INT_MAX it reports a value of INT_MAX. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Mar 10 15:25:19 2009 (r189626) +++ head/sys/kern/vfs_bio.c Tue Mar 10 15:26:50 2009 (r189627) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include "opt_compat.h" #include "opt_directio.h" #include "opt_swap.h" @@ -108,6 +109,10 @@ static int vfs_bio_clcheck(struct vnode static int flushbufqueues(int, int); static void buf_daemon(void); static void bremfreel(struct buf *bp); +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); +#endif int vmiodirenable = TRUE; SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, &vmiodirenable, 0, @@ -116,8 +121,14 @@ long runningbufspace; SYSCTL_LONG(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0, "Amount of presently outstanding async buffer io"); static long bufspace; +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +SYSCTL_PROC(_vfs, OID_AUTO, bufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RD, + &bufspace, 0, sysctl_bufspace, "L", "KVA memory used for bufs"); +#else SYSCTL_LONG(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0, "KVA memory used for bufs"); +#endif static long maxbufspace; SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, "Maximum allowed value of bufspace (including buf_daemon)"); @@ -265,6 +276,22 @@ const char *buf_wmesg = BUF_WMESG; #define VFS_BIO_NEED_FREE 0x04 /* wait for free bufs, hi hysteresis */ #define VFS_BIO_NEED_BUFSPACE 0x08 /* wait for buf space, lo hysteresis */ +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +static int +sysctl_bufspace(SYSCTL_HANDLER_ARGS) +{ + long lvalue; + int ivalue; + + if (sizeof(int) == sizeof(long) || req->oldlen == sizeof(long)) + return (sysctl_handle_long(oidp, arg1, arg2, req)); + lvalue = *(long *)arg1; + ivalue = lvalue > INT_MAX ? INT_MAX : lvalue; + return (sysctl_handle_int(oidp, &ivalue, 0, req)); +} +#endif + #ifdef DIRECTIO extern void ffs_rawread_setup(void); #endif /* DIRECTIO */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 15:49:44 2009 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 00DAF1065706; Tue, 10 Mar 2009 15:49:44 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E39698FC16; Tue, 10 Mar 2009 15:49:43 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AFnhAK066535; Tue, 10 Mar 2009 15:49:43 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AFnhun066533; Tue, 10 Mar 2009 15:49:43 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903101549.n2AFnhun066533@svn.freebsd.org> From: Andrew Thompson Date: Tue, 10 Mar 2009 15:49: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: r189628 - head/lib/libusb 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 Mar 2009 15:49:44 -0000 Author: thompsa Date: Tue Mar 10 15:49:43 2009 New Revision: 189628 URL: http://svn.freebsd.org/changeset/base/189628 Log: Update libusb.3 name and add mlinks for usb.3 and libusb20.3 Added: head/lib/libusb/libusb.3 (contents, props changed) - copied, changed from r189619, head/lib/libusb/libusb20.3 Deleted: head/lib/libusb/libusb20.3 Modified: head/lib/libusb/Makefile Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Tue Mar 10 15:26:50 2009 (r189627) +++ head/lib/libusb/Makefile Tue Mar 10 15:49:43 2009 (r189628) @@ -14,10 +14,13 @@ SRCS+= libusb20_compat01.c SRCS+= libusb20_compat10.c INCS+= libusb20.h INCS+= libusb20_desc.h -MAN= libusb20.3 +MAN= libusb.3 MKLINT= no NOGCCERROR= +MLINKS+= libusb.3 usb.3 \ + libusb.3 libusb20.3 + # libusb 0.1 compat INCS+= usb.h Copied and modified: head/lib/libusb/libusb.3 (from r189619, head/lib/libusb/libusb20.3) ============================================================================== --- head/lib/libusb/libusb20.3 Tue Mar 10 12:10:50 2009 (r189619, copy source) +++ head/lib/libusb/libusb.3 Tue Mar 10 15:49:43 2009 (r189628) @@ -27,10 +27,10 @@ .\" $FreeBSD$ .\" .Dd Feb 14, 2009 -.Dt LIBUSB20 3 +.Dt LIBUSB 3 .Os .Sh NAME -.Nm libusb20 +.Nm libusb . .Nd "USB access library" . @@ -38,7 +38,7 @@ .Sh LIBRARY . . -USB access library (libusb20 -lusb20) +USB access library (libusb -lusb) . . . From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 15:52:24 2009 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 BB6771065715; Tue, 10 Mar 2009 15:52:24 +0000 (UTC) (envelope-from ga9@york.ac.uk) Received: from buffy.york.ac.uk (buffy.york.ac.uk [144.32.226.160]) by mx1.freebsd.org (Postfix) with ESMTP id 5469C8FC24; Tue, 10 Mar 2009 15:52:23 +0000 (UTC) (envelope-from ga9@york.ac.uk) Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.3/8.14.3) with ESMTP id n2AFXTul080882; Tue, 10 Mar 2009 15:33:29 GMT (envelope-from ga9@york.ac.uk) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.3/8.14.3/Submit) id n2AFXTNF080881; Tue, 10 Mar 2009 15:33:29 GMT (envelope-from ga9@york.ac.uk) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to ga9@york.ac.uk using -f From: Gavin Atkinson To: Guido van Rooij In-Reply-To: <200903101519.n2AFJovP065743@svn.freebsd.org> References: <200903101519.n2AFJovP065743@svn.freebsd.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 10 Mar 2009 15:33:28 +0000 Message-Id: <1236699209.62820.32.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 FreeBSD GNOME Team Port Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189624 - 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: Tue, 10 Mar 2009 15:52:25 -0000 On Tue, 2009-03-10 at 15:19 +0000, Guido van Rooij wrote: > Author: guido > Date: Tue Mar 10 15:19:49 2009 > New Revision: 189624 > URL: http://svn.freebsd.org/changeset/base/189624 > > Log: > When swap resides on a mirror and it is not stopped, the mirror > is degraded upon the next reboot and will have to be rebuild. > Thus call swapoff when rebooting (read: when stopping swap1) Is this due to a bug/feature of gmirror? A long time ago, swapoff used to be run on shutdown, but it was removed by pjd@ in src/etc/rc.d/swap1 version 1.9 with the following commit message: | Stop method for swap1 script was introduced, because gmirror needed | it. Now gmirror use shutdown hooks to mark mirrors as clean on | shutdown, so this is not needed anymore. I'm not saying it's not needed, just intrigued why it is now needed again when it never used to be? FWIW, I seem to remember that one of the reasons it was removed was that turning swap off created the possibility that lots of things would be paged back into RAM, which a) could take a long time, and b) fail if there was insufficient RAM. Gavin -- Gavin Atkinson Systems Administrator & Programmer Computing Service, The University of York, York. YO10 5DD Tel: +44 (0)1904 433738 Fax: +44 (0)1904 433740 I have a proof of Fermat's theorem but this .sig is too nar From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 15:54:37 2009 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 D66D910656E6; Tue, 10 Mar 2009 15:54:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C34B68FC2C; Tue, 10 Mar 2009 15:54:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AFsbln066671; Tue, 10 Mar 2009 15:54:37 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AFsbdn066670; Tue, 10 Mar 2009 15:54:37 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903101554.n2AFsbdn066670@svn.freebsd.org> From: Andrew Thompson Date: Tue, 10 Mar 2009 15:54: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: r189629 - 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 Mar 2009 15:54:39 -0000 Author: thompsa Date: Tue Mar 10 15:54:37 2009 New Revision: 189629 URL: http://svn.freebsd.org/changeset/base/189629 Log: Remove these files, they refer to module bundles that do not exist anymore. Deleted: head/share/man/man4/usb2_bluetooth.4 head/share/man/man4/usb2_controller.4 head/share/man/man4/usb2_ethernet.4 head/share/man/man4/usb2_image.4 head/share/man/man4/usb2_input.4 head/share/man/man4/usb2_misc.4 head/share/man/man4/usb2_ndis.4 head/share/man/man4/usb2_quirk.4 head/share/man/man4/usb2_serial.4 head/share/man/man4/usb2_sound.4 head/share/man/man4/usb2_storage.4 head/share/man/man4/usb2_wlan.4 From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 16:34:35 2009 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 CDD911065674; Tue, 10 Mar 2009 16:34:35 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay01.ispgateway.de (smtprelay01.ispgateway.de [80.67.18.13]) by mx1.freebsd.org (Postfix) with ESMTP id 852778FC08; Tue, 10 Mar 2009 16:34:35 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from [88.153.16.241] (helo=localhost) by smtprelay01.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1Lh4gO-0000J2-6H; Tue, 10 Mar 2009 17:19:56 +0100 Date: Tue, 10 Mar 2009 17:19:48 +0100 From: Fabian Keil To: Guido van Rooij Message-ID: <20090310171948.1ac51696@fabiankeil.de> In-Reply-To: <200903101523.n2AFNhs1065867@svn.freebsd.org> References: <200903101523.n2AFNhs1065867@svn.freebsd.org> X-Mailer: Claws Mail 3.7.0 (GTK+ 2.14.7; i386-portbld-freebsd8.0) X-PGP-KEY-URL: http://www.fabiankeil.de/gpg-keys/freebsd-listen-2008-08-18.asc Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/2BaWsgMhOF27EkVAfA2gA6m"; protocol="application/pgp-signature"; micalg=PGP-SHA1 X-Df-Sender: 775067 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189625 - head/sys/geom/eli 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 Mar 2009 16:34:36 -0000 --Sig_/2BaWsgMhOF27EkVAfA2gA6m Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Guido van Rooij wrote: > Author: guido > Date: Tue Mar 10 15:23:43 2009 > New Revision: 189625 > URL: http://svn.freebsd.org/changeset/base/189625 >=20 > Log: > When attaching a geli on boot make sure that it is detached > upon last close. (needed for a gmirror to properly shutdown > upon reboot when a geli is on top the gmirror) >=20 > Modified: > head/sys/geom/eli/g_eli.c >=20 > Modified: head/sys/geom/eli/g_eli.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/geom/eli/g_eli.c Tue Mar 10 15:19:49 2009 > (r189624) +++ head/sys/geom/eli/g_eli.c Tue Mar 10 15:23:43 > 2009 (r189625) @@ -996,6 +996,7 @@ g_eli_taste(struct g_class > *mp, struct g /* > * We have correct key, let's attach provider. > */ > + md.md_flags |=3D G_ELI_FLAG_WO_DETACH; > gp =3D g_eli_create(NULL, mp, pp, &md, mkey, nkey); > bzero(mkey, sizeof(mkey)); > bzero(&md, sizeof(md)); Detach-on-last-close is known to cause panics when scrubbing at least some ZFS pools: http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dkern/117158 Quoting the PR: |Quoting Pawel Jakub Dawidek's response to my initial report: ||GELI's detach-on-last-close mechanism is a general purpose mechanism, it ||may not work correctly with ZFS, because ZFS sometimes closes and reopen ||providers, which will make GELI to detach. In other words you shouldn't ||configure detach-on-last-close for ZFS components.=20 Fabian --Sig_/2BaWsgMhOF27EkVAfA2gA6m Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm2kyQACgkQBYqIVf93VJ16RgCfXr9jmNerH8V03NVtX6Zdty0R nXwAn0xwziOcO00wvoRip6LoooRgtmcE =6J7x -----END PGP SIGNATURE----- --Sig_/2BaWsgMhOF27EkVAfA2gA6m-- From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 16:42:50 2009 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 081C0106566B; Tue, 10 Mar 2009 16:42:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAAD58FC2B; Tue, 10 Mar 2009 16:42:49 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AGgnnN067660; Tue, 10 Mar 2009 16:42:49 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AGgntw067658; Tue, 10 Mar 2009 16:42:49 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903101642.n2AGgntw067658@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 16:42:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189630 - head/sys/arm/xscale/ixp425 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 Mar 2009 16:42:50 -0000 Author: sam Date: Tue Mar 10 16:42:49 2009 New Revision: 189630 URL: http://svn.freebsd.org/changeset/base/189630 Log: catch up with r189306; handle delayed activation of resources Submitted by: jhb Modified: head/sys/arm/xscale/ixp425/ixp425.c head/sys/arm/xscale/ixp425/ixp425_pci.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Tue Mar 10 15:54:37 2009 (r189629) +++ head/sys/arm/xscale/ixp425/ixp425.c Tue Mar 10 16:42:49 2009 (r189630) @@ -362,8 +362,10 @@ ixp425_alloc_resource(device_t dev, devi struct rman *rmanp; struct resource *rv; uint32_t vbase, addr; + int needactivate = flags & RF_ACTIVE; int irq; + flags &= ~RF_ACTIVE; switch (type) { case SYS_RES_IRQ: rmanp = &sc->sc_irq_rman; @@ -382,6 +384,7 @@ ixp425_alloc_resource(device_t dev, devi if (BUS_READ_IVAR(dev, child, IXP425_IVAR_ADDR, &addr) == 0) { start = addr; end = start + 0x1000; /* XXX */ + count = end - start; } if (getvbase(start, end - start, &vbase) != 0) { /* likely means above table needs to be updated */ @@ -391,20 +394,41 @@ ixp425_alloc_resource(device_t dev, devi } rv = rman_reserve_resource(rmanp, start, end, count, flags, child); - if (rv != NULL) { + if (rv != NULL) rman_set_rid(rv, *rid); - if (strcmp(device_get_name(child), "uart") == 0) - rman_set_bustag(rv, &ixp425_a4x_bs_tag); - else - rman_set_bustag(rv, sc->sc_iot); - rman_set_bushandle(rv, vbase); - } break; default: rv = NULL; break; } - return rv; + if (rv != NULL && needactivate) { + if (bus_activate_resource(child, type, *rid, rv)) { + rman_release_resource(rv); + return (NULL); + } + } + return (rv); +} + +static int +ixp425_activate_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + struct ixp425_softc *sc = device_get_softc(dev); + int error; + uint32_t vbase; + + if (type == SYS_RES_MEMORY) { + error = getvbase(rman_get_start(r), rman_get_size(r), &vbase); + if (error) + return (error); + if (strcmp(device_get_name(child), "uart") == 0) + rman_set_bustag(r, &ixp425_a4x_bs_tag); + else + rman_set_bustag(r, sc->sc_iot); + rman_set_bushandle(r, vbase); + } + return (rman_activate_resource(r)); } static __inline void @@ -472,6 +496,7 @@ static device_method_t ixp425_methods[] DEVMETHOD(bus_read_ivar, ixp425_read_ivar), DEVMETHOD(bus_alloc_resource, ixp425_alloc_resource), + DEVMETHOD(bus_activate_resource, ixp425_activate_resource), DEVMETHOD(bus_setup_intr, ixp425_setup_intr), DEVMETHOD(bus_teardown_intr, ixp425_teardown_intr), Modified: head/sys/arm/xscale/ixp425/ixp425_pci.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425_pci.c Tue Mar 10 15:54:37 2009 (r189629) +++ head/sys/arm/xscale/ixp425/ixp425_pci.c Tue Mar 10 16:42:49 2009 (r189630) @@ -276,12 +276,10 @@ static struct resource * ixppcib_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { - bus_space_tag_t tag; struct ixppcib_softc *sc = device_get_softc(bus); struct rman *rmanp; struct resource *rv; - tag = NULL; /* shut up stupid gcc */ rv = NULL; switch (type) { case SYS_RES_IRQ: @@ -290,28 +288,25 @@ ixppcib_alloc_resource(device_t bus, dev case SYS_RES_IOPORT: rmanp = &sc->sc_io_rman; - tag = &sc->sc_pci_iot; break; case SYS_RES_MEMORY: rmanp = &sc->sc_mem_rman; - tag = &sc->sc_pci_memt; break; default: return (rv); } - rv = rman_reserve_resource(rmanp, start, end, count, flags, child); - if (rv != NULL) { - rman_set_rid(rv, *rid); - if (type == SYS_RES_IOPORT) { - rman_set_bustag(rv, tag); - rman_set_bushandle(rv, rman_get_start(rv)); - } else if (type == SYS_RES_MEMORY) { - rman_set_bustag(rv, tag); - rman_set_bushandle(rv, rman_get_bushandle(sc->sc_mem) + - (rman_get_start(rv) - IXP425_PCI_MEM_HWBASE)); + rv = rman_reserve_resource(rmanp, start, end, count, flags & ~RF_ACTIVE, + child); + if (rv == NULL) + return (NULL); + rman_set_rid(rv, *rid); + if (flags & RF_ACTIVE) { + if (bus_activate_resource(child, type, *rid, rv)) { + rman_release_resource(rv); + return (NULL); } } @@ -323,9 +318,21 @@ ixppcib_activate_resource(device_t bus, struct resource *r) { - device_printf(bus, "%s called activate_resource (unexpected)\n", - device_get_nameunit(child)); - return (ENXIO); + struct ixppcib_softc *sc = device_get_softc(bus); + + switch (type) { + case SYS_RES_IOPORT: + rman_set_bustag(r, &sc->sc_pci_iot); + rman_set_bushandle(r, rman_get_start(r)); + break; + case SYS_RES_MEMORY: + rman_set_bustag(r, &sc->sc_pci_memt); + rman_set_bushandle(r, rman_get_bushandle(sc->sc_mem) + + (rman_get_start(r) - IXP425_PCI_MEM_HWBASE)); + break; + } + + return (rman_activate_resource(r)); } static int From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 17:00:29 2009 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 3E62B1065694; Tue, 10 Mar 2009 17:00:29 +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 2C68D8FC08; Tue, 10 Mar 2009 17:00:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AH0TvG068114; Tue, 10 Mar 2009 17:00:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AH0T5l068113; Tue, 10 Mar 2009 17:00:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903101700.n2AH0T5l068113@svn.freebsd.org> From: John Baldwin Date: Tue, 10 Mar 2009 17:00: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: r189631 - 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: Tue, 10 Mar 2009 17:00:30 -0000 Author: jhb Date: Tue Mar 10 17:00:28 2009 New Revision: 189631 URL: http://svn.freebsd.org/changeset/base/189631 Log: - Remove a recently added comment from kernel_sysctlbyname() that isn't needed. - Move the release of the sysctl sx lock after the vsunlock() in userland_sysctl() to restore the original memlock behavior of minimizing the amount of memory wired to handle sysctl requests. MFC after: 1 week Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Tue Mar 10 16:42:49 2009 (r189630) +++ head/sys/kern/kern_sysctl.c Tue Mar 10 17:00:28 2009 (r189631) @@ -1200,14 +1200,6 @@ kernel_sysctlbyname(struct thread *td, c oid[1] = 3; /* name2oid */ oidlen = sizeof(oid); - /* - * XXX: Prone to a possible race condition between lookup and - * execution? Maybe put locking around it? - * - * Userland is just as racy, so I think the current implementation - * is fine. - */ - error = kernel_sysctl(td, oid, 2, oid, &oidlen, (void *)name, strlen(name), &plen, flags); if (error) @@ -1520,10 +1512,10 @@ userland_sysctl(struct thread *td, int * } CURVNET_RESTORE(); - SYSCTL_XUNLOCK(); if (req.lock == REQ_WIRED && req.validlen > 0) vsunlock(req.oldptr, req.validlen); + SYSCTL_XUNLOCK(); if (error && error != ENOMEM) return (error); From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 17:16:16 2009 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 F1E55106566C; Tue, 10 Mar 2009 17:16:16 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF9898FC1E; Tue, 10 Mar 2009 17:16:16 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AHGGK9068419; Tue, 10 Mar 2009 17:16:16 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AHGGJ2068418; Tue, 10 Mar 2009 17:16:16 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903101716.n2AHGGJ2068418@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 17:16: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: r189632 - head/sys/arm/xscale/ixp425 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 Mar 2009 17:16:17 -0000 Author: sam Date: Tue Mar 10 17:16:16 2009 New Revision: 189632 URL: http://svn.freebsd.org/changeset/base/189632 Log: Small cleanup of memory resource allocation from Cambria branch: o encode need for A4 bus space tag hackery according to the memory address; checking for "uart" breaks down with the GPS chip support which is also a uart but does not require the same hackery o encode the correct memory window instead of carving up all of i/o space, potentially with a larger window than a device should have; this likely should be handled in the drivers by using a proper bus alloc call but since some drivers depend on the bus support to figure this out we cannot simply mod them o add optional GPS and RS485 support (conditionally as the support isn't ready yet) Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Tue Mar 10 17:00:28 2009 (r189631) +++ head/sys/arm/xscale/ixp425/ixp425.c Tue Mar 10 17:16:16 2009 (r189632) @@ -315,43 +315,82 @@ ixp425_read_ivar(device_t bus, device_t } /* - * NB: This table handles P->V translations for regions mapped - * through bus_alloc_resource. Anything done with bus_space_map - * is handled elsewhere and does not require an entry here. + * NB: This table handles P->V translations for regions setup with + * static mappings in initarm. This is used solely for calls to + * bus_alloc_resource_any; anything done with bus_space_map is + * handled elsewhere and does not require an entry here. * - * XXX getvbase is also used by uart_cpu_getdev (hence public) + * XXX this table is also used by uart_cpu_getdev via getvbase + * (hence the public api) */ -static const struct { +struct hwvtrans { uint32_t hwbase; uint32_t size; uint32_t vbase; -} hwvtrans[] = { - { IXP425_IO_HWBASE, IXP425_IO_SIZE, IXP425_IO_VBASE }, - { IXP425_PCI_HWBASE, IXP425_PCI_SIZE, IXP425_PCI_VBASE }, - { IXP425_PCI_MEM_HWBASE,IXP425_PCI_MEM_SIZE, IXP425_PCI_MEM_VBASE }, - { IXP425_EXP_BUS_CS0_HWBASE, IXP425_EXP_BUS_CS0_SIZE, - IXP425_EXP_BUS_CS0_VBASE }, - /* NB: needed only for uart_cpu_getdev */ - { IXP425_UART0_HWBASE, IXP425_REG_SIZE, IXP425_UART0_VBASE }, - { IXP425_UART1_HWBASE, IXP425_REG_SIZE, IXP425_UART1_VBASE }, - /* NB: need for ixp435 ehci controllers */ - { IXP435_USB1_HWBASE, IXP435_USB1_SIZE, IXP435_USB1_VBASE }, - { IXP435_USB2_HWBASE, IXP435_USB2_SIZE, IXP435_USB2_VBASE }, + int isa4x; /* XXX needs special bus space tag */ }; -int -getvbase(uint32_t hwbase, uint32_t size, uint32_t *vbase) +static const struct hwvtrans * +gethwvtrans(uint32_t hwbase, uint32_t size) { + static const struct hwvtrans hwvtrans[] = { + /* NB: needed only for uart_cpu_getdev */ + { .hwbase = IXP425_UART0_HWBASE, + .size = IXP425_REG_SIZE, + .vbase = IXP425_UART0_VBASE, + .isa4x = 1 }, + { .hwbase = IXP425_UART1_HWBASE, + .size = IXP425_REG_SIZE, + .vbase = IXP425_UART1_VBASE, + .isa4x = 1 }, + { .hwbase = IXP425_PCI_HWBASE, + .size = IXP425_PCI_SIZE, + .vbase = IXP425_PCI_VBASE }, + { .hwbase = IXP425_PCI_MEM_HWBASE, + .size = IXP425_PCI_MEM_SIZE, + .vbase = IXP425_PCI_MEM_VBASE }, + { .hwbase = IXP425_EXP_BUS_CS0_HWBASE, + .size = IXP425_EXP_BUS_CS0_SIZE, + .vbase = IXP425_EXP_BUS_CS0_VBASE }, + /* NB: needed for ixp435 ehci controllers */ + { .hwbase = IXP435_USB1_HWBASE, + .size = IXP435_USB1_SIZE, + .vbase = IXP435_USB1_VBASE }, + { .hwbase = IXP435_USB2_HWBASE, + .size = IXP435_USB2_SIZE, + .vbase = IXP435_USB2_VBASE }, +#ifdef CAMBRIA_GPS_VBASE + { .hwbase = CAMBRIA_GPS_HWBASE, + .size = CAMBRIA_GPS_SIZE, + .vbase = CAMBRIA_GPS_VBASE }, +#endif +#ifdef CAMBRIA_RS485_VBASE + { .hwbase = CAMBRIA_RS485_HWBASE, + .size = CAMBRIA_RS485_SIZE, + .vbase = CAMBRIA_RS485_VBASE }, +#endif + }; int i; for (i = 0; i < sizeof hwvtrans / sizeof *hwvtrans; i++) { if (hwbase >= hwvtrans[i].hwbase && - hwbase + size <= hwvtrans[i].hwbase + hwvtrans[i].size) { - *vbase = hwbase - hwvtrans[i].hwbase + hwvtrans[i].vbase; - return (0); - } + hwbase + size <= hwvtrans[i].hwbase + hwvtrans[i].size) + return &hwvtrans[i]; } - return (ENOENT); + return NULL; +} + +/* XXX for uart_cpu_getdev */ +int +getvbase(uint32_t hwbase, uint32_t size, uint32_t *vbase) +{ + const struct hwvtrans *hw; + + hw = gethwvtrans(hwbase, size); + if (hw == NULL) + return (ENOENT); + *vbase = hwbase - hw->hwbase + hw->vbase; + return (0); } static struct resource * @@ -359,9 +398,10 @@ ixp425_alloc_resource(device_t dev, devi u_long start, u_long end, u_long count, u_int flags) { struct ixp425_softc *sc = device_get_softc(dev); + const struct hwvtrans *vtrans; struct rman *rmanp; struct resource *rv; - uint32_t vbase, addr; + uint32_t addr; int needactivate = flags & RF_ACTIVE; int irq; @@ -383,16 +423,31 @@ ixp425_alloc_resource(device_t dev, devi /* override per hints */ if (BUS_READ_IVAR(dev, child, IXP425_IVAR_ADDR, &addr) == 0) { start = addr; - end = start + 0x1000; /* XXX */ - count = end - start; - } - if (getvbase(start, end - start, &vbase) != 0) { + /* XXX use nominal window to check for mapping */ + vtrans = gethwvtrans(start, 0x1000); + if (vtrans != NULL) { + /* + * Assign the entire mapped region; this may + * not be correct but without more info from + * the caller we cannot tell. + */ + end = start + vtrans->size - + (start - vtrans->hwbase); + if (bootverbose) + device_printf(child, + "%s: assign 0x%lx:0x%lx%s\n", + __func__, start, end - start, + vtrans->isa4x ? " A4X" : ""); + } + } else + vtrans = gethwvtrans(start, end - start); + if (vtrans == NULL) { /* likely means above table needs to be updated */ - device_printf(dev, "%s: no mapping for 0x%lx:0x%lx\n", + device_printf(child, "%s: no mapping for 0x%lx:0x%lx\n", __func__, start, end-start); return NULL; } - rv = rman_reserve_resource(rmanp, start, end, count, + rv = rman_reserve_resource(rmanp, start, end, end - start, flags, child); if (rv != NULL) rman_set_rid(rv, *rid); @@ -415,18 +470,17 @@ ixp425_activate_resource(device_t dev, d struct resource *r) { struct ixp425_softc *sc = device_get_softc(dev); - int error; - uint32_t vbase; + const struct hwvtrans *vtrans; if (type == SYS_RES_MEMORY) { - error = getvbase(rman_get_start(r), rman_get_size(r), &vbase); - if (error) - return (error); - if (strcmp(device_get_name(child), "uart") == 0) + vtrans = gethwvtrans(rman_get_start(r), rman_get_size(r)); + if (vtrans == NULL) /* NB: should not happen */ + return (ENOENT); + if (vtrans->isa4x) rman_set_bustag(r, &ixp425_a4x_bs_tag); else rman_set_bustag(r, sc->sc_iot); - rman_set_bushandle(r, vbase); + rman_set_bushandle(r, vtrans->vbase); } return (rman_activate_resource(r)); } From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 17:19:45 2009 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 CBADB10656E2; Tue, 10 Mar 2009 17:19:45 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B67008FC23; Tue, 10 Mar 2009 17:19:45 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AHJjuV068514; Tue, 10 Mar 2009 17:19:45 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AHJjWl068513; Tue, 10 Mar 2009 17:19:45 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903101719.n2AHJjWl068513@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 17:19: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: r189633 - head/sys/arm/xscale/ixp425 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 Mar 2009 17:19:47 -0000 Author: sam Date: Tue Mar 10 17:19:45 2009 New Revision: 189633 URL: http://svn.freebsd.org/changeset/base/189633 Log: bring in ddb "show gpio" support from Cambria branch Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Tue Mar 10 17:16:16 2009 (r189632) +++ head/sys/arm/xscale/ixp425/ixp425.c Tue Mar 10 17:19:45 2009 (r189633) @@ -36,6 +36,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ddb.h" + #define _ARM32_BUS_DMA_PRIVATE #include #include @@ -95,22 +97,61 @@ bus_dma_get_range_nb(void) return (0); } +static const uint8_t int2gpio[32] __attribute__ ((aligned(32))) = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* INT#0 -> INT#5 */ + 0x00, 0x01, /* GPIO#0 -> GPIO#1 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* INT#8 -> INT#13 */ + 0xff, 0xff, 0xff, 0xff, 0xff, /* INT#14 -> INT#18 */ + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* GPIO#2 -> GPIO#7 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, /* GPIO#8 -> GPIO#12 */ + 0xff, 0xff /* INT#30 -> INT#31 */ +}; + static __inline u_int32_t ixp425_irq2gpio_bit(int irq) { + return (1U << int2gpio[irq]); +} - static const uint8_t int2gpio[32] __attribute__ ((aligned(32))) = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* INT#0 -> INT#5 */ - 0x00, 0x01, /* GPIO#0 -> GPIO#1 */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* INT#8 -> INT#13 */ - 0xff, 0xff, 0xff, 0xff, 0xff, /* INT#14 -> INT#18 */ - 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* GPIO#2 -> GPIO#7 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, /* GPIO#8 -> GPIO#12 */ - 0xff, 0xff /* INT#30 -> INT#31 */ - }; +#ifdef DDB +#include - return (1U << int2gpio[irq]); +DB_SHOW_COMMAND(gpio, db_show_gpio) +{ + static const char *itype[8] = { + [GPIO_TYPE_ACT_HIGH] = "act-high", + [GPIO_TYPE_ACT_LOW] = "act-low", + [GPIO_TYPE_EDG_RISING] = "edge-rising", + [GPIO_TYPE_EDG_FALLING] = "edge-falling", + [GPIO_TYPE_TRANSITIONAL]= "transitional", + [5] = "type-5", [6] = "type-6", [7] = "type-7" + }; + uint32_t gpoutr = GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPOUTR); + uint32_t gpoer = GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPOER); + uint32_t gpinr = GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPINR); + uint32_t gpit1r = GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPIT1R); + uint32_t gpit2r = GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPIT2R); + int i, j; + + db_printf("GPOUTR %08x GPOER %08x GPINR %08x GPISR %08x\n", + gpoutr, gpoer, gpinr, + GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPISR)); + db_printf("GPIT1R %08x GPIT2R %08x GPCLKR %08x\n", + gpit1r, gpit2r, GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPCLKR)); + for (i = 0; i < 16; i++) { + db_printf("[%2d] out %u in %u %-3s", i, + (gpoutr>>i)&1, (gpinr>>i)&1, (gpoer>>i)&1 ? "in" : "out"); + for (j = 0; j < 32; j++) + if (int2gpio[j] == i) { + db_printf(" irq %2u %s", j, itype[ + (((i & 8) ? gpit2r : gpit1r) >> (3*(i&7))) + & 7]); + break; + } + db_printf("\n"); + } } +#endif void arm_mask_irq(uintptr_t nb) From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 17:21:50 2009 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 A68D81065728; Tue, 10 Mar 2009 17:21:50 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from creme-brulee.marcuscom.com (marcuscom-pt.tunnel.tserv1.fmt.ipv6.he.net [IPv6:2001:470:1f00:ffff::1279]) by mx1.freebsd.org (Postfix) with ESMTP id 398BB8FC1C; Tue, 10 Mar 2009 17:21:50 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from [IPv6:2001:470:1f00:2464::4] (shumai.marcuscom.com [IPv6:2001:470:1f00:2464::4]) by creme-brulee.marcuscom.com (8.14.3/8.14.3) with ESMTP id n2AHO1lD037974; Tue, 10 Mar 2009 13:24:01 -0400 (EDT) (envelope-from marcus@FreeBSD.org) From: Joe Marcus Clarke To: Giorgos Keramidas In-Reply-To: <878wndeomq.fsf@kobe.laptop> References: <200903081905.n28J5sFQ092475@svn.freebsd.org> <878wndeomq.fsf@kobe.laptop> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-U0oQ/vdCVTgWd2AkZU/6" Organization: FreeBSD, Inc. Date: Tue, 10 Mar 2009 13:22:01 -0400 Message-Id: <1236705721.14266.35.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on creme-brulee.marcuscom.com Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189539 - 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: Tue, 10 Mar 2009 17:21:55 -0000 --=-U0oQ/vdCVTgWd2AkZU/6 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2009-03-10 at 11:03 +0200, Giorgos Keramidas wrote: > On Sun, 8 Mar 2009 19:05:54 +0000 (UTC), Joe Marcus Clarke wrote: > > Author: marcus (doc,ports committer) > > Date: Sun Mar 8 19:05:53 2009 > > New Revision: 189539 > > URL: http://svn.freebsd.org/changeset/base/189539 > > > > Log: > > Add a default implementation for VOP_VPTOCNP(9) which scans the paren= t > > directory of a vnode to find a dirent with a matching file number. T= he > > name from that dirent is then used to provide the component name. > > > > Note: if the initial vnode argument is not a directory itself, then > > the default VOP_VPTOCNP(9) implementation still returns ENOENT. > > > > Reviewed by: kib > > Approved by: kib > > Tested by: pho >=20 > I think this panics nullfs mounts. I have a kernel build from > subversion changeset /head@189540 that panics instantly with: Yep, kib committed a patch for this today. Joe --=20 Joe Marcus Clarke FreeBSD GNOME Team :: gnome@FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome --=-U0oQ/vdCVTgWd2AkZU/6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkm2obgACgkQb2iPiv4Uz4dtBwCeIF4AFg2/pp+HJbBkzr+bSnFj h1AAoKjLtfFJS8+FGTDf5S2NKjzNF4SB =nk+I -----END PGP SIGNATURE----- --=-U0oQ/vdCVTgWd2AkZU/6-- From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 17:48:50 2009 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 1820B106564A; Tue, 10 Mar 2009 17:48:50 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05D6F8FC17; Tue, 10 Mar 2009 17:48:50 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AHmnTT069144; Tue, 10 Mar 2009 17:48:49 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AHmnpN069143; Tue, 10 Mar 2009 17:48:49 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903101748.n2AHmnpN069143@svn.freebsd.org> From: Bruce M Simpson Date: Tue, 10 Mar 2009 17:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189635 - 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: Tue, 10 Mar 2009 17:48:50 -0000 Author: bms Date: Tue Mar 10 17:48:49 2009 New Revision: 189635 URL: http://svn.freebsd.org/changeset/base/189635 Log: Don't print inm_print() chatter when KTR_IGMPV3 is not enabled in the KTR_COMPILE mask. Found by: gnn Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Tue Mar 10 17:28:23 2009 (r189634) +++ head/sys/netinet/in_mcast.c Tue Mar 10 17:48:49 2009 (r189635) @@ -2851,6 +2851,9 @@ inm_print(const struct in_multi *inm) { int t; + if ((KTR_COMPILE & KTR_IGMPV3) == 0) + return; + printf("%s: --- begin inm %p ---\n", __func__, inm); printf("addr %s ifp %p(%s) ifma %p\n", inet_ntoa(inm->inm_addr), From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 17:54:04 2009 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 B4CCB106564A; Tue, 10 Mar 2009 17:54:04 +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 A2AD08FC08; Tue, 10 Mar 2009 17:54:04 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AHs4YV069348; Tue, 10 Mar 2009 17:54:04 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AHs408069347; Tue, 10 Mar 2009 17:54:04 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200903101754.n2AHs408069347@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 10 Mar 2009 17:54: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: r189636 - head/sys/dev/cardbus 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 Mar 2009 17:54:05 -0000 Author: gnn Date: Tue Mar 10 17:54:04 2009 New Revision: 189636 URL: http://svn.freebsd.org/changeset/base/189636 Log: Complete removal of cardbus_write_ivar which was left hanging. Modified: head/sys/dev/cardbus/cardbus.c Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Tue Mar 10 17:48:49 2009 (r189635) +++ head/sys/dev/cardbus/cardbus.c Tue Mar 10 17:54:04 2009 (r189636) @@ -82,9 +82,6 @@ static int cardbus_read_ivar(device_t cb uintptr_t *result); static void cardbus_release_all_resources(device_t cbdev, struct cardbus_devinfo *dinfo); -static int cardbus_write_ivar(device_t cbdev, device_t child, int which, - uintptr_t value); - /************************************************************************/ /* Probe/Attach */ /************************************************************************/ From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 17:57:41 2009 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 B089F106566C; Tue, 10 Mar 2009 17:57:41 +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 9D7DD8FC15; Tue, 10 Mar 2009 17:57:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AHvfPJ069474; Tue, 10 Mar 2009 17:57:41 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AHvfgs069472; Tue, 10 Mar 2009 17:57:41 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903101757.n2AHvfgs069472@svn.freebsd.org> From: Robert Watson Date: Tue, 10 Mar 2009 17:57: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: r189637 - in head: sys/netinet usr.bin/sockstat 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 Mar 2009 17:57:42 -0000 Author: rwatson Date: Tue Mar 10 17:57:41 2009 New Revision: 189637 URL: http://svn.freebsd.org/changeset/base/189637 Log: Remove unused v6 macro aliases for inpcb fields: in6p_ip6_nxt in6p_vflag in6p_flags in6p_socket in6p_lport in6p_fport in6p_ppcb Remove unused v6 macro aliases for inpcb flags: IN6P_HIGHPORT IN6P_LOWPORT IN6P_ANONPORT IN6P_RECVIF IN6P_MTUDISC IN6P_FAITH IN6P_CONTROLOPTS References to in6p_lport and in6_fport in sockstat are also replaced with normal inp_lport and inp_fport references. MFC after: 3 days Reviewed by: bz Modified: head/sys/netinet/in_pcb.h head/usr.bin/sockstat/sockstat.c Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Tue Mar 10 17:54:04 2009 (r189636) +++ head/sys/netinet/in_pcb.h Tue Mar 10 17:57:41 2009 (r189637) @@ -214,19 +214,12 @@ struct inpcb { #define in6p_faddr inp_inc.inc6_faddr #define in6p_laddr inp_inc.inc6_laddr #define in6p_hops inp_depend6.inp6_hops /* default hop limit */ -#define in6p_ip6_nxt inp_ip_p #define in6p_flowinfo inp_flow -#define in6p_vflag inp_vflag #define in6p_options inp_depend6.inp6_options #define in6p_outputopts inp_depend6.inp6_outputopts #define in6p_moptions inp_depend6.inp6_moptions #define in6p_icmp6filt inp_depend6.inp6_icmp6filt #define in6p_cksum inp_depend6.inp6_cksum -#define in6p_flags inp_flags /* for KAME src sync over BSD*'s */ -#define in6p_socket inp_socket /* for KAME src sync over BSD*'s */ -#define in6p_lport inp_lport /* for KAME src sync over BSD*'s */ -#define in6p_fport inp_fport /* for KAME src sync over BSD*'s */ -#define in6p_ppcb inp_ppcb /* for KAME src sync over BSD*'s */ /* * The range of the generation count, as used in this implementation, is 9e19. @@ -434,19 +427,6 @@ void inp_4tuple_get(struct inpcb *inp, IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\ IN6P_MTU) - /* for KAME src sync over BSD*'s */ -#define IN6P_HIGHPORT INP_HIGHPORT -#define IN6P_LOWPORT INP_LOWPORT -#define IN6P_ANONPORT INP_ANONPORT -#define IN6P_RECVIF INP_RECVIF -#define IN6P_MTUDISC INP_MTUDISC -#define IN6P_FAITH INP_FAITH -#define IN6P_CONTROLOPTS INP_CONTROLOPTS - /* - * socket AF version is {newer than,or include} - * actual datagram AF version - */ - #define INPLOOKUP_WILDCARD 1 #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) #define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Tue Mar 10 17:54:04 2009 (r189636) +++ head/usr.bin/sockstat/sockstat.c Tue Mar 10 17:57:41 2009 (r189637) @@ -351,8 +351,8 @@ gather_inet(int proto) continue; #undef __IN_IS_ADDR_LOOPBACK } else if (inp->inp_vflag & INP_IPV6) { - if ((inp->in6p_fport == 0 && !opt_l) || - (inp->in6p_fport != 0 && !opt_c)) + if ((inp->inp_fport == 0 && !opt_l) || + (inp->inp_fport != 0 && !opt_c)) continue; if (opt_L && (IN6_IS_ADDR_LOOPBACK(&inp->in6p_faddr) || @@ -376,9 +376,9 @@ gather_inet(int proto) } else if (inp->inp_vflag & INP_IPV6) { sock->family = AF_INET6; sockaddr(&sock->laddr, sock->family, - &inp->in6p_laddr, inp->in6p_lport); + &inp->in6p_laddr, inp->inp_lport); sockaddr(&sock->faddr, sock->family, - &inp->in6p_faddr, inp->in6p_fport); + &inp->in6p_faddr, inp->inp_fport); } sock->vflag = inp->inp_vflag; sock->protoname = protoname; From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 18:05:07 2009 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 9CC48106564A; Tue, 10 Mar 2009 18:05:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id 52A838FC13; Tue, 10 Mar 2009 18:05:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id F0C2241C612; Tue, 10 Mar 2009 19:05:05 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id LSPM9XhgfzDv; Tue, 10 Mar 2009 19:05:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 9A3EE41C5DA; Tue, 10 Mar 2009 19:05:05 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 6056F4448E6; Tue, 10 Mar 2009 18:02:36 +0000 (UTC) Date: Tue, 10 Mar 2009 18:02:36 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Robert Watson In-Reply-To: <200903101757.n2AHvfgs069472@svn.freebsd.org> Message-ID: <20090310180133.H96785@maildrop.int.zabbadoz.net> References: <200903101757.n2AHvfgs069472@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189637 - in head: sys/netinet usr.bin/sockstat 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 Mar 2009 18:05:08 -0000 On Tue, 10 Mar 2009, Robert Watson wrote: > Author: rwatson > Date: Tue Mar 10 17:57:41 2009 > New Revision: 189637 > URL: http://svn.freebsd.org/changeset/base/189637 > > Log: > Remove unused v6 macro aliases for inpcb fields: > > in6p_ip6_nxt > in6p_vflag > in6p_flags > in6p_socket > in6p_lport > in6p_fport > in6p_ppcb > > Remove unused v6 macro aliases for inpcb flags: > > IN6P_HIGHPORT > IN6P_LOWPORT > IN6P_ANONPORT > IN6P_RECVIF > IN6P_MTUDISC > IN6P_FAITH > IN6P_CONTROLOPTS > > References to in6p_lport and in6_fport in sockstat are also replaced with > normal inp_lport and inp_fport references. > > MFC after: 3 days That's probably not possible -- at least not if/before I have MFCed all my changes from last Dec along with the other 50 pending MFCs in my queue. -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 18:07:15 2009 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 1D650106564A; Tue, 10 Mar 2009 18:07:15 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id CC9388FC12; Tue, 10 Mar 2009 18:07:14 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n2AI7hoo072413; Tue, 10 Mar 2009 14:07:43 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n2AI7hR9072412; Tue, 10 Mar 2009 14:07:43 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Tue, 10 Mar 2009 14:07:43 -0400 From: David Schultz To: Gavin Atkinson Message-ID: <20090310180743.GA72342@zim.MIT.EDU> Mail-Followup-To: Gavin Atkinson , Guido van Rooij , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200903101519.n2AFJovP065743@svn.freebsd.org> <1236699209.62820.32.camel@buffy.york.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1236699209.62820.32.camel@buffy.york.ac.uk> Cc: svn-src-head@FreeBSD.ORG, Guido van Rooij , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG Subject: Re: svn commit: r189624 - 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: Tue, 10 Mar 2009 18:07:15 -0000 On Tue, Mar 10, 2009, Gavin Atkinson wrote: > On Tue, 2009-03-10 at 15:19 +0000, Guido van Rooij wrote: > > Author: guido > > Date: Tue Mar 10 15:19:49 2009 > > New Revision: 189624 > > URL: http://svn.freebsd.org/changeset/base/189624 > > > > Log: > > When swap resides on a mirror and it is not stopped, the mirror > > is degraded upon the next reboot and will have to be rebuild. > > Thus call swapoff when rebooting (read: when stopping swap1) > > Is this due to a bug/feature of gmirror? A long time ago, swapoff used > to be run on shutdown, but it was removed by pjd@ in src/etc/rc.d/swap1 > version 1.9 with the following commit message: > > | Stop method for swap1 script was introduced, because gmirror needed > | it. Now gmirror use shutdown hooks to mark mirrors as clean on > | shutdown, so this is not needed anymore. > > I'm not saying it's not needed, just intrigued why it is now needed > again when it never used to be? > > FWIW, I seem to remember that one of the reasons it was removed was that > turning swap off created the possibility that lots of things would be > paged back into RAM, which a) could take a long time, and b) fail if > there was insufficient RAM. Ideally it should be done only when (if?) needed, and as late as possible in the shutdown process. For one, it's rather pointless to swap in all the pages for applications that will only be killed anyway. For two, swapoff() was designed as an infrequent administrative operation; it's not robust against I/O errors, and it doesn't do clustering or otherwise attempts to be efficient. From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 18:28:46 2009 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 71769106568B; Tue, 10 Mar 2009 18:28:46 +0000 (UTC) (envelope-from guido@gvr.org) Received: from gvr.gvr.org (gvr-gw.gvr.org [82.95.154.195]) by mx1.freebsd.org (Postfix) with ESMTP id 2BD828FC3F; Tue, 10 Mar 2009 18:28:46 +0000 (UTC) (envelope-from guido@gvr.org) Received: by gvr.gvr.org (Postfix, from userid 657) id ED12042D83C; Tue, 10 Mar 2009 19:01:57 +0100 (CET) Date: Tue, 10 Mar 2009 19:01:57 +0100 From: Guido van Rooij To: Fabian Keil Message-ID: <20090310180157.GA4663@gvr.gvr.org> References: <200903101523.n2AFNhs1065867@svn.freebsd.org> <20090310171948.1ac51696@fabiankeil.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090310171948.1ac51696@fabiankeil.de> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, phk@freebsd.org Subject: Re: svn commit: r189625 - head/sys/geom/eli 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 Mar 2009 18:28:48 -0000 On Tue, Mar 10, 2009 at 05:19:48PM +0100, Fabian Keil wrote: > > Log: > > When attaching a geli on boot make sure that it is detached > > upon last close. (needed for a gmirror to properly shutdown > > upon reboot when a geli is on top the gmirror) > > > > Detach-on-last-close is known to cause panics when > scrubbing at least some ZFS pools: > http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/117158 > > Quoting the PR: > |Quoting Pawel Jakub Dawidek's response to my initial report: > ||GELI's detach-on-last-close mechanism is a general purpose mechanism, it > ||may not work correctly with ZFS, because ZFS sometimes closes and reopen > ||providers, which will make GELI to detach. In other words you shouldn't > ||configure detach-on-last-close for ZFS components. > Grr. So we should make it tuneable. How about being able to set this flag with the geli command, like the G_ELI_FLAG_BOOT flag. -Guido From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 18:41:07 2009 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 73E9F106566B; Tue, 10 Mar 2009 18:41:07 +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 7F46D8FC1C; Tue, 10 Mar 2009 18:41:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AIf66p070378; Tue, 10 Mar 2009 18:41:06 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AIf6si070377; Tue, 10 Mar 2009 18:41:06 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903101841.n2AIf6si070377@svn.freebsd.org> From: John Baldwin Date: Tue, 10 Mar 2009 18:41: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: r189639 - head/sys/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: Tue, 10 Mar 2009 18:41:08 -0000 Author: jhb Date: Tue Mar 10 18:41:06 2009 New Revision: 189639 URL: http://svn.freebsd.org/changeset/base/189639 Log: - Remove code to set SAVENAME for CREATE or RENAME requests that get a -ve hit in the name cache. cache_lookup() doesn't actually return ENOENT for such requests to force the filesystem to do an explicit lookup, so this was effectively dead code. - Grab the nfsnode mutex while writing to n_dmtime. We don't grab the lock when comparing the time against the cached directory mod time (just as we don't when comparing ctime's for +ve name cache hits) since the attribute caching is already racy for NFS clients as it is. Discussed with: bde Modified: head/sys/nfsclient/nfs_vnops.c Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Tue Mar 10 18:16:03 2009 (r189638) +++ head/sys/nfsclient/nfs_vnops.c Tue Mar 10 18:41:06 2009 (r189639) @@ -923,14 +923,12 @@ nfs_lookup(struct vop_lookup_args *ap) if (VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && vattr.va_mtime.tv_sec == np->n_dmtime) { nfsstats.lookupcache_hits++; - if ((cnp->cn_nameiop == CREATE || - cnp->cn_nameiop == RENAME) && - (flags & ISLASTCN)) - cnp->cn_flags |= SAVENAME; return (ENOENT); } cache_purge_negative(dvp); + mtx_lock(&np->n_mtx); np->n_dmtime = 0; + mtx_unlock(&np->n_mtx); } error = 0; newvp = NULLVP; @@ -1041,8 +1039,10 @@ nfsmout: * name cache entry for this directory was * added. */ + mtx_lock(&np->n_mtx); if (np->n_dmtime == 0) np->n_dmtime = np->n_vattr.va_mtime.tv_sec; + mtx_unlock(&np->n_mtx); cache_enter(dvp, NULL, cnp); } return (ENOENT); From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 19:15:36 2009 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 31F83106564A; Tue, 10 Mar 2009 19:15:36 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F02D8FC1A; Tue, 10 Mar 2009 19:15:36 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AJFagC071208; Tue, 10 Mar 2009 19:15:36 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AJFam9071207; Tue, 10 Mar 2009 19:15:36 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903101915.n2AJFam9071207@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 19:15: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: r189641 - head/sys/arm/xscale/ixp425 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 Mar 2009 19:15:36 -0000 Author: sam Date: Tue Mar 10 19:15:35 2009 New Revision: 189641 URL: http://svn.freebsd.org/changeset/base/189641 Log: o add missing bus_release_resource and bus_deactivate_resource that just operate on the resource (we have no local resources to manage); this fixes drivers that alloc/release resources in their probe method and then do it again in attach o while here add some prints to catch failures and massage style a bit Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Tue Mar 10 18:57:10 2009 (r189640) +++ head/sys/arm/xscale/ixp425/ixp425.c Tue Mar 10 19:15:35 2009 (r189641) @@ -440,7 +440,6 @@ ixp425_alloc_resource(device_t dev, devi { struct ixp425_softc *sc = device_get_softc(dev); const struct hwvtrans *vtrans; - struct rman *rmanp; struct resource *rv; uint32_t addr; int needactivate = flags & RF_ACTIVE; @@ -449,18 +448,16 @@ ixp425_alloc_resource(device_t dev, devi flags &= ~RF_ACTIVE; switch (type) { case SYS_RES_IRQ: - rmanp = &sc->sc_irq_rman; /* override per hints */ if (BUS_READ_IVAR(dev, child, IXP425_IVAR_IRQ, &irq) == 0) start = end = irq; - rv = rman_reserve_resource(rmanp, start, end, count, - flags, child); + rv = rman_reserve_resource(&sc->sc_irq_rman, start, end, count, + flags, child); if (rv != NULL) rman_set_rid(rv, *rid); break; case SYS_RES_MEMORY: - rmanp = &sc->sc_mem_rman; /* override per hints */ if (BUS_READ_IVAR(dev, child, IXP425_IVAR_ADDR, &addr) == 0) { start = addr; @@ -485,13 +482,17 @@ ixp425_alloc_resource(device_t dev, devi if (vtrans == NULL) { /* likely means above table needs to be updated */ device_printf(child, "%s: no mapping for 0x%lx:0x%lx\n", - __func__, start, end-start); + __func__, start, end - start); return NULL; } - rv = rman_reserve_resource(rmanp, start, end, end - start, - flags, child); - if (rv != NULL) - rman_set_rid(rv, *rid); + rv = rman_reserve_resource(&sc->sc_mem_rman, start, end, + end - start, flags, child); + if (rv == NULL) { + device_printf(child, "%s: cannot reserve 0x%lx:0x%lx\n", + __func__, start, end - start); + return NULL; + } + rman_set_rid(rv, *rid); break; default: rv = NULL; @@ -507,6 +508,14 @@ ixp425_alloc_resource(device_t dev, devi } static int +ixp425_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + /* NB: no private resources, just release */ + return rman_release_resource(r); +} + +static int ixp425_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { @@ -515,8 +524,11 @@ ixp425_activate_resource(device_t dev, d if (type == SYS_RES_MEMORY) { vtrans = gethwvtrans(rman_get_start(r), rman_get_size(r)); - if (vtrans == NULL) /* NB: should not happen */ + if (vtrans == NULL) { /* NB: should not happen */ + device_printf(child, "%s: no mapping for 0x%lx:0x%lx\n", + __func__, rman_get_start(r), rman_get_size(r)); return (ENOENT); + } if (vtrans->isa4x) rman_set_bustag(r, &ixp425_a4x_bs_tag); else @@ -526,6 +538,14 @@ ixp425_activate_resource(device_t dev, d return (rman_activate_resource(r)); } +static int +ixp425_deactivate_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + /* NB: no private resources, just deactive */ + return (rman_deactivate_resource(r)); +} + static __inline void get_masks(struct resource *res, uint32_t *mask, uint32_t *mask2) { @@ -581,19 +601,21 @@ ixp425_teardown_intr(device_t dev, devic static device_method_t ixp425_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, ixp425_probe), - DEVMETHOD(device_attach, ixp425_attach), - DEVMETHOD(device_identify, ixp425_identify), + DEVMETHOD(device_probe, ixp425_probe), + DEVMETHOD(device_attach, ixp425_attach), + DEVMETHOD(device_identify, ixp425_identify), /* Bus interface */ - DEVMETHOD(bus_add_child, ixp425_add_child), - DEVMETHOD(bus_hinted_child, ixp425_hinted_child), - DEVMETHOD(bus_read_ivar, ixp425_read_ivar), - - DEVMETHOD(bus_alloc_resource, ixp425_alloc_resource), - DEVMETHOD(bus_activate_resource, ixp425_activate_resource), - DEVMETHOD(bus_setup_intr, ixp425_setup_intr), - DEVMETHOD(bus_teardown_intr, ixp425_teardown_intr), + DEVMETHOD(bus_add_child, ixp425_add_child), + DEVMETHOD(bus_hinted_child, ixp425_hinted_child), + DEVMETHOD(bus_read_ivar, ixp425_read_ivar), + + DEVMETHOD(bus_alloc_resource, ixp425_alloc_resource), + DEVMETHOD(bus_release_resource, ixp425_release_resource), + DEVMETHOD(bus_activate_resource, ixp425_activate_resource), + DEVMETHOD(bus_deactivate_resource, ixp425_deactivate_resource), + DEVMETHOD(bus_setup_intr, ixp425_setup_intr), + DEVMETHOD(bus_teardown_intr, ixp425_teardown_intr), {0, 0}, }; From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 19:18:11 2009 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 E97F4106564A; Tue, 10 Mar 2009 19:18:11 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D78498FC1B; Tue, 10 Mar 2009 19:18:11 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AJIBQ0071294; Tue, 10 Mar 2009 19:18:11 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AJIB08071293; Tue, 10 Mar 2009 19:18:11 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903101918.n2AJIB08071293@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 19:18: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: r189642 - head/sys/arm/xscale/ixp425 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 Mar 2009 19:18:12 -0000 Author: sam Date: Tue Mar 10 19:18:11 2009 New Revision: 189642 URL: http://svn.freebsd.org/changeset/base/189642 Log: turn off inclusion of FCS in rx'd frames; we don't use it anywhere and dhclient gets annoyed when it receives FCS in frames via bpf Modified: head/sys/arm/xscale/ixp425/if_npe.c Modified: head/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- head/sys/arm/xscale/ixp425/if_npe.c Tue Mar 10 19:15:35 2009 (r189641) +++ head/sys/arm/xscale/ixp425/if_npe.c Tue Mar 10 19:18:11 2009 (r189642) @@ -1108,7 +1108,6 @@ npe_rxdone(int qid, void *arg) mrx->m_len = be32toh(hw->ix_ne[0].len) & 0xffff; mrx->m_pkthdr.len = mrx->m_len; mrx->m_pkthdr.rcvif = ifp; - mrx->m_flags |= M_HASFCS; ifp->if_ipackets++; ifp->if_input(ifp, mrx); @@ -1222,9 +1221,8 @@ if (ifp->if_drv_flags & IFF_DRV_RUNNING) | NPE_TX_CNTRL1_2DEFER /* 2-part deferal */ | NPE_TX_CNTRL1_PAD_EN); /* pad runt frames */ /* XXX pad strip? */ - WR4(sc, NPE_MAC_RX_CNTRL1, - NPE_RX_CNTRL1_CRC_EN /* include CRC/FCS */ - | NPE_RX_CNTRL1_PAUSE_EN); /* ena pause frame handling */ + /* ena pause frame handling */ + WR4(sc, NPE_MAC_RX_CNTRL1, NPE_RX_CNTRL1_PAUSE_EN); WR4(sc, NPE_MAC_RX_CNTRL2, 0); npe_setmac(sc, IF_LLADDR(ifp)); From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 19:22:46 2009 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 6DE4A106566C; Tue, 10 Mar 2009 19:22:46 +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 590748FC1F; Tue, 10 Mar 2009 19:22:46 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AJMk80071428; Tue, 10 Mar 2009 19:22:46 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AJMja9071422; Tue, 10 Mar 2009 19:22:45 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200903101922.n2AJMja9071422@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 10 Mar 2009 19:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189643 - in head: sys/dev/cxgb sys/dev/cxgb/common usr.sbin/cxgbtool 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 Mar 2009 19:22:47 -0000 Author: gnn Date: Tue Mar 10 19:22:45 2009 New Revision: 189643 URL: http://svn.freebsd.org/changeset/base/189643 Log: Update the Chelsio driver to the latest bits from Chelsio Firmware upgraded to 7.1.0 (from 5.0.0). T3C EEPROM and SRAM added; Code to update eeprom/sram fixed. fl_empty and rx_fifo_ovfl counters can be observed via sysctl. Two new cxgbtool commands to get uP logic analyzer info and uP IOQs Synced up with Chelsio's "common code" (as of 03/03/09) Submitted by: Navdeep Parhar at Chelsio Reviewed by: gnn MFC after: 2 weeks Added: head/sys/dev/cxgb/t3c_protocol_sram.h (contents, props changed) head/sys/dev/cxgb/t3c_tp_eeprom.h (contents, props changed) Modified: head/sys/dev/cxgb/bin2h.pl head/sys/dev/cxgb/common/cxgb_ael1002.c head/sys/dev/cxgb/common/cxgb_common.h head/sys/dev/cxgb/common/cxgb_t3_cpl.h head/sys/dev/cxgb/common/cxgb_t3_hw.c head/sys/dev/cxgb/common/cxgb_xgmac.c head/sys/dev/cxgb/cxgb_adapter.h head/sys/dev/cxgb/cxgb_ioctl.h head/sys/dev/cxgb/cxgb_main.c head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/cxgb/cxgb_t3fw.c head/sys/dev/cxgb/cxgb_t3fw.h head/usr.sbin/cxgbtool/cxgbtool.c head/usr.sbin/cxgbtool/version.h Modified: head/sys/dev/cxgb/bin2h.pl ============================================================================== --- head/sys/dev/cxgb/bin2h.pl Tue Mar 10 19:18:11 2009 (r189642) +++ head/sys/dev/cxgb/bin2h.pl Tue Mar 10 19:22:45 2009 (r189643) @@ -22,7 +22,7 @@ unless ($success) { my $license = < 10 ? phy_modtype_twinax_long : - phy_modtype_twinax; - } - } else if (v == 0x6) { - /* XFP: See INF-8077i for details. */ - - v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 127); - if (v < 0) - return v; - - if (v != 1) { - /* XXX: set page select to table 1 yourself */ - return phy_modtype_unknown; - } - - v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 131); - if (v < 0) - return v; - if (v == 0x10) - return phy_modtype_lrm; - if (v == 0x40) - return phy_modtype_lr; - if (v == 0x80) - return phy_modtype_sr; - } - - return phy_modtype_unknown; -} +static int get_module_type(struct cphy *phy); static int set_phy_regs(struct cphy *phy, const struct reg_val *rv) { @@ -164,6 +108,110 @@ static void ael100x_txon(struct cphy *ph msleep(30); } +static int ael_i2c_rd(struct cphy *phy, int dev_addr, int word_addr) +{ + int i, err; + unsigned int stat, data; + + err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL_I2C_CTRL, + (dev_addr << 8) | (1 << 8) | word_addr); + if (err) + return err; + + for (i = 0; i < 200; i++) { + msleep(1); + err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_STAT, &stat); + if (err) + return err; + if ((stat & 3) == 1) { + err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_DATA, + &data); + if (err) + return err; + return data >> 8; + } + } + CH_WARN(phy->adapter, "PHY %u I2C read of addr %u timed out\n", + phy->addr, word_addr); + return -ETIMEDOUT; +} + +static int ael_i2c_wr(struct cphy *phy, int dev_addr, int word_addr, int data) +{ + int i, err; + unsigned int stat; + + err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL_I2C_DATA, data); + if (err) + return err; + + err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL_I2C_CTRL, + (dev_addr << 8) | word_addr); + if (err) + return err; + + for (i = 0; i < 200; i++) { + msleep(1); + err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_STAT, &stat); + if (err) + return err; + if ((stat & 3) == 1) + return 0; + } + CH_WARN(phy->adapter, "PHY %u I2C Write of addr %u timed out\n", + phy->addr, word_addr); + return -ETIMEDOUT; +} + +static int get_phytrans_type(struct cphy *phy) +{ + int v; + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0); + if (v < 0) + return phy_transtype_unknown; + + return v; +} + +static int ael_laser_down(struct cphy *phy, int enable) +{ + int v, dev_addr; + + v = get_phytrans_type(phy); + if (v < 0) + return v; + + if (v == phy_transtype_sfp) { + /* Check SFF Soft TX disable is supported */ + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 93); + if (v < 0) + return v; + + v &= 0x40; + if (!v) + return v; + + dev_addr = SFF_DEV_ADDR; + } else if (v == phy_transtype_xfp) + dev_addr = MODULE_DEV_ADDR; + else + return v; + + v = ael_i2c_rd(phy, dev_addr, 110); + if (v < 0) + return v; + + if (enable) + v |= 0x40; + else + v &= ~0x40; + + v = ael_i2c_wr(phy, dev_addr, 110, v); + + return v; +} + static int ael1002_power_down(struct cphy *phy, int enable) { int err; @@ -182,9 +230,9 @@ static int ael1002_get_module_type(struc if (delay_ms) msleep(delay_ms); - v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 0); + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0); - return v == -ETIMEDOUT ? phy_modtype_none : get_module_type(phy, v); + return v == -ETIMEDOUT ? phy_modtype_none : get_module_type(phy); } static int ael1002_reset(struct cphy *phy, int wait) @@ -273,6 +321,7 @@ int t3_ael1002_phy_prep(struct cphy *phy SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE, "10GBASE-R"); ael100x_txon(phy); + ael_laser_down(phy, 0); err = ael1002_get_module_type(phy, 0); if (err >= 0) @@ -283,31 +332,38 @@ int t3_ael1002_phy_prep(struct cphy *phy static int ael1006_reset(struct cphy *phy, int wait) { - u32 gpio_out; - t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); - /* Hack to reset the phy correctly */ - /* Read out the current value */ - gpio_out = t3_read_reg(phy->adapter, A_T3DBG_GPIO_EN); - /* Reset the phy */ - gpio_out &= ~F_GPIO6_OUT_VAL; - t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out); + int err; + + err = t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); + if (err) + return err; + + t3_set_reg_field(phy->adapter, A_T3DBG_GPIO_EN, + F_GPIO6_OUT_VAL, 0); + + msleep(125); + + t3_set_reg_field(phy->adapter, A_T3DBG_GPIO_EN, + F_GPIO6_OUT_VAL, F_GPIO6_OUT_VAL); + + msleep(125); + + err = t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); + if (err) + return err; + msleep(125); - /* Take the phy out of reset */ - gpio_out |= F_GPIO6_OUT_VAL; - t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out); + + err = t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 1); + if (err) + return err; + msleep(125); - t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); - /* Phy loopback work around for ael1006 */ - /* Soft reset phy by toggling loopback */ - msleep(125); - /* Put phy into local loopback */ - t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 0, 1); - msleep(125); - /* Take phy out of local loopback */ - t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 0); + err = t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 0); - return 0; + return err; + } static int ael1006_power_down(struct cphy *phy, int enable) @@ -1047,53 +1103,71 @@ static int ael2005_setup_twinax_edc(stru return err; } -static int ael2005_i2c_rd(struct cphy *phy, int dev_addr, int word_addr) +static int get_module_type(struct cphy *phy) { - int i, err; - unsigned int stat, data; + int v; - err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL_I2C_CTRL, - (dev_addr << 8) | (1 << 8) | word_addr); - if (err) - return err; + v = get_phytrans_type(phy); + if (v == phy_transtype_sfp) { + /* SFP: see SFF-8472 for below */ - for (i = 0; i < 5; i++) { - msleep(1); - err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_STAT, &stat); - if (err) - return err; - if ((stat & 3) == 1) { - err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_DATA, - &data); - if (err) - return err; - return data >> 8; - } - } - CH_WARN(phy->adapter, "PHY %u I2C read of addr %u timed out\n", - phy->addr, word_addr); - return -ETIMEDOUT; -} + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 3); + if (v < 0) + return v; -static int ael2005_get_module_type(struct cphy *phy, int delay_ms) -{ - int v; - unsigned int stat; + if (v == 0x1) + return phy_modtype_twinax; + if (v == 0x10) + return phy_modtype_sr; + if (v == 0x20) + return phy_modtype_lr; + if (v == 0x40) + return phy_modtype_lrm; - v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, &stat); - if (v) - return v; + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 6); + if (v < 0) + return v; + if (v != 4) + return phy_modtype_unknown; - if (stat & (1 << 8)) /* module absent */ - return phy_modtype_none; + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 10); + if (v < 0) + return v; - if (delay_ms) - msleep(delay_ms); + if (v & 0x80) { + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0x12); + if (v < 0) + return v; + return v > 10 ? phy_modtype_twinax_long : + phy_modtype_twinax; + } + } else if (v == phy_transtype_xfp) { + /* XFP: See INF-8077i for details. */ + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 127); + if (v < 0) + return v; + + if (v != 1) { + /* XXX: set page select to table 1 yourself */ + return phy_modtype_unknown; + } - return get_module_type(phy, 0); + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 131); + if (v < 0) + return v; + if (v == 0x10) + return phy_modtype_lrm; + if (v == 0x40) + return phy_modtype_lr; + if (v == 0x80) + return phy_modtype_sr; + } + return phy_modtype_unknown; } + static int ael2005_intr_enable(struct cphy *phy) { int err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, 0x200); @@ -1112,6 +1186,24 @@ static int ael2005_intr_clear(struct cph return err ? err : t3_phy_lasi_intr_clear(phy); } +static int ael2005_get_module_type(struct cphy *phy, int delay_ms) +{ + int v; + unsigned int stat; + + v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, &stat); + if (v) + return v; + + if (stat & (1 << 8)) /* module absent */ + return phy_modtype_none; + + if (delay_ms) + msleep(delay_ms); + + return get_module_type(phy); +} + static int ael2005_reset(struct cphy *phy, int wait) { static struct reg_val regs0[] = { @@ -1207,7 +1299,13 @@ static int ael2005_intr_handler(struct c } ret = t3_phy_lasi_intr_handler(phy); - return ret < 0 ? ret : ret + cause; + if (ret < 0) + return ret; + + ret |= cause; + if (!ret) + ret |= cphy_cause_link_change; + return ret; } #ifdef C99_NOT_SUPPORTED @@ -1245,6 +1343,7 @@ int t3_ael2005_phy_prep(struct cphy *phy SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE | SUPPORTED_IRQ, "10GBASE-R"); msleep(125); + ael_laser_down(phy, 0); err = ael2005_get_module_type(phy, 0); if (err >= 0) @@ -1335,7 +1434,7 @@ static int xaui_direct_get_link_status(s { if (link_ok) { unsigned int status; - + status = t3_read_reg(phy->adapter, XGM_REG(A_XGM_SERDES_STAT0, phy->addr)) | t3_read_reg(phy->adapter, Modified: head/sys/dev/cxgb/common/cxgb_common.h ============================================================================== --- head/sys/dev/cxgb/common/cxgb_common.h Tue Mar 10 19:18:11 2009 (r189642) +++ head/sys/dev/cxgb/common/cxgb_common.h Tue Mar 10 19:22:45 2009 (r189643) @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2007-2008, Chelsio Inc. +Copyright (c) 2007-2009, Chelsio Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -92,12 +92,22 @@ enum { (((x) >> S_TP_VERSION_MICRO) & M_TP_VERSION_MICRO) enum { - FW_VERSION_MAJOR = 5, - FW_VERSION_MINOR = 0, + FW_VERSION_MAJOR = 7, + FW_VERSION_MINOR = 1, FW_VERSION_MICRO = 0 }; enum { + LA_CTRL = 0x80, + LA_DATA = 0x84, + LA_ENTRIES = 512 +}; + +enum { + IOQ_ENTRIES = 7 +}; + +enum { SGE_QSETS = 8, /* # of SGE Tx/Rx/RspQ sets */ SGE_RXQ_PER_SET = 2, /* # of Rx queues per set */ SGE_TXQ_PER_SET = 3 /* # of Tx queues per set */ @@ -143,8 +153,6 @@ struct adapter_info { unsigned char nports0; /* # of ports on channel 0 */ unsigned char nports1; /* # of ports on channel 1 */ unsigned char phy_base_addr; /* MDIO PHY base address */ - unsigned char mdien:1; - unsigned char mdiinv:1; unsigned int gpio_out; /* GPIO output settings */ unsigned char gpio_intr[MAX_PHYINTRS]; /* GPIO PHY IRQ pins */ unsigned long caps; /* adapter capabilities */ @@ -231,6 +239,8 @@ struct mac_stats { unsigned long num_toggled; /* # times toggled TxEn due to stuck TX */ unsigned long num_resets; /* # times reset due to stuck TX */ + + unsigned long link_faults; /* # detected link faults */ }; struct tp_mib_stats { @@ -345,6 +355,14 @@ struct vpd_params { unsigned short xauicfg[2]; }; +struct generic_vpd { + u32 offset; + u32 len; + u8 *data; +}; + +enum { MAX_VPD_BYTES = 32000 }; + struct pci_params { unsigned int vpd_cap_addr; unsigned int pcie_cap_addr; @@ -674,6 +692,8 @@ int t3_phy_lasi_intr_handler(struct cphy void t3_intr_enable(adapter_t *adapter); void t3_intr_disable(adapter_t *adapter); void t3_intr_clear(adapter_t *adapter); +void t3_xgm_intr_enable(adapter_t *adapter, int idx); +void t3_xgm_intr_disable(adapter_t *adapter, int idx); void t3_port_intr_enable(adapter_t *adapter, int idx); void t3_port_intr_disable(adapter_t *adapter, int idx); void t3_port_intr_clear(adapter_t *adapter, int idx); @@ -681,29 +701,34 @@ int t3_slow_intr_handler(adapter_t *adap int t3_phy_intr_handler(adapter_t *adapter); void t3_link_changed(adapter_t *adapter, int port_id); +void t3_link_fault(adapter_t *adapter, int port_id); int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); const struct adapter_info *t3_get_adapter_info(unsigned int board_id); int t3_seeprom_read(adapter_t *adapter, u32 addr, u32 *data); int t3_seeprom_write(adapter_t *adapter, u32 addr, u32 data); int t3_seeprom_wp(adapter_t *adapter, int enable); +int t3_get_vpd_len(adapter_t *adapter, struct generic_vpd *vpd); +int t3_read_vpd(adapter_t *adapter, struct generic_vpd *vpd); int t3_read_flash(adapter_t *adapter, unsigned int addr, unsigned int nwords, u32 *data, int byte_oriented); int t3_get_tp_version(adapter_t *adapter, u32 *vers); -int t3_check_tpsram_version(adapter_t *adapter, int *must_load); +int t3_check_tpsram_version(adapter_t *adapter); int t3_check_tpsram(adapter_t *adapter, const u8 *tp_ram, unsigned int size); int t3_load_fw(adapter_t *adapter, const u8 *fw_data, unsigned int size); int t3_get_fw_version(adapter_t *adapter, u32 *vers); -int t3_check_fw_version(adapter_t *adapter, int *must_load); +int t3_check_fw_version(adapter_t *adapter); int t3_load_boot(adapter_t *adapter, u8 *fw_data, unsigned int size); int t3_init_hw(adapter_t *adapter, u32 fw_params); void mac_prep(struct cmac *mac, adapter_t *adapter, int index); void early_hw_init(adapter_t *adapter, const struct adapter_info *ai); +int t3_reset_adapter(adapter_t *adapter); int t3_prep_adapter(adapter_t *adapter, const struct adapter_info *ai, int reset); int t3_reinit_adapter(adapter_t *adap); void t3_led_ready(adapter_t *adapter); void t3_fatal_err(adapter_t *adapter); void t3_set_vlan_accel(adapter_t *adapter, unsigned int ports, int on); void t3_enable_filters(adapter_t *adap); +void t3_disable_filters(adapter_t *adap); void t3_tp_set_offload_mode(adapter_t *adap, int enable); void t3_config_rss(adapter_t *adapter, unsigned int rss_config, const u8 *cpus, const u16 *rspq); @@ -720,6 +745,8 @@ int t3_mc7_bd_read(struct mc7 *mc7, unsi int t3_mac_reset(struct cmac *mac); void t3b_pcs_reset(struct cmac *mac); +void t3_mac_disable_exact_filters(struct cmac *mac); +void t3_mac_enable_exact_filters(struct cmac *mac); int t3_mac_enable(struct cmac *mac, int which); int t3_mac_disable(struct cmac *mac, int which); int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu); @@ -750,6 +777,8 @@ void t3_get_cong_cntl_tab(adapter_t *ada unsigned short incr[NMTUS][NCCTRL_WIN]); void t3_config_trace_filter(adapter_t *adapter, const struct trace_params *tp, int filter_index, int invert, int enable); +void t3_query_trace_filter(adapter_t *adapter, struct trace_params *tp, + int filter_index, int *inverted, int *enabled); int t3_config_sched(adapter_t *adap, unsigned int kbps, int sched); int t3_set_sched_ipg(adapter_t *adap, int sched, unsigned int ipg); void t3_get_tx_sched(adapter_t *adap, unsigned int sched, unsigned int *kbps, @@ -759,6 +788,10 @@ void t3_set_pace_tbl(adapter_t *adap, un unsigned int start, unsigned int n); #endif +int t3_get_up_la(adapter_t *adapter, u32 *stopped, u32 *index, + u32 *size, void *data); +int t3_get_up_ioqs(adapter_t *adapter, u32 *size, void *data); + void t3_sge_prep(adapter_t *adap, struct sge_params *p); void t3_sge_init(adapter_t *adap, struct sge_params *p); int t3_sge_init_ecntxt(adapter_t *adapter, unsigned int id, int gts_enable, @@ -795,6 +828,11 @@ int t3_vsc7323_enable(adapter_t *adap, i int t3_vsc7323_disable(adapter_t *adap, int port, int which); const struct mac_stats *t3_vsc7323_update_stats(struct cmac *mac); +int t3_mi1_read(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr, + unsigned int *valp); +int t3_mi1_write(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr, + unsigned int val); + int t3_mv88e1xxx_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr, const struct mdio_ops *mdio_ops); int t3_vsc8211_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr, Modified: head/sys/dev/cxgb/common/cxgb_t3_cpl.h ============================================================================== --- head/sys/dev/cxgb/common/cxgb_t3_cpl.h Tue Mar 10 19:18:11 2009 (r189642) +++ head/sys/dev/cxgb/common/cxgb_t3_cpl.h Tue Mar 10 19:22:45 2009 (r189643) @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2007, Chelsio Inc. +Copyright (c) 2007-2009 Chelsio Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -273,6 +273,14 @@ struct work_request_hdr { #define V_WR_FLUSH(x) ((x) << S_WR_FLUSH) #define F_WR_FLUSH V_WR_FLUSH(1U) +#define S_WR_CHN 18 +#define V_WR_CHN(x) ((x) << S_WR_CHN) +#define F_WR_CHN V_WR_CHN(1U) + +#define S_WR_CHN_VLD 19 +#define V_WR_CHN_VLD(x) ((x) << S_WR_CHN_VLD) +#define F_WR_CHN_VLD V_WR_CHN_VLD(1U) + #define S_WR_DATATYPE 20 #define V_WR_DATATYPE(x) ((x) << S_WR_DATATYPE) #define F_WR_DATATYPE V_WR_DATATYPE(1U) Modified: head/sys/dev/cxgb/common/cxgb_t3_hw.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_t3_hw.c Tue Mar 10 19:18:11 2009 (r189642) +++ head/sys/dev/cxgb/common/cxgb_t3_hw.c Tue Mar 10 19:22:45 2009 (r189643) @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2007-2008, Chelsio Inc. +Copyright (c) 2007-2009, Chelsio Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -194,21 +194,18 @@ int t3_mc7_bd_read(struct mc7 *mc7, unsi static void mi1_init(adapter_t *adap, const struct adapter_info *ai) { u32 clkdiv = adap->params.vpd.cclk / (2 * adap->params.vpd.mdc) - 1; - u32 val = F_PREEN | V_MDIINV(ai->mdiinv) | V_MDIEN(ai->mdien) | - V_CLKDIV(clkdiv); + u32 val = F_PREEN | V_CLKDIV(clkdiv); - if (!(ai->caps & SUPPORTED_10000baseT_Full)) - val |= V_ST(1); t3_write_reg(adap, A_MI1_CFG, val); } #define MDIO_ATTEMPTS 20 /* - * MI1 read/write operations for direct-addressed PHYs. + * MI1 read/write operations for clause 22 PHYs. */ -static int mi1_read(adapter_t *adapter, int phy_addr, int mmd_addr, - int reg_addr, unsigned int *valp) +int t3_mi1_read(adapter_t *adapter, int phy_addr, int mmd_addr, + int reg_addr, unsigned int *valp) { int ret; u32 addr = V_REGADDR(reg_addr) | V_PHYADDR(phy_addr); @@ -217,6 +214,7 @@ static int mi1_read(adapter_t *adapter, return -EINVAL; MDIO_LOCK(adapter); + t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), V_ST(1)); t3_write_reg(adapter, A_MI1_ADDR, addr); t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(2)); ret = t3_wait_op_done(adapter, A_MI1_OP, F_BUSY, 0, MDIO_ATTEMPTS, 10); @@ -226,8 +224,8 @@ static int mi1_read(adapter_t *adapter, return ret; } -static int mi1_write(adapter_t *adapter, int phy_addr, int mmd_addr, - int reg_addr, unsigned int val) +int t3_mi1_write(adapter_t *adapter, int phy_addr, int mmd_addr, + int reg_addr, unsigned int val) { int ret; u32 addr = V_REGADDR(reg_addr) | V_PHYADDR(phy_addr); @@ -236,6 +234,7 @@ static int mi1_write(adapter_t *adapter, return -EINVAL; MDIO_LOCK(adapter); + t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), V_ST(1)); t3_write_reg(adapter, A_MI1_ADDR, addr); t3_write_reg(adapter, A_MI1_DATA, val); t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(1)); @@ -245,12 +244,12 @@ static int mi1_write(adapter_t *adapter, } static struct mdio_ops mi1_mdio_ops = { - mi1_read, - mi1_write + t3_mi1_read, + t3_mi1_write }; /* - * MI1 read/write operations for indirect-addressed PHYs. + * MI1 read/write operations for clause 45 PHYs. */ static int mi1_ext_read(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr, unsigned int *valp) @@ -259,6 +258,7 @@ static int mi1_ext_read(adapter_t *adapt u32 addr = V_REGADDR(mmd_addr) | V_PHYADDR(phy_addr); MDIO_LOCK(adapter); + t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), 0); t3_write_reg(adapter, A_MI1_ADDR, addr); t3_write_reg(adapter, A_MI1_DATA, reg_addr); t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(0)); @@ -281,6 +281,7 @@ static int mi1_ext_write(adapter_t *adap u32 addr = V_REGADDR(mmd_addr) | V_PHYADDR(phy_addr); MDIO_LOCK(adapter); + t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), 0); t3_write_reg(adapter, A_MI1_ADDR, addr); t3_write_reg(adapter, A_MI1_DATA, reg_addr); t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(0)); @@ -485,32 +486,32 @@ int t3_phy_lasi_intr_handler(struct cphy } static struct adapter_info t3_adap_info[] = { - { 1, 1, 0, 0, 0, + { 1, 1, 0, F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0, &mi1_mdio_ops, "Chelsio PE9000" }, - { 1, 1, 0, 0, 0, + { 1, 1, 0, F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0, &mi1_mdio_ops, "Chelsio T302" }, - { 1, 0, 0, 0, 0, + { 1, 0, 0, F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, { 0 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, &mi1_mdio_ext_ops, "Chelsio T310" }, - { 1, 1, 0, 0, 0, + { 1, 1, 0, F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, { S_GPIO9, S_GPIO3 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, &mi1_mdio_ext_ops, "Chelsio T320" }, - { 4, 0, 0, 0, 0, + { 4, 0, 0, F_GPIO5_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO7_OUT_VAL, { S_GPIO1, S_GPIO2, S_GPIO3, S_GPIO4 }, SUPPORTED_AUI, &mi1_mdio_ops, "Chelsio T304" }, { 0 }, - { 1, 0, 0, 0, 0, + { 1, 0, 0, F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, { S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, @@ -747,16 +748,17 @@ enum { SF_ERASE_SECTOR = 0xd8, /* erase sector */ FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */ - OLD_FW_VERS_ADDR = 0x77ffc, /* flash address holding FW version */ FW_VERS_ADDR = 0x7fffc, /* flash address holding FW version */ + FW_VERS_ADDR_PRE8 = 0x77ffc,/* flash address holding FW version pre8 */ FW_MIN_SIZE = 8, /* at least version and csum */ FW_MAX_SIZE = FW_VERS_ADDR - FW_FLASH_BOOT_ADDR, + FW_MAX_SIZE_PRE8 = FW_VERS_ADDR_PRE8 - FW_FLASH_BOOT_ADDR, BOOT_FLASH_BOOT_ADDR = 0x0,/* start address of boot image in flash */ BOOT_SIGNATURE = 0xaa55, /* signature of BIOS boot ROM */ BOOT_SIZE_INC = 512, /* image size measured in 512B chunks */ BOOT_MIN_SIZE = sizeof(boot_header_t), /* at least basic header */ - BOOT_MAX_SIZE = 0xff*BOOT_SIZE_INC /* 1 byte * length increment */ + BOOT_MAX_SIZE = 1024*BOOT_SIZE_INC /* 1 byte * length increment */ }; /** @@ -885,7 +887,7 @@ int t3_read_flash(adapter_t *adapter, un * at the given address. * If @byte_oriented is set the write data is stored as a 32-bit * big-endian array, otherwise in the processor's native endianess. - * + * */ static int t3_write_flash(adapter_t *adapter, unsigned int addr, unsigned int n, const u8 *data, @@ -946,7 +948,7 @@ int t3_get_tp_version(adapter_t *adapter 1, 1, 5, 1); if (ret) return ret; - + *vers = t3_read_reg(adapter, A_TP_EMBED_OP_FIELD1); return 0; @@ -957,7 +959,7 @@ int t3_get_tp_version(adapter_t *adapter * @adapter: the adapter * */ -int t3_check_tpsram_version(adapter_t *adapter, int *must_load) +int t3_check_tpsram_version(adapter_t *adapter) { int ret; u32 vers; @@ -966,26 +968,19 @@ int t3_check_tpsram_version(adapter_t *a if (adapter->params.rev == T3_REV_A) return 0; - *must_load = 1; ret = t3_get_tp_version(adapter, &vers); if (ret) return ret; - + vers = t3_read_reg(adapter, A_TP_EMBED_OP_FIELD1); major = G_TP_VERSION_MAJOR(vers); minor = G_TP_VERSION_MINOR(vers); - if (major == TP_VERSION_MAJOR && minor == TP_VERSION_MINOR) + if (major == TP_VERSION_MAJOR && minor == TP_VERSION_MINOR) return 0; - - if (major != TP_VERSION_MAJOR) - CH_ERR(adapter, "found wrong TP version (%u.%u), " - "driver needs version %d.%d\n", major, minor, - TP_VERSION_MAJOR, TP_VERSION_MINOR); else { - *must_load = 0; CH_ERR(adapter, "found wrong TP version (%u.%u), " "driver compiled for version %d.%d\n", major, minor, TP_VERSION_MAJOR, TP_VERSION_MINOR); @@ -994,7 +989,7 @@ int t3_check_tpsram_version(adapter_t *a } /** - * t3_check_tpsram - check if provided protocol SRAM + * t3_check_tpsram - check if provided protocol SRAM * is compatible with this driver * @adapter: the adapter * @tp_sram: the firmware image to write @@ -1031,16 +1026,17 @@ enum fw_version_type { * @adapter: the adapter * @vers: where to place the version * - * Reads the FW version from flash. + * Reads the FW version from flash. Note that we had to move the version + * due to FW size. If we don't find a valid FW version in the new location + * we fall back and read the old location. */ int t3_get_fw_version(adapter_t *adapter, u32 *vers) { int ret = t3_read_flash(adapter, FW_VERS_ADDR, 1, vers, 0); - if (!ret && *vers != 0xffffffff) return 0; else - return t3_read_flash(adapter, OLD_FW_VERS_ADDR, 1, vers, 0); + return t3_read_flash(adapter, FW_VERS_ADDR_PRE8, 1, vers, 0); } /** @@ -1050,13 +1046,12 @@ int t3_get_fw_version(adapter_t *adapter * Checks if an adapter's FW is compatible with the driver. Returns 0 * if the versions are compatible, a negative error otherwise. */ -int t3_check_fw_version(adapter_t *adapter, int *must_load) +int t3_check_fw_version(adapter_t *adapter) { int ret; u32 vers; unsigned int type, major, minor; - *must_load = 1; ret = t3_get_fw_version(adapter, &vers); if (ret) return ret; @@ -1069,16 +1064,11 @@ int t3_check_fw_version(adapter_t *adapt minor == FW_VERSION_MINOR) return 0; - if (major != FW_VERSION_MAJOR) - CH_ERR(adapter, "found wrong FW version(%u.%u), " - "driver needs version %u.%u\n", major, minor, - FW_VERSION_MAJOR, FW_VERSION_MINOR); - else if ((int)minor < FW_VERSION_MINOR) { - *must_load = 0; + else if (major != FW_VERSION_MAJOR || minor < FW_VERSION_MINOR) CH_WARN(adapter, "found old FW minor version(%u.%u), " "driver compiled for version %u.%u\n", major, minor, FW_VERSION_MAJOR, FW_VERSION_MINOR); - } else { + else { CH_WARN(adapter, "found newer FW version(%u.%u), " "driver compiled for version %u.%u\n", major, minor, FW_VERSION_MAJOR, FW_VERSION_MINOR); @@ -1123,7 +1113,7 @@ static int t3_flash_erase_sectors(adapte */ int t3_load_fw(adapter_t *adapter, const u8 *fw_data, unsigned int size) { - u32 csum; + u32 version, csum, fw_version_addr; unsigned int i; const u32 *p = (const u32 *)fw_data; int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; @@ -1133,6 +1123,16 @@ int t3_load_fw(adapter_t *adapter, const if (size - 8 > FW_MAX_SIZE) return -EFBIG; + version = ntohl(*(const u32 *)(fw_data + size - 8)); + if (G_FW_VERSION_MAJOR(version) < 8) { + + fw_version_addr = FW_VERS_ADDR_PRE8; + + if (size - 8 > FW_MAX_SIZE_PRE8) + return -EFBIG; + } else + fw_version_addr = FW_VERS_ADDR; + for (csum = 0, i = 0; i < size / sizeof(csum); i++) csum += ntohl(p[i]); if (csum != 0xffffffff) { @@ -1158,7 +1158,7 @@ int t3_load_fw(adapter_t *adapter, const size -= chunk_size; } - ret = t3_write_flash(adapter, FW_VERS_ADDR, 4, fw_data, 1); + ret = t3_write_flash(adapter, fw_version_addr, 4, fw_data, 1); out: if (ret) CH_ERR(adapter, "firmware download failed, error %d\n", ret); @@ -1252,6 +1252,39 @@ int t3_cim_ctl_blk_read(adapter_t *adap, return ret; } +static void t3_gate_rx_traffic(struct cmac *mac, u32 *rx_cfg, + u32 *rx_hash_high, u32 *rx_hash_low) +{ + /* stop Rx unicast traffic */ + t3_mac_disable_exact_filters(mac); + + /* stop broadcast, multicast, promiscuous mode traffic */ + *rx_cfg = t3_read_reg(mac->adapter, A_XGM_RX_CFG); + t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, + F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES, + F_DISBCAST); + + *rx_hash_high = t3_read_reg(mac->adapter, A_XGM_RX_HASH_HIGH); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, 0); + + *rx_hash_low = t3_read_reg(mac->adapter, A_XGM_RX_HASH_LOW); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, 0); + + /* Leave time to drain max RX fifo */ + msleep(1); +} + +static void t3_open_rx_traffic(struct cmac *mac, u32 rx_cfg, + u32 rx_hash_high, u32 rx_hash_low) +{ + t3_mac_enable_exact_filters(mac); + t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, + F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES, + rx_cfg); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, rx_hash_high); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, rx_hash_low); +} + /** * t3_link_changed - handle interface link changes * @adapter: the adapter *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 19:35:37 2009 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 6FAF1106566B; Tue, 10 Mar 2009 19:35:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D23D8FC13; Tue, 10 Mar 2009 19:35:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AJZbvk071737; Tue, 10 Mar 2009 19:35:37 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AJZbPj071736; Tue, 10 Mar 2009 19:35:37 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903101935.n2AJZbPj071736@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 19:35: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: r189645 - head/sys/arm/xscale/ixp425 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 Mar 2009 19:35:38 -0000 Author: sam Date: Tue Mar 10 19:35:37 2009 New Revision: 189645 URL: http://svn.freebsd.org/changeset/base/189645 Log: mark device capable of vlan-size frames Obtained from: netbsd Modified: head/sys/arm/xscale/ixp425/if_npe.c Modified: head/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- head/sys/arm/xscale/ixp425/if_npe.c Tue Mar 10 19:33:50 2009 (r189644) +++ head/sys/arm/xscale/ixp425/if_npe.c Tue Mar 10 19:35:37 2009 (r189645) @@ -363,6 +363,9 @@ npe_attach(device_t dev) ifp->if_linkmib = &sc->mibdata; ifp->if_linkmiblen = sizeof(sc->mibdata); sc->mibdata.dot3Compliance = DOT3COMPLIANCE_STATS; + /* device supports oversided vlan frames */ + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capenable = ifp->if_capabilities; #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; #endif From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 19:35:41 2009 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 95E211065678; Tue, 10 Mar 2009 19:35:41 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 839558FC0A; Tue, 10 Mar 2009 19:35:41 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AJZf62071777; Tue, 10 Mar 2009 19:35:41 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AJZfd9071776; Tue, 10 Mar 2009 19:35:41 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903101935.n2AJZfd9071776@svn.freebsd.org> From: Andrew Thompson Date: Tue, 10 Mar 2009 19:35: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: r189646 - 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: Tue, 10 Mar 2009 19:35:42 -0000 Author: thompsa Date: Tue Mar 10 19:35:41 2009 New Revision: 189646 URL: http://svn.freebsd.org/changeset/base/189646 Log: Make sure HID has a default usage, this fixes recent mouse problems. Tested by: Renato Botelho Tested by: beech (earlier version) Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_hid.c Modified: head/sys/dev/usb/usb_hid.c ============================================================================== --- head/sys/dev/usb/usb_hid.c Tue Mar 10 19:35:37 2009 (r189645) +++ head/sys/dev/usb/usb_hid.c Tue Mar 10 19:35:41 2009 (r189646) @@ -283,14 +283,15 @@ hid_get_item(struct hid_data *s, struct */ c->loc.count = 1; } else { - /* make sure we have a usage */ - if (s->nusage == 0) { - s->usages_min[s->nusage] = 0; - s->usages_max[s->nusage] = 0; - s->nusage = 1; - } s->ncount = 1; } + /* make sure we have a usage */ + if (s->nusage == 0) { + /* use the undefined HID PAGE */ + s->usages_min[s->nusage] = 0x0000; + s->usages_max[s->nusage] = 0xFFFF; + s->nusage = s->ncount; + } goto top; case 9: /* Output */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 21:13:26 2009 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 D0B851065673; Tue, 10 Mar 2009 21:13:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD5D88FC17; Tue, 10 Mar 2009 21:13:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ALDQlg073753; Tue, 10 Mar 2009 21:13:26 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ALDQKm073747; Tue, 10 Mar 2009 21:13:26 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903102113.n2ALDQKm073747@svn.freebsd.org> From: Xin LI Date: Tue, 10 Mar 2009 21:13: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: r189647 - head/lib/libc/softfloat 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 Mar 2009 21:13:27 -0000 Author: delphij Date: Tue Mar 10 21:13:26 2009 New Revision: 189647 URL: http://svn.freebsd.org/changeset/base/189647 Log: Reflect license change from NetBSD. Obtained from: NetBSD Modified: head/lib/libc/softfloat/fpgetmask.c head/lib/libc/softfloat/fpgetround.c head/lib/libc/softfloat/fpgetsticky.c head/lib/libc/softfloat/fpsetmask.c head/lib/libc/softfloat/fpsetround.c head/lib/libc/softfloat/fpsetsticky.c Modified: head/lib/libc/softfloat/fpgetmask.c ============================================================================== --- head/lib/libc/softfloat/fpgetmask.c Tue Mar 10 19:35:41 2009 (r189646) +++ head/lib/libc/softfloat/fpgetmask.c Tue Mar 10 21:13:26 2009 (r189647) @@ -1,4 +1,4 @@ -/* $NetBSD: fpgetmask.c,v 1.3 2002/05/12 13:12:45 bjh21 Exp $ */ +/* $NetBSD: fpgetmask.c,v 1.4 2008/04/28 20:23:00 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -15,13 +15,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/lib/libc/softfloat/fpgetround.c ============================================================================== --- head/lib/libc/softfloat/fpgetround.c Tue Mar 10 19:35:41 2009 (r189646) +++ head/lib/libc/softfloat/fpgetround.c Tue Mar 10 21:13:26 2009 (r189647) @@ -1,4 +1,4 @@ -/* $NetBSD: fpgetround.c,v 1.2 2002/01/13 21:45:53 thorpej Exp $ */ +/* $NetBSD: fpgetround.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -15,13 +15,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/lib/libc/softfloat/fpgetsticky.c ============================================================================== --- head/lib/libc/softfloat/fpgetsticky.c Tue Mar 10 19:35:41 2009 (r189646) +++ head/lib/libc/softfloat/fpgetsticky.c Tue Mar 10 21:13:26 2009 (r189647) @@ -1,4 +1,4 @@ -/* $NetBSD: fpgetsticky.c,v 1.2 2002/01/13 21:45:53 thorpej Exp $ */ +/* $NetBSD: fpgetsticky.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -15,13 +15,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/lib/libc/softfloat/fpsetmask.c ============================================================================== --- head/lib/libc/softfloat/fpsetmask.c Tue Mar 10 19:35:41 2009 (r189646) +++ head/lib/libc/softfloat/fpsetmask.c Tue Mar 10 21:13:26 2009 (r189647) @@ -1,4 +1,4 @@ -/* $NetBSD: fpsetmask.c,v 1.3 2002/05/12 13:12:45 bjh21 Exp $ */ +/* $NetBSD: fpsetmask.c,v 1.4 2008/04/28 20:23:00 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -15,13 +15,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/lib/libc/softfloat/fpsetround.c ============================================================================== --- head/lib/libc/softfloat/fpsetround.c Tue Mar 10 19:35:41 2009 (r189646) +++ head/lib/libc/softfloat/fpsetround.c Tue Mar 10 21:13:26 2009 (r189647) @@ -1,4 +1,4 @@ -/* $NetBSD: fpsetround.c,v 1.2 2002/01/13 21:45:53 thorpej Exp $ */ +/* $NetBSD: fpsetround.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -15,13 +15,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/lib/libc/softfloat/fpsetsticky.c ============================================================================== --- head/lib/libc/softfloat/fpsetsticky.c Tue Mar 10 19:35:41 2009 (r189646) +++ head/lib/libc/softfloat/fpsetsticky.c Tue Mar 10 21:13:26 2009 (r189647) @@ -1,4 +1,4 @@ -/* $NetBSD: fpsetsticky.c,v 1.2 2002/01/13 21:45:54 thorpej Exp $ */ +/* $NetBSD: fpsetsticky.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -15,13 +15,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 21:27:15 2009 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 E7ABE106564A; Tue, 10 Mar 2009 21:27:15 +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 D62F28FC18; Tue, 10 Mar 2009 21:27:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ALRFfA074057; Tue, 10 Mar 2009 21:27:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ALRFK2074056; Tue, 10 Mar 2009 21:27:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903102127.n2ALRFK2074056@svn.freebsd.org> From: John Baldwin Date: Tue, 10 Mar 2009 21:27: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: r189648 - 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: Tue, 10 Mar 2009 21:27:16 -0000 Author: jhb Date: Tue Mar 10 21:27:15 2009 New Revision: 189648 URL: http://svn.freebsd.org/changeset/base/189648 Log: In the ABI shim for vfs.bufspace, rather than truncating values larger than INT_MAX to INT_MAX, just go ahead and write out the full long to give an error of ENOMEM to the user process. Requested by: bde Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Mar 10 21:13:26 2009 (r189647) +++ head/sys/kern/vfs_bio.c Tue Mar 10 21:27:15 2009 (r189648) @@ -287,7 +287,10 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) if (sizeof(int) == sizeof(long) || req->oldlen == sizeof(long)) return (sysctl_handle_long(oidp, arg1, arg2, req)); lvalue = *(long *)arg1; - ivalue = lvalue > INT_MAX ? INT_MAX : lvalue; + if (lvalue > INT_MAX) + /* On overflow, still write out a long to trigger ENOMEM. */ + return (sysctl_handle_long(oidp, &lvalue, 0, req)); + ivalue = lvalue; return (sysctl_handle_int(oidp, &ivalue, 0, req)); } #endif From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 21:28:43 2009 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 91579106566B; Tue, 10 Mar 2009 21:28:43 +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 75BFC8FC0C; Tue, 10 Mar 2009 21:28:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ALSh5D074120; Tue, 10 Mar 2009 21:28:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ALShYQ074117; Tue, 10 Mar 2009 21:28:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903102128.n2ALShYQ074117@svn.freebsd.org> From: John Baldwin Date: Tue, 10 Mar 2009 21:28: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: r189649 - in head/sys: kern 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: Tue, 10 Mar 2009 21:28:44 -0000 Author: jhb Date: Tue Mar 10 21:28:43 2009 New Revision: 189649 URL: http://svn.freebsd.org/changeset/base/189649 Log: - Make maxpipekva a signed long rather than an unsigned long as overflow is more likely to be noticed with signed types. - Make amountpipekva a long as well to match maxpipekva. Discussed with: bde Modified: head/sys/kern/subr_param.c head/sys/kern/sys_pipe.c head/sys/sys/pipe.h Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Tue Mar 10 21:27:15 2009 (r189648) +++ head/sys/kern/subr_param.c Tue Mar 10 21:28:43 2009 (r189649) @@ -91,7 +91,7 @@ int nbuf; int nswbuf; long maxswzone; /* max swmeta KVA storage */ long maxbcache; /* max buffer cache KVA storage */ -u_long maxpipekva; /* Limit on pipe KVA */ +long maxpipekva; /* Limit on pipe KVA */ int vm_guest; /* Running as virtual machine guest? */ u_long maxtsiz; /* max text size */ u_long dfldsiz; /* initial data size limit */ @@ -282,7 +282,7 @@ init_param3(long kmempages) maxpipekva = (kmempages / 20) * PAGE_SIZE; if (maxpipekva < 512 * 1024) maxpipekva = 512 * 1024; - TUNABLE_ULONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); + TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); } /* Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Tue Mar 10 21:27:15 2009 (r189648) +++ head/sys/kern/sys_pipe.c Tue Mar 10 21:28:43 2009 (r189649) @@ -178,15 +178,15 @@ static struct filterops pipe_wfiltops = #define MINPIPESIZE (PIPE_SIZE/3) #define MAXPIPESIZE (2*PIPE_SIZE/3) -static int amountpipekva; +static long amountpipekva; static int pipefragretry; static int pipeallocfail; static int piperesizefail; static int piperesizeallowed = 1; -SYSCTL_ULONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN, +SYSCTL_LONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN, &maxpipekva, 0, "Pipe KVA limit"); -SYSCTL_INT(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD, +SYSCTL_LONG(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD, &amountpipekva, 0, "Pipe KVA usage"); SYSCTL_INT(_kern_ipc, OID_AUTO, pipefragretry, CTLFLAG_RD, &pipefragretry, 0, "Pipe allocation retries due to fragmentation"); @@ -463,7 +463,7 @@ retry: cpipe->pipe_buffer.in = cnt; cpipe->pipe_buffer.out = 0; cpipe->pipe_buffer.cnt = cnt; - atomic_add_int(&amountpipekva, cpipe->pipe_buffer.size); + atomic_add_long(&amountpipekva, cpipe->pipe_buffer.size); return (0); } @@ -1457,7 +1457,7 @@ pipe_free_kmem(cpipe) ("pipe_free_kmem: pipe mutex locked")); if (cpipe->pipe_buffer.buffer != NULL) { - atomic_subtract_int(&amountpipekva, cpipe->pipe_buffer.size); + atomic_subtract_long(&amountpipekva, cpipe->pipe_buffer.size); vm_map_remove(pipe_map, (vm_offset_t)cpipe->pipe_buffer.buffer, (vm_offset_t)cpipe->pipe_buffer.buffer + cpipe->pipe_buffer.size); Modified: head/sys/sys/pipe.h ============================================================================== --- head/sys/sys/pipe.h Tue Mar 10 21:27:15 2009 (r189648) +++ head/sys/sys/pipe.h Tue Mar 10 21:28:43 2009 (r189649) @@ -56,7 +56,7 @@ /* * See sys_pipe.c for info on what these limits mean. */ -extern u_long maxpipekva; +extern long maxpipekva; /* * Pipe buffer information. From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 21:47:18 2009 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 4F7061065680; Tue, 10 Mar 2009 21:47:18 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BADF8FC0C; Tue, 10 Mar 2009 21:47:18 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ALlIcb074566; Tue, 10 Mar 2009 21:47:18 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ALlImT074565; Tue, 10 Mar 2009 21:47:18 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903102147.n2ALlImT074565@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 21:47: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: r189650 - head/sys/arm/xscale/ixp425 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 Mar 2009 21:47:18 -0000 Author: sam Date: Tue Mar 10 21:47:17 2009 New Revision: 189650 URL: http://svn.freebsd.org/changeset/base/189650 Log: map CS0 on 2358 so flash is accessible Modified: head/sys/arm/xscale/ixp425/avila_machdep.c Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Tue Mar 10 21:28:43 2009 (r189649) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Tue Mar 10 21:47:17 2009 (r189650) @@ -187,6 +187,10 @@ static const struct pmap_devmap ixp435_d { IXP425_EXP_VBASE, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* CFI Flash on the Expansion Bus */ + { IXP425_EXP_BUS_CS0_VBASE, IXP425_EXP_BUS_CS0_HWBASE, + IXP425_EXP_BUS_CS0_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* IXP425 PCI Configuration */ { IXP425_PCI_VBASE, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 21:49:22 2009 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 CC225106564A; Tue, 10 Mar 2009 21:49:22 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9E018FC2C; Tue, 10 Mar 2009 21:49:22 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ALnM6a074641; Tue, 10 Mar 2009 21:49:22 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ALnMaV074639; Tue, 10 Mar 2009 21:49:22 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903102149.n2ALnMaV074639@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 21:49: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: r189651 - in head/sys: arm/xscale/ixp425 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: Tue, 10 Mar 2009 21:49:23 -0000 Author: sam Date: Tue Mar 10 21:49:22 2009 New Revision: 189651 URL: http://svn.freebsd.org/changeset/base/189651 Log: add IXP4XX_FLASH_SIZE config knob that can be used to override the default flash size; this is necessary at the moment because we map all of flash at boot, eventually we'll do this on the fly Modified: head/sys/arm/xscale/ixp425/ixp425reg.h head/sys/conf/options.arm Modified: head/sys/arm/xscale/ixp425/ixp425reg.h ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425reg.h Tue Mar 10 21:47:17 2009 (r189650) +++ head/sys/arm/xscale/ixp425/ixp425reg.h Tue Mar 10 21:49:22 2009 (r189651) @@ -660,7 +660,11 @@ /* NB: CS0 is special; it maps flash */ #define IXP425_EXP_BUS_CS0_HWBASE IXP425_EXP_BUS_CSx_HWBASE(0) #define IXP425_EXP_BUS_CS0_VBASE 0xFD000000UL +#ifndef IXP4XX_FLASH_SIZE #define IXP425_EXP_BUS_CS0_SIZE 0x01000000 /* NB: 16M */ +#else +#define IXP425_EXP_BUS_CS0_SIZE IXP4XX_FLASH_SIZE +#endif #define IXP425_EXP_BUS_CS1_HWBASE IXP425_EXP_BUS_CSx_HWBASE(1) #define IXP425_EXP_BUS_CS1_VBASE IXP425_EXP_BUS_CSx_VBASE(1) #define IXP425_EXP_BUS_CS1_SIZE IXP425_EXP_BUS_CSx_SIZE Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Tue Mar 10 21:47:17 2009 (r189650) +++ head/sys/conf/options.arm Tue Mar 10 21:49:22 2009 (r189651) @@ -18,6 +18,7 @@ CPU_XSCALE_IXP425 opt_global.h CPU_XSCALE_IXP435 opt_global.h CPU_XSCALE_PXA2X0 opt_global.h FLASHADDR opt_global.h +IXP4XX_FLASH_SIZE opt_global.h KERNPHYSADDR opt_global.h KERNVIRTADDR opt_global.h LOADERRAMADDR opt_global.h From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 21:49:52 2009 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 5D8BC106564A; Tue, 10 Mar 2009 21:49:52 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B2348FC1A; Tue, 10 Mar 2009 21:49:52 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ALnqSW074689; Tue, 10 Mar 2009 21:49:52 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ALnqh4074687; Tue, 10 Mar 2009 21:49:52 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903102149.n2ALnqh4074687@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 21:49: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: r189652 - head/sys/arm/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: Tue, 10 Mar 2009 21:49:53 -0000 Author: sam Date: Tue Mar 10 21:49:51 2009 New Revision: 189652 URL: http://svn.freebsd.org/changeset/base/189652 Log: configure flash support Modified: head/sys/arm/conf/CAMBRIA head/sys/arm/conf/CAMBRIA.hints Modified: head/sys/arm/conf/CAMBRIA ============================================================================== --- head/sys/arm/conf/CAMBRIA Tue Mar 10 21:49:22 2009 (r189651) +++ head/sys/arm/conf/CAMBRIA Tue Mar 10 21:49:51 2009 (r189652) @@ -67,6 +67,8 @@ device pci device uart device ixpwdog # watchdog timer + +options IXP4XX_FLASH_SIZE=0x02000000 # stock 2358 comes w/ 32M device cfi # flash support device cfid # flash disk support device geom_redboot # redboot fis parser Modified: head/sys/arm/conf/CAMBRIA.hints ============================================================================== --- head/sys/arm/conf/CAMBRIA.hints Tue Mar 10 21:49:22 2009 (r189651) +++ head/sys/arm/conf/CAMBRIA.hints Tue Mar 10 21:49:51 2009 (r189652) @@ -27,6 +27,10 @@ hint.npe.0.phy=1 #hint.npe.1.mii="C" #hint.npe.1.phy=2 +# FLASH +hint.cfi.0.at="ixp0" +hint.cfi.0.addr=0x50000000 + # CF IDE controller hint.ata_avila.0.at="ixp0" From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 22:04:53 2009 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 060E6106564A; Tue, 10 Mar 2009 22:04:53 +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 E894E8FC13; Tue, 10 Mar 2009 22:04:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AM4qKE075050; Tue, 10 Mar 2009 22:04:52 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AM4qJM075049; Tue, 10 Mar 2009 22:04:52 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903102204.n2AM4qJM075049@svn.freebsd.org> From: Warner Losh Date: Tue, 10 Mar 2009 22:04: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: r189653 - head/sys/dev/cardbus 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 Mar 2009 22:04:53 -0000 Author: imp Date: Tue Mar 10 22:04:52 2009 New Revision: 189653 URL: http://svn.freebsd.org/changeset/base/189653 Log: Restore blank line removed when fixing my earlier botch. Never do just one last change before bed... Pointy had to: imp Modified: head/sys/dev/cardbus/cardbus.c Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Tue Mar 10 21:49:51 2009 (r189652) +++ head/sys/dev/cardbus/cardbus.c Tue Mar 10 22:04:52 2009 (r189653) @@ -82,6 +82,7 @@ static int cardbus_read_ivar(device_t cb uintptr_t *result); static void cardbus_release_all_resources(device_t cbdev, struct cardbus_devinfo *dinfo); + /************************************************************************/ /* Probe/Attach */ /************************************************************************/ From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 22:29:42 2009 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 A442B106566B; Tue, 10 Mar 2009 22:29:42 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 926EE8FC1B; Tue, 10 Mar 2009 22:29:42 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AMTggW075574; Tue, 10 Mar 2009 22:29:42 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AMTgvM075573; Tue, 10 Mar 2009 22:29:42 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903102229.n2AMTgvM075573@svn.freebsd.org> From: Sam Leffler Date: Tue, 10 Mar 2009 22:29: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: r189654 - head/sys/dev/cfi 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 Mar 2009 22:29:43 -0000 Author: sam Date: Tue Mar 10 22:29:42 2009 New Revision: 189654 URL: http://svn.freebsd.org/changeset/base/189654 Log: choose the size of the last region for d_stripsize instead of the first; this fixes geom_redboot on boards that have multiple parts/regions as it uses the value to locate the FIS directory which is in the last erase region of flash Modified: head/sys/dev/cfi/cfi_disk.c Modified: head/sys/dev/cfi/cfi_disk.c ============================================================================== --- head/sys/dev/cfi/cfi_disk.c Tue Mar 10 22:04:52 2009 (r189653) +++ head/sys/dev/cfi/cfi_disk.c Tue Mar 10 22:29:42 2009 (r189654) @@ -99,9 +99,16 @@ cfi_disk_attach(device_t dev) sc->disk->d_mediasize = sc->parent->sc_size; sc->disk->d_maxsize = CFI_DISK_MAXIOSIZE; /* NB: use stripesize to hold the erase/region size */ - if (sc->parent->sc_regions) - sc->disk->d_stripesize = sc->parent->sc_region->r_blksz; - else + if (sc->parent->sc_regions) { + /* + * Multiple regions, use the last one. This is a + * total hack as it's (presently) used only by + * geom_redboot to locate the FIS directory which + * lies at the start of the last erase region. + */ + sc->disk->d_stripesize = + sc->parent->sc_region[sc->parent->sc_regions-1].r_blksz; + } else sc->disk->d_stripesize = sc->disk->d_mediasize; sc->disk->d_drv1 = sc; disk_create(sc->disk, DISK_VERSION); From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 22:32:01 2009 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 86E031065670; Tue, 10 Mar 2009 22:32:01 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 6021D8FC08; Tue, 10 Mar 2009 22:32:01 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n2AMW0xu029409 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Mar 2009 15:32:01 -0700 (PDT) (envelope-from sam@freebsd.org) Message-ID: <49B6EA60.6010208@freebsd.org> Date: Tue, 10 Mar 2009 15:32:00 -0700 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.18 (X11/20081209) MIME-Version: 1.0 To: src-committers@freebsd.org References: <200903102229.n2AMTgvM075573@svn.freebsd.org> In-Reply-To: <200903102229.n2AMTgvM075573@svn.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC-Misty-Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r189654 - head/sys/dev/cfi 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 Mar 2009 22:32:02 -0000 Sam Leffler wrote: > Author: sam > Date: Tue Mar 10 22:29:42 2009 > New Revision: 189654 > URL: http://svn.freebsd.org/changeset/base/189654 > > Log: > choose the size of the last region for d_stripsize instead of the first; > this fixes geom_redboot on boards that have multiple parts/regions as it > uses the value to locate the FIS directory which is in the last erase > region of flash > > This is a total hack. Suggestions welcome on how best to pass the right information to a geom module. Sam From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 22:35:46 2009 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 250C5106566C; Tue, 10 Mar 2009 22:35:46 +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 13AA98FC15; Tue, 10 Mar 2009 22:35:46 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2AMZjku075771; Tue, 10 Mar 2009 22:35:45 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AMZj36075770; Tue, 10 Mar 2009 22:35:45 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903102235.n2AMZj36075770@svn.freebsd.org> From: Robert Watson Date: Tue, 10 Mar 2009 22:35: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: r189655 - head/sys/dev/cxgb 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 Mar 2009 22:35:46 -0000 Author: rwatson Date: Tue Mar 10 22:35:45 2009 New Revision: 189655 URL: http://svn.freebsd.org/changeset/base/189655 Log: Prefer ENETDOWN to ENXIO when returning queuing errors due to a link down, interface down, etc, with if_cxgb's if_transmit routine. MFC after: 3 days Reviewed by: kmacy Modified: head/sys/dev/cxgb/cxgb_multiq.c Modified: head/sys/dev/cxgb/cxgb_multiq.c ============================================================================== --- head/sys/dev/cxgb/cxgb_multiq.c Tue Mar 10 22:29:42 2009 (r189654) +++ head/sys/dev/cxgb/cxgb_multiq.c Tue Mar 10 22:35:45 2009 (r189655) @@ -120,7 +120,7 @@ cxgb_pcpu_enqueue_packet_(struct sge_qse KASSERT(m->m_type == MT_DATA, ("bad mbuf type %d", m->m_type)); if (qs->qs_flags & QS_EXITING) { m_freem(m); - return (ENXIO); + return (ENETDOWN); } txq = &qs->txq[TXQ_ETH]; err = buf_ring_enqueue(txq->txq_mr, m); @@ -301,13 +301,13 @@ cxgb_pcpu_start_(struct sge_qset *qs, st retry: if (!pi->link_config.link_ok) - initerr = ENXIO; + initerr = ENETDOWN; else if (qs->qs_flags & QS_EXITING) - initerr = ENXIO; + initerr = ENETDOWN; else if ((pi->ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - initerr = ENXIO; + initerr = ENETDOWN; else if ((pi->ifp->if_flags & IFF_UP) == 0) - initerr = ENXIO; + initerr = ENETDOWN; else if (immpkt) { if (!buf_ring_empty(txq->txq_mr) From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 00:12:45 2009 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 92C54106564A; Wed, 11 Mar 2009 00:12:45 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 815D88FC14; Wed, 11 Mar 2009 00:12:45 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B0Cjrs077597; Wed, 11 Mar 2009 00:12:45 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B0CjdR077596; Wed, 11 Mar 2009 00:12:45 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903110012.n2B0CjdR077596@svn.freebsd.org> From: Sam Leffler Date: Wed, 11 Mar 2009 00:12: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: r189656 - head/sys/arm/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: Wed, 11 Mar 2009 00:12:46 -0000 Author: sam Date: Wed Mar 11 00:12:45 2009 New Revision: 189656 URL: http://svn.freebsd.org/changeset/base/189656 Log: switch to !legacy usb stack Modified: head/sys/arm/conf/CAMBRIA Modified: head/sys/arm/conf/CAMBRIA ============================================================================== --- head/sys/arm/conf/CAMBRIA Tue Mar 10 22:35:45 2009 (r189655) +++ head/sys/arm/conf/CAMBRIA Wed Mar 11 00:12:45 2009 (r189656) @@ -142,15 +142,14 @@ device ath_rf5413 #device ath_ar9285 # NB: 2 USB 2.0 ports standard -makeoptions WITH_LEGACY -device ousb +device usb options USB_EHCI_BIG_ENDIAN_DESC # handle big-endian byte order #options USB_DEBUG -device oehci -device oumass +device ehci +device umass device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) -#device oural -#device ozyd +#device ural +#device zyd #device wlan_amrr From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 00:29:22 2009 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 976D91065674; Wed, 11 Mar 2009 00:29:22 +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 85B2A8FC19; Wed, 11 Mar 2009 00:29:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B0TMUo077953; Wed, 11 Mar 2009 00:29:22 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B0TMS6077951; Wed, 11 Mar 2009 00:29:22 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903110029.n2B0TMS6077951@svn.freebsd.org> From: Robert Watson Date: Wed, 11 Mar 2009 00:29: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: r189657 - 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: Wed, 11 Mar 2009 00:29:23 -0000 Author: rwatson Date: Wed Mar 11 00:29:22 2009 New Revision: 189657 URL: http://svn.freebsd.org/changeset/base/189657 Log: Add INP_INHASHLIST flag for inpcb->inp_flags to indicate whether or not the inpcb is currenty on various hash lookup lists, rather than using (lport != 0) to detect this. This means that the full 4-tuple of a connection can be retained after close, which should lead to more sensible netstat output in the window between TCP close and socket close. MFC after: 2 weeks Modified: head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Wed Mar 11 00:12:45 2009 (r189656) +++ head/sys/netinet/in_pcb.c Wed Mar 11 00:29:22 2009 (r189657) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1982, 1986, 1991, 1993, 1995 * The Regents of the University of California. - * Copyright (c) 2007-2008 Robert N. M. Watson + * Copyright (c) 2007-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1032,7 +1032,7 @@ in_pcbdrop(struct inpcb *inp) INP_WLOCK_ASSERT(inp); inp->inp_vflag |= INP_DROPPED; - if (inp->inp_lport) { + if (inp->inp_flags & INP_INHASHLIST) { struct inpcbport *phd = inp->inp_phd; LIST_REMOVE(inp, inp_hash); @@ -1041,7 +1041,7 @@ in_pcbdrop(struct inpcb *inp) LIST_REMOVE(phd, phd_hash); free(phd, M_PCB); } - inp->inp_lport = 0; + inp->inp_flags &= ~INP_INHASHLIST; } } @@ -1421,6 +1421,8 @@ in_pcbinshash(struct inpcb *inp) INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); + KASSERT((inp->inp_flags & INP_INHASHLIST) == 0, + ("in_pcbinshash: INP_INHASHLIST")); #ifdef INET6 if (inp->inp_vflag & INP_IPV6) @@ -1457,6 +1459,7 @@ in_pcbinshash(struct inpcb *inp) inp->inp_phd = phd; LIST_INSERT_HEAD(&phd->phd_pcblist, inp, inp_portlist); LIST_INSERT_HEAD(pcbhash, inp, inp_hash); + inp->inp_flags |= INP_INHASHLIST; return (0); } @@ -1475,6 +1478,8 @@ in_pcbrehash(struct inpcb *inp) INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); + KASSERT(inp->inp_flags & INP_INHASHLIST, + ("in_pcbrehash: !INP_INHASHLIST")); #ifdef INET6 if (inp->inp_vflag & INP_IPV6) @@ -1502,7 +1507,7 @@ in_pcbremlists(struct inpcb *inp) INP_WLOCK_ASSERT(inp); inp->inp_gencnt = ++pcbinfo->ipi_gencnt; - if (inp->inp_lport) { + if (inp->inp_flags & INP_INHASHLIST) { struct inpcbport *phd = inp->inp_phd; LIST_REMOVE(inp, inp_hash); @@ -1511,6 +1516,7 @@ in_pcbremlists(struct inpcb *inp) LIST_REMOVE(phd, phd_hash); free(phd, M_PCB); } + inp->inp_flags &= ~INP_INHASHLIST; } LIST_REMOVE(inp, inp_list); pcbinfo->ipi_count--; Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Wed Mar 11 00:12:45 2009 (r189656) +++ head/sys/netinet/in_pcb.h Wed Mar 11 00:29:22 2009 (r189657) @@ -406,6 +406,7 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_DONTFRAG 0x800 /* don't fragment packet */ #define INP_NONLOCALOK 0x1000 /* Allow bind to spoof any address */ /* - requires options IP_NONLOCALBIND */ +#define INP_INHASHLIST 0x2000 /* in_pcbinshash() has been called */ #define IN6P_IPV6_V6ONLY 0x008000 /* restrict AF_INET6 socket for v6 */ From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 01:12:43 2009 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 7B295106566B; Wed, 11 Mar 2009 01:12:43 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id E64178FC26; Wed, 11 Mar 2009 01:12:42 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id n2B1Ce1H065997; Wed, 11 Mar 2009 04:12:40 +0300 (MSK) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru; s=default; t=1236733961; bh=7+w1yLYSS6xEmfeFEiydnf1DBN5PxLzMMUgC1OF0y10=; l=1218; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=egdQwqEK8tWXk4EIh9tckuLs19AhWVObkOG7mAw7OFv2wgtSSyTP0cppkycxCYd1q SmmJ4IaR/Bo0BFwnnvsO6ZkfMqOeGOZWtK2KDANlhVH+G6kWnjZVQEASBfR7CadhAZ pHOBAe2FCf9XYZ3w+scrUIb7I9pmfTeowsMQrkK4= Received: (from ache@localhost) by nagual.pp.ru (8.14.3/8.14.3/Submit) id n2B1CdIE065996; Wed, 11 Mar 2009 04:12:39 +0300 (MSK) (envelope-from ache) Date: Wed, 11 Mar 2009 04:12:37 +0300 From: Andrey Chernov To: Andrew Thompson Message-ID: <20090311011237.GA65734@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Andrew Thompson , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <200903101935.n2AJZfd9071776@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200903101935.n2AJZfd9071776@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189646 - 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: Wed, 11 Mar 2009 01:12:44 -0000 On Tue, Mar 10, 2009 at 07:35:41PM +0000, Andrew Thompson wrote: > Author: thompsa > Date: Tue Mar 10 19:35:41 2009 > New Revision: 189646 > URL: http://svn.freebsd.org/changeset/base/189646 > > Log: > Make sure HID has a default usage, this fixes recent mouse problems. My mouse still not fixed by this patch. Debugging info you requested: usbconfig ... 1 ... REQUEST = <0x06 0x00 0xff 0x09 0x01 0xa1 0x01 0x85 0x10 0x75 0x08 0x95 0x06 0x15 0x00 0x26 0xff 0x00 0x09 0x01 0x81 0x00 0x09 0x01 0x91 0x00 0xc0 0x06 0x00 0xff 0x09 0x02 0xa1 0x01 0x85 0x11 0x75 0x08 0x95 0x13 0x15 0x00 0x26 0xff 0x00 0x09 0x02 0x81 0x00 0x09 0x02 0x91 0x00 0xc0> usbconfig ... 0 ... REQUEST = <0x05 0x01 0x09 0x02 0xa1 0x01 0x09 0x01 0xa1 0x00 0x05 0x09 0x19 0x01 0x29 0x08 0x15 0x00 0x25 0x01 0x95 0x08 0x75 0x01 0x81 0x02 0x06 0x00 0xff 0x09 0x40 0x15 0x81 0x25 0x7f 0x75 0x08 0x95 0x02 0x81 0x02 0x05 0x01 0x09 0x38 0x95 0x01 0x81 0x06 0x05 0x0c 0x0a 0x38 0x02 0x95 0x01 0x81 0x06 0x05 0x01 0x16 0x01 0x80 0x26 0xff 0x7f 0x75 0x10 0x95 0x02 0x09 0x30 0x09 0x31 0x81 0x06 0x05 0x09 0x19 0x09 0x29 0x10 0x15 0x00 0x25 0x01 0x95 0x08 0x75 0x01 0x81 0x02 0xc0 0xc0><)%u@%u88&u01)%u> -- http://ache.pp.ru/ From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 01:12:52 2009 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 D2C2A1065777; Wed, 11 Mar 2009 01:12:52 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A72418FC1E; Wed, 11 Mar 2009 01:12:52 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B1Cq4V079032; Wed, 11 Mar 2009 01:12:52 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B1Cqoh079031; Wed, 11 Mar 2009 01:12:52 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903110112.n2B1Cqoh079031@svn.freebsd.org> From: Sam Leffler Date: Wed, 11 Mar 2009 01:12: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: r189660 - head/sys/geom 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 Mar 2009 01:12:53 -0000 Author: sam Date: Wed Mar 11 01:12:52 2009 New Revision: 189660 URL: http://svn.freebsd.org/changeset/base/189660 Log: o disallow write to RedBoot and FIS directory partitions; these are painful to resurrect (maybe honor foot shooting bit in kern.geom_debugflags) o fix match macro so we now recognize we want to merge FIS dir with RedBoot config parameters even if we don't actually do it Modified: head/sys/geom/geom_redboot.c Modified: head/sys/geom/geom_redboot.c ============================================================================== --- head/sys/geom/geom_redboot.c Wed Mar 11 01:03:32 2009 (r189659) +++ head/sys/geom/geom_redboot.c Wed Mar 11 01:12:52 2009 (r189660) @@ -62,6 +62,7 @@ struct fis_image_desc { #define FISDIR_NAME "FIS directory" #define REDBCFG_NAME "RedBoot config" +#define REDBOOT_NAME "RedBoot" #define REDBOOT_MAXSLICE 64 #define REDBOOT_MAXOFF \ @@ -70,6 +71,8 @@ struct fis_image_desc { struct g_redboot_softc { uint32_t entry[REDBOOT_MAXSLICE]; uint32_t dsize[REDBOOT_MAXSLICE]; + uint8_t readonly[REDBOOT_MAXSLICE]; + g_access_t *parent_access; }; static void @@ -90,6 +93,18 @@ g_redboot_ioctl(struct g_provider *pp, u } static int +g_redboot_access(struct g_provider *pp, int dread, int dwrite, int dexcl) +{ + struct g_geom *gp = pp->geom; + struct g_slicer *gsp = gp->softc; + struct g_redboot_softc *sc = gsp->softc; + + if (dwrite > 0 && sc->readonly[pp->index]) + return (EPERM); + return (sc->parent_access(pp, dread, dwrite, dexcl)); +} + +static int g_redboot_start(struct bio *bp) { struct g_provider *pp; @@ -155,8 +170,7 @@ nameok(const char name[16]) static struct fis_image_desc * parse_fis_directory(u_char *buf, size_t bufsize, off_t offset, uint32_t offmask) { -#define match(a,b) \ - (bcmp(fd->name, FISDIR_NAME, sizeof(FISDIR_NAME)-1) == 0) +#define match(a,b) (bcmp(a, b, sizeof(b)-1) == 0) struct fis_image_desc *fd, *efd; struct fis_image_desc *fisdir, *redbcfg; struct fis_image_desc *head, **tail; @@ -242,6 +256,10 @@ g_redboot_taste(struct g_class *mp, stru g_redboot_start); if (gp == NULL) return (NULL); + /* interpose our access method */ + sc->parent_access = gp->access; + gp->access = g_redboot_access; + sectorsize = cp->provider->sectorsize; blksize = cp->provider->stripesize; if (powerof2(cp->provider->mediasize)) @@ -287,6 +305,9 @@ again: __func__, error, fd->name); sc->entry[i] = fd->entry; sc->dsize[i] = fd->dsize; + /* disallow writing hard-to-recover entries */ + sc->readonly[i] = (strcmp(fd->name, FISDIR_NAME) == 0) || + (strcmp(fd->name, REDBOOT_NAME) == 0); i++; } g_free(buf); From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 01:27:10 2009 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 6C0A2106564A; Wed, 11 Mar 2009 01:27:10 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id D89138FC16; Wed, 11 Mar 2009 01:27:09 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id n2B1R8MR066397; Wed, 11 Mar 2009 04:27:08 +0300 (MSK) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru; s=default; t=1236734828; bh=6tXjJuuYvuJzrw+WIHcfBm225XVHga6QhgRNm31D5Qg=; l=472; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=pWqZASn/QvOnJWoKUsRhGbP9eMk7kpV8LcBj/g8RLpS4a6BB66UwcZphHfV0s29nc dY2dqubfXVzuPIvSP+MPGlnNmYOd3wQCr9LPFKOKy00orhb9dxCjJuUORuSCdfokAJ Sscr1LONm2HaIV8sGgmg73G3S22Jg7TuBBBEmx9U= Received: (from ache@localhost) by nagual.pp.ru (8.14.3/8.14.3/Submit) id n2B1R7Ul066396; Wed, 11 Mar 2009 04:27:07 +0300 (MSK) (envelope-from ache) Date: Wed, 11 Mar 2009 04:27:05 +0300 From: Andrey Chernov To: Ed Schouten Message-ID: <20090311012704.GA66313@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Ed Schouten , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <200903101128.n2ABSsvZ060914@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200903101128.n2ABSsvZ060914@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189617 - in head/sys: dev/syscons dev/syscons/teken pc98/cbus 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 Mar 2009 01:27:10 -0000 On Tue, Mar 10, 2009 at 11:28:54AM +0000, Ed Schouten wrote: > Author: ed > Date: Tue Mar 10 11:28:54 2009 > New Revision: 189617 > URL: http://svn.freebsd.org/changeset/base/189617 > > Log: > Make a 1:1 mapping between syscons stats and terminal emulators. Well, reboot messages are now in the proper position, thanx. But _boot_ messages still makes complete mess with rc output after the moment rc switches syscons to 80x30 -- http://ache.pp.ru/ From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 02:16:54 2009 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 342DF1065670; Wed, 11 Mar 2009 02:16:54 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 9F50F8FC19; Wed, 11 Mar 2009 02:16:53 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id n2B2Gp4K067763; Wed, 11 Mar 2009 05:16:51 +0300 (MSK) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru; s=default; t=1236737812; bh=fFF62WYVSQG6GYvmySJEvG/gyCoK2Ihr9Q9q5cQ2tvE=; l=732; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=LoU4HRd5TpS3+wOFV2kvVqSLXSzsPJYPU97bE09FpGax4CEUyRnO96U9/Xsg+/dJt D1tI3bACAuIHCz5D1IvmArpd7SN+sJmMTPJWOC7l/5RrowlqS7WH47nVifIP5ASJ2V Adxp8PBXRkOFvWAMxEbxbJyX6QGLS6IEbr61yTZE= Received: (from ache@localhost) by nagual.pp.ru (8.14.3/8.14.3/Submit) id n2B2GpZr067762; Wed, 11 Mar 2009 05:16:51 +0300 (MSK) (envelope-from ache) Date: Wed, 11 Mar 2009 05:16:48 +0300 From: Andrey Chernov To: Ed Schouten , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Message-ID: <20090311021646.GA67589@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Ed Schouten , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <200903101128.n2ABSsvZ060914@svn.freebsd.org> <20090311012704.GA66313@nagual.pp.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090311012704.GA66313@nagual.pp.ru> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: Subject: Re: svn commit: r189617 - in head/sys: dev/syscons dev/syscons/teken pc98/cbus 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 Mar 2009 02:16:54 -0000 On Wed, Mar 11, 2009 at 04:27:05AM +0300, Andrey Chernov wrote: > On Tue, Mar 10, 2009 at 11:28:54AM +0000, Ed Schouten wrote: > > Author: ed > > Date: Tue Mar 10 11:28:54 2009 > > New Revision: 189617 > > URL: http://svn.freebsd.org/changeset/base/189617 > > > > Log: > > Make a 1:1 mapping between syscons stats and terminal emulators. > > Well, reboot messages are now in the proper position, thanx. > > But _boot_ messages still makes complete mess with rc output after the > moment rc switches syscons to 80x30 Hmm. Perhaps not after but before, because screen is cleared on mode change... It looks like rc messages appearse in the middle of the screen over boot messages. -- http://ache.pp.ru/ From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 03:19:20 2009 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 2760F106564A; Wed, 11 Mar 2009 03:19:20 +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 152E28FC14; Wed, 11 Mar 2009 03:19:20 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B3JJs1082648; Wed, 11 Mar 2009 03:19:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B3JJbO082647; Wed, 11 Mar 2009 03:19:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200903110319.n2B3JJbO082647@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 11 Mar 2009 03:19: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: r189675 - head/sys/powerpc/aim 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 Mar 2009 03:19:20 -0000 Author: nwhitehorn Date: Wed Mar 11 03:19:19 2009 New Revision: 189675 URL: http://svn.freebsd.org/changeset/base/189675 Log: Change the PVO zone for fictitious pages to the unmanaged PVO zone, to match the unmanaged flag set in the PVO attributes. Without doing this, pmap_remove() could try to remove fictitious pages (like those created by mmap of physical memory) from the wrong UMA zone, causing a panic. Reported by: Justin Hibbits MFC after: 1 week Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Wed Mar 11 03:00:40 2009 (r189674) +++ head/sys/powerpc/aim/mmu_oea.c Wed Mar 11 03:19:19 2009 (r189675) @@ -1081,8 +1081,11 @@ moea_enter_locked(pmap_t pmap, vm_offset PMAP_LOCK_ASSERT(pmap, MA_OWNED); /* XXX change the pvo head for fake pages */ - if ((m->flags & PG_FICTITIOUS) == PG_FICTITIOUS) + if ((m->flags & PG_FICTITIOUS) == PG_FICTITIOUS) { + pvo_flags &= ~PVO_MANAGED; pvo_head = &moea_pvo_kunmanaged; + zone = moea_upvo_zone; + } /* * If this is a managed page, and it's the first reference to the page, From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 04:09:20 2009 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 7F1EE106566B; Wed, 11 Mar 2009 04:09:20 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from mail2.asahi-net.or.jp (mail2.asahi-net.or.jp [202.224.39.198]) by mx1.freebsd.org (Postfix) with ESMTP id 16C508FC16; Wed, 11 Mar 2009 04:09:20 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from localhost (pool-70-20-228-87.phil.east.verizon.net [70.20.228.87]) by mail2.asahi-net.or.jp (Postfix) with ESMTP id E0CA96F7DE; Wed, 11 Mar 2009 12:51:12 +0900 (JST) Date: Tue, 10 Mar 2009 23:51:10 -0400 From: Yoshihiro Ota To: Guido van Rooij , Fabian Keil , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, phk@freebsd.org Message-Id: <20090310235110.c0c6f71e.ota@j.email.ne.jp> In-Reply-To: <20090310180157.GA4663@gvr.gvr.org> References: <200903101523.n2AFNhs1065867@svn.freebsd.org> <20090310171948.1ac51696@fabiankeil.de> <20090310180157.GA4663@gvr.gvr.org> X-Mailer: Sylpheed 2.6.0 (GTK+ 2.12.11; i386-portbld-freebsd7.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r189625 - head/sys/geom/eli 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 Mar 2009 04:09:21 -0000 On Tue, 10 Mar 2009 19:01:57 +0100 Guido van Rooij wrote: > On Tue, Mar 10, 2009 at 05:19:48PM +0100, Fabian Keil wrote: > > > Log: > > > When attaching a geli on boot make sure that it is detached > > > upon last close. (needed for a gmirror to properly shutdown > > > upon reboot when a geli is on top the gmirror) > > > > > > > Detach-on-last-close is known to cause panics when > > scrubbing at least some ZFS pools: > > http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/117158 > > > > Quoting the PR: > > |Quoting Pawel Jakub Dawidek's response to my initial report: > > ||GELI's detach-on-last-close mechanism is a general purpose mechanism, it > > ||may not work correctly with ZFS, because ZFS sometimes closes and reopen > > ||providers, which will make GELI to detach. In other words you shouldn't > > ||configure detach-on-last-close for ZFS components. > > > > Grr. So we should make it tuneable. How about being able to set > this flag with the geli command, like the G_ELI_FLAG_BOOT flag. > > -Guido Can we move its implementation into the GEOM framwork such that all of GEOM classes can have detach-on-last-close? It will need some kind of custom hook such that each class can do something extra, i.e. gjournal sync. I often need to stop providers to securely detach USB disks. Hiro From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 04:56:31 2009 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 6DFE1106564A; Wed, 11 Mar 2009 04:56:31 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5BE7A8FC12; Wed, 11 Mar 2009 04:56:31 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B4uVso084617; Wed, 11 Mar 2009 04:56:31 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B4uVLY084616; Wed, 11 Mar 2009 04:56:31 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903110456.n2B4uVLY084616@svn.freebsd.org> From: Andrew Thompson Date: Wed, 11 Mar 2009 04:56: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: r189676 - 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: Wed, 11 Mar 2009 04:56:31 -0000 Author: thompsa Date: Wed Mar 11 04:56:30 2009 New Revision: 189676 URL: http://svn.freebsd.org/changeset/base/189676 Log: Fix a possible NULL pointer access at controller attach. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/usb_controller.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Wed Mar 11 03:19:19 2009 (r189675) +++ head/sys/dev/usb/controller/usb_controller.c Wed Mar 11 04:56:30 2009 (r189676) @@ -346,7 +346,8 @@ usb2_bus_attach(struct usb2_proc_msg *pm err = usb2_probe_and_attach(child, USB_IFACE_INDEX_ANY); if (!err) { - if (!bus->devices[USB_ROOT_HUB_ADDR]->hub) { + if ((bus->devices[USB_ROOT_HUB_ADDR] == NULL) || + (bus->devices[USB_ROOT_HUB_ADDR]->hub == NULL)) { err = USB_ERR_NO_ROOT_HUB; } } From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 04:58:22 2009 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 E96431065670; Wed, 11 Mar 2009 04:58:21 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D60EF8FC0A; Wed, 11 Mar 2009 04:58:21 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B4wLs1084686; Wed, 11 Mar 2009 04:58:21 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B4wLKc084683; Wed, 11 Mar 2009 04:58:21 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903110458.n2B4wLKc084683@svn.freebsd.org> From: Andrew Thompson Date: Wed, 11 Mar 2009 04: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: r189677 - 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: Wed, 11 Mar 2009 04:58:22 -0000 Author: thompsa Date: Wed Mar 11 04:58:21 2009 New Revision: 189677 URL: http://svn.freebsd.org/changeset/base/189677 Log: MFp4 //depot/projects/usb 158981,159016,159024 Sync support for ATMEGA DCI parts. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/atmegadci.h head/sys/dev/usb/controller/atmegadci_atmelarm.c Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Wed Mar 11 04:56:30 2009 (r189676) +++ head/sys/dev/usb/controller/atmegadci.c Wed Mar 11 04:58:21 2009 (r189677) @@ -27,8 +27,9 @@ __FBSDID("$FreeBSD$"); */ /* - * This file contains the driver for the ATMEGA series USB Device - * Controller + * This file contains the driver for the ATMEGA series USB OTG + * Controller. This driver currently only supports the DCI mode of the + * USB hardware. */ /* @@ -225,8 +226,6 @@ atmegadci_set_address(struct atmegadci_s { DPRINTFN(5, "addr=%d\n", addr); - ATMEGA_WRITE_1(sc, ATMEGA_UDADDR, addr); - addr |= ATMEGA_UDADDR_ADDEN; ATMEGA_WRITE_1(sc, ATMEGA_UDADDR, addr); @@ -295,6 +294,8 @@ atmegadci_setup_rx(struct atmegadci_td * if ((req.bmRequestType == UT_WRITE_DEVICE) && (req.bRequest == UR_SET_ADDRESS)) { sc->sc_dv_addr = req.wValue[0] & 0x7F; + /* must write address before ZLP */ + ATMEGA_WRITE_1(sc, ATMEGA_UDADDR, sc->sc_dv_addr); } else { sc->sc_dv_addr = 0xFF; } @@ -651,6 +652,8 @@ atmegadci_interrupt(struct atmegadci_sof /* clear all set interrupts */ ATMEGA_WRITE_1(sc, ATMEGA_UDINT, ~status); + DPRINTFN(14, "UDINT=0x%02x\n", status); + /* check for any bus state change interrupts */ if (status & ATMEGA_UDINT_EORSTI) { @@ -722,6 +725,8 @@ atmegadci_interrupt(struct atmegadci_sof if (status & ATMEGA_USBINT_VBUSTI) { uint8_t temp; + DPRINTFN(5, "USBINT=0x%02x\n", status); + temp = ATMEGA_READ_1(sc, ATMEGA_USBSTA); atmegadci_vbus_interrupt(sc, temp & ATMEGA_USBSTA_VBUS); } @@ -733,7 +738,7 @@ atmegadci_interrupt(struct atmegadci_sof if (status) { - DPRINTFN(5, "real endpoint interrupt 0x%02x\n", status); + DPRINTFN(5, "real endpoint interrupt UEINT=0x%02x\n", status); atmegadci_interrupt_poll(sc); } @@ -1085,7 +1090,7 @@ atmegadci_device_done(struct usb2_xfer * USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); - DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n", + DPRINTFN(9, "xfer=%p, pipe=%p, error=%d\n", xfer, xfer->pipe, error); if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) { @@ -1163,15 +1168,7 @@ atmegadci_clear_stall_sub(struct atmegad ATMEGA_UECONX_EPEN | ATMEGA_UECONX_STALLRQC); - if (ep_type == UE_CONTROL) { - /* one bank, 64-bytes wMaxPacket */ - ATMEGA_WRITE_1(sc, ATMEGA_UECFG0X, - ATMEGA_UECFG0X_EPTYPE0); - ATMEGA_WRITE_1(sc, ATMEGA_UECFG1X, - ATMEGA_UECFG1X_ALLOC | - ATMEGA_UECFG1X_EPBK0 | - ATMEGA_UECFG1X_EPSIZE(7)); - } else { + do { temp = 0; if (ep_type == UE_BULK) { temp |= ATMEGA_UECFG0X_EPTYPE2; @@ -1188,13 +1185,13 @@ atmegadci_clear_stall_sub(struct atmegad ATMEGA_WRITE_1(sc, ATMEGA_UECFG1X, ATMEGA_UECFG1X_ALLOC | ATMEGA_UECFG1X_EPBK1 | - ATMEGA_UECFG1X_EPSIZE(7)); + ATMEGA_UECFG1X_EPSIZE(3)); temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X); if (!(temp & ATMEGA_UESTA0X_CFGOK)) { DPRINTFN(0, "Chip rejected configuration\n"); } - } + } while (0); } static void @@ -1237,16 +1234,21 @@ atmegadci_init(struct atmegadci_softc *s sc->sc_bus.methods = &atmegadci_bus_methods; USB_BUS_LOCK(&sc->sc_bus); +#if 0 + /* XXX TODO - currently done by boot strap */ /* enable USB PAD regulator */ ATMEGA_WRITE_1(sc, ATMEGA_UHWCON, - ATMEGA_UHWCON_UVREGE); - + ATMEGA_UHWCON_UVREGE | ATMEGA_UHWCON_UIMOD); +#endif /* turn on clocks */ (sc->sc_clocks_on) (&sc->sc_bus); + /* make sure device is re-enumerated */ + ATMEGA_WRITE_1(sc, ATMEGA_UDCON, ATMEGA_UDCON_DETACH); + /* wait a little for things to stabilise */ - usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); + usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 20); /* enable interrupts */ ATMEGA_WRITE_1(sc, ATMEGA_UDIEN, @@ -1261,7 +1263,7 @@ atmegadci_init(struct atmegadci_softc *s ATMEGA_WRITE_1(sc, ATMEGA_UERST, 0); /* disable all endpoints */ - for (n = 1; n != ATMEGA_EP_MAX; n++) { + for (n = 0; n != ATMEGA_EP_MAX; n++) { /* select endpoint */ ATMEGA_WRITE_1(sc, ATMEGA_UENUM, n); @@ -1277,6 +1279,11 @@ atmegadci_init(struct atmegadci_softc *s atmegadci_clocks_off(sc); + /* read initial VBUS state */ + + n = ATMEGA_READ_1(sc, ATMEGA_USBSTA); + atmegadci_vbus_interrupt(sc, n & ATMEGA_USBSTA_VBUS); + USB_BUS_UNLOCK(&sc->sc_bus); /* catch any lost interrupts */ @@ -1688,6 +1695,7 @@ atmegadci_root_ctrl_done(struct usb2_xfe struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); uint16_t value; uint16_t index; + uint8_t temp; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); @@ -1976,7 +1984,38 @@ tr_handle_clear_port_feature: atmegadci_clocks_off(sc); break; case UHF_C_PORT_CONNECTION: + /* clear connect change flag */ sc->sc_flags.change_connect = 0; + + /* configure the control endpoint */ + + /* select endpoint number */ + ATMEGA_WRITE_1(sc, ATMEGA_UENUM, 0); + + /* set endpoint reset */ + ATMEGA_WRITE_1(sc, ATMEGA_UERST, ATMEGA_UERST_MASK(0)); + + /* clear endpoint reset */ + ATMEGA_WRITE_1(sc, ATMEGA_UERST, 0); + + /* enable and stall endpoint */ + ATMEGA_WRITE_1(sc, ATMEGA_UECONX, + ATMEGA_UECONX_EPEN | + ATMEGA_UECONX_STALLRQ); + + /* one bank, 64-bytes wMaxPacket */ + ATMEGA_WRITE_1(sc, ATMEGA_UECFG0X, + ATMEGA_UECFG0X_EPTYPE0); + ATMEGA_WRITE_1(sc, ATMEGA_UECFG1X, + ATMEGA_UECFG1X_ALLOC | + ATMEGA_UECFG1X_EPBK0 | + ATMEGA_UECFG1X_EPSIZE(3)); + + /* check valid config */ + temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X); + if (!(temp & ATMEGA_UESTA0X_CFGOK)) { + DPRINTFN(0, "Chip rejected EP0 configuration\n"); + } break; case UHF_C_PORT_SUSPEND: sc->sc_flags.change_suspend = 0; @@ -2252,10 +2291,10 @@ atmegadci_pipe_init(struct usb2_device * { struct atmegadci_softc *sc = ATMEGA_BUS2SC(udev->bus); - DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n", + DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d,%d)\n", pipe, udev->address, edesc->bEndpointAddress, udev->flags.usb2_mode, - sc->sc_rt_addr); + sc->sc_rt_addr, udev->device_index); if (udev->device_index == sc->sc_rt_addr) { Modified: head/sys/dev/usb/controller/atmegadci.h ============================================================================== --- head/sys/dev/usb/controller/atmegadci.h Wed Mar 11 04:56:30 2009 (r189676) +++ head/sys/dev/usb/controller/atmegadci.h Wed Mar 11 04:58:21 2009 (r189677) @@ -155,6 +155,9 @@ #define ATMEGA_UHWCON 0xD7 #define ATMEGA_UHWCON_UVREGE (1 << 0) +#define ATMEGA_UHWCON_UVCONE (1 << 4) +#define ATMEGA_UHWCON_UIDE (1 << 6) +#define ATMEGA_UHWCON_UIMOD (1 << 7) #define ATMEGA_READ_1(sc, reg) \ bus_space_read_1((sc)->sc_io_tag, (sc)->sc_io_hdl, reg) Modified: head/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci_atmelarm.c Wed Mar 11 04:56:30 2009 (r189676) +++ head/sys/dev/usb/controller/atmegadci_atmelarm.c Wed Mar 11 04:58:21 2009 (r189677) @@ -25,3 +25,191 @@ __FBSDID("$FreeBSD$"); * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +static device_probe_t atmegadci_probe; +static device_attach_t atmegadci_attach; +static device_detach_t atmegadci_detach; +static device_shutdown_t atmegadci_shutdown; + +struct atmegadci_super_softc { + struct atmegadci_softc sc_otg; /* must be first */ +}; + +static void +atmegadci_clocks_on(struct usb2_bus *bus) +{ + /* TODO */ +} + +static void +atmegadci_clocks_off(struct usb2_bus *bus) +{ + /* TODO */ +} + +static int +atmegadci_probe(device_t dev) +{ + device_set_desc(dev, "ATMEL OTG integrated USB controller"); + return (0); +} + +static int +atmegadci_attach(device_t dev) +{ + struct atmegadci_super_softc *sc = device_get_softc(dev); + int err; + int rid; + + /* setup MUSB OTG USB controller interface softc */ + sc->sc_otg.sc_clocks_on = &atmegadci_clocks_on; + sc->sc_otg.sc_clocks_off = &atmegadci_clocks_off; + + /* initialise some bus fields */ + sc->sc_otg.sc_bus.parent = dev; + sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices; + sc->sc_otg.sc_bus.devices_max = ATMEGA_MAX_DEVICES; + + /* get all DMA memory */ + if (usb2_bus_mem_alloc_all(&sc->sc_otg.sc_bus, + USB_GET_DMA_TAG(dev), NULL)) { + return (ENOMEM); + } + rid = 0; + sc->sc_otg.sc_io_res = + bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + + if (!(sc->sc_otg.sc_io_res)) { + err = ENOMEM; + goto error; + } + sc->sc_otg.sc_io_tag = rman_get_bustag(sc->sc_otg.sc_io_res); + sc->sc_otg.sc_io_hdl = rman_get_bushandle(sc->sc_otg.sc_io_res); + + rid = 0; + sc->sc_otg.sc_irq_res = + bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + if (!(sc->sc_otg.sc_irq_res)) { + goto error; + } + sc->sc_otg.sc_bus.bdev = device_add_child(dev, "usbus", -1); + if (!(sc->sc_otg.sc_bus.bdev)) { + goto error; + } + device_set_ivars(sc->sc_otg.sc_bus.bdev, &sc->sc_otg.sc_bus); + + err = bus_setup_intr(dev, sc->sc_otg.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (void *)atmegadci_interrupt, sc, &sc->sc_otg.sc_intr_hdl); + if (err) { + sc->sc_otg.sc_intr_hdl = NULL; + goto error; + } + err = atmegadci_init(&sc->sc_otg); + if (!err) { + err = device_probe_and_attach(sc->sc_otg.sc_bus.bdev); + } + if (err) { + goto error; + } + return (0); + +error: + atmegadci_detach(dev); + return (ENXIO); +} + +static int +atmegadci_detach(device_t dev) +{ + struct atmegadci_super_softc *sc = device_get_softc(dev); + device_t bdev; + int err; + + if (sc->sc_otg.sc_bus.bdev) { + bdev = sc->sc_otg.sc_bus.bdev; + device_detach(bdev); + device_delete_child(dev, bdev); + } + /* during module unload there are lots of children leftover */ + device_delete_all_children(dev); + + if (sc->sc_otg.sc_irq_res && sc->sc_otg.sc_intr_hdl) { + /* + * only call atmegadci_uninit() after atmegadci_init() + */ + atmegadci_uninit(&sc->sc_otg); + + err = bus_teardown_intr(dev, sc->sc_otg.sc_irq_res, + sc->sc_otg.sc_intr_hdl); + sc->sc_otg.sc_intr_hdl = NULL; + } + /* free IRQ channel, if any */ + if (sc->sc_otg.sc_irq_res) { + bus_release_resource(dev, SYS_RES_IRQ, 0, + sc->sc_otg.sc_irq_res); + sc->sc_otg.sc_irq_res = NULL; + } + /* free memory resource, if any */ + if (sc->sc_otg.sc_io_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, + sc->sc_otg.sc_io_res); + sc->sc_otg.sc_io_res = NULL; + } + usb2_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL); + + return (0); +} + +static int +atmegadci_shutdown(device_t dev) +{ + struct atmegadci_super_softc *sc = device_get_softc(dev); + int err; + + err = bus_generic_shutdown(dev); + if (err) + return (err); + + atmegadci_uninit(&sc->sc_otg); + + return (0); +} + +static device_method_t atmegadci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, atmegadci_probe), + DEVMETHOD(device_attach, atmegadci_attach), + DEVMETHOD(device_detach, atmegadci_detach), + DEVMETHOD(device_shutdown, atmegadci_shutdown), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + + {0, 0} +}; + +static driver_t atmegadci_driver = { + "atmegadci", + atmegadci_methods, + sizeof(struct atmegadci_super_softc), +}; + +static devclass_t atmegadci_devclass; + +DRIVER_MODULE(atmegadci, atmelarm, atmegadci_driver, atmegadci_devclass, 0, 0); +MODULE_DEPEND(atmegadci, usb, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 05:11:57 2009 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 7E8881065670; Wed, 11 Mar 2009 05:11:57 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C2368FC0C; Wed, 11 Mar 2009 05:11:57 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B5BvxE085016; Wed, 11 Mar 2009 05:11:57 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B5BvO1085015; Wed, 11 Mar 2009 05:11:57 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903110511.n2B5BvO1085015@svn.freebsd.org> From: Tim Kientzle Date: Wed, 11 Mar 2009 05:11: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: r189678 - head/lib/libarchive 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 Mar 2009 05:11:58 -0000 Author: kientzle Date: Wed Mar 11 05:11:57 2009 New Revision: 189678 URL: http://svn.freebsd.org/changeset/base/189678 Log: Hack: *Temporarily* disable reading extended attributes from disk, as it seems to be badly broken on ZFS. Modified: head/lib/libarchive/config_freebsd.h Modified: head/lib/libarchive/config_freebsd.h ============================================================================== --- head/lib/libarchive/config_freebsd.h Wed Mar 11 04:58:21 2009 (r189677) +++ head/lib/libarchive/config_freebsd.h Wed Mar 11 05:11:57 2009 (r189678) @@ -34,8 +34,12 @@ #define HAVE_ACL_SET_FD_NP 1 #define HAVE_ACL_SET_FILE 1 #define HAVE_ACL_USER 1 +#if 0 +/* XXX Temporarily disable support for reading extended attributes from + * disk, as it seems to be badly broken on ZFS. XXX */ #define HAVE_EXTATTR_GET_FILE 1 #define HAVE_EXTATTR_LIST_FILE 1 +#endif #define HAVE_EXTATTR_SET_FD 1 #define HAVE_EXTATTR_SET_FILE 1 #define HAVE_SYS_ACL_H 1 From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 07:22:12 2009 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 0ADFB1065672; Wed, 11 Mar 2009 07:22:12 +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 EDA9F8FC08; Wed, 11 Mar 2009 07:22:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B7MBJK087673; Wed, 11 Mar 2009 07:22:11 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B7MB2B087672; Wed, 11 Mar 2009 07:22:11 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903110722.n2B7MB2B087672@svn.freebsd.org> From: Warner Losh Date: Wed, 11 Mar 2009 07:22: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: r189679 - head/sys/dev/pccard 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 Mar 2009 07:22:12 -0000 Author: imp Date: Wed Mar 11 07:22:11 2009 New Revision: 189679 URL: http://svn.freebsd.org/changeset/base/189679 Log: Add 3 new cards that I found today in akihabara... Toshiba LANCT00A TDK LAK-CD011 TJ PTJ-LAN/T PC-NIC ENCC 990010759-001A Modified: head/sys/dev/pccard/pccarddevs Modified: head/sys/dev/pccard/pccarddevs ============================================================================== --- head/sys/dev/pccard/pccarddevs Wed Mar 11 05:11:57 2009 (r189678) +++ head/sys/dev/pccard/pccarddevs Wed Mar 11 07:22:11 2009 (r189679) @@ -186,6 +186,7 @@ vendor DUAL 0x890f Dual vendor EDIMAX 0x890f Edimax Technology Inc. vendor ADAPTEC2 0x9005 Adaptec vendor CONTEC 0xc001 Contec +vendor TJ 0xc00a TJ vendor MACNICA 0xc00b MACNICA vendor ROLAND 0xc00c Roland vendor COREGA2 0xc00f Corega K.K. @@ -589,6 +590,7 @@ product SYMBOL LA4100 0x0001 Symbol Spe /* TDK Products */ product TDK LAK_CD011WL 0x0000 TDK LAK-CD011WL +product TDK LAK_CD011 0x0100 TDK LAK-CD011 product TDK CFE_10 0x010a Xircom CompactCard CFE-10 product TDK LAK_CD021BX 0x0200 TDK LAK-CD021BX Ethernet product TDK LAK_CF010 0x0900 TDK LAC-CF010 @@ -603,6 +605,12 @@ product TDK DFL5610WS 0xea15 TDK DFL561 product TELECOMDEVICE LM5LT 0x0101 Billionton LM5LT-10B Ethernet/Modem product TELECOMDEVICE TCD_HPC100 0x0202 Telecom Device TCD-HPC100 +/* TJ Products */ +product TJ PTJ_LAN_T 0x0001 TJ Ethernet PTJ-LAN/T PC-NIC ENCC 990010759-001A + +/* Toshiba products */ +product TOSHIBA2 LANCT00A 0x0042 Toshiba LANCT00A Ethernet + /* US Robotics Products */ product USROBOTICS WORLDPORT144 0x3330 US Robotics WorldPort 14.4 Modem From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 08:11:12 2009 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 1126F106564A; Wed, 11 Mar 2009 08:11:12 +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 006228FC0C; Wed, 11 Mar 2009 08:11:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B8BB0b088593; Wed, 11 Mar 2009 08:11:11 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B8BBjP088592; Wed, 11 Mar 2009 08:11:11 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903110811.n2B8BBjP088592@svn.freebsd.org> From: Warner Losh Date: Wed, 11 Mar 2009 08:11: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: r189680 - head/sys/dev/pccard 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 Mar 2009 08:11:12 -0000 Author: imp Date: Wed Mar 11 08:11:11 2009 New Revision: 189680 URL: http://svn.freebsd.org/changeset/base/189680 Log: Add entry for Hitachi HT-4840-11, which is a fe-based card. Modified: head/sys/dev/pccard/pccarddevs Modified: head/sys/dev/pccard/pccarddevs ============================================================================== --- head/sys/dev/pccard/pccarddevs Wed Mar 11 07:22:11 2009 (r189679) +++ head/sys/dev/pccard/pccarddevs Wed Mar 11 08:11:11 2009 (r189680) @@ -75,6 +75,7 @@ $FreeBSD$ * publication 106 reserves the top bit for parity. */ vendor FUJITSU 0x0004 Fujitsu Corporation +vendor HITACHI 0x0007 Hitachi vendor INTERSIL 0x000b Intersil vendor PANASONIC 0x0032 Matsushita Electric Industrial Co. vendor SANDISK 0x0045 Sandisk Corporation @@ -347,6 +348,9 @@ product GLOBALVILLAGE LANMODEM 0x0105 Gl product GREY_CELL TDK3000 0x3341 TDK 3000/3400/5670 Fast Ethernet/Modem product GREY_CELL DMF650TX 0xc0ab D-Link DMF-650TX +/* Hitachi */ +product HITACHI HT_4840 0x000b Hitachi HT-4840-11 Ethernet Card + /* Home Wireless Networks */ product HWN AIRWAY80211 0x0002 HWN Airway Wireless PCMCIA Card From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 08:12:28 2009 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 AE6D91065672; Wed, 11 Mar 2009 08:12:28 +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 834DC8FC16; Wed, 11 Mar 2009 08:12:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B8CSDc088658; Wed, 11 Mar 2009 08:12:28 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B8CSM0088657; Wed, 11 Mar 2009 08:12:28 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903110812.n2B8CSM0088657@svn.freebsd.org> From: Warner Losh Date: Wed, 11 Mar 2009 08:12: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: r189681 - head/sys/dev/fe 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 Mar 2009 08:12:29 -0000 Author: imp Date: Wed Mar 11 08:12:28 2009 New Revision: 189681 URL: http://svn.freebsd.org/changeset/base/189681 Log: Add support for Hitachi HT-4840-11. This card is supposedly just like the J181, but not quite. This card's CIS has some quirks that means we have to ignore CFE's 1-9. Modified: head/sys/dev/fe/if_fe_pccard.c Modified: head/sys/dev/fe/if_fe_pccard.c ============================================================================== --- head/sys/dev/fe/if_fe_pccard.c Wed Mar 11 08:11:11 2009 (r189680) +++ head/sys/dev/fe/if_fe_pccard.c Wed Mar 11 08:12:28 2009 (r189681) @@ -64,6 +64,7 @@ static const struct fe_pccard_product { int mpp_flags; #define MPP_MBH10302 1 #define MPP_ANYFUNC 2 +#define MPP_SKIP_TO_CFE_10 4 } fe_pccard_products[] = { /* These need to be first */ { PCMCIA_CARD(FUJITSU2, FMV_J181), MPP_MBH10302 }, @@ -80,6 +81,7 @@ static const struct fe_pccard_product { { PCMCIA_CARD(FUJITSU, LA501), 0 }, { PCMCIA_CARD(FUJITSU, LA10S), 0 }, { PCMCIA_CARD(FUJITSU, NE200T), MPP_MBH10302 },/* Sold by Eagle */ + { PCMCIA_CARD(HITACHI, HT_4840), MPP_MBH10302 | MPP_SKIP_TO_CFE_10}, { PCMCIA_CARD(RATOC, REX_R280), 0 }, { PCMCIA_CARD(XIRCOM, CE), MPP_ANYFUNC }, { { NULL } } @@ -91,6 +93,7 @@ fe_pccard_probe(device_t dev) int error; uint32_t fcn = PCCARD_FUNCTION_UNSPEC; const struct fe_pccard_product *pp; + int i; if ((pp = (const struct fe_pccard_product *)pccard_product_lookup(dev, (const struct pccard_product *)fe_pccard_products, @@ -105,6 +108,16 @@ fe_pccard_probe(device_t dev) return (error); if (fcn != PCCARD_FUNCTION_NETWORK) return (ENXIO); + if (pp->mpp_flags & MPP_SKIP_TO_CFE_10) { + for (i = 10; i < 27; i++) { + if (pccard_select_cfe(dev, i) == 0) + goto good; + } + device_printf(dev, + "Hitachi HT-4840-11 workaround failed\n"); + return ENXIO; + } + good:; return (0); } return (ENXIO); @@ -126,6 +139,7 @@ static driver_t fe_pccard_driver = { }; DRIVER_MODULE(fe, pccard, fe_pccard_driver, fe_devclass, 0, 0); +MODULE_DEPEND(fe, pccard, 1, 1, 1); static int fe_probe_mbh(device_t, const struct fe_pccard_product *); static int fe_probe_tdk(device_t, const struct fe_pccard_product *); From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 08:14:44 2009 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 DA7951065676; Wed, 11 Mar 2009 08:14:44 +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 C5D408FC18; Wed, 11 Mar 2009 08:14:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B8EidY088734; Wed, 11 Mar 2009 08:14:44 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B8EiGV088733; Wed, 11 Mar 2009 08:14:44 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903110814.n2B8EiGV088733@svn.freebsd.org> From: Warner Losh Date: Wed, 11 Mar 2009 08:14: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: r189682 - head/sys/dev/pccard 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 Mar 2009 08:14:47 -0000 Author: imp Date: Wed Mar 11 08:14:44 2009 New Revision: 189682 URL: http://svn.freebsd.org/changeset/base/189682 Log: Allow zero length memroy space descriptor sections. It is apparently legal in the spec. Add newline to the verbose messages we print when debugging when this happens. The Hitachi HT-4840-11 is the only card to hit these in years, and it works well enough if we're liberal about what we accept. Modified: head/sys/dev/pccard/pccard_cis.c Modified: head/sys/dev/pccard/pccard_cis.c ============================================================================== --- head/sys/dev/pccard/pccard_cis.c Wed Mar 11 08:12:28 2009 (r189681) +++ head/sys/dev/pccard/pccard_cis.c Wed Mar 11 08:14:44 2009 (r189682) @@ -1198,8 +1198,7 @@ pccard_parse_cis_tuple(const struct pcca if (lengthsize == 0) { DPRINTF(("cfe memspace " - "lengthsize == 0")); - state->card->error++; + "lengthsize == 0\n")); } for (i = 0; i < cfe->num_memspace; i++) { if (lengthsize) { @@ -1211,9 +1210,8 @@ pccard_parse_cis_tuple(const struct pcca cfe->memspace[i].length = 0; } if (cfe->memspace[i].length == 0) { - DPRINTF(("cfe->memspace[%d].length == 0", + DPRINTF(("cfe->memspace[%d].length == 0\n", i)); - state->card->error++; } if (cardaddrsize) { cfe->memspace[i].cardaddr = From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 08:15:17 2009 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 BCA9D106566B; Wed, 11 Mar 2009 08:15:17 +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 AB2AB8FC28; Wed, 11 Mar 2009 08:15:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B8FHT1088797; Wed, 11 Mar 2009 08:15:17 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B8FHSw088796; Wed, 11 Mar 2009 08:15:17 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903110815.n2B8FHSw088796@svn.freebsd.org> From: Warner Losh Date: Wed, 11 Mar 2009 08:15: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: r189683 - head/sys/dev/pccard 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 Mar 2009 08:15:18 -0000 Author: imp Date: Wed Mar 11 08:15:17 2009 New Revision: 189683 URL: http://svn.freebsd.org/changeset/base/189683 Log: Remove old compat method that's no longer needed (and hasn't been since just before 6.0). Modified: head/sys/dev/pccard/card_if.m Modified: head/sys/dev/pccard/card_if.m ============================================================================== --- head/sys/dev/pccard/card_if.m Wed Mar 11 08:14:44 2009 (r189682) +++ head/sys/dev/pccard/card_if.m Wed Mar 11 08:15:17 2009 (r189683) @@ -102,15 +102,6 @@ METHOD const struct pccard_product * do_ } # -# Helper method for the above. When a compatibility driver is converted, -# one must write a match routine. This routine is unused on OLDCARD but -# is used as a discriminator for NEWCARD. -# -METHOD int compat_match { - device_t dev; -} - -# # Scanning function for accessing the CIS of a card in its driver. # METHOD int cis_scan { From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 08:19:31 2009 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 D97CB106566C; Wed, 11 Mar 2009 08:19:31 +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 C873C8FC0A; Wed, 11 Mar 2009 08:19:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B8JV0Y088910; Wed, 11 Mar 2009 08:19:31 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B8JVcq088909; Wed, 11 Mar 2009 08:19:31 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903110819.n2B8JVcq088909@svn.freebsd.org> From: Warner Losh Date: Wed, 11 Mar 2009 08:19: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: r189684 - 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: Wed, 11 Mar 2009 08:19:32 -0000 Author: imp Date: Wed Mar 11 08:19:31 2009 New Revision: 189684 URL: http://svn.freebsd.org/changeset/base/189684 Log: Minor nits notice by jhb@ Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Wed Mar 11 08:15:17 2009 (r189683) +++ head/sys/kern/subr_bus.c Wed Mar 11 08:19:31 2009 (r189684) @@ -849,7 +849,6 @@ devclass_find(const char *classname) return (devclass_find_internal(classname, NULL, FALSE)); } - /** * @brief Register that a device driver has been added to a devclass * @@ -868,8 +867,8 @@ devclass_find(const char *classname) static void devclass_driver_added(devclass_t dc, driver_t *driver) { - int i; devclass_t parent; + int i; /* * Call BUS_DRIVER_ADDED for any existing busses in this class. @@ -883,7 +882,7 @@ devclass_driver_added(devclass_t dc, dri * single parent pointer around, we walk the entire list of * devclasses looking for children. We set the * DC_HAS_CHILDREN flag when a child devclass is created on - * the parent, so we only walk thoe list for those devclasses + * the parent, so we only walk the list for those devclasses * that have children. */ if (!(dc->flags & DC_HAS_CHILDREN)) From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 08:25:19 2009 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 53D4C1065679; Wed, 11 Mar 2009 08:25:19 +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 38DBA8FC18; Wed, 11 Mar 2009 08:25:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B8PJJK089083; Wed, 11 Mar 2009 08:25:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B8PJRT089082; Wed, 11 Mar 2009 08:25:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903110825.n2B8PJRT089082@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 11 Mar 2009 08:25: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: r189685 - head/sys/dev/txp 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 Mar 2009 08:25:20 -0000 Author: yongari Date: Wed Mar 11 08:25:18 2009 New Revision: 189685 URL: http://svn.freebsd.org/changeset/base/189685 Log: K&R -> ANSI C function definitions. Modified: head/sys/dev/txp/if_txp.c Modified: head/sys/dev/txp/if_txp.c ============================================================================== --- head/sys/dev/txp/if_txp.c Wed Mar 11 08:19:31 2009 (r189684) +++ head/sys/dev/txp/if_txp.c Wed Mar 11 08:25:18 2009 (r189685) @@ -186,8 +186,7 @@ MODULE_DEPEND(txp, pci, 1, 1, 1); MODULE_DEPEND(txp, ether, 1, 1, 1); static int -txp_probe(dev) - device_t dev; +txp_probe(device_t dev) { struct txp_type *t; @@ -206,8 +205,7 @@ txp_probe(dev) } static int -txp_attach(dev) - device_t dev; +txp_attach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; @@ -363,8 +361,7 @@ fail: } static int -txp_detach(dev) - device_t dev; +txp_detach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; @@ -392,8 +389,7 @@ txp_detach(dev) } static void -txp_release_resources(sc) - struct txp_softc *sc; +txp_release_resources(struct txp_softc *sc) { device_t dev; @@ -418,8 +414,7 @@ txp_release_resources(sc) } static int -txp_chip_init(sc) - struct txp_softc *sc; +txp_chip_init(struct txp_softc *sc) { /* disable interrupts */ WRITE_REG(sc, TXP_IER, 0); @@ -456,8 +451,7 @@ txp_chip_init(sc) } static int -txp_reset_adapter(sc) - struct txp_softc *sc; +txp_reset_adapter(struct txp_softc *sc) { u_int32_t r; int i; @@ -484,8 +478,7 @@ txp_reset_adapter(sc) } static int -txp_download_fw(sc) - struct txp_softc *sc; +txp_download_fw(struct txp_softc *sc) { struct txp_fw_file_header *fileheader; struct txp_fw_section_header *secthead; @@ -573,8 +566,7 @@ fail: } static int -txp_download_fw_wait(sc) - struct txp_softc *sc; +txp_download_fw_wait(struct txp_softc *sc) { u_int32_t i, r; @@ -602,10 +594,8 @@ txp_download_fw_wait(sc) } static int -txp_download_fw_section(sc, sect, sectnum) - struct txp_softc *sc; - struct txp_fw_section_header *sect; - int sectnum; +txp_download_fw_section(struct txp_softc *sc, + struct txp_fw_section_header *sect, int sectnum) { vm_offset_t dma; int rseg, err = 0; @@ -670,8 +660,7 @@ bail: } static void -txp_intr(vsc) - void *vsc; +txp_intr(void *vsc) { struct txp_softc *sc = vsc; struct txp_hostvar *hv = sc->sc_hostvar; @@ -718,9 +707,7 @@ txp_intr(vsc) } static void -txp_rx_reclaim(sc, r) - struct txp_softc *sc; - struct txp_rx_ring *r; +txp_rx_reclaim(struct txp_softc *sc, struct txp_rx_ring *r) { struct ifnet *ifp = sc->sc_ifp; struct txp_rx_desc *rxd; @@ -810,8 +797,7 @@ next: } static void -txp_rxbuf_reclaim(sc) - struct txp_softc *sc; +txp_rxbuf_reclaim(struct txp_softc *sc) { struct ifnet *ifp = sc->sc_ifp; struct txp_hostvar *hv = sc->sc_hostvar; @@ -859,9 +845,7 @@ txp_rxbuf_reclaim(sc) * Reclaim mbufs and entries from a transmit ring. */ static void -txp_tx_reclaim(sc, r) - struct txp_softc *sc; - struct txp_tx_ring *r; +txp_tx_reclaim(struct txp_softc *sc, struct txp_tx_ring *r) { struct ifnet *ifp = sc->sc_ifp; u_int32_t idx = TXP_OFFSET2IDX(*(r->r_off)); @@ -906,8 +890,7 @@ txp_tx_reclaim(sc, r) } static int -txp_shutdown(dev) - device_t dev; +txp_shutdown(device_t dev) { struct txp_softc *sc; @@ -930,8 +913,7 @@ txp_shutdown(dev) } static int -txp_alloc_rings(sc) - struct txp_softc *sc; +txp_alloc_rings(struct txp_softc *sc) { struct txp_boot_record *boot; struct txp_ldata *ld; @@ -1066,10 +1048,7 @@ txp_alloc_rings(sc) } static int -txp_ioctl(ifp, command, data) - struct ifnet *ifp; - u_long command; - caddr_t data; +txp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct txp_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; @@ -1110,8 +1089,7 @@ txp_ioctl(ifp, command, data) } static int -txp_rxring_fill(sc) - struct txp_softc *sc; +txp_rxring_fill(struct txp_softc *sc) { int i; struct ifnet *ifp; @@ -1141,8 +1119,7 @@ txp_rxring_fill(sc) } static void -txp_rxring_empty(sc) - struct txp_softc *sc; +txp_rxring_empty(struct txp_softc *sc) { int i; struct txp_swdesc *sd; @@ -1167,8 +1144,7 @@ txp_rxring_empty(sc) } static void -txp_init(xsc) - void *xsc; +txp_init(void *xsc) { struct txp_softc *sc; @@ -1179,8 +1155,7 @@ txp_init(xsc) } static void -txp_init_locked(sc) - struct txp_softc *sc; +txp_init_locked(struct txp_softc *sc) { struct ifnet *ifp; u_int16_t p1; @@ -1229,8 +1204,7 @@ txp_init_locked(sc) } static void -txp_tick(vsc) - void *vsc; +txp_tick(void *vsc) { struct txp_softc *sc = vsc; struct ifnet *ifp = sc->sc_ifp; @@ -1269,8 +1243,7 @@ out: } static void -txp_start(ifp) - struct ifnet *ifp; +txp_start(struct ifnet *ifp) { struct txp_softc *sc; @@ -1281,8 +1254,7 @@ txp_start(ifp) } static void -txp_start_locked(ifp) - struct ifnet *ifp; +txp_start_locked(struct ifnet *ifp) { struct txp_softc *sc = ifp->if_softc; struct txp_tx_ring *r = &sc->sc_txhir; @@ -1527,9 +1499,8 @@ txp_response(struct txp_softc *sc, u_int } static void -txp_rsp_fixup(sc, rsp, dst) - struct txp_softc *sc; - struct txp_rsp_desc *rsp, *dst; +txp_rsp_fixup(struct txp_softc *sc, struct txp_rsp_desc *rsp, + struct txp_rsp_desc *dst) { struct txp_rsp_desc *src = rsp; struct txp_hostvar *hv = sc->sc_hostvar; @@ -1553,8 +1524,7 @@ txp_rsp_fixup(sc, rsp, dst) } static int -txp_cmd_desc_numfree(sc) - struct txp_softc *sc; +txp_cmd_desc_numfree(struct txp_softc *sc) { struct txp_hostvar *hv = sc->sc_hostvar; struct txp_boot_record *br = sc->sc_boot; @@ -1578,8 +1548,7 @@ txp_cmd_desc_numfree(sc) } static void -txp_stop(sc) - struct txp_softc *sc; +txp_stop(struct txp_softc *sc) { struct ifnet *ifp; @@ -1599,15 +1568,13 @@ txp_stop(sc) } static void -txp_watchdog(ifp) - struct ifnet *ifp; +txp_watchdog(struct ifnet *ifp) { return; } static int -txp_ifmedia_upd(ifp) - struct ifnet *ifp; +txp_ifmedia_upd(struct ifnet *ifp) { struct txp_softc *sc = ifp->if_softc; struct ifmedia *ifm = &sc->sc_ifmedia; @@ -1651,9 +1618,7 @@ txp_ifmedia_upd(ifp) } static void -txp_ifmedia_sts(ifp, ifmr) - struct ifnet *ifp; - struct ifmediareq *ifmr; +txp_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { struct txp_softc *sc = ifp->if_softc; struct ifmedia *ifm = &sc->sc_ifmedia; @@ -1726,8 +1691,7 @@ bail: #ifdef TXP_DEBUG static void -txp_show_descriptor(d) - void *d; +txp_show_descriptor(void *d) { struct txp_cmd_desc *cmd = d; struct txp_rsp_desc *rsp = d; @@ -1770,8 +1734,7 @@ txp_show_descriptor(d) #endif static void -txp_set_filter(sc) - struct txp_softc *sc; +txp_set_filter(struct txp_softc *sc) { struct ifnet *ifp = sc->sc_ifp; u_int32_t crc, carry, hashbit, hash[2]; @@ -1838,8 +1801,7 @@ setit: } static void -txp_capabilities(sc) - struct txp_softc *sc; +txp_capabilities(struct txp_softc *sc) { struct ifnet *ifp = sc->sc_ifp; struct txp_rsp_desc *rsp = NULL; From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 08:28:25 2009 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 21433106566B; Wed, 11 Mar 2009 08:28:25 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F1A58FC0C; Wed, 11 Mar 2009 08:28:25 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B8SOjh089191; Wed, 11 Mar 2009 08:28:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B8SOOj089190; Wed, 11 Mar 2009 08:28:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903110828.n2B8SOOj089190@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 11 Mar 2009 08:28: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: r189686 - head/sys/dev/txp 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 Mar 2009 08:28:26 -0000 Author: yongari Date: Wed Mar 11 08:28:24 2009 New Revision: 189686 URL: http://svn.freebsd.org/changeset/base/189686 Log: Remove extra tab characters. Modified: head/sys/dev/txp/if_txp.c Modified: head/sys/dev/txp/if_txp.c ============================================================================== --- head/sys/dev/txp/if_txp.c Wed Mar 11 08:25:18 2009 (r189685) +++ head/sys/dev/txp/if_txp.c Wed Mar 11 08:28:24 2009 (r189686) @@ -534,7 +534,7 @@ txp_download_fw(struct txp_softc *sc) sizeof(struct txp_fw_file_header)); for (sect = 0; sect < fileheader->nsections; sect++) { - + if (txp_download_fw_section(sc, secthead, sect)) { error = -1; goto fail; @@ -659,7 +659,7 @@ bail: return (err); } -static void +static void txp_intr(void *vsc) { struct txp_softc *sc = vsc; @@ -1519,7 +1519,7 @@ txp_rsp_fixup(struct txp_softc *sc, stru src++; sc->sc_rspring.lastwrite = hv->hv_resp_read_idx = ridx; } - + hv->hv_resp_read_idx = ridx; } From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 08:41:58 2009 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 358061065716; Wed, 11 Mar 2009 08:41:58 +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 209B98FC18; Wed, 11 Mar 2009 08:41:58 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B8fwIs089523; Wed, 11 Mar 2009 08:41:58 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B8fwVd089522; Wed, 11 Mar 2009 08:41:58 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903110841.n2B8fwVd089522@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 11 Mar 2009 08:41: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: r189687 - head/sys/dev/txp 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 Mar 2009 08:42:02 -0000 Author: yongari Date: Wed Mar 11 08:41:57 2009 New Revision: 189687 URL: http://svn.freebsd.org/changeset/base/189687 Log: Remove return statement at the end of function that returns void. Modified: head/sys/dev/txp/if_txp.c Modified: head/sys/dev/txp/if_txp.c ============================================================================== --- head/sys/dev/txp/if_txp.c Wed Mar 11 08:28:24 2009 (r189686) +++ head/sys/dev/txp/if_txp.c Wed Mar 11 08:41:57 2009 (r189687) @@ -409,8 +409,6 @@ txp_release_resources(struct txp_softc * if (sc->sc_ifp) if_free(sc->sc_ifp); - - return; } static int @@ -702,8 +700,6 @@ txp_intr(void *vsc) txp_start_locked(sc->sc_ifp); TXP_UNLOCK(sc); - - return; } static void @@ -792,8 +788,6 @@ next: } *r->r_roff = woff; - - return; } static void @@ -837,8 +831,6 @@ txp_rxbuf_reclaim(struct txp_softc *sc) } sc->sc_rxbufprod = i; - - return; } /* @@ -1139,8 +1131,6 @@ txp_rxring_empty(struct txp_softc *sc) sd->sd_mbuf = NULL; } } - - return; } static void @@ -1238,8 +1228,6 @@ out: free(rsp, M_DEVBUF); callout_reset(&sc->sc_tick, hz, txp_tick, sc); - - return; } static void @@ -1355,7 +1343,6 @@ oactive: r->r_prod = firstprod; r->r_cnt = firstcnt; IF_PREPEND(&ifp->if_snd, m); - return; } /* @@ -1563,14 +1550,12 @@ txp_stop(struct txp_softc *sc) txp_command(sc, TXP_CMD_RX_DISABLE, 0, 0, 0, NULL, NULL, NULL, 1); txp_rxring_empty(sc); - - return; } static void txp_watchdog(struct ifnet *ifp) { - return; + } static int @@ -1796,8 +1781,6 @@ setit: txp_command(sc, TXP_CMD_RX_FILTER_WRITE, filter, 0, 0, NULL, NULL, NULL, 1); - - return; } static void @@ -1864,6 +1847,4 @@ txp_capabilities(struct txp_softc *sc) out: if (rsp != NULL) free(rsp, M_DEVBUF); - - return; } From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 08:49:17 2009 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 E1219106568A; Wed, 11 Mar 2009 08:49:17 +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 C50068FC19; Wed, 11 Mar 2009 08:49:17 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B8nH9Q089688; Wed, 11 Mar 2009 08:49:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B8nHcJ089687; Wed, 11 Mar 2009 08:49:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903110849.n2B8nHcJ089687@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 11 Mar 2009 08:49: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: r189688 - head/sys/dev/txp 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 Mar 2009 08:49:18 -0000 Author: yongari Date: Wed Mar 11 08:49:17 2009 New Revision: 189688 URL: http://svn.freebsd.org/changeset/base/189688 Log: style(9) - space after keywords. Modified: head/sys/dev/txp/if_txp.c Modified: head/sys/dev/txp/if_txp.c ============================================================================== --- head/sys/dev/txp/if_txp.c Wed Mar 11 08:41:57 2009 (r189687) +++ head/sys/dev/txp/if_txp.c Wed Mar 11 08:49:17 2009 (r189688) @@ -192,16 +192,16 @@ txp_probe(device_t dev) t = txp_devs; - while(t->txp_name != NULL) { + while (t->txp_name != NULL) { if ((pci_get_vendor(dev) == t->txp_vid) && (pci_get_device(dev) == t->txp_did)) { device_set_desc(dev, t->txp_name); - return(BUS_PROBE_DEFAULT); + return (BUS_PROBE_DEFAULT); } t++; } - return(ENXIO); + return (ENXIO); } static int @@ -352,12 +352,12 @@ txp_attach(device_t dev) goto fail; } - return(0); + return (0); fail: txp_release_resources(sc); mtx_destroy(&sc->sc_mtx); - return(error); + return (error); } static int @@ -385,7 +385,7 @@ txp_detach(device_t dev) txp_release_resources(sc); mtx_destroy(&sc->sc_mtx); - return(0); + return (0); } static void @@ -901,7 +901,7 @@ txp_shutdown(device_t dev) txp_command(sc, TXP_CMD_HALT, 0, 0, 0, NULL, NULL, NULL, 0); TXP_UNLOCK(sc); - return(0); + return (0); } static int @@ -990,7 +990,7 @@ txp_alloc_rings(struct txp_softc *sc) sc->sc_rxbufs[i].rb_sd = malloc(sizeof(struct txp_swdesc), M_DEVBUF, M_NOWAIT); if (sc->sc_rxbufs[i].rb_sd == NULL) - return(ENOBUFS); + return (ENOBUFS); sd = sc->sc_rxbufs[i].rb_sd; sd->sd_mbuf = NULL; } @@ -1011,7 +1011,7 @@ txp_alloc_rings(struct txp_softc *sc) if (r != STAT_WAITING_FOR_BOOT) { device_printf(sc->sc_dev, "not waiting for boot\n"); - return(ENXIO); + return (ENXIO); } WRITE_REG(sc, TXP_H2A_2, 0); @@ -1027,7 +1027,7 @@ txp_alloc_rings(struct txp_softc *sc) } if (r != STAT_RUNNING) { device_printf(sc->sc_dev, "fw not running\n"); - return(ENXIO); + return (ENXIO); } /* Clear TX and CMD ring write registers */ @@ -1046,7 +1046,7 @@ txp_ioctl(struct ifnet *ifp, u_long comm struct ifreq *ifr = (struct ifreq *)data; int error = 0; - switch(command) { + switch (command) { case SIOCSIFFLAGS: TXP_LOCK(sc); if (ifp->if_flags & IFF_UP) { @@ -1077,7 +1077,7 @@ txp_ioctl(struct ifnet *ifp, u_long comm break; } - return(error); + return (error); } static int @@ -1094,7 +1094,7 @@ txp_rxring_fill(struct txp_softc *sc) sd = sc->sc_rxbufs[i].rb_sd; sd->sd_mbuf = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (sd->sd_mbuf == NULL) - return(ENOBUFS); + return (ENOBUFS); sd->sd_mbuf->m_pkthdr.len = sd->sd_mbuf->m_len = MCLBYTES; sd->sd_mbuf->m_pkthdr.rcvif = ifp; @@ -1107,7 +1107,7 @@ txp_rxring_fill(struct txp_softc *sc) sc->sc_hostvar->hv_rx_buf_write_idx = (RXBUF_ENTRIES - 1) * sizeof(struct txp_rxbuf_desc); - return(0); + return (0); } static void From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 09:06:39 2009 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 91148106566C; Wed, 11 Mar 2009 09:06:39 +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 7ED718FC22; Wed, 11 Mar 2009 09:06:39 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B96doE090032; Wed, 11 Mar 2009 09:06:39 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B96dYG090030; Wed, 11 Mar 2009 09:06:39 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903110906.n2B96dYG090030@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 11 Mar 2009 09:06: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: r189689 - head/sys/dev/txp 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 Mar 2009 09:06:40 -0000 Author: yongari Date: Wed Mar 11 09:06:39 2009 New Revision: 189689 URL: http://svn.freebsd.org/changeset/base/189689 Log: s/u_int8_t/uint8_t/g s/u_int16_t/uint16_t/g s/u_int32_t/uint32_t/g s/u_int64_t/uint64_t/g Modified: head/sys/dev/txp/if_txp.c head/sys/dev/txp/if_txpreg.h Modified: head/sys/dev/txp/if_txp.c ============================================================================== --- head/sys/dev/txp/if_txp.c Wed Mar 11 08:49:17 2009 (r189688) +++ head/sys/dev/txp/if_txp.c Wed Mar 11 09:06:39 2009 (r189689) @@ -136,12 +136,12 @@ static void txp_rxring_empty(struct txp_ static void txp_set_filter(struct txp_softc *); static int txp_cmd_desc_numfree(struct txp_softc *); -static int txp_command(struct txp_softc *, u_int16_t, u_int16_t, u_int32_t, - u_int32_t, u_int16_t *, u_int32_t *, u_int32_t *, int); -static int txp_command2(struct txp_softc *, u_int16_t, u_int16_t, - u_int32_t, u_int32_t, struct txp_ext_desc *, u_int8_t, +static int txp_command(struct txp_softc *, uint16_t, uint16_t, uint32_t, + uint32_t, uint16_t *, uint32_t *, uint32_t *, int); +static int txp_command2(struct txp_softc *, uint16_t, uint16_t, + uint32_t, uint32_t, struct txp_ext_desc *, uint8_t, struct txp_rsp_desc **, int); -static int txp_response(struct txp_softc *, u_int32_t, u_int16_t, u_int16_t, +static int txp_response(struct txp_softc *, uint32_t, uint16_t, uint16_t, struct txp_rsp_desc **); static void txp_rsp_fixup(struct txp_softc *, struct txp_rsp_desc *, struct txp_rsp_desc *); @@ -209,8 +209,8 @@ txp_attach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; - u_int16_t p1; - u_int32_t p2; + uint16_t p1; + uint32_t p2; int error = 0, rid; u_char eaddr[6]; @@ -296,12 +296,12 @@ txp_attach(device_t dev) goto fail; } - eaddr[0] = ((u_int8_t *)&p1)[1]; - eaddr[1] = ((u_int8_t *)&p1)[0]; - eaddr[2] = ((u_int8_t *)&p2)[3]; - eaddr[3] = ((u_int8_t *)&p2)[2]; - eaddr[4] = ((u_int8_t *)&p2)[1]; - eaddr[5] = ((u_int8_t *)&p2)[0]; + eaddr[0] = ((uint8_t *)&p1)[1]; + eaddr[1] = ((uint8_t *)&p1)[0]; + eaddr[2] = ((uint8_t *)&p2)[3]; + eaddr[3] = ((uint8_t *)&p2)[2]; + eaddr[4] = ((uint8_t *)&p2)[1]; + eaddr[5] = ((uint8_t *)&p2)[0]; sc->sc_cold = 0; @@ -451,7 +451,7 @@ txp_chip_init(struct txp_softc *sc) static int txp_reset_adapter(struct txp_softc *sc) { - u_int32_t r; + uint32_t r; int i; r = 0; @@ -481,7 +481,7 @@ txp_download_fw(struct txp_softc *sc) struct txp_fw_file_header *fileheader; struct txp_fw_section_header *secthead; int error, sect; - u_int32_t r, i, ier, imr; + uint32_t r, i, ier, imr; r = 0; error = 0; @@ -528,7 +528,7 @@ txp_download_fw(struct txp_softc *sc) goto fail; } - secthead = (struct txp_fw_section_header *)(((u_int8_t *)tc990image) + + secthead = (struct txp_fw_section_header *)(((uint8_t *)tc990image) + sizeof(struct txp_fw_file_header)); for (sect = 0; sect < fileheader->nsections; sect++) { @@ -538,7 +538,7 @@ txp_download_fw(struct txp_softc *sc) goto fail; } secthead = (struct txp_fw_section_header *) - (((u_int8_t *)secthead) + secthead->nbytes + + (((uint8_t *)secthead) + secthead->nbytes + sizeof(*secthead)); } @@ -566,7 +566,7 @@ fail: static int txp_download_fw_wait(struct txp_softc *sc) { - u_int32_t i, r; + uint32_t i, r; r = 0; for (i = 0; i < 10000; i++) { @@ -598,14 +598,14 @@ txp_download_fw_section(struct txp_softc vm_offset_t dma; int rseg, err = 0; struct mbuf m; - u_int16_t csum; + uint16_t csum; /* Skip zero length sections */ if (sect->nbytes == 0) return (0); /* Make sure we aren't past the end of the image */ - rseg = ((u_int8_t *)sect) - ((u_int8_t *)tc990image); + rseg = ((uint8_t *)sect) - ((uint8_t *)tc990image); if (rseg >= sizeof(tc990image)) { device_printf(sc->sc_dev, "fw invalid section address, " "section %d\n", sectnum); @@ -620,7 +620,7 @@ txp_download_fw_section(struct txp_softc return (-1); } - bcopy(((u_int8_t *)sect) + sizeof(*sect), sc->sc_fwbuf, sect->nbytes); + bcopy(((uint8_t *)sect) + sizeof(*sect), sc->sc_fwbuf, sect->nbytes); dma = vtophys(sc->sc_fwbuf); /* @@ -662,7 +662,7 @@ txp_intr(void *vsc) { struct txp_softc *sc = vsc; struct txp_hostvar *hv = sc->sc_hostvar; - u_int32_t isr; + uint32_t isr; /* mask all interrupts */ TXP_LOCK(sc); @@ -709,7 +709,7 @@ txp_rx_reclaim(struct txp_softc *sc, str struct txp_rx_desc *rxd; struct mbuf *m; struct txp_swdesc *sd = NULL; - u_int32_t roff, woff; + uint32_t roff, woff; TXP_LOCK_ASSERT(sc); roff = *r->r_roff; @@ -797,7 +797,7 @@ txp_rxbuf_reclaim(struct txp_softc *sc) struct txp_hostvar *hv = sc->sc_hostvar; struct txp_rxbuf_desc *rbd; struct txp_swdesc *sd; - u_int32_t i; + uint32_t i; TXP_LOCK_ASSERT(sc); if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) @@ -840,8 +840,8 @@ static void txp_tx_reclaim(struct txp_softc *sc, struct txp_tx_ring *r) { struct ifnet *ifp = sc->sc_ifp; - u_int32_t idx = TXP_OFFSET2IDX(*(r->r_off)); - u_int32_t cons = r->r_cons, cnt = r->r_cnt; + uint32_t idx = TXP_OFFSET2IDX(*(r->r_off)); + uint32_t cons = r->r_cons, cnt = r->r_cnt; struct txp_tx_desc *txd = r->r_desc + cons; struct txp_swdesc *sd = sc->sc_txd + cons; struct mbuf *m; @@ -909,7 +909,7 @@ txp_alloc_rings(struct txp_softc *sc) { struct txp_boot_record *boot; struct txp_ldata *ld; - u_int32_t r; + uint32_t r; int i; r = 0; @@ -997,7 +997,7 @@ txp_alloc_rings(struct txp_softc *sc) sc->sc_rxbufprod = 0; /* zero dma */ - bzero(&ld->txp_zero, sizeof(u_int32_t)); + bzero(&ld->txp_zero, sizeof(uint32_t)); boot->br_zero_lo = vtophys(&ld->txp_zero); boot->br_zero_hi = 0; @@ -1148,8 +1148,8 @@ static void txp_init_locked(struct txp_softc *sc) { struct ifnet *ifp; - u_int16_t p1; - u_int32_t p2; + uint16_t p1; + uint32_t p2; TXP_LOCK_ASSERT(sc); ifp = sc->sc_ifp; @@ -1163,12 +1163,12 @@ txp_init_locked(struct txp_softc *sc) NULL, NULL, NULL, 1); /* Set station address. */ - ((u_int8_t *)&p1)[1] = IF_LLADDR(sc->sc_ifp)[0]; - ((u_int8_t *)&p1)[0] = IF_LLADDR(sc->sc_ifp)[1]; - ((u_int8_t *)&p2)[3] = IF_LLADDR(sc->sc_ifp)[2]; - ((u_int8_t *)&p2)[2] = IF_LLADDR(sc->sc_ifp)[3]; - ((u_int8_t *)&p2)[1] = IF_LLADDR(sc->sc_ifp)[4]; - ((u_int8_t *)&p2)[0] = IF_LLADDR(sc->sc_ifp)[5]; + ((uint8_t *)&p1)[1] = IF_LLADDR(sc->sc_ifp)[0]; + ((uint8_t *)&p1)[0] = IF_LLADDR(sc->sc_ifp)[1]; + ((uint8_t *)&p2)[3] = IF_LLADDR(sc->sc_ifp)[2]; + ((uint8_t *)&p2)[2] = IF_LLADDR(sc->sc_ifp)[3]; + ((uint8_t *)&p2)[1] = IF_LLADDR(sc->sc_ifp)[4]; + ((uint8_t *)&p2)[0] = IF_LLADDR(sc->sc_ifp)[5]; txp_command(sc, TXP_CMD_STATION_ADDRESS_WRITE, p1, p2, 0, NULL, NULL, NULL, 1); @@ -1250,7 +1250,7 @@ txp_start_locked(struct ifnet *ifp) struct txp_frag_desc *fxd; struct mbuf *m, *m0; struct txp_swdesc *sd; - u_int32_t firstprod, firstcnt, prod, cnt; + uint32_t firstprod, firstcnt, prod, cnt; TXP_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != @@ -1349,8 +1349,8 @@ oactive: * Handle simple commands sent to the typhoon */ static int -txp_command(struct txp_softc *sc, u_int16_t id, u_int16_t in1, u_int32_t in2, - u_int32_t in3, u_int16_t *out1, u_int32_t *out2, u_int32_t *out3, int wait) +txp_command(struct txp_softc *sc, uint16_t id, uint16_t in1, uint32_t in2, + uint32_t in3, uint16_t *out1, uint32_t *out2, uint32_t *out3, int wait) { struct txp_rsp_desc *rsp = NULL; @@ -1371,15 +1371,15 @@ txp_command(struct txp_softc *sc, u_int1 } static int -txp_command2(struct txp_softc *sc, u_int16_t id, u_int16_t in1, u_int32_t in2, - u_int32_t in3, struct txp_ext_desc *in_extp, u_int8_t in_extn, +txp_command2(struct txp_softc *sc, uint16_t id, uint16_t in1, uint32_t in2, + uint32_t in3, struct txp_ext_desc *in_extp, uint8_t in_extn, struct txp_rsp_desc **rspp, int wait) { struct txp_hostvar *hv = sc->sc_hostvar; struct txp_cmd_desc *cmd; struct txp_ext_desc *ext; - u_int32_t idx, i; - u_int16_t seq; + uint32_t idx, i; + uint16_t seq; if (txp_cmd_desc_numfree(sc) < (in_extn + 1)) { device_printf(sc->sc_dev, "no free cmd descriptors\n"); @@ -1387,7 +1387,7 @@ txp_command2(struct txp_softc *sc, u_int } idx = sc->sc_cmdring.lastwrite; - cmd = (struct txp_cmd_desc *)(((u_int8_t *)sc->sc_cmdring.base) + idx); + cmd = (struct txp_cmd_desc *)(((uint8_t *)sc->sc_cmdring.base) + idx); bzero(cmd, sizeof(*cmd)); cmd->cmd_numdesc = in_extn; @@ -1404,7 +1404,7 @@ txp_command2(struct txp_softc *sc, u_int idx = 0; for (i = 0; i < in_extn; i++) { - ext = (struct txp_ext_desc *)(((u_int8_t *)sc->sc_cmdring.base) + idx); + ext = (struct txp_ext_desc *)(((uint8_t *)sc->sc_cmdring.base) + idx); bcopy(in_extp, ext, sizeof(struct txp_ext_desc)); in_extp++; idx += sizeof(struct txp_cmd_desc); @@ -1439,14 +1439,14 @@ txp_command2(struct txp_softc *sc, u_int } static int -txp_response(struct txp_softc *sc, u_int32_t ridx, u_int16_t id, u_int16_t seq, +txp_response(struct txp_softc *sc, uint32_t ridx, uint16_t id, uint16_t seq, struct txp_rsp_desc **rspp) { struct txp_hostvar *hv = sc->sc_hostvar; struct txp_rsp_desc *rsp; while (ridx != hv->hv_resp_write_idx) { - rsp = (struct txp_rsp_desc *)(((u_int8_t *)sc->sc_rspring.base) + ridx); + rsp = (struct txp_rsp_desc *)(((uint8_t *)sc->sc_rspring.base) + ridx); if (id == rsp->rsp_id && rsp->rsp_seq == seq) { *rspp = (struct txp_rsp_desc *)malloc( @@ -1491,7 +1491,7 @@ txp_rsp_fixup(struct txp_softc *sc, stru { struct txp_rsp_desc *src = rsp; struct txp_hostvar *hv = sc->sc_hostvar; - u_int32_t i, ridx; + uint32_t i, ridx; ridx = hv->hv_resp_read_idx; @@ -1515,7 +1515,7 @@ txp_cmd_desc_numfree(struct txp_softc *s { struct txp_hostvar *hv = sc->sc_hostvar; struct txp_boot_record *br = sc->sc_boot; - u_int32_t widx, ridx, nfree; + uint32_t widx, ridx, nfree; widx = sc->sc_cmdring.lastwrite; ridx = hv->hv_cmd_read_idx; @@ -1563,7 +1563,7 @@ txp_ifmedia_upd(struct ifnet *ifp) { struct txp_softc *sc = ifp->if_softc; struct ifmedia *ifm = &sc->sc_ifmedia; - u_int16_t new_xcvr; + uint16_t new_xcvr; TXP_LOCK(sc); if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) { @@ -1607,7 +1607,7 @@ txp_ifmedia_sts(struct ifnet *ifp, struc { struct txp_softc *sc = ifp->if_softc; struct ifmedia *ifm = &sc->sc_ifmedia; - u_int16_t bmsr, bmcr, anar, anlpar; + uint16_t bmsr, bmcr, anar, anlpar; ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; @@ -1722,9 +1722,9 @@ static void txp_set_filter(struct txp_softc *sc) { struct ifnet *ifp = sc->sc_ifp; - u_int32_t crc, carry, hashbit, hash[2]; - u_int16_t filter; - u_int8_t octet; + uint32_t crc, carry, hashbit, hash[2]; + uint16_t filter; + uint8_t octet; int i, j, mcnt = 0; struct ifmultiaddr *ifma; char *enm; @@ -1765,7 +1765,7 @@ txp_set_filter(struct txp_softc *sc) carry; } } - hashbit = (u_int16_t)(crc & (64 - 1)); + hashbit = (uint16_t)(crc & (64 - 1)); hash[hashbit / 32] |= (1 << hashbit % 32); } IF_ADDR_UNLOCK(ifp); Modified: head/sys/dev/txp/if_txpreg.h ============================================================================== --- head/sys/dev/txp/if_txpreg.h Wed Mar 11 08:49:17 2009 (r189688) +++ head/sys/dev/txp/if_txpreg.h Wed Mar 11 09:06:39 2009 (r189689) @@ -225,12 +225,12 @@ #define TXP_STAT_UDPCKSUMGOOD 0x0200 struct txp_tx_desc { - volatile u_int8_t tx_flags; /* type/descriptor flags */ - volatile u_int8_t tx_numdesc; /* number of descriptors */ - volatile u_int16_t tx_totlen; /* total packet length */ - volatile u_int32_t tx_addrlo; /* virt addr low word */ - volatile u_int32_t tx_addrhi; /* virt addr high word */ - volatile u_int32_t tx_pflags; /* processing flags */ + volatile uint8_t tx_flags; /* type/descriptor flags */ + volatile uint8_t tx_numdesc; /* number of descriptors */ + volatile uint16_t tx_totlen; /* total packet length */ + volatile uint32_t tx_addrlo; /* virt addr low word */ + volatile uint32_t tx_addrhi; /* virt addr high word */ + volatile uint32_t tx_pflags; /* processing flags */ }; #define TX_FLAGS_TYPE_M 0x07 /* type mask */ #define TX_FLAGS_TYPE_FRAG 0x00 /* type: fragment */ @@ -256,21 +256,21 @@ struct txp_tx_desc { #define TX_PFLAGS_VLANTAG_S 12 /* amount to shift tag */ struct txp_rx_desc { - volatile u_int8_t rx_flags; /* type/descriptor flags */ - volatile u_int8_t rx_numdesc; /* number of descriptors */ - volatile u_int16_t rx_len; /* frame length */ + volatile uint8_t rx_flags; /* type/descriptor flags */ + volatile uint8_t rx_numdesc; /* number of descriptors */ + volatile uint16_t rx_len; /* frame length */ #ifdef notdef - volatile u_int32_t rx_vaddrlo; /* virtual address, lo word */ - volatile u_int32_t rx_vaddrhi; /* virtual address, hi word */ + volatile uint32_t rx_vaddrlo; /* virtual address, lo word */ + volatile uint32_t rx_vaddrhi; /* virtual address, hi word */ #endif union { struct txp_swdesc *rx_sd; - u_int64_t rx_dummy; + uint64_t rx_dummy; } txp_rx_u; - volatile u_int32_t rx_stat; /* status */ - volatile u_int16_t rx_filter; /* filter status */ - volatile u_int16_t rx_hash; /* hash status */ - volatile u_int32_t rx_vlan; /* vlan tag/priority */ + volatile uint32_t rx_stat; /* status */ + volatile uint16_t rx_filter; /* filter status */ + volatile uint16_t rx_hash; /* hash status */ + volatile uint32_t rx_vlan; /* vlan tag/priority */ }; #define rx_sd txp_rx_u.rx_sd @@ -316,15 +316,15 @@ struct txp_rx_desc { struct txp_rxbuf_desc { - volatile u_int32_t rb_paddrlo; - volatile u_int32_t rb_paddrhi; + volatile uint32_t rb_paddrlo; + volatile uint32_t rb_paddrhi; #ifdef notdef - volatile u_int32_t rb_vaddrlo; - volatile u_int32_t rb_vaddrhi; + volatile uint32_t rb_vaddrlo; + volatile uint32_t rb_vaddrhi; #endif union { struct txp_swdesc *rb_sd; - u_int64_t rb_dummy; + uint64_t rb_dummy; } txp_rb_u; }; @@ -332,20 +332,20 @@ struct txp_rxbuf_desc { /* Extension descriptor */ struct txp_ext_desc { - volatile u_int32_t ext_1; - volatile u_int32_t ext_2; - volatile u_int32_t ext_3; - volatile u_int32_t ext_4; + volatile uint32_t ext_1; + volatile uint32_t ext_2; + volatile uint32_t ext_3; + volatile uint32_t ext_4; }; struct txp_cmd_desc { - volatile u_int8_t cmd_flags; - volatile u_int8_t cmd_numdesc; - volatile u_int16_t cmd_id; - volatile u_int16_t cmd_seq; - volatile u_int16_t cmd_par1; - volatile u_int32_t cmd_par2; - volatile u_int32_t cmd_par3; + volatile uint8_t cmd_flags; + volatile uint8_t cmd_numdesc; + volatile uint16_t cmd_id; + volatile uint16_t cmd_seq; + volatile uint16_t cmd_par1; + volatile uint32_t cmd_par2; + volatile uint32_t cmd_par3; }; #define CMD_FLAGS_TYPE_M 0x07 /* type mask */ #define CMD_FLAGS_TYPE_FRAG 0x00 /* type: fragment */ @@ -358,13 +358,13 @@ struct txp_cmd_desc { #define CMD_FLAGS_VALID 0x80 /* valid descriptor */ struct txp_rsp_desc { - volatile u_int8_t rsp_flags; - volatile u_int8_t rsp_numdesc; - volatile u_int16_t rsp_id; - volatile u_int16_t rsp_seq; - volatile u_int16_t rsp_par1; - volatile u_int32_t rsp_par2; - volatile u_int32_t rsp_par3; + volatile uint8_t rsp_flags; + volatile uint8_t rsp_numdesc; + volatile uint16_t rsp_id; + volatile uint16_t rsp_seq; + volatile uint16_t rsp_par1; + volatile uint32_t rsp_par2; + volatile uint32_t rsp_par3; }; #define RSP_FLAGS_TYPE_M 0x07 /* type mask */ #define RSP_FLAGS_TYPE_FRAG 0x00 /* type: fragment */ @@ -376,12 +376,12 @@ struct txp_rsp_desc { #define RSP_FLAGS_ERROR 0x40 /* response error */ struct txp_frag_desc { - volatile u_int8_t frag_flags; /* type/descriptor flags */ - volatile u_int8_t frag_rsvd1; - volatile u_int16_t frag_len; /* bytes in this fragment */ - volatile u_int32_t frag_addrlo; /* phys addr low word */ - volatile u_int32_t frag_addrhi; /* phys addr high word */ - volatile u_int32_t frag_rsvd2; + volatile uint8_t frag_flags; /* type/descriptor flags */ + volatile uint8_t frag_rsvd1; + volatile uint16_t frag_len; /* bytes in this fragment */ + volatile uint32_t frag_addrlo; /* phys addr low word */ + volatile uint32_t frag_addrhi; /* phys addr high word */ + volatile uint32_t frag_rsvd2; }; #define FRAG_FLAGS_TYPE_M 0x07 /* type mask */ #define FRAG_FLAGS_TYPE_FRAG 0x00 /* type: fragment */ @@ -392,44 +392,44 @@ struct txp_frag_desc { #define FRAG_FLAGS_TYPE_RESP 0x05 /* type: response */ struct txp_opt_desc { - u_int8_t opt_desctype:3, + uint8_t opt_desctype:3, opt_rsvd:1, opt_type:4; - u_int8_t opt_num; - u_int16_t opt_dep1; - u_int32_t opt_dep2; - u_int32_t opt_dep3; - u_int32_t opt_dep4; + uint8_t opt_num; + uint16_t opt_dep1; + uint32_t opt_dep2; + uint32_t opt_dep3; + uint32_t opt_dep4; }; struct txp_ipsec_desc { - u_int8_t ipsec_desctpe:3, + uint8_t ipsec_desctpe:3, ipsec_rsvd:1, ipsec_type:4; - u_int8_t ipsec_num; - u_int16_t ipsec_flags; - u_int16_t ipsec_ah1; - u_int16_t ipsec_esp1; - u_int16_t ipsec_ah2; - u_int16_t ipsec_esp2; - u_int32_t ipsec_rsvd1; + uint8_t ipsec_num; + uint16_t ipsec_flags; + uint16_t ipsec_ah1; + uint16_t ipsec_esp1; + uint16_t ipsec_ah2; + uint16_t ipsec_esp2; + uint32_t ipsec_rsvd1; }; struct txp_tcpseg_desc { - u_int8_t tcpseg_desctype:3, + uint8_t tcpseg_desctype:3, tcpseg_rsvd:1, tcpseg_type:4; - u_int8_t tcpseg_num; + uint8_t tcpseg_num; - u_int16_t tcpseg_mss:12, + uint16_t tcpseg_mss:12, tcpseg_misc:4; - u_int32_t tcpseg_respaddr; - u_int32_t tcpseg_txbytes; - u_int32_t tcpseg_lss; + uint32_t tcpseg_respaddr; + uint32_t tcpseg_txbytes; + uint32_t tcpseg_lss; }; /* @@ -463,48 +463,48 @@ struct txp_tcpseg_desc { * boot record (pointers to rings) */ struct txp_boot_record { - volatile u_int32_t br_hostvar_lo; /* host ring pointer */ - volatile u_int32_t br_hostvar_hi; - volatile u_int32_t br_txlopri_lo; /* tx low pri ring */ - volatile u_int32_t br_txlopri_hi; - volatile u_int32_t br_txlopri_siz; - volatile u_int32_t br_txhipri_lo; /* tx high pri ring */ - volatile u_int32_t br_txhipri_hi; - volatile u_int32_t br_txhipri_siz; - volatile u_int32_t br_rxlopri_lo; /* rx low pri ring */ - volatile u_int32_t br_rxlopri_hi; - volatile u_int32_t br_rxlopri_siz; - volatile u_int32_t br_rxbuf_lo; /* rx buffer ring */ - volatile u_int32_t br_rxbuf_hi; - volatile u_int32_t br_rxbuf_siz; - volatile u_int32_t br_cmd_lo; /* command ring */ - volatile u_int32_t br_cmd_hi; - volatile u_int32_t br_cmd_siz; - volatile u_int32_t br_resp_lo; /* response ring */ - volatile u_int32_t br_resp_hi; - volatile u_int32_t br_resp_siz; - volatile u_int32_t br_zero_lo; /* zero word */ - volatile u_int32_t br_zero_hi; - volatile u_int32_t br_rxhipri_lo; /* rx high pri ring */ - volatile u_int32_t br_rxhipri_hi; - volatile u_int32_t br_rxhipri_siz; + volatile uint32_t br_hostvar_lo; /* host ring pointer */ + volatile uint32_t br_hostvar_hi; + volatile uint32_t br_txlopri_lo; /* tx low pri ring */ + volatile uint32_t br_txlopri_hi; + volatile uint32_t br_txlopri_siz; + volatile uint32_t br_txhipri_lo; /* tx high pri ring */ + volatile uint32_t br_txhipri_hi; + volatile uint32_t br_txhipri_siz; + volatile uint32_t br_rxlopri_lo; /* rx low pri ring */ + volatile uint32_t br_rxlopri_hi; + volatile uint32_t br_rxlopri_siz; + volatile uint32_t br_rxbuf_lo; /* rx buffer ring */ + volatile uint32_t br_rxbuf_hi; + volatile uint32_t br_rxbuf_siz; + volatile uint32_t br_cmd_lo; /* command ring */ + volatile uint32_t br_cmd_hi; + volatile uint32_t br_cmd_siz; + volatile uint32_t br_resp_lo; /* response ring */ + volatile uint32_t br_resp_hi; + volatile uint32_t br_resp_siz; + volatile uint32_t br_zero_lo; /* zero word */ + volatile uint32_t br_zero_hi; + volatile uint32_t br_rxhipri_lo; /* rx high pri ring */ + volatile uint32_t br_rxhipri_hi; + volatile uint32_t br_rxhipri_siz; }; /* * hostvar structure (shared with typhoon) */ struct txp_hostvar { - volatile u_int32_t hv_rx_hi_read_idx; /* host->arm */ - volatile u_int32_t hv_rx_lo_read_idx; /* host->arm */ - volatile u_int32_t hv_rx_buf_write_idx; /* host->arm */ - volatile u_int32_t hv_resp_read_idx; /* host->arm */ - volatile u_int32_t hv_tx_lo_desc_read_idx; /* arm->host */ - volatile u_int32_t hv_tx_hi_desc_read_idx; /* arm->host */ - volatile u_int32_t hv_rx_lo_write_idx; /* arm->host */ - volatile u_int32_t hv_rx_buf_read_idx; /* arm->host */ - volatile u_int32_t hv_cmd_read_idx; /* arm->host */ - volatile u_int32_t hv_resp_write_idx; /* arm->host */ - volatile u_int32_t hv_rx_hi_write_idx; /* arm->host */ + volatile uint32_t hv_rx_hi_read_idx; /* host->arm */ + volatile uint32_t hv_rx_lo_read_idx; /* host->arm */ + volatile uint32_t hv_rx_buf_write_idx; /* host->arm */ + volatile uint32_t hv_resp_read_idx; /* host->arm */ + volatile uint32_t hv_tx_lo_desc_read_idx; /* arm->host */ + volatile uint32_t hv_tx_hi_desc_read_idx; /* arm->host */ + volatile uint32_t hv_rx_lo_write_idx; /* arm->host */ + volatile uint32_t hv_rx_buf_read_idx; /* arm->host */ + volatile uint32_t hv_cmd_read_idx; /* arm->host */ + volatile uint32_t hv_resp_write_idx; /* arm->host */ + volatile uint32_t hv_rx_hi_write_idx; /* arm->host */ }; /* @@ -546,23 +546,23 @@ struct txp_hostvar { struct txp_cmd_ring { struct txp_cmd_desc *base; - u_int32_t lastwrite; - u_int32_t size; + uint32_t lastwrite; + uint32_t size; }; struct txp_rsp_ring { struct txp_rsp_desc *base; - u_int32_t lastwrite; - u_int32_t size; + uint32_t lastwrite; + uint32_t size; }; struct txp_tx_ring { struct txp_tx_desc *r_desc; /* base address of descs */ - u_int32_t r_reg; /* register to activate */ - u_int32_t r_prod; /* producer */ - u_int32_t r_cons; /* consumer */ - u_int32_t r_cnt; /* # descs in use */ - volatile u_int32_t *r_off; /* hostvar index pointer */ + uint32_t r_reg; /* register to activate */ + uint32_t r_prod; /* producer */ + uint32_t r_cons; /* consumer */ + uint32_t r_cnt; /* # descs in use */ + volatile uint32_t *r_off; /* hostvar index pointer */ }; struct txp_swdesc { @@ -572,8 +572,8 @@ struct txp_swdesc { struct txp_rx_ring { struct txp_rx_desc *r_desc; /* base address of descs */ - volatile u_int32_t *r_roff; /* hv read offset ptr */ - volatile u_int32_t *r_woff; /* hv write offset ptr */ + volatile uint32_t *r_roff; /* hv read offset ptr */ + volatile uint32_t *r_woff; /* hv write offset ptr */ }; struct txp_ldata { @@ -586,7 +586,7 @@ struct txp_ldata { struct txp_rx_desc txp_rxloring[RX_ENTRIES]; struct txp_cmd_desc txp_cmdring[CMD_ENTRIES]; struct txp_rsp_desc txp_rspring[RSP_ENTRIES]; - u_int32_t txp_zero; + uint32_t txp_zero; }; struct txp_softc { @@ -611,25 +611,25 @@ struct txp_softc { struct txp_tx_ring sc_txhir, sc_txlor; struct txp_rxbuf_desc *sc_rxbufs; struct txp_rx_ring sc_rxhir, sc_rxlor; - u_int16_t sc_xcvr; - u_int16_t sc_seq; + uint16_t sc_xcvr; + uint16_t sc_seq; int sc_cold; - u_int32_t sc_rx_capability, sc_tx_capability; + uint32_t sc_rx_capability, sc_tx_capability; }; struct txp_fw_file_header { - u_int8_t magicid[8]; /* TYPHOON\0 */ - u_int32_t version; - u_int32_t nsections; - u_int32_t addr; - u_int32_t hmac[5]; + uint8_t magicid[8]; /* TYPHOON\0 */ + uint32_t version; + uint32_t nsections; + uint32_t addr; + uint32_t hmac[5]; }; struct txp_fw_section_header { - u_int32_t nbytes; - u_int16_t cksum; - u_int16_t reserved; - u_int32_t addr; + uint32_t nbytes; + uint16_t cksum; + uint16_t reserved; + uint32_t addr; }; #define TXP_MAX_SEGLEN 0xffff @@ -660,7 +660,7 @@ struct txp_fw_section_header { #define TXP_DEVICEID_3CR990B_SRV 0x990A struct txp_type { - u_int16_t txp_vid; - u_int16_t txp_did; + uint16_t txp_vid; + uint16_t txp_did; char *txp_name; }; From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 09:57:11 2009 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 D0DB61065673; Wed, 11 Mar 2009 09:57:11 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF4658FC18; Wed, 11 Mar 2009 09:57:11 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B9vBQb091005; Wed, 11 Mar 2009 09:57:11 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B9vBCC091003; Wed, 11 Mar 2009 09:57:11 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903110957.n2B9vBCC091003@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 11 Mar 2009 09:57: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: r189690 - head/sys/dev/txp 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 Mar 2009 09:57:12 -0000 Author: yongari Date: Wed Mar 11 09:57:11 2009 New Revision: 189690 URL: http://svn.freebsd.org/changeset/base/189690 Log: Replace local CRC32 routine with ether_crc32_be(). This should have happened long time ago. Also simplify Rx filter logic. Modified: head/sys/dev/txp/if_txp.c head/sys/dev/txp/if_txpreg.h Modified: head/sys/dev/txp/if_txp.c ============================================================================== --- head/sys/dev/txp/if_txp.c Wed Mar 11 09:06:39 2009 (r189689) +++ head/sys/dev/txp/if_txp.c Wed Mar 11 09:57:11 2009 (r189690) @@ -1721,60 +1721,44 @@ txp_show_descriptor(void *d) static void txp_set_filter(struct txp_softc *sc) { - struct ifnet *ifp = sc->sc_ifp; - uint32_t crc, carry, hashbit, hash[2]; + struct ifnet *ifp; + uint32_t crc, mchash[2]; uint16_t filter; - uint8_t octet; - int i, j, mcnt = 0; struct ifmultiaddr *ifma; - char *enm; + int mcnt; - if (ifp->if_flags & IFF_PROMISC) { - filter = TXP_RXFILT_PROMISC; - goto setit; - } + TXP_LOCK_ASSERT(sc); + ifp = sc->sc_ifp; filter = TXP_RXFILT_DIRECT; - - if (ifp->if_flags & IFF_BROADCAST) + if ((ifp->if_flags & IFF_BROADCAST) != 0) filter |= TXP_RXFILT_BROADCAST; + if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) { + if ((ifp->if_flags & IFF_ALLMULTI) != 0) + filter |= TXP_RXFILT_ALLMULTI; + if ((ifp->if_flags & IFF_PROMISC) != 0) + filter = TXP_RXFILT_PROMISC; + goto setit; + } - if (ifp->if_flags & IFF_ALLMULTI) - filter |= TXP_RXFILT_ALLMULTI; - else { - hash[0] = hash[1] = 0; - - IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - enm = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - mcnt++; - crc = 0xffffffff; - - for (i = 0; i < ETHER_ADDR_LEN; i++) { - octet = enm[i]; - for (j = 0; j < 8; j++) { - carry = ((crc & 0x80000000) ? 1 : 0) ^ - (octet & 1); - crc <<= 1; - octet >>= 1; - if (carry) - crc = (crc ^ TXP_POLYNOMIAL) | - carry; - } - } - hashbit = (uint16_t)(crc & (64 - 1)); - hash[hashbit / 32] |= (1 << hashbit % 32); - } - IF_ADDR_UNLOCK(ifp); - - if (mcnt > 0) { - filter |= TXP_RXFILT_HASHMULTI; - txp_command(sc, TXP_CMD_MCAST_HASH_MASK_WRITE, - 2, hash[0], hash[1], NULL, NULL, NULL, 0); - } + mchash[0] = mchash[1] = 0; + mcnt = 0; + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) + ifma->ifma_addr), ETHER_ADDR_LEN); + crc &= 0x3f; + mchash[crc >> 5] |= 1 << (crc & 0x1f); + mcnt++; + } + IF_ADDR_UNLOCK(ifp); + + if (mcnt > 0) { + filter |= TXP_RXFILT_HASHMULTI; + txp_command(sc, TXP_CMD_MCAST_HASH_MASK_WRITE, 2, mchash[0], + mchash[1], NULL, NULL, NULL, 0); } setit: Modified: head/sys/dev/txp/if_txpreg.h ============================================================================== --- head/sys/dev/txp/if_txpreg.h Wed Mar 11 09:06:39 2009 (r189689) +++ head/sys/dev/txp/if_txpreg.h Wed Mar 11 09:57:11 2009 (r189690) @@ -456,9 +456,6 @@ struct txp_tcpseg_desc { #define TXP_RXFILT_PROMISC 0x0008 /* promiscuous mode */ #define TXP_RXFILT_HASHMULTI 0x0010 /* use multicast filter */ -/* multicast polynomial */ -#define TXP_POLYNOMIAL 0x04c11db7 - /* * boot record (pointers to rings) */ From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 10:08:48 2009 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 DF1DE106566B; Wed, 11 Mar 2009 10:08:48 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 835E48FC1A; Wed, 11 Mar 2009 10:08:48 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (pD9E2E7B0.dip.t-dialin.net [217.226.231.176]) by redbull.bpaserver.net (Postfix) with ESMTP id 2AADA2E0EF; Wed, 11 Mar 2009 11:08:43 +0100 (CET) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 8EB7710FC9E; Wed, 11 Mar 2009 11:08:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1236766119; bh=S+vDXS1HAYjeP/jVIki8sG39CSxTPRV59 +nTskY75gQ=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=wofAnJbS8c0sSOmHgX7eGdqOJNtYwMn39Y2ufSGdz+BMAfj826dE7i2cMxPRybKDL 5H0OrLAd271rLPnEaep/2iM/o+sCSSPQXsAFTbTGi+fM3UVp89UD6h6/nef54TVRrQY CTE9QgGRTJiKaCDf0VZ8cKi0VU2zFDjbS1Oa4tHJiExSKVpPsa9EiyC38O9K0iL2G8Y SK/Nj7intZLZ2ums1Hr0d1LKSp75M/P4MVsUojb531OuEk3ef/KnXTg20RloyqmrCZo B/9VeRc4LQV9IfrT3KOXTsNQrTprnvPkKTMDfnPKftdt7J+V6swXfgbswacB/F7GjYB yiO+FCMcw== Received: (from www@localhost) by webmail.leidinger.net (8.14.3/8.13.8/Submit) id n2BA8Z6F065395; Wed, 11 Mar 2009 11:08:35 +0100 (CET) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Wed, 11 Mar 2009 11:08:31 +0100 Message-ID: <20090311110831.48881q646t7mslgk@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Wed, 11 Mar 2009 11:08:31 +0100 From: Alexander Leidinger To: Andrew Thompson References: <200903101554.n2AFsbdn066670@svn.freebsd.org> In-Reply-To: <200903101554.n2AFsbdn066670@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 2AADA2E0EF.57A43 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.823, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10, TW_SV 0.08) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189629 - 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: Wed, 11 Mar 2009 10:08:49 -0000 Quoting Andrew Thompson (from Tue, 10 Mar 2009 15:54:37 +0000 (UTC)): > Author: thompsa > Date: Tue Mar 10 15:54:37 2009 > New Revision: 189629 > URL: http://svn.freebsd.org/changeset/base/189629 > > Log: > Remove these files, they refer to module bundles that do not exist anymore. ObsoleteFiles.inc? Bye, Alexander. -- BOFH excuse #222: I'm not sure, try calling the Internet's head office -- it's in the book http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 10:37:03 2009 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 042731065675; Wed, 11 Mar 2009 10:37:03 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5F938FC14; Wed, 11 Mar 2009 10:37:02 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BAb2Es093284; Wed, 11 Mar 2009 10:37:02 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BAb2tj093282; Wed, 11 Mar 2009 10:37:02 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200903111037.n2BAb2tj093282@svn.freebsd.org> From: Poul-Henning Kamp Date: Wed, 11 Mar 2009 10:37: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: r189691 - head/sbin/recoverdisk 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 Mar 2009 10:37:03 -0000 Author: phk Date: Wed Mar 11 10:37:02 2009 New Revision: 189691 URL: http://svn.freebsd.org/changeset/base/189691 Log: Some improvements to recoverdisk Modified: head/sbin/recoverdisk/recoverdisk.1 head/sbin/recoverdisk/recoverdisk.c Modified: head/sbin/recoverdisk/recoverdisk.1 ============================================================================== --- head/sbin/recoverdisk/recoverdisk.1 Wed Mar 11 09:57:11 2009 (r189690) +++ head/sbin/recoverdisk/recoverdisk.1 Wed Mar 11 10:37:02 2009 (r189691) @@ -32,7 +32,9 @@ .Nd recover data from hard disk or optical media .Sh SYNOPSIS .Nm +.Op Fl b Ar bigsize .Op Fl r Ar rlist +.Op Fl s Ar snapshot .Op Fl w Ar wlist .Ar special .Op Ar file @@ -46,15 +48,24 @@ It starts reading in multiples of the se Whenever a block fails, it is put to the end of the working queue and will be read again, possibly with a smaller read size. .Pp -It uses block sizes of roughly 1 MB, 64kB, and the native sector size (usually -512 bytes). +By default it uses block sizes of roughly 1 MB, 32kB, and the native +sector size (usually 512 bytes). These figures are adjusted slightly, for devices whose sectorsize is not a power of 2, e.g., audio CDs with a sector size of 2352 bytes. .Pp +.Pp The options are as follows: .Bl -tag -width indent +.It Fl b Ar bigsize +The size of reads attempted first. +The middle pass is roughly the logarithmic average of the bigsize and +the sectorsize. .It Fl r Ar rlist Read the list of blocks and block sizes to read from the specified file. +.It Fl s Ar snapshot +How often we should update the worklist file while things go OK. +The default is 60 and the units is "progress messages" so if things +go well, this is the same as once per minute. .It Fl w Ar wlist Write the list of remaining blocks to read to the specified file if .Nm @@ -106,6 +117,10 @@ recoverdisk -r worklist -w worklist /dev # recover a single file from the unreadable media touch file.avi; recoverdisk /cdrom/file.avi file.avi + +# If the disk hangs the system on read-errors try: +recoverdisk -b 0 /dev/ad3 /somewhere + .Ed .Sh SEE ALSO .Xr dd 1 Modified: head/sbin/recoverdisk/recoverdisk.c ============================================================================== --- head/sbin/recoverdisk/recoverdisk.c Wed Mar 11 09:57:11 2009 (r189690) +++ head/sbin/recoverdisk/recoverdisk.c Wed Mar 11 10:37:02 2009 (r189691) @@ -26,7 +26,7 @@ volatile sig_atomic_t aborting = 0; static size_t bigsize = 1024 * 1024; -static size_t medsize = 64 * 1024; +static size_t medsize; static size_t minsize = 512; struct lump { @@ -76,6 +76,7 @@ static void save_worklist(void) { FILE *file; + struct lump *llp; if (wworklist != NULL) { (void)fprintf(stderr, "\nSaving worklist ..."); @@ -85,14 +86,11 @@ save_worklist(void) if (file == NULL) err(1, "Error opening file %s", wworklist); - for (;;) { - lp = TAILQ_FIRST(&lumps); - if (lp == NULL) - break; + TAILQ_FOREACH(llp, &lumps, list) fprintf(file, "%jd %jd %d\n", - (intmax_t)lp->start, (intmax_t)lp->len, lp->state); - TAILQ_REMOVE(&lumps, lp, list); - } + (intmax_t)llp->start, (intmax_t)llp->len, + llp->state); + fclose(file); (void)fprintf(stderr, " done.\n"); } } @@ -160,14 +158,21 @@ main(int argc, char * const argv[]) u_int sectorsize; time_t t1, t2; struct stat sb; + u_int n, snapshot = 60; - while ((ch = getopt(argc, argv, "r:w:")) != -1) { + while ((ch = getopt(argc, argv, "b:r:w:s:")) != -1) { switch (ch) { + case 'b': + bigsize = strtoul(optarg, NULL, 0); + break; case 'r': rworklist = strdup(optarg); if (rworklist == NULL) err(1, "Cannot allocate enough memory"); break; + case 's': + snapshot = strtoul(optarg, NULL, 0); + break; case 'w': wworklist = strdup(optarg); if (wworklist == NULL) @@ -197,15 +202,8 @@ main(int argc, char * const argv[]) if (error < 0) err(1, "DIOCGSECTORSIZE failed"); - /* - * Make medsize roughly 64kB, depending on native sector - * size. bigsize has to be a multiple of medsize. - * For media with 2352 sectors, this will - * result in 2352, 63504, and 1016064 bytes. - */ minsize = sectorsize; - medsize = (medsize / sectorsize) * sectorsize; - bigsize = medsize * 16; + bigsize = (bigsize / sectorsize) * sectorsize; error = ioctl(fdr, DIOCGMEDIASIZE, &t); if (error < 0) @@ -215,6 +213,17 @@ main(int argc, char * const argv[]) flags |= O_CREAT | O_TRUNC; } + if (bigsize < minsize) + bigsize = minsize; + + for (ch = 0; (bigsize >> ch) > minsize; ch++) + continue; + medsize = bigsize >> (ch / 2); + medsize = (medsize / minsize) * minsize; + + fprintf(stderr, "Bigsize = %u, medsize = %u, minsize = %u\n", + bigsize, medsize, minsize); + buf = malloc(bigsize); if (buf == NULL) err(1, "Cannot allocate %jd bytes buffer", (intmax_t)bigsize); @@ -238,6 +247,7 @@ main(int argc, char * const argv[]) t1 = 0; start = len = i = state = 0; PRINT_HEADER; + n = 0; for (;;) { lp = TAILQ_FIRST(&lumps); if (lp == NULL) @@ -257,6 +267,10 @@ main(int argc, char * const argv[]) if (t1 != t2 || lp->len < (off_t)bigsize) { PRINT_STATUS(start, i, len, state, d, t); t1 = t2; + if (++n == snapshot) { + save_worklist(); + n = 0; + } } if (i == 0) { errx(1, "BOGUS i %10jd", (intmax_t)i); From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 11:42:19 2009 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 249DA1065769; Wed, 11 Mar 2009 11:42:19 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B5AC8FC1A; Wed, 11 Mar 2009 11:42:18 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BBgHGh094621; Wed, 11 Mar 2009 11:42:17 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BBgHHj094620; Wed, 11 Mar 2009 11:42:17 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200903111142.n2BBgHHj094620@svn.freebsd.org> From: Poul-Henning Kamp Date: Wed, 11 Mar 2009 11:42: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: r189692 - head/sbin/recoverdisk 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 Mar 2009 11:42:21 -0000 Author: phk Date: Wed Mar 11 11:42:17 2009 New Revision: 189692 URL: http://svn.freebsd.org/changeset/base/189692 Log: One Pp is more than enough. Says: brueffer Modified: head/sbin/recoverdisk/recoverdisk.1 Modified: head/sbin/recoverdisk/recoverdisk.1 ============================================================================== --- head/sbin/recoverdisk/recoverdisk.1 Wed Mar 11 10:37:02 2009 (r189691) +++ head/sbin/recoverdisk/recoverdisk.1 Wed Mar 11 11:42:17 2009 (r189692) @@ -53,7 +53,6 @@ sector size (usually 512 bytes). These figures are adjusted slightly, for devices whose sectorsize is not a power of 2, e.g., audio CDs with a sector size of 2352 bytes. .Pp -.Pp The options are as follows: .Bl -tag -width indent .It Fl b Ar bigsize From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 12:51:49 2009 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 3B66C1065672; Wed, 11 Mar 2009 12:51:49 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id ED2858FC0A; Wed, 11 Mar 2009 12:51:48 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id E130C6D43F; Wed, 11 Mar 2009 12:51:47 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id C1EAD84482; Wed, 11 Mar 2009 13:51:47 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Mike Makonnen References: <200902021538.n12FcOgW000612@svn.freebsd.org> Date: Wed, 11 Mar 2009 13:51:47 +0100 In-Reply-To: <200902021538.n12FcOgW000612@svn.freebsd.org> (Mike Makonnen's message of "Mon, 2 Feb 2009 15:38:24 +0000 (UTC)") Message-ID: <86zlfsp6ho.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r188010 - head/etc/defaults 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 Mar 2009 12:51:50 -0000 Mike Makonnen writes: > Since, rc.d/defaultroute has the ability to wait for a > default route to show up we can turn this knob back on > without screwing subsequent daemons that expect to be > able to talk to the outside world. Please revert this. It breaks the boot for, well, pretty much anyone who uses DHCP. It always takes at least a second or two to obtain or renew a DHCP lease, and if you background this process, /etc/rc will try to start services such as ntpdate, sendmail, sshd etc. before the machine has an IP address and a name server. In the worst case (such as mine), it will render the machine unusable until the admin has a chance to read svn logs and figure out what's broken and how to fix it. The rc_quiet changes you made last summer certainly didn't help me figure out what went on. I understand the rationale for them, but in my experience, they make debugging harder rather than easier. To add insult to injury, there is currently no way to revert to the historical behavior, short of applying a large number of patches in reverse. I would suggest adding an rc.conf knob for that, and making the historical behavior the default. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 12:53:16 2009 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 64BD81065672; Wed, 11 Mar 2009 12:53:16 +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 526658FC16; Wed, 11 Mar 2009 12:53:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BCrGX4096126; Wed, 11 Mar 2009 12:53:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BCrGsC096125; Wed, 11 Mar 2009 12:53:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903111253.n2BCrGsC096125@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 11 Mar 2009 12:53: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: r189693 - head/sys/fs/devfs 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 Mar 2009 12:53:17 -0000 Author: kib Date: Wed Mar 11 12:53:16 2009 New Revision: 189693 URL: http://svn.freebsd.org/changeset/base/189693 Log: Enable advisory file locking for devfs vnodes. Reported by: Timothy Redaelli MFC after: 1 week Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Wed Mar 11 11:42:17 2009 (r189692) +++ head/sys/fs/devfs/devfs_vnops.c Wed Mar 11 12:53:16 2009 (r189693) @@ -452,14 +452,6 @@ devfs_access(struct vop_access_args *ap) /* ARGSUSED */ static int -devfs_advlock(struct vop_advlock_args *ap) -{ - - return (ap->a_flags & F_FLOCK ? EOPNOTSUPP : EINVAL); -} - -/* ARGSUSED */ -static int devfs_close(struct vop_close_args *ap) { struct vnode *vp = ap->a_vp, *oldvp; @@ -1552,7 +1544,6 @@ static struct vop_vector devfs_specops = .vop_default = &default_vnodeops, .vop_access = devfs_access, - .vop_advlock = devfs_advlock, .vop_bmap = VOP_PANIC, .vop_close = devfs_close, .vop_create = VOP_PANIC, From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 12:54:50 2009 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 3E0641065674; Wed, 11 Mar 2009 12:54:50 +0000 (UTC) (envelope-from guido@gvr.org) Received: from gvr.gvr.org (gvr-gw.gvr.org [82.95.154.195]) by mx1.freebsd.org (Postfix) with ESMTP id AA4118FC21; Wed, 11 Mar 2009 12:54:49 +0000 (UTC) (envelope-from guido@gvr.org) Received: by gvr.gvr.org (Postfix, from userid 657) id CC2FD42D831; Wed, 11 Mar 2009 13:54:48 +0100 (CET) Date: Wed, 11 Mar 2009 13:54:48 +0100 From: Guido van Rooij To: Gavin Atkinson Message-ID: <20090311125448.GA18760@gvr.gvr.org> References: <200903101519.n2AFJovP065743@svn.freebsd.org> <1236699209.62820.32.camel@buffy.york.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1236699209.62820.32.camel@buffy.york.ac.uk> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189624 - 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: Wed, 11 Mar 2009 12:54:51 -0000 On Tue, Mar 10, 2009 at 03:33:28PM +0000, Gavin Atkinson wrote: > > Is this due to a bug/feature of gmirror? A long time ago, swapoff used > to be run on shutdown, but it was removed by pjd@ in src/etc/rc.d/swap1 > version 1.9 with the following commit message: > It was due to a brainfart on my side.. I just backed it out. -Guido From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 12:55:13 2009 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 09858106566C; Wed, 11 Mar 2009 12:55:13 +0000 (UTC) (envelope-from guido@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D19BF8FC1F; Wed, 11 Mar 2009 12:55:12 +0000 (UTC) (envelope-from guido@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BCtCst096224; Wed, 11 Mar 2009 12:55:12 GMT (envelope-from guido@svn.freebsd.org) Received: (from guido@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BCtC3L096223; Wed, 11 Mar 2009 12:55:12 GMT (envelope-from guido@svn.freebsd.org) Message-Id: <200903111255.n2BCtC3L096223@svn.freebsd.org> From: Guido van Rooij Date: Wed, 11 Mar 2009 12:55: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: r189694 - 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: Wed, 11 Mar 2009 12:55:13 -0000 Author: guido Date: Wed Mar 11 12:55:12 2009 New Revision: 189694 URL: http://svn.freebsd.org/changeset/base/189694 Log: Backout previous commit due to PEBKAC Modified: head/etc/rc.d/swap1 Modified: head/etc/rc.d/swap1 ============================================================================== --- head/etc/rc.d/swap1 Wed Mar 11 12:53:16 2009 (r189693) +++ head/etc/rc.d/swap1 Wed Mar 11 12:55:12 2009 (r189694) @@ -11,7 +11,7 @@ name="swap1" start_cmd='swapon -aq' -stop_cmd='swapoff -aq' +stop_cmd=':' load_rc_config swap run_rc_command "$1" From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 13:15:42 2009 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 E4CC21065762; Wed, 11 Mar 2009 13:15:42 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D07518FC27; Wed, 11 Mar 2009 13:15:42 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BDFgfL096648; Wed, 11 Mar 2009 13:15:42 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BDFgMM096646; Wed, 11 Mar 2009 13:15:42 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200903111315.n2BDFgMM096646@svn.freebsd.org> From: Takahashi Yoshihiro Date: Wed, 11 Mar 2009 13:15: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: r189695 - in head/sys: geom/part 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 Mar 2009 13:15:44 -0000 Author: nyan Date: Wed Mar 11 13:15:42 2009 New Revision: 189695 URL: http://svn.freebsd.org/changeset/base/189695 Log: Move the PC98_[MS]ID_* defines from g_part_pc98.c to diskpc98.h. Reviewed by: marcel Modified: head/sys/geom/part/g_part_pc98.c head/sys/sys/diskpc98.h Modified: head/sys/geom/part/g_part_pc98.c ============================================================================== --- head/sys/geom/part/g_part_pc98.c Wed Mar 11 12:55:12 2009 (r189694) +++ head/sys/geom/part/g_part_pc98.c Wed Mar 11 13:15:42 2009 (r189695) @@ -45,14 +45,6 @@ __FBSDID("$FreeBSD$"); #include "g_part_if.h" -#define PC98_MID_BOOTABLE 0x80 -#define PC98_MID_MASK 0x7f -#define PC98_MID_386BSD 0x14 - -#define PC98_SID_ACTIVE 0x80 -#define PC98_SID_MASK 0x7f -#define PC98_SID_386BSD 0x44 - #define SECSIZE 512 struct g_part_pc98_table { Modified: head/sys/sys/diskpc98.h ============================================================================== --- head/sys/sys/diskpc98.h Wed Mar 11 12:55:12 2009 (r189694) +++ head/sys/sys/diskpc98.h Wed Mar 11 13:15:42 2009 (r189695) @@ -42,9 +42,17 @@ #define DOSMAGICOFFSET 510 #define DOSMAGIC 0xAA55 -#define DOSMID_386BSD (0x14|0x80) /* 386BSD | bootable */ -#define DOSSID_386BSD (0x44|0x80) /* 386BSD | active */ -#define DOSPTYP_386BSD (DOSSID_386BSD << 8 | DOSMID_386BSD) +#define PC98_MID_BOOTABLE 0x80 +#define PC98_MID_MASK 0x7f +#define PC98_MID_386BSD 0x14 + +#define PC98_SID_ACTIVE 0x80 +#define PC98_SID_MASK 0x7f +#define PC98_SID_386BSD 0x44 + +#define DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE) +#define DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE) +#define DOSPTYP_386BSD (DOSSID_386BSD << 8 | DOSMID_386BSD) struct pc98_partition { unsigned char dp_mid; From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 13:33:06 2009 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 726E2106566C; Wed, 11 Mar 2009 13:33:06 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 2CF1F8FC13; Wed, 11 Mar 2009 13:33:06 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 233FFFF4E; Thu, 12 Mar 2009 02:33:05 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 82c+UEB1MJur; Thu, 12 Mar 2009 02:33:00 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Thu, 12 Mar 2009 02:33:00 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 42B5C1142F; Thu, 12 Mar 2009 02:33:00 +1300 (NZDT) Date: Wed, 11 Mar 2009 06:33:00 -0700 From: Andrew Thompson To: Alexander Leidinger Message-ID: <20090311133300.GA41397@citylink.fud.org.nz> References: <200903101554.n2AFsbdn066670@svn.freebsd.org> <20090311110831.48881q646t7mslgk@webmail.leidinger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090311110831.48881q646t7mslgk@webmail.leidinger.net> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189629 - 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: Wed, 11 Mar 2009 13:33:07 -0000 On Wed, Mar 11, 2009 at 11:08:31AM +0100, Alexander Leidinger wrote: > Quoting Andrew Thompson (from Tue, 10 Mar 2009 > 15:54:37 +0000 (UTC)): > >> Author: thompsa >> Date: Tue Mar 10 15:54:37 2009 >> New Revision: 189629 >> URL: http://svn.freebsd.org/changeset/base/189629 >> >> Log: >> Remove these files, they refer to module bundles that do not exist anymore. > > ObsoleteFiles.inc? Never installed. From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 13:54:04 2009 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 2CFA71065677; Wed, 11 Mar 2009 13:54:04 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id DEDFB8FC15; Wed, 11 Mar 2009 13:54:03 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 112F51CE0D; Wed, 11 Mar 2009 14:54:03 +0100 (CET) Date: Wed, 11 Mar 2009 14:54:03 +0100 From: Ed Schouten To: Andrey Chernov , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Message-ID: <20090311135403.GK31961@hoeg.nl> References: <200903101128.n2ABSsvZ060914@svn.freebsd.org> <20090311012704.GA66313@nagual.pp.ru> <20090311021646.GA67589@nagual.pp.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ewQ5hdP4CtoTt3oD" Content-Disposition: inline In-Reply-To: <20090311021646.GA67589@nagual.pp.ru> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: Subject: Re: svn commit: r189617 - in head/sys: dev/syscons dev/syscons/teken pc98/cbus 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 Mar 2009 13:54:09 -0000 --ewQ5hdP4CtoTt3oD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Andrey Chernov wrote: > Hmm. Perhaps not after but before, because screen is cleared on mode=20 > change... It looks like rc messages appearse in the middle of the screen= =20 > over boot messages. So the screen isn't correctly blanked when switching modes? Messages shouldn't overlap anymore, because we use the same terminal emulator to print both user and kernel messages now. --=20 Ed Schouten WWW: http://80386.nl/ --ewQ5hdP4CtoTt3oD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm3wnoACgkQ52SDGA2eCwUWDgCaA+5N0muovWHGQKUeskALDP5/ 4PAAnRdEOIEPBpvK5e16WzqZb+0tfz1j =vb/P -----END PGP SIGNATURE----- --ewQ5hdP4CtoTt3oD-- From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 14:13:48 2009 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 145C4106564A; Wed, 11 Mar 2009 14:13:48 +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 F3EA68FC08; Wed, 11 Mar 2009 14:13:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BEDlYe097782; Wed, 11 Mar 2009 14:13:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BEDlJA097773; Wed, 11 Mar 2009 14:13:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903111413.n2BEDlJA097773@svn.freebsd.org> From: John Baldwin Date: Wed, 11 Mar 2009 14: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: r189696 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/md fs/cd9660 fs/udf kern 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: Wed, 11 Mar 2009 14:13:48 -0000 Author: jhb Date: Wed Mar 11 14:13:47 2009 New Revision: 189696 URL: http://svn.freebsd.org/changeset/base/189696 Log: Add a new internal mount flag (MNTK_EXTENDED_SHARED) to indicate that a filesystem supports additional operations using shared vnode locks. Currently this is used to enable shared locks for open() and close() of read-only file descriptors. - When an ISOPEN namei() request is performed with LOCKSHARED, use a shared vnode lock for the leaf vnode only if the mount point has the extended shared flag set. - Set LOCKSHARED in vn_open_cred() for requests that specify O_RDONLY but not O_CREAT. - Use a shared vnode lock around VOP_CLOSE() if the file was opened with O_RDONLY and the mountpoint has the extended shared flag set. - Adjust md(4) to upgrade the vnode lock on the vnode it gets back from vn_open() since it now may only have a shared vnode lock. - Don't enable shared vnode locks on FIFO vnodes in ZFS and UFS since FIFO's require exclusive vnode locks for their open() and close() routines. (My recent MPSAFE patches for UDF and cd9660 already included this change.) - Enable extended shared operations on UFS, cd9660, and UDF. Submitted by: ups Reviewed by: pjd (ZFS bits) MFC after: 1 month Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/dev/md/md.c head/sys/fs/cd9660/cd9660_vfsops.c head/sys/fs/udf/udf_vfsops.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_vnops.c head/sys/kern/vnode_if.src head/sys/sys/mount.h head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Mar 11 13:15:42 2009 (r189695) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Mar 11 14:13:47 2009 (r189696) @@ -153,7 +153,6 @@ zfs_znode_cache_constructor(void *buf, v zp->z_vnode = vp; vp->v_data = (caddr_t)zp; VN_LOCK_AREC(vp); - VN_LOCK_ASHARE(vp); list_link_init(&zp->z_link_node); @@ -610,6 +609,8 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_bu vp->v_op = &zfs_fifoops; break; } + if (vp->v_type != VFIFO) + VN_LOCK_ASHARE(vp); mutex_enter(&zfsvfs->z_znodes_lock); list_insert_tail(&zfsvfs->z_all_znodes, zp); @@ -1491,6 +1492,7 @@ zfs_create_fs(objset_t *os, cred_t *cr, vp = ZTOV(rootzp); vp->v_type = VDIR; + VN_LOCK_ASHARE(vp); bzero(&zfsvfs, sizeof (zfsvfs_t)); Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Wed Mar 11 13:15:42 2009 (r189695) +++ head/sys/dev/md/md.c Wed Mar 11 14:13:47 2009 (r189696) @@ -924,12 +924,20 @@ mdcreate_vnode(struct md_s *sc, struct m return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); - if (nd.ni_vp->v_type != VREG || - (error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred))) { - VOP_UNLOCK(nd.ni_vp, 0); - (void)vn_close(nd.ni_vp, flags, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); - return (error ? error : EINVAL); + if (nd.ni_vp->v_type != VREG) { + error = EINVAL; + goto bad; + } + error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred); + if (error != 0) + goto bad; + if (VOP_ISLOCKED(nd.ni_vp) != LK_EXCLUSIVE) { + vn_lock(nd.ni_vp, LK_UPGRADE | LK_RETRY); + if (nd.ni_vp->v_iflag & VI_DOOMED) { + /* Forced unmount. */ + error = EBADF; + goto bad; + } } nd.ni_vp->v_vflag |= VV_MD; VOP_UNLOCK(nd.ni_vp, 0); @@ -948,13 +956,15 @@ mdcreate_vnode(struct md_s *sc, struct m sc->vnode = NULL; vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY); nd.ni_vp->v_vflag &= ~VV_MD; - VOP_UNLOCK(nd.ni_vp, 0); - (void)vn_close(nd.ni_vp, flags, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); - return (error); + goto bad; } VFS_UNLOCK_GIANT(vfslocked); return (0); +bad: + VOP_UNLOCK(nd.ni_vp, 0); + (void)vn_close(nd.ni_vp, flags, td->td_ucred, td); + VFS_UNLOCK_GIANT(vfslocked); + return (error); } static int Modified: head/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vfsops.c Wed Mar 11 13:15:42 2009 (r189695) +++ head/sys/fs/cd9660/cd9660_vfsops.c Wed Mar 11 14:13:47 2009 (r189696) @@ -371,7 +371,8 @@ iso_mountfs(devvp, mp) mp->mnt_maxsymlinklen = 0; MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED; + mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED | + MNTK_EXTENDED_SHARED; MNT_IUNLOCK(mp); isomp->im_mountp = mp; isomp->im_dev = dev; Modified: head/sys/fs/udf/udf_vfsops.c ============================================================================== --- head/sys/fs/udf/udf_vfsops.c Wed Mar 11 13:15:42 2009 (r189695) +++ head/sys/fs/udf/udf_vfsops.c Wed Mar 11 14:13:47 2009 (r189696) @@ -353,7 +353,8 @@ udf_mountfs(struct vnode *devvp, struct mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED; + mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED | + MNTK_EXTENDED_SHARED; MNT_IUNLOCK(mp); udfmp->im_mountp = mp; udfmp->im_dev = dev; Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Wed Mar 11 13:15:42 2009 (r189695) +++ head/sys/kern/vfs_lookup.c Wed Mar 11 14:13:47 2009 (r189696) @@ -353,6 +353,41 @@ compute_cn_lkflags(struct mount *mp, int return (lkflags); } +static __inline int +needs_exclusive_leaf(struct mount *mp, int flags) +{ + + /* + * Intermediate nodes can use shared locks, we only need to + * force an exclusive lock for leaf nodes. + */ + if ((flags & (ISLASTCN | LOCKLEAF)) != (ISLASTCN | LOCKLEAF)) + return (0); + + /* Always use exclusive locks if LOCKSHARED isn't set. */ + if (!(flags & LOCKSHARED)) + return (1); + + /* + * For lookups during open(), if the mount point supports + * extended shared operations, then use a shared lock for the + * leaf node, otherwise use an exclusive lock. + */ + if (flags & ISOPEN) { + if (mp != NULL && + (mp->mnt_kern_flag & MNTK_EXTENDED_SHARED)) + return (0); + else + return (1); + } + + /* + * Lookup requests outside of open() that specify LOCKSHARED + * only need a shared lock on the leaf vnode. + */ + return (1); +} + /* * Search a pathname. * This is a very central and rather complicated routine. @@ -610,8 +645,7 @@ unionlookup: * If we're looking up the last component and we need an exclusive * lock, adjust our lkflags. */ - if ((cnp->cn_flags & (ISLASTCN|LOCKSHARED|LOCKLEAF)) == - (ISLASTCN|LOCKLEAF)) + if (needs_exclusive_leaf(dp->v_mount, cnp->cn_flags)) cnp->cn_lkflags = LK_EXCLUSIVE; #ifdef NAMEI_DIAGNOSTIC vprint("lookup in", dp); @@ -811,8 +845,8 @@ success: * Because of lookup_shared we may have the vnode shared locked, but * the caller may want it to be exclusively locked. */ - if ((cnp->cn_flags & (ISLASTCN | LOCKSHARED | LOCKLEAF)) == - (ISLASTCN | LOCKLEAF) && VOP_ISLOCKED(dp) != LK_EXCLUSIVE) { + if (needs_exclusive_leaf(dp->v_mount, cnp->cn_flags) && + VOP_ISLOCKED(dp) != LK_EXCLUSIVE) { vn_lock(dp, LK_UPGRADE | LK_RETRY); if (dp->v_iflag & VI_DOOMED) { error = ENOENT; Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Wed Mar 11 13:15:42 2009 (r189695) +++ head/sys/kern/vfs_vnops.c Wed Mar 11 14:13:47 2009 (r189696) @@ -188,6 +188,8 @@ restart: ndp->ni_cnd.cn_flags = ISOPEN | ((fmode & O_NOFOLLOW) ? NOFOLLOW : FOLLOW) | LOCKLEAF | MPSAFE | AUDITVNODE1; + if (!(fmode & FWRITE)) + ndp->ni_cnd.cn_flags |= LOCKSHARED; if ((error = namei(ndp)) != 0) return (error); if (!mpsafe) @@ -240,7 +242,7 @@ restart: if (fmode & FWRITE) vp->v_writecount++; *flagp = fmode; - ASSERT_VOP_ELOCKED(vp, "vn_open_cred"); + ASSERT_VOP_LOCKED(vp, "vn_open_cred"); if (!mpsafe) VFS_UNLOCK_GIANT(vfslocked); return (0); @@ -285,12 +287,18 @@ vn_close(vp, flags, file_cred, td) struct thread *td; { struct mount *mp; - int error; + int error, lock_flags; + + if (!(flags & FWRITE) && vp->v_mount != NULL && + vp->v_mount->mnt_kern_flag & MNTK_EXTENDED_SHARED) + lock_flags = LK_SHARED; + else + lock_flags = LK_EXCLUSIVE; VFS_ASSERT_GIANT(vp->v_mount); vn_start_write(vp, &mp, V_WAIT); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, lock_flags | LK_RETRY); if (flags & FWRITE) { VNASSERT(vp->v_writecount > 0, vp, ("vn_close: negative writecount")); Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Wed Mar 11 13:15:42 2009 (r189695) +++ head/sys/kern/vnode_if.src Wed Mar 11 14:13:47 2009 (r189696) @@ -133,7 +133,7 @@ vop_open { }; -%% close vp E E E +%% close vp L L L vop_close { IN struct vnode *vp; Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Wed Mar 11 13:15:42 2009 (r189695) +++ head/sys/sys/mount.h Wed Mar 11 14:13:47 2009 (r189696) @@ -324,14 +324,15 @@ void __mnt_vnode_markerfree(str #define MNTK_NOINSMNTQ 0x00000008 /* insmntque is not allowed */ #define MNTK_DRAINING 0x00000010 /* lock draining is happening */ #define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */ +#define MNTK_EXTENDED_SHARED 0x00000040 /* Allow shared locking for more ops */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ #define MNTK_SUSPEND 0x08000000 /* request write suspension */ #define MNTK_SUSPEND2 0x04000000 /* block secondary writes */ #define MNTK_SUSPENDED 0x10000000 /* write operations are suspended */ #define MNTK_MPSAFE 0x20000000 /* Filesystem is MPSAFE. */ -#define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */ #define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */ +#define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */ /* * Sysctl CTL_VFS definitions. Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Wed Mar 11 13:15:42 2009 (r189695) +++ head/sys/ufs/ffs/ffs_vfsops.c Wed Mar 11 14:13:47 2009 (r189696) @@ -883,7 +883,8 @@ ffs_mountfs(devvp, mp, td) * Initialize filesystem stat information in mount struct. */ MNT_ILOCK(mp); - mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED; + mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED | + MNTK_EXTENDED_SHARED; MNT_IUNLOCK(mp); #ifdef UFS_EXTATTR #ifdef UFS_EXTATTR_AUTOSTART @@ -1440,10 +1441,9 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags return (error); } /* - * FFS supports recursive and shared locking. + * FFS supports recursive locking. */ VN_LOCK_AREC(vp); - VN_LOCK_ASHARE(vp); vp->v_data = ip; vp->v_bufobj.bo_bsize = fs->fs_bsize; ip->i_vnode = vp; @@ -1516,6 +1516,10 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags /* * Finish inode initialization. */ + if (vp->v_type != VFIFO) { + /* FFS supports shared locking for all files except fifos. */ + VN_LOCK_ASHARE(vp); + } /* * Set up a generation number for this inode if it does not From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 14:27:20 2009 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 ACD941065688 for ; Wed, 11 Mar 2009 14:27:20 +0000 (UTC) (envelope-from cokane@FreeBSD.org) Received: from mail-out2.fuse.net (mail-out2.fuse.net [216.68.8.171]) by mx1.freebsd.org (Postfix) with ESMTP id 6680F8FC2A for ; Wed, 11 Mar 2009 14:27:20 +0000 (UTC) (envelope-from cokane@FreeBSD.org) X-CNFS-Analysis: v=1.0 c=1 a=iN0ZH7lpZ6IA:10 a=Hkso0HQtS48A:10 a=6I5d2MoRAAAA:8 a=gc_eYPclRjOCZIDIgsYA:9 a=-WD4RW5RINnYu1z37KsA:7 a=caVS4gsAzbbO0KR1ksb2SZCsdtIA:4 a=LY0hPdMaydYA:10 a=DZTxF9fASv3EVdVCP7wA:9 a=Xno9aq8Plulj1ZE4s1aBbDpa-mcA:4 a=rPt6xJ-oxjAA:10 X-CM-Score: 0 X-Scanned-by: Cloudmark Authority Engine Authentication-Results: gwout2 smtp.mail=cokane@FreeBSD.org; spf=softfail Received-SPF: softfail (gwout2: transitional domain FreeBSD.org does not designate 74.215.227.9 as permitted sender) Received: from [74.215.227.9] ([74.215.227.9:50501] helo=discordia) by gwout2 (envelope-from ) (ecelerity 2.2.2.37 r(28805/28810M)) with ESMTP id 16/FE-12703-74AC7B94; Wed, 11 Mar 2009 10:27:19 -0400 Received: by discordia (Postfix, from userid 103) id 94C7435A7D8; Wed, 11 Mar 2009 10:27:18 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.1.8-gr1 (2007-02-13) on discordia X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.8-gr1 Received: from [172.31.1.6] (unknown [172.31.1.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by discordia (Postfix) with ESMTP id 95EA635A7D9; Wed, 11 Mar 2009 10:27:04 -0400 (EDT) From: Coleman Kane To: Poul-Henning Kamp In-Reply-To: <200903111037.n2BAb2tj093282@svn.freebsd.org> References: <200903111037.n2BAb2tj093282@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-7BbJhmSH/KFHHR4R0DV1" Organization: FreeBSD Project Date: Wed, 11 Mar 2009 10:25:46 -0400 Message-Id: <1236781546.1906.5.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.24.4 FreeBSD GNOME Team Port Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189691 - head/sbin/recoverdisk 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 Mar 2009 14:27:22 -0000 --=-7BbJhmSH/KFHHR4R0DV1 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2009-03-11 at 10:37 +0000, Poul-Henning Kamp wrote: > Author: phk > Date: Wed Mar 11 10:37:02 2009 > New Revision: 189691 > URL: http://svn.freebsd.org/changeset/base/189691 >=20 > Log: > Some improvements to recoverdisk >=20 > Modified: > head/sbin/recoverdisk/recoverdisk.1 > head/sbin/recoverdisk/recoverdisk.c >=20 < ... snip ... > >=20 > Modified: head/sbin/recoverdisk/recoverdisk.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/sbin/recoverdisk/recoverdisk.c Wed Mar 11 09:57:11 2009 (r189690= ) > +++ head/sbin/recoverdisk/recoverdisk.c Wed Mar 11 10:37:02 2009 (r189691= ) < ... snip ... > > @@ -215,6 +213,17 @@ main(int argc, char * const argv[]) > flags |=3D O_CREAT | O_TRUNC; > } > =20 > + if (bigsize < minsize) > + bigsize =3D minsize; > + > + for (ch =3D 0; (bigsize >> ch) > minsize; ch++) > + continue; > + medsize =3D bigsize >> (ch / 2); > + medsize =3D (medsize / minsize) * minsize; > + > + fprintf(stderr, "Bigsize =3D %u, medsize =3D %u, minsize =3D %u\n", > + bigsize, medsize, minsize); > + > buf =3D malloc(bigsize); > if (buf =3D=3D NULL) > err(1, "Cannot allocate %jd bytes buffer", (intmax_t)bigsize); > =20 That new fprintf warns in the case where sizeof(size_t) !=3D sizeof(unsigned int), such as is the case on amd64. --=20 Coleman Kane --=-7BbJhmSH/KFHHR4R0DV1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkm3yeMACgkQcMSxQcXat5e+qwCbBt2KBvcccG5lqBVs3FpnpIlB bzgAnRDv7LDPv1FdmQRRb8oJ75G048x/ =xJr5 -----END PGP SIGNATURE----- --=-7BbJhmSH/KFHHR4R0DV1-- From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 14:30:46 2009 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 3D54110656D6 for ; Wed, 11 Mar 2009 14:30:46 +0000 (UTC) (envelope-from cokane@FreeBSD.org) Received: from mail-out2.fuse.net (mail-out2.fuse.net [216.68.8.171]) by mx1.freebsd.org (Postfix) with ESMTP id E87248FC28 for ; Wed, 11 Mar 2009 14:30:45 +0000 (UTC) (envelope-from cokane@FreeBSD.org) X-CNFS-Analysis: v=1.0 c=1 a=iN0ZH7lpZ6IA:10 a=Hkso0HQtS48A:10 a=6I5d2MoRAAAA:8 a=kPvJ-YZLt_3HyXKtSPYA:9 a=J5-KrI2R02uQvptvSucA:7 a=E5kesLvNyGGyZjsibyfimvPnaZIA:4 a=LY0hPdMaydYA:10 a=YU2NQ9VS5T9TPjSJBtMA:9 a=1q0xXIetoTnHbNx0mm4F6mVDgXsA:4 a=rPt6xJ-oxjAA:10 X-CM-Score: 0 X-Scanned-by: Cloudmark Authority Engine Authentication-Results: gwout2 smtp.mail=cokane@FreeBSD.org; spf=softfail Received-SPF: softfail (gwout2: transitional domain FreeBSD.org does not designate 74.215.227.9 as permitted sender) Received: from [74.215.227.9] ([74.215.227.9:50581] helo=discordia) by gwout2 (envelope-from ) (ecelerity 2.2.2.37 r(28805/28810M)) with ESMTP id 61/72-12703-51BC7B94; Wed, 11 Mar 2009 10:30:45 -0400 Received: by discordia (Postfix, from userid 103) id EEA2635A7DA; Wed, 11 Mar 2009 10:30:44 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.1.8-gr1 (2007-02-13) on discordia X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.8-gr1 Received: from [172.31.1.6] (unknown [172.31.1.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by discordia (Postfix) with ESMTP id 3B96D35A7D8; Wed, 11 Mar 2009 10:30:33 -0400 (EDT) From: Coleman Kane To: Poul-Henning Kamp In-Reply-To: <1236781546.1906.5.camel@localhost> References: <200903111037.n2BAb2tj093282@svn.freebsd.org> <1236781546.1906.5.camel@localhost> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-A73AZhK6xQN6kp58QeK/" Organization: FreeBSD Project Date: Wed, 11 Mar 2009 10:29:19 -0400 Message-Id: <1236781759.1906.7.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.24.4 FreeBSD GNOME Team Port Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189691 - head/sbin/recoverdisk 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 Mar 2009 14:30:47 -0000 --=-A73AZhK6xQN6kp58QeK/ Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2009-03-11 at 10:25 -0400, Coleman Kane wrote: > On Wed, 2009-03-11 at 10:37 +0000, Poul-Henning Kamp wrote: > > Author: phk > > Date: Wed Mar 11 10:37:02 2009 > > New Revision: 189691 > > URL: http://svn.freebsd.org/changeset/base/189691 > >=20 > > Log: > > Some improvements to recoverdisk > >=20 > > Modified: > > head/sbin/recoverdisk/recoverdisk.1 > > head/sbin/recoverdisk/recoverdisk.c > >=20 >=20 > < ... snip ... > >=20 > >=20 > > Modified: head/sbin/recoverdisk/recoverdisk.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/sbin/recoverdisk/recoverdisk.c Wed Mar 11 09:57:11 2009 (r1896= 90) > > +++ head/sbin/recoverdisk/recoverdisk.c Wed Mar 11 10:37:02 2009 (r1896= 91) >=20 > < ... snip ... > >=20 > > @@ -215,6 +213,17 @@ main(int argc, char * const argv[]) > > flags |=3D O_CREAT | O_TRUNC; > > } > > =20 > > + if (bigsize < minsize) > > + bigsize =3D minsize; > > + > > + for (ch =3D 0; (bigsize >> ch) > minsize; ch++) > > + continue; > > + medsize =3D bigsize >> (ch / 2); > > + medsize =3D (medsize / minsize) * minsize; > > + > > + fprintf(stderr, "Bigsize =3D %u, medsize =3D %u, minsize =3D %u\n", > > + bigsize, medsize, minsize); > > + > > buf =3D malloc(bigsize); > > if (buf =3D=3D NULL) > > err(1, "Cannot allocate %jd bytes buffer", (intmax_t)bigsize); > > =20 >=20 > That new fprintf warns in the case where sizeof(size_t) !=3D > sizeof(unsigned int), such as is the case on amd64. >=20 A quick read of the printf(3) page suggests printf(stderr, "Bigsize =3D %zu, medsize =3D %zu, minsize =3D %zu\n", bigsi= ze, medsize, minsize); is more appropriate... I think. --=20 Coleman Kane --=-A73AZhK6xQN6kp58QeK/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkm3yr0ACgkQcMSxQcXat5fNFACggcThnC8APxejBk9WbtFRn6Jf BzUAn0cLd+ZY0vmGMHWhGIJdLb/dQ3a1 =elo6 -----END PGP SIGNATURE----- --=-A73AZhK6xQN6kp58QeK/-- From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 14:39:55 2009 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 B865710656C7; Wed, 11 Mar 2009 14:39:55 +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 A677C8FC24; Wed, 11 Mar 2009 14:39:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BEdtZZ098371; Wed, 11 Mar 2009 14:39:55 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BEdtCB098370; Wed, 11 Mar 2009 14:39:55 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903111439.n2BEdtCB098370@svn.freebsd.org> From: John Baldwin Date: Wed, 11 Mar 2009 14:39: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: r189697 - 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: Wed, 11 Mar 2009 14:39:56 -0000 Author: jhb Date: Wed Mar 11 14:39:55 2009 New Revision: 189697 URL: http://svn.freebsd.org/changeset/base/189697 Log: Gah, fix the code to match the comment. For non-open lookups use a shared vnode lock for the leaf vnode if LOCKSHARED is set. Submitted by: rdivacky Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Wed Mar 11 14:13:47 2009 (r189696) +++ head/sys/kern/vfs_lookup.c Wed Mar 11 14:39:55 2009 (r189697) @@ -385,7 +385,7 @@ needs_exclusive_leaf(struct mount *mp, i * Lookup requests outside of open() that specify LOCKSHARED * only need a shared lock on the leaf vnode. */ - return (1); + return (0); } /* From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 14:55:04 2009 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 9E0921065678; Wed, 11 Mar 2009 14:55:04 +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 84BB28FC22; Wed, 11 Mar 2009 14:55:04 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BEt4iX098697; Wed, 11 Mar 2009 14:55:04 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BEt4g7098696; Wed, 11 Mar 2009 14:55:04 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200903111455.n2BEt4g7098696@svn.freebsd.org> From: Alan Cox Date: Wed, 11 Mar 2009 14:55: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: r189698 - head/sys/amd64/amd64 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 Mar 2009 14:55:06 -0000 Author: alc Date: Wed Mar 11 14:55:04 2009 New Revision: 189698 URL: http://svn.freebsd.org/changeset/base/189698 Log: Optimize the inner loop of pmap_copy(). MFC after: 6 weeks Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Mar 11 14:39:55 2009 (r189697) +++ head/sys/amd64/amd64/pmap.c Wed Mar 11 14:55:04 2009 (r189698) @@ -3538,6 +3538,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm src_pte = (pt_entry_t *)PHYS_TO_DMAP(srcptepaddr); src_pte = &src_pte[pmap_pte_index(addr)]; + dstmpte = NULL; while (addr < va_next) { pt_entry_t ptetemp; ptetemp = *src_pte; @@ -3545,9 +3546,11 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm * we only virtual copy managed pages */ if ((ptetemp & PG_MANAGED) != 0) { - dstmpte = pmap_allocpte(dst_pmap, addr, - M_NOWAIT); - if (dstmpte == NULL) + if (dstmpte != NULL && + dstmpte->pindex == pmap_pde_pindex(addr)) + dstmpte->wire_count++; + else if ((dstmpte = pmap_allocpte(dst_pmap, + addr, M_NOWAIT)) == NULL) break; dst_pte = (pt_entry_t *) PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dstmpte)); From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 15:30:13 2009 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 A59B41065673; Wed, 11 Mar 2009 15:30:13 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EAF58FC14; Wed, 11 Mar 2009 15:30:13 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BFUDSk099465; Wed, 11 Mar 2009 15:30:13 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BFUD4j099456; Wed, 11 Mar 2009 15:30:13 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200903111530.n2BFUD4j099456@svn.freebsd.org> From: Doug Rabson Date: Wed, 11 Mar 2009 15:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189699 - in head/sys: . amd64/amd64 amd64/conf amd64/include amd64/include/xen conf contrib/pf dev/ata dev/cxgb dev/sound/usb dev/usb dev/xen/balloon dev/xen/blkfront dev/xen/console 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: Wed, 11 Mar 2009 15:30:14 -0000 Author: dfr Date: Wed Mar 11 15:30:12 2009 New Revision: 189699 URL: http://svn.freebsd.org/changeset/base/189699 Log: Merge in support for Xen HVM on amd64 architecture. Added: head/sys/amd64/conf/XENHVM (contents, props changed) - copied, changed from r189614, user/dfr/xenhvm/7/sys/amd64/conf/XENHVM head/sys/amd64/include/xen/ (props changed) - copied from r189614, user/dfr/xenhvm/7/sys/amd64/include/xen/ head/sys/dev/xen/xenpci/ (props changed) - copied from r189614, user/dfr/xenhvm/7/sys/dev/xen/xenpci/ head/sys/xen/features.h - copied unchanged from r189614, user/dfr/xenhvm/7/sys/xen/features.h head/sys/xen/reboot.c - copied unchanged from r189614, user/dfr/xenhvm/7/sys/xen/reboot.c Modified: head/sys/ (props changed) head/sys/amd64/amd64/machdep.c head/sys/amd64/include/pcpu.h head/sys/amd64/include/xen/xenvar.h head/sys/conf/files head/sys/conf/options.amd64 head/sys/contrib/pf/ (props changed) head/sys/dev/ata/ata-usb.c (props changed) head/sys/dev/cxgb/ (props changed) head/sys/dev/sound/usb/uaudio.c (props changed) head/sys/dev/sound/usb/uaudio.h (props changed) head/sys/dev/sound/usb/uaudio_pcm.c (props changed) head/sys/dev/sound/usb/uaudioreg.h (props changed) head/sys/dev/usb/usb.h (props changed) head/sys/dev/usb/usb_if.m (props changed) head/sys/dev/usb/usbdevs (props changed) head/sys/dev/usb/usbhid.h (props changed) head/sys/dev/xen/balloon/balloon.c head/sys/dev/xen/blkfront/blkfront.c head/sys/dev/xen/console/console.c head/sys/dev/xen/console/xencons_ring.c head/sys/dev/xen/netfront/ (props changed) head/sys/dev/xen/netfront/netfront.c head/sys/dev/xen/xenpci/machine_reboot.c head/sys/i386/include/xen/xenpmap.h head/sys/xen/evtchn.h (props changed) head/sys/xen/evtchn/evtchn.c head/sys/xen/evtchn/evtchn_dev.c head/sys/xen/features.c head/sys/xen/gnttab.c head/sys/xen/gnttab.h head/sys/xen/hypervisor.h (contents, props changed) head/sys/xen/interface/arch-x86/xen.h head/sys/xen/interface/hvm/params.h head/sys/xen/xen_intr.h (contents, props changed) head/sys/xen/xenbus/xenbus_probe.c head/sys/xen/xenbus/xenbus_xs.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Mar 11 14:55:04 2009 (r189698) +++ head/sys/amd64/amd64/machdep.c Wed Mar 11 15:30:12 2009 (r189699) @@ -1494,6 +1494,14 @@ hammer_time(u_int64_t modulep, u_int64_t if (env != NULL) strlcpy(kernelname, env, sizeof(kernelname)); +#ifdef XENHVM + if (inw(0x10) == 0x49d2) { + if (bootverbose) + printf("Xen detected: disabling emulated block and network devices\n"); + outw(0x10, 3); + } +#endif + /* Location of kernel stack for locore */ return ((u_int64_t)thread0.td_pcb); } Copied and modified: head/sys/amd64/conf/XENHVM (from r189614, user/dfr/xenhvm/7/sys/amd64/conf/XENHVM) ============================================================================== --- user/dfr/xenhvm/7/sys/amd64/conf/XENHVM Tue Mar 10 10:59:30 2009 (r189614, copy source) +++ head/sys/amd64/conf/XENHVM Wed Mar 11 15:30:12 2009 (r189699) @@ -1,8 +1,8 @@ # # XENHVM -- Xen HVM kernel configuration file for FreeBSD/amd64 # -# For more information on this file, please read the handbook section on -# Kernel Configuration Files: +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: # # http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html # @@ -19,11 +19,17 @@ # $FreeBSD$ cpu HAMMER -ident XENHVM +ident GENERIC # To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" # Default places to look for devices. +# Use the following to compile in values accessible to the kernel +# through getenv() (or kenv(1) in userland). The format of the file +# is 'variable=value', see kenv(1) +# +# env "GENERIC.env" + makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions MODULES_OVERRIDE="" @@ -31,7 +37,7 @@ options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols -options SCTP # Stream Control Transmission Protocol +options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists @@ -42,18 +48,18 @@ options NFSCLIENT # Network Filesystem options NFSSERVER # Network Filesystem Server options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCLIENT -options NTFS # NT File System options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization -options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) options COMPAT_IA32 # Compatible with i386 binaries options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 +options COMPAT_FREEBSD7 # Compatible with FreeBSD7 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support @@ -62,15 +68,20 @@ options SYSVMSG # SYSV-style message options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options ADAPTIVE_GIANT # Giant mutex is adaptive. options STOP_NMI # Stop CPUS using NMI instead of IPI +options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing #options KDTRACE_FRAME # Ensure frames are compiled in #options KDTRACE_HOOKS # Kernel DTrace hooks -options KDB -options DDB -options GDB +# Debugging for use in -current +options KDB # Enable kernel debugger support. +options DDB # Support DDB. +options GDB # Support remote GDB. +options INVARIANTS # Enable calls of extra sanity checking +options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +options WITNESS # Enable checks to detect deadlocks and cycles +options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel @@ -107,6 +118,7 @@ device cd # CD device pass # Passthrough device (direct SCSI access) device ses # SCSI Environmental Services (and SAF-TE) + # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller device atkbd # AT keyboard @@ -124,7 +136,6 @@ device sc device agp # support several AGP chipsets # Serial (COM) ports -device sio # 8250, 16[45]50 based serial ports device uart # Generic UART driver # PCI Ethernet NICs that use the common MII bus controller code. @@ -136,10 +147,8 @@ device re # RealTek 8139C+/8169/8169S/ device loop # Network loopback device random # Entropy device device ether # Ethernet support -device sl # Kernel SLIP -device ppp # Kernel PPP device tun # Packet tunnel. -device pty # Pseudo-ttys (telnet etc) +device pty # BSD-style compatibility pseudo ttys device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device faith # IPv6-to-IPv4 relaying (translation) @@ -149,4 +158,3 @@ device firmware # firmware assist modul # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter - Modified: head/sys/amd64/include/pcpu.h ============================================================================== --- head/sys/amd64/include/pcpu.h Wed Mar 11 14:55:04 2009 (r189698) +++ head/sys/amd64/include/pcpu.h Wed Mar 11 15:30:12 2009 (r189699) @@ -33,6 +33,24 @@ #error "sys/cdefs.h is a prerequisite for this file" #endif +#if defined(XEN) || defined(XENHVM) +#ifndef NR_VIRQS +#define NR_VIRQS 24 +#endif +#ifndef NR_IPIS +#define NR_IPIS 2 +#endif +#endif + +#ifdef XENHVM +#define PCPU_XEN_FIELDS \ + ; \ + unsigned int pc_last_processed_l1i; \ + unsigned int pc_last_processed_l2i +#else +#define PCPU_XEN_FIELDS +#endif + /* * The SMP parts are setup in pmap.c and locore.s for the BSP, and * mp_machdep.c sets up the data for the AP's to "see" when they awake. @@ -49,7 +67,8 @@ register_t pc_scratch_rsp; /* User %rsp in syscall */ \ u_int pc_apic_id; \ u_int pc_acpi_id; /* ACPI CPU id */ \ - struct user_segment_descriptor *pc_gs32p + struct user_segment_descriptor *pc_gs32p \ + PCPU_XEN_FIELDS #ifdef _KERNEL Modified: head/sys/amd64/include/xen/xenvar.h ============================================================================== --- user/dfr/xenhvm/7/sys/amd64/include/xen/xenvar.h Tue Mar 10 10:59:30 2009 (r189614) +++ head/sys/amd64/include/xen/xenvar.h Wed Mar 11 15:30:12 2009 (r189699) @@ -71,6 +71,7 @@ machtophys(vm_paddr_t ma) #define MFNTOPFN(ma) (ma) #define set_phys_to_machine(pfn, mfn) ((void)0) +#define phys_to_machine_mapping_valid(pfn) (TRUE) #define PT_UPDATES_FLUSH() ((void)0) #else Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Mar 11 14:55:04 2009 (r189698) +++ head/sys/conf/files Wed Mar 11 15:30:12 2009 (r189699) @@ -2758,21 +2758,24 @@ gnu/fs/xfs/xfs_iomap.c optional xfs \ gnu/fs/xfs/xfs_behavior.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" -xen/gnttab.c optional xen -xen/features.c optional xen -xen/evtchn/evtchn.c optional xen -xen/evtchn/evtchn_dev.c optional xen -xen/xenbus/xenbus_client.c optional xen -xen/xenbus/xenbus_comms.c optional xen -xen/xenbus/xenbus_dev.c optional xen -xen/xenbus/xenbus_if.m optional xen -xen/xenbus/xenbus_probe.c optional xen -#xen/xenbus/xenbus_probe_backend.c optional xen -xen/xenbus/xenbus_xs.c optional xen -dev/xen/console/console.c optional xen -dev/xen/console/xencons_ring.c optional xen -dev/xen/blkfront/blkfront.c optional xen -dev/xen/netfront/netfront.c optional xen -#dev/xen/xenpci/xenpci.c optional xen -#xen/xenbus/xenbus_newbus.c optional xenhvm +xen/gnttab.c optional xen | xenhvm +xen/features.c optional xen | xenhvm +xen/evtchn/evtchn.c optional xen +xen/evtchn/evtchn_dev.c optional xen | xenhvm +xen/reboot.c optional xen +xen/xenbus/xenbus_client.c optional xen | xenhvm +xen/xenbus/xenbus_comms.c optional xen | xenhvm +xen/xenbus/xenbus_dev.c optional xen | xenhvm +xen/xenbus/xenbus_if.m optional xen | xenhvm +xen/xenbus/xenbus_probe.c optional xen | xenhvm +#xen/xenbus/xenbus_probe_backend.c optional xen +xen/xenbus/xenbus_xs.c optional xen | xenhvm +dev/xen/balloon/balloon.c optional xen | xenhvm +dev/xen/console/console.c optional xen +dev/xen/console/xencons_ring.c optional xen +dev/xen/blkfront/blkfront.c optional xen | xenhvm +dev/xen/netfront/netfront.c optional xen | xenhvm +dev/xen/xenpci/xenpci.c optional xenpci +dev/xen/xenpci/evtchn.c optional xenpci +dev/xen/xenpci/machine_reboot.c optional xenpci Modified: head/sys/conf/options.amd64 ============================================================================== --- head/sys/conf/options.amd64 Wed Mar 11 14:55:04 2009 (r189698) +++ head/sys/conf/options.amd64 Wed Mar 11 15:30:12 2009 (r189699) @@ -57,3 +57,5 @@ KDTRACE_FRAME opt_kdtrace.h # BPF just-in-time compiler BPF_JITTER opt_bpf.h + +XENHVM opt_global.h Modified: head/sys/dev/xen/balloon/balloon.c ============================================================================== --- head/sys/dev/xen/balloon/balloon.c Wed Mar 11 14:55:04 2009 (r189698) +++ head/sys/dev/xen/balloon/balloon.c Wed Mar 11 15:30:12 2009 (r189699) @@ -34,11 +34,24 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include #include +#include -#include -#include -#include +#include +#include +#include +#include +#include + +#include +#include + +MALLOC_DEFINE(M_BALLOON, "Balloon", "Xen Balloon Driver"); + +struct mtx balloon_mutex; /* * Protects atomic reservation decrease/increase against concurrent increases. @@ -46,23 +59,44 @@ __FBSDID("$FreeBSD$"); * balloon lists. */ struct mtx balloon_lock; -#ifdef notyet - -/* We aim for 'current allocation' == 'target allocation'. */ -static unsigned long current_pages; -static unsigned long target_pages; -/* VM /proc information for memory */ -extern unsigned long totalram_pages; +/* We increase/decrease in batches which fit in a page */ +static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)]; +#define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0])) + +struct balloon_stats { + /* We aim for 'current allocation' == 'target allocation'. */ + unsigned long current_pages; + unsigned long target_pages; + /* We may hit the hard limit in Xen. If we do then we remember it. */ + unsigned long hard_limit; + /* + * Drivers may alter the memory reservation independently, but they + * must inform the balloon driver so we avoid hitting the hard limit. + */ + unsigned long driver_pages; + /* Number of pages in high- and low-memory balloons. */ + unsigned long balloon_low; + unsigned long balloon_high; +}; -/* We may hit the hard limit in Xen. If we do then we remember it. */ -static unsigned long hard_limit; +static struct balloon_stats balloon_stats; +#define bs balloon_stats -/* - * Drivers may alter the memory reservation independently, but they must - * inform the balloon driver so that we can avoid hitting the hard limit. - */ -static unsigned long driver_pages; +SYSCTL_DECL(_dev_xen); +SYSCTL_NODE(_dev_xen, OID_AUTO, balloon, CTLFLAG_RD, NULL, "Balloon"); +SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, current, CTLFLAG_RD, + &bs.current_pages, 0, "Current allocation"); +SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, target, CTLFLAG_RD, + &bs.target_pages, 0, "Target allocation"); +SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, driver_pages, CTLFLAG_RD, + &bs.driver_pages, 0, "Driver pages"); +SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, hard_limit, CTLFLAG_RD, + &bs.hard_limit, 0, "Xen hard limit"); +SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, low_mem, CTLFLAG_RD, + &bs.balloon_low, 0, "Low-mem balloon"); +SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, high_mem, CTLFLAG_RD, + &bs.balloon_high, 0, "High-mem balloon"); struct balloon_entry { vm_page_t page; @@ -72,9 +106,6 @@ struct balloon_entry { /* List of ballooned pages, threaded through the mem_map array. */ static STAILQ_HEAD(,balloon_entry) ballooned_pages; -static unsigned long balloon_low, balloon_high; - - /* Main work function, always executed in process context. */ static void balloon_process(void *unused); @@ -89,10 +120,10 @@ balloon_append(vm_page_t page) { struct balloon_entry *entry; - entry = malloc(sizeof(struct balloon_entry), M_WAITOK); - + entry = malloc(sizeof(struct balloon_entry), M_BALLOON, M_WAITOK); + entry->page = page; STAILQ_INSERT_HEAD(&ballooned_pages, entry, list); - balloon_low++; + bs.balloon_low++; } /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ @@ -111,13 +142,13 @@ balloon_retrieve(void) page = entry->page; free(entry, M_DEVBUF); - balloon_low--; + bs.balloon_low--; return page; } static void -balloon_alarm(unsigned long unused) +balloon_alarm(void *unused) { wakeup(balloon_process); } @@ -125,17 +156,56 @@ balloon_alarm(unsigned long unused) static unsigned long current_target(void) { - unsigned long target = min(target_pages, hard_limit); - if (target > (current_pages + balloon_low + balloon_high)) - target = current_pages + balloon_low + balloon_high; + unsigned long target = min(bs.target_pages, bs.hard_limit); + if (target > (bs.current_pages + bs.balloon_low + bs.balloon_high)) + target = bs.current_pages + bs.balloon_low + bs.balloon_high; return target; } +static unsigned long +minimum_target(void) +{ +#ifdef XENHVM +#define max_pfn physmem +#endif + unsigned long min_pages, curr_pages = current_target(); + +#define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) + /* Simple continuous piecewiese linear function: + * max MiB -> min MiB gradient + * 0 0 + * 16 16 + * 32 24 + * 128 72 (1/2) + * 512 168 (1/4) + * 2048 360 (1/8) + * 8192 552 (1/32) + * 32768 1320 + * 131072 4392 + */ + if (max_pfn < MB2PAGES(128)) + min_pages = MB2PAGES(8) + (max_pfn >> 1); + else if (max_pfn < MB2PAGES(512)) + min_pages = MB2PAGES(40) + (max_pfn >> 2); + else if (max_pfn < MB2PAGES(2048)) + min_pages = MB2PAGES(104) + (max_pfn >> 3); + else + min_pages = MB2PAGES(296) + (max_pfn >> 5); +#undef MB2PAGES + + /* Don't enforce growth */ + return min(min_pages, curr_pages); +#ifndef CONFIG_XEN +#undef max_pfn +#endif +} + static int increase_reservation(unsigned long nr_pages) { - unsigned long *mfn_list, pfn, i, flags; - struct page *page; + unsigned long pfn, i; + struct balloon_entry *entry; + vm_page_t page; long rc; struct xen_memory_reservation reservation = { .address_bits = 0, @@ -143,64 +213,81 @@ increase_reservation(unsigned long nr_pa .domid = DOMID_SELF }; - if (nr_pages > (PAGE_SIZE / sizeof(unsigned long))) - nr_pages = PAGE_SIZE / sizeof(unsigned long); + if (nr_pages > ARRAY_SIZE(frame_list)) + nr_pages = ARRAY_SIZE(frame_list); - mfn_list = (unsigned long *)malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT); - if (mfn_list == NULL) - return ENOMEM; + mtx_lock(&balloon_lock); + for (entry = STAILQ_FIRST(&ballooned_pages), i = 0; + i < nr_pages; i++, entry = STAILQ_NEXT(entry, list)) { + KASSERT(entry, ("ballooned_pages list corrupt")); + page = entry->page; + frame_list[i] = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); + } - reservation.extent_start = mfn_list; + set_xen_guest_handle(reservation.extent_start, frame_list); reservation.nr_extents = nr_pages; rc = HYPERVISOR_memory_op( - XENMEM_increase_reservation, &reservation); + XENMEM_populate_physmap, &reservation); if (rc < nr_pages) { - int ret; - /* We hit the Xen hard limit: reprobe. */ - reservation.extent_start = mfn_list; - reservation.nr_extents = rc; - ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, - &reservation); - PANIC_IF(ret != rc); - hard_limit = current_pages + rc - driver_pages; + if (rc > 0) { + int ret; + + /* We hit the Xen hard limit: reprobe. */ + reservation.nr_extents = rc; + ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, + &reservation); + KASSERT(ret == rc, ("HYPERVISOR_memory_op failed")); + } + if (rc >= 0) + bs.hard_limit = (bs.current_pages + rc - + bs.driver_pages); goto out; } for (i = 0; i < nr_pages; i++) { page = balloon_retrieve(); - PANIC_IF(page == NULL); + KASSERT(page, ("balloon_retrieve failed")); pfn = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); - PANIC_IF(phys_to_machine_mapping_valid(pfn)); + KASSERT((xen_feature(XENFEAT_auto_translated_physmap) || + !phys_to_machine_mapping_valid(pfn)), + ("auto translated physmap but mapping is valid")); + + set_phys_to_machine(pfn, frame_list[i]); + +#ifndef XENHVM + /* Link back into the page tables if not highmem. */ + if (pfn < max_low_pfn) { + int ret; + ret = HYPERVISOR_update_va_mapping( + (unsigned long)__va(pfn << PAGE_SHIFT), + pfn_pte_ma(frame_list[i], PAGE_KERNEL), + 0); + PASSING(ret == 0, + ("HYPERVISOR_update_va_mapping failed")); + } +#endif - /* Update P->M and M->P tables. */ - PFNTOMFN(pfn) = mfn_list[i]; - xen_machphys_update(mfn_list[i], pfn); - /* Relinquish the page back to the allocator. */ - ClearPageReserved(page); - set_page_count(page, 1); + vm_page_unwire(page, 0); vm_page_free(page); } - current_pages += nr_pages; - totalram_pages = current_pages; + bs.current_pages += nr_pages; + //totalram_pages = bs.current_pages; out: - balloon_unlock(flags); - - free((mfn_list); + mtx_unlock(&balloon_lock); return 0; } -static int +static int decrease_reservation(unsigned long nr_pages) { - unsigned long *mfn_list, pfn, i, flags; - struct page *page; - void *v; + unsigned long pfn, i; + vm_page_t page; int need_sleep = 0; int ret; struct xen_memory_reservation reservation = { @@ -209,48 +296,68 @@ decrease_reservation(unsigned long nr_pa .domid = DOMID_SELF }; - if (nr_pages > (PAGE_SIZE / sizeof(unsigned long))) - nr_pages = PAGE_SIZE / sizeof(unsigned long); - - mfn_list = (unsigned long *)malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT); - if (mfn_list == NULL) - return ENOMEM; + if (nr_pages > ARRAY_SIZE(frame_list)) + nr_pages = ARRAY_SIZE(frame_list); for (i = 0; i < nr_pages; i++) { int color = 0; if ((page = vm_page_alloc(NULL, color++, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | + VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { nr_pages = i; need_sleep = 1; break; } + pfn = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); - mfn_list[i] = PFNTOMFN(pfn); + frame_list[i] = PFNTOMFN(pfn); + +#if 0 + if (!PageHighMem(page)) { + v = phys_to_virt(pfn << PAGE_SHIFT); + scrub_pages(v, 1); +#ifdef CONFIG_XEN + ret = HYPERVISOR_update_va_mapping( + (unsigned long)v, __pte_ma(0), 0); + BUG_ON(ret); +#endif + } +#endif +#ifdef CONFIG_XEN_SCRUB_PAGES + else { + v = kmap(page); + scrub_pages(v, 1); + kunmap(page); + } +#endif } - balloon_lock(flags); +#ifdef CONFIG_XEN + /* Ensure that ballooned highmem pages don't have kmaps. */ + kmap_flush_unused(); + flush_tlb_all(); +#endif + + mtx_lock(&balloon_lock); /* No more mappings: invalidate P2M and add to balloon. */ for (i = 0; i < nr_pages; i++) { - pfn = MFNTOPFN(mfn_list[i]); - PFNTOMFN(pfn) = INVALID_P2M_ENTRY; + pfn = MFNTOPFN(frame_list[i]); + set_phys_to_machine(pfn, INVALID_P2M_ENTRY); balloon_append(PHYS_TO_VM_PAGE(pfn << PAGE_SHIFT)); } - reservation.extent_start = mfn_list; + set_xen_guest_handle(reservation.extent_start, frame_list); reservation.nr_extents = nr_pages; ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); - PANIC_IF(ret != nr_pages); + KASSERT(ret == nr_pages, ("HYPERVISOR_memory_op failed")); - current_pages -= nr_pages; - totalram_pages = current_pages; - - balloon_unlock(flags); + bs.current_pages -= nr_pages; + //totalram_pages = bs.current_pages; - free(mfn_list, M_DEVBUF); + mtx_unlock(&balloon_lock); - return need_sleep; + return (need_sleep); } /* @@ -265,27 +372,24 @@ balloon_process(void *unused) int need_sleep = 0; long credit; + mtx_lock(&balloon_mutex); for (;;) { do { - credit = current_target() - current_pages; + credit = current_target() - bs.current_pages; if (credit > 0) need_sleep = (increase_reservation(credit) != 0); if (credit < 0) need_sleep = (decrease_reservation(-credit) != 0); -#ifndef CONFIG_PREEMPT - if (need_resched()) - schedule(); -#endif } while ((credit != 0) && !need_sleep); /* Schedule more work if there is some still to be done. */ - if (current_target() != current_pages) - timeout(balloon_alarm, NULL, ticks + HZ); + if (current_target() != bs.current_pages) + timeout(balloon_alarm, NULL, ticks + hz); - msleep(balloon_process, balloon_lock, 0, "balloon", -1); + msleep(balloon_process, &balloon_mutex, 0, "balloon", -1); } - + mtx_unlock(&balloon_mutex); } /* Resets the Xen limit, sets new target, and kicks off processing. */ @@ -293,8 +397,8 @@ static void set_new_target(unsigned long target) { /* No need for lock. Not read-modify-write updates. */ - hard_limit = ~0UL; - target_pages = target; + bs.hard_limit = ~0UL; + bs.target_pages = max(target, minimum_target()); wakeup(balloon_process); } @@ -311,8 +415,9 @@ watch_target(struct xenbus_watch *watch, unsigned long long new_target; int err; - err = xenbus_scanf(NULL, "memory", "target", "%llu", &new_target); - if (err != 1) { + err = xenbus_scanf(XBT_NIL, "memory", "target", NULL, + "%llu", &new_target); + if (err) { /* This is ok (for domain0 at least) - so just return */ return; } @@ -325,7 +430,7 @@ watch_target(struct xenbus_watch *watch, } static void -balloon_init_watcher(void *) +balloon_init_watcher(void *arg) { int err; @@ -334,48 +439,60 @@ balloon_init_watcher(void *) printf("Failed to set balloon watcher\n"); } +SYSINIT(balloon_init_watcher, SI_SUB_PSEUDO, SI_ORDER_ANY, + balloon_init_watcher, NULL); static void -balloon_init(void *) +balloon_init(void *arg) { - unsigned long pfn; - struct page *page; +#ifndef XENHVM + vm_page_t page; +#endif - IPRINTK("Initialising balloon driver.\n"); + if (!is_running_on_xen()) + return; - if (xen_init() < 0) - return -1; - - current_pages = min(xen_start_info->nr_pages, max_pfn); - target_pages = current_pages; - balloon_low = 0; - balloon_high = 0; - driver_pages = 0UL; - hard_limit = ~0UL; - - init_timer(&balloon_timer); - balloon_timer.data = 0; - balloon_timer.function = balloon_alarm; + mtx_init(&balloon_lock, "balloon_lock", NULL, MTX_DEF); + mtx_init(&balloon_mutex, "balloon_mutex", NULL, MTX_DEF); + +#ifndef XENHVM + bs.current_pages = min(xen_start_info->nr_pages, max_pfn); +#else + bs.current_pages = physmem; +#endif + bs.target_pages = bs.current_pages; + bs.balloon_low = 0; + bs.balloon_high = 0; + bs.driver_pages = 0UL; + bs.hard_limit = ~0UL; + + kproc_create(balloon_process, NULL, NULL, 0, 0, "balloon"); +// init_timer(&balloon_timer); +// balloon_timer.data = 0; +// balloon_timer.function = balloon_alarm; +#ifndef XENHVM /* Initialise the balloon with excess memory space. */ for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) { page = PHYS_TO_VM_PAGE(pfn << PAGE_SHIFT); balloon_append(page); } +#endif target_watch.callback = watch_target; - return 0; + return; } +SYSINIT(balloon_init, SI_SUB_PSEUDO, SI_ORDER_ANY, balloon_init, NULL); + +void balloon_update_driver_allowance(long delta); void balloon_update_driver_allowance(long delta) { - unsigned long flags; - - balloon_lock(flags); - driver_pages += delta; - balloon_unlock(flags); + mtx_lock(&balloon_lock); + bs.driver_pages += delta; + mtx_unlock(&balloon_lock); } #if 0 @@ -393,17 +510,18 @@ static int dealloc_pte_fn( set_pte_at(&init_mm, addr, pte, __pte_ma(0)); set_phys_to_machine(__pa(addr) >> PAGE_SHIFT, INVALID_P2M_ENTRY); ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); - PANIC_IF(ret != 1); + KASSERT(ret == 1, ("HYPERVISOR_memory_op failed")); return 0; } #endif + +#if 0 vm_page_t balloon_alloc_empty_page_range(unsigned long nr_pages) { - unsigned long flags; vm_page_t pages; - int i; + int i, rc; unsigned long *mfn_list; struct xen_memory_reservation reservation = { .address_bits = 0, @@ -422,7 +540,9 @@ balloon_alloc_empty_page_range(unsigned PFNTOMFN(i) = INVALID_P2M_ENTRY; reservation.extent_start = mfn_list; reservation.nr_extents = nr_pages; - PANIC_IF(HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation) != nr_pages); + rc = HYPERVISOR_memory_op(XENMEM_decrease_reservation, + &reservation); + KASSERT(rc == nr_pages, ("HYPERVISOR_memory_op failed")); } current_pages -= nr_pages; @@ -435,12 +555,11 @@ balloon_alloc_empty_page_range(unsigned void balloon_dealloc_empty_page_range(vm_page_t page, unsigned long nr_pages) { - unsigned long i, flags; + unsigned long i; for (i = 0; i < nr_pages; i++) balloon_append(page + i); wakeup(balloon_process); } - #endif Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Wed Mar 11 14:55:04 2009 (r189698) +++ head/sys/dev/xen/blkfront/blkfront.c Wed Mar 11 15:30:12 2009 (r189699) @@ -40,17 +40,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include +#include #include #include +#include #include #include #include #include -#include -#include #include @@ -106,7 +106,7 @@ static char * blkif_status_name[] = { #endif #define WPRINTK(fmt, args...) printf("[XEN] " fmt, ##args) #if 0 -#define DPRINTK(fmt, args...) printf("[XEN] %s:%d" fmt ".\n", __FUNCTION__, __LINE__,##args) +#define DPRINTK(fmt, args...) printf("[XEN] %s:%d: " fmt ".\n", __func__, __LINE__, ##args) #else #define DPRINTK(fmt, args...) #endif @@ -138,7 +138,6 @@ pfn_to_mfn(vm_paddr_t pfn) return (phystomach(pfn << PAGE_SHIFT) >> PAGE_SHIFT); } - /* * Translate Linux major/minor to an appropriate name and unit * number. For HVM guests, this allows us to use the same drive names @@ -323,17 +322,17 @@ blkfront_probe(device_t dev) static int blkfront_attach(device_t dev) { - int err, vdevice, i, unit; + int error, vdevice, i, unit; struct blkfront_info *info; const char *name; /* FIXME: Use dynamic device id if this is not set. */ - err = xenbus_scanf(XBT_NIL, xenbus_get_node(dev), + error = xenbus_scanf(XBT_NIL, xenbus_get_node(dev), "virtual-device", NULL, "%i", &vdevice); - if (err) { - xenbus_dev_fatal(dev, err, "reading virtual-device"); + if (error) { + xenbus_dev_fatal(dev, error, "reading virtual-device"); printf("couldn't find virtual device"); - return (err); + return (error); } blkfront_vdevice_to_unit(vdevice, &unit, &name); @@ -362,9 +361,22 @@ blkfront_attach(device_t dev) /* Front end dir is a number, which is used as the id. */ info->handle = strtoul(strrchr(xenbus_get_node(dev),'/')+1, NULL, 0); - err = talk_to_backend(dev, info); - if (err) - return (err); + error = talk_to_backend(dev, info); + if (error) + return (error); + + return (0); +} + +static int +blkfront_suspend(device_t dev) +{ + struct blkfront_info *info = device_get_softc(dev); + + /* Prevent new requests being issued until we fix things up. */ + mtx_lock(&blkif_io_lock); + info->connected = BLKIF_STATE_SUSPENDED; + mtx_unlock(&blkif_io_lock); return (0); } @@ -375,16 +387,14 @@ blkfront_resume(device_t dev) struct blkfront_info *info = device_get_softc(dev); int err; - DPRINTK("blkfront_resume: %s\n", dev->nodename); + DPRINTK("blkfront_resume: %s\n", xenbus_get_node(dev)); blkif_free(info, 1); - err = talk_to_backend(dev, info); - if (info->connected == BLKIF_STATE_SUSPENDED && !err) blkif_recover(info); - return err; + return (err); } /* Common code used when first setting up, and when resuming. */ @@ -425,6 +435,7 @@ talk_to_backend(device_t dev, struct blk message = "writing protocol"; goto abort_transaction; } + err = xenbus_transaction_end(xbt, 0); if (err) { if (err == EAGAIN) @@ -462,8 +473,8 @@ setup_blkring(device_t dev, struct blkfr SHARED_RING_INIT(sring); FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE); - error = xenbus_grant_ring(dev, (vtomach(info->ring.sring) >> PAGE_SHIFT), - &info->ring_ref); + error = xenbus_grant_ring(dev, + (vtomach(info->ring.sring) >> PAGE_SHIFT), &info->ring_ref); if (error) { free(sring, M_DEVBUF); info->ring.sring = NULL; @@ -471,11 +482,11 @@ setup_blkring(device_t dev, struct blkfr } error = bind_listening_port_to_irqhandler(xenbus_get_otherend_id(dev), - "xbd", (driver_intr_t *)blkif_int, info, - INTR_TYPE_BIO | INTR_MPSAFE, &info->irq); + "xbd", (driver_intr_t *)blkif_int, info, + INTR_TYPE_BIO | INTR_MPSAFE, &info->irq); if (error) { xenbus_dev_fatal(dev, error, - "bind_evtchn_to_irqhandler failed"); + "bind_evtchn_to_irqhandler failed"); goto fail; } @@ -494,7 +505,7 @@ blkfront_backend_changed(device_t dev, X { struct blkfront_info *info = device_get_softc(dev); - DPRINTK("blkfront:backend_changed.\n"); + DPRINTK("backend_state=%d\n", backend_state); switch (backend_state) { case XenbusStateUnknown: @@ -707,7 +718,7 @@ blkif_open(struct disk *dp) struct xb_softc *sc = (struct xb_softc *)dp->d_drv1; if (sc == NULL) { - printk("xb%d: not found", sc->xb_unit); + printf("xb%d: not found", sc->xb_unit); return (ENXIO); } @@ -1019,9 +1030,11 @@ blkif_recover(struct blkfront_info *info blkif_request_t *req; struct blk_shadow *copy; + if (!info->sc) + return; + /* Stage 1: Make a safe copy of the shadow state. */ copy = (struct blk_shadow *)malloc(sizeof(info->shadow), M_DEVBUF, M_NOWAIT|M_ZERO); - PANIC_IF(copy == NULL); memcpy(copy, info->shadow, sizeof(info->shadow)); /* Stage 2: Set up free list. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 16:32:01 2009 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 2094D106566B; Wed, 11 Mar 2009 16:32:01 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EECE8FC19; Wed, 11 Mar 2009 16:32:01 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BGW0iK000900; Wed, 11 Mar 2009 16:32:00 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BGW08Z000899; Wed, 11 Mar 2009 16:32:00 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200903111632.n2BGW08Z000899@svn.freebsd.org> From: Poul-Henning Kamp Date: Wed, 11 Mar 2009 16:32: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: r189700 - head/sbin/recoverdisk 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 Mar 2009 16:32:01 -0000 Author: phk Date: Wed Mar 11 16:32:00 2009 New Revision: 189700 URL: http://svn.freebsd.org/changeset/base/189700 Log: Fix printf warnings on amd64 etc. Modified: head/sbin/recoverdisk/recoverdisk.c Modified: head/sbin/recoverdisk/recoverdisk.c ============================================================================== --- head/sbin/recoverdisk/recoverdisk.c Wed Mar 11 15:30:12 2009 (r189699) +++ head/sbin/recoverdisk/recoverdisk.c Wed Mar 11 16:32:00 2009 (r189700) @@ -221,7 +221,7 @@ main(int argc, char * const argv[]) medsize = bigsize >> (ch / 2); medsize = (medsize / minsize) * minsize; - fprintf(stderr, "Bigsize = %u, medsize = %u, minsize = %u\n", + fprintf(stderr, "Bigsize = %zu, medsize = %zu, minsize = %zu\n", bigsize, medsize, minsize); buf = malloc(bigsize); From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 17:14:17 2009 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 C7D971065687; Wed, 11 Mar 2009 17:14:17 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4A6D8FC13; Wed, 11 Mar 2009 17:14:17 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BHEHDk001713; Wed, 11 Mar 2009 17:14:17 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BHEHxp001708; Wed, 11 Mar 2009 17:14:17 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903111714.n2BHEHxp001708@svn.freebsd.org> From: Sam Leffler Date: Wed, 11 Mar 2009 17:14: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: r189701 - head/tools/tools/ath/athregs 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 Mar 2009 17:14:19 -0000 Author: sam Date: Wed Mar 11 17:14:17 2009 New Revision: 189701 URL: http://svn.freebsd.org/changeset/base/189701 Log: add %b format strings for use by athdecode Modified: head/tools/tools/ath/athregs/dumpregs.h head/tools/tools/ath/athregs/dumpregs_5210.c head/tools/tools/ath/athregs/dumpregs_5211.c head/tools/tools/ath/athregs/dumpregs_5212.c head/tools/tools/ath/athregs/dumpregs_5416.c Modified: head/tools/tools/ath/athregs/dumpregs.h ============================================================================== --- head/tools/tools/ath/athregs/dumpregs.h Wed Mar 11 16:32:00 2009 (r189700) +++ head/tools/tools/ath/athregs/dumpregs.h Wed Mar 11 17:14:17 2009 (r189701) @@ -36,6 +36,7 @@ struct dumpreg { uint32_t addr; const char *name; + const char *bits; int type; u_int srevMin, srevMax; u_int phyMin, phyMax; @@ -61,6 +62,30 @@ enum { DUMP_ALL = 0xffff }; +#define _DEFREG(_addr, _name, _type) \ + { .addr = _addr, .name = _name, .type = _type } +#define _DEFREGx(_addr, _name, _type, _srevmin, _srevmax) \ + { .addr = _addr, .name = _name, .type = _type, \ + .srevMin = _srevmin, .srevMax = _srevmax } +#define _DEFREGfmt(_addr, _name, _type, _fmt) \ + { .addr = _addr, .name = _name, .type = _type, .bits = _fmt } +#define DEFVOID(_addr, _name) _DEFREG(_addr, _name, 0) +#define DEFVOIDx(_addr, _name, _smin, _smax) \ + __DEFREGx(_addr, _name, _smin, _smax, 0) +#define DEFVOIDfmt(_addr, _name, _fmt) \ + _DEFREGfmt(_addr, _name, 0, _fmt) +#define DEFBASIC(_addr, _name) _DEFREG(_addr, _name, DUMP_BASIC) +#define DEFBASICfmt(_addr, _name, _fmt) \ + _DEFREGfmt(_addr, _name, DUMP_BASIC, _fmt) +#define DEFBASICx(_addr, _name, _smin, _smax) \ + _DEFREGx(_addr, _name, DUMP_BASIC, _smin, _smax) +#define DEFBB(_addr, _name) _DEFREG(_addr, _name, DUMP_BASEBAND) +#define DEFINT(_addr, _name) _DEFREG(_addr, _name, DUMP_INTERRUPT) +#define DEFINTfmt(_addr, _name, _fmt) \ + _DEFREGfmt(_addr, _name, DUMP_INTERRUPT, _fmt) +#define DEFQCU(_addr, _name) _DEFREG(_addr, _name, DUMP_QCU) +#define DEFDCU(_addr, _name) _DEFREG(_addr, _name, DUMP_DCU) + void register_regs(struct dumpreg *_regs, u_int _nregs, int def_srev_min, int def_srev_max, int def_phy_min, int def_phy_max); Modified: head/tools/tools/ath/athregs/dumpregs_5210.c ============================================================================== --- head/tools/tools/ath/athregs/dumpregs_5210.c Wed Mar 11 16:32:00 2009 (r189700) +++ head/tools/tools/ath/athregs/dumpregs_5210.c Wed Mar 11 17:14:17 2009 (r189701) @@ -33,83 +33,85 @@ #include "ah.h" #include "ah_internal.h" #include "ar5210/ar5210reg.h" +#include "ar5210/ar5210phy.h" #include "dumpregs.h" #define N(a) (sizeof(a) / sizeof(a[0])) static struct dumpreg ar5210regs[] = { - { AR_TXDP0, "TXDP0", DUMP_BASIC }, - { AR_TXDP1, "TXDP1", DUMP_BASIC }, - { AR_CR, "CR", DUMP_BASIC }, - { AR_RXDP, "RXDP", DUMP_BASIC }, - { AR_CFG, "CFG", DUMP_BASIC }, -#if 0 /* read clears pending interrupts */ - { AR_ISR, "ISR", DUMP_INTERRUPT }, -#endif - { AR_IMR, "IMR", DUMP_BASIC }, - { AR_IER, "IER", DUMP_BASIC }, - { AR_BCR, "BCR", DUMP_BASIC }, - { AR_BSR, "BSR", DUMP_BASIC }, - { AR_TXCFG, "TXCFG", DUMP_BASIC }, - { AR_RXCFG, "RXCFG", DUMP_BASIC }, - { AR_MIBC, "MIBC", DUMP_BASIC }, - { AR_TOPS, "TOPS", DUMP_BASIC }, - { AR_RXNOFRM, "RXNOFR", DUMP_BASIC }, - { AR_TXNOFRM, "TXNOFR", DUMP_BASIC }, - { AR_RPGTO, "RPGTO", DUMP_BASIC }, - { AR_RFCNT, "RFCNT", DUMP_BASIC }, - { AR_MISC, "MISC", DUMP_BASIC }, - { AR_RC, "RC", DUMP_BASIC }, - { AR_SCR, "SCR", DUMP_BASIC }, - { AR_INTPEND, "INTPEND", DUMP_BASIC }, - { AR_SFR, "SFR", DUMP_BASIC }, - { AR_PCICFG, "PCICFG", DUMP_BASIC }, - { AR_GPIOCR, "GPIOCR", DUMP_BASIC }, -#if 0 - { AR_GPIODO, "GPIODO", DUMP_BASIC }, - { AR_GPIODI, "GPIODI", DUMP_BASIC }, -#endif - { AR_SREV, "SREV", DUMP_BASIC }, - { AR_STA_ID0, "STA_ID0", DUMP_BASIC }, - { AR_STA_ID1, "STA_ID1", DUMP_BASIC }, - { AR_BSS_ID0, "BSS_ID0", DUMP_BASIC }, - { AR_BSS_ID1, "BSS_ID1", DUMP_BASIC }, - { AR_SLOT_TIME, "SLOTTIME", DUMP_BASIC }, - { AR_TIME_OUT, "TIME_OUT", DUMP_BASIC }, - { AR_RSSI_THR, "RSSI_THR", DUMP_BASIC }, - { AR_RETRY_LMT, "RETRY_LM", DUMP_BASIC }, - { AR_USEC, "USEC", DUMP_BASIC }, - { AR_BEACON, "BEACON", DUMP_BASIC }, - { AR_CFP_PERIOD, "CFP_PER", DUMP_BASIC }, - { AR_TIMER0, "TIMER0", DUMP_BASIC }, - { AR_TIMER1, "TIMER1", DUMP_BASIC }, - { AR_TIMER2, "TIMER2", DUMP_BASIC }, - { AR_TIMER3, "TIMER3", DUMP_BASIC }, - { AR_IFS0, "IFS0", DUMP_BASIC }, - { AR_IFS1, "IFS1" , DUMP_BASIC }, - { AR_CFP_DUR, "CFP_DUR", DUMP_BASIC }, - { AR_RX_FILTER, "RXFILTER", DUMP_BASIC }, - { AR_MCAST_FIL0, "MCAST_0", DUMP_BASIC }, - { AR_MCAST_FIL1, "MCAST_1", DUMP_BASIC }, - { AR_TX_MASK0, "TX_MASK0", DUMP_BASIC }, - { AR_TX_MASK1, "TX_MASK1", DUMP_BASIC }, -#if 0 - { AR_CLR_TMASK, "CLR_TMASK", DUMP_BASIC }, -#endif - { AR_TRIG_LEV, "TRIG_LEV", DUMP_BASIC }, - { AR_DIAG_SW, "DIAG_SW", DUMP_BASIC }, - { AR_TSF_L32, "TSF_L32", DUMP_BASIC }, - { AR_TSF_U32, "TSF_U32", DUMP_BASIC }, - { AR_LAST_TSTP, "LAST_TST", DUMP_BASIC }, - { AR_RETRY_CNT, "RETRYCNT", DUMP_BASIC }, - { AR_BACKOFF, "BACKOFF", DUMP_BASIC }, - { AR_NAV, "NAV", DUMP_BASIC }, - { AR_RTS_OK, "RTS_OK", DUMP_BASIC }, - { AR_RTS_FAIL, "RTS_FAIL", DUMP_BASIC }, - { AR_ACK_FAIL, "ACK_FAIL", DUMP_BASIC }, - { AR_FCS_FAIL, "FCS_FAIL", DUMP_BASIC }, - { AR_BEACON_CNT, "BEAC_CNT", DUMP_BASIC }, + DEFBASIC(AR_TXDP0, "TXDP0"), + DEFBASIC(AR_TXDP1, "TXDP1"), + DEFBASICfmt(AR_CR, "CR", AR_CR_BITS), + DEFBASIC(AR_RXDP, "RXDP"), + DEFBASICfmt(AR_CFG, "CFG", AR_CFG_BITS), + /* NB: read clears pending interrupts */ + DEFVOIDfmt(AR_ISR, "ISR", AR_ISR_BITS), + DEFBASICfmt(AR_IMR, "IMR", AR_IMR_BITS), + DEFBASICfmt(AR_IER, "IER", AR_IER_BITS), + DEFBASICfmt(AR_BCR, "BCR", AR_BCR_BITS), + DEFBASICfmt(AR_BSR, "BSR", AR_BSR_BITS), + DEFBASICfmt(AR_TXCFG, "TXCFG", AR_TXCFG_BITS), + DEFBASIC(AR_RXCFG, "RXCFG"), + DEFBASIC(AR_MIBC, "MIBC"), + DEFBASIC(AR_TOPS, "TOPS"), + DEFBASIC(AR_RXNOFRM, "RXNOFR"), + DEFBASIC(AR_TXNOFRM, "TXNOFR"), + DEFBASIC(AR_RPGTO, "RPGTO"), + DEFBASIC(AR_RFCNT, "RFCNT"), + DEFBASIC(AR_MISC, "MISC"), + DEFBASICfmt(AR_RC, "RC", AR_RC_BITS), + DEFBASICfmt(AR_SCR, "SCR", AR_SCR_BITS), + DEFBASICfmt(AR_INTPEND, "INTPEND", AR_INTPEND_BITS), + DEFBASIC(AR_SFR, "SFR"), + DEFBASICfmt(AR_PCICFG, "PCICFG", AR_PCICFG_BITS), + DEFBASIC(AR_GPIOCR, "GPIOCR"), + DEFVOID(AR_GPIODO, "GPIODO"), + DEFVOID(AR_GPIODI, "GPIODI"), + DEFBASIC(AR_SREV, "SREV"), + DEFBASIC(AR_STA_ID0, "STA_ID0"), + DEFBASICfmt(AR_STA_ID1, "STA_ID1", AR_STA_ID1_BITS), + DEFBASIC(AR_BSS_ID0, "BSS_ID0"), + DEFBASIC(AR_BSS_ID1, "BSS_ID1"), + DEFBASIC(AR_SLOT_TIME, "SLOTTIME"), + DEFBASIC(AR_TIME_OUT, "TIME_OUT"), + DEFBASIC(AR_RSSI_THR, "RSSI_THR"), + DEFBASIC(AR_RETRY_LMT, "RETRY_LM"), + DEFBASIC(AR_USEC, "USEC"), + DEFBASICfmt(AR_BEACON, "BEACON", AR_BEACON_BITS), + DEFBASIC(AR_CFP_PERIOD, "CFP_PER"), + DEFBASIC(AR_TIMER0, "TIMER0"), + DEFBASIC(AR_TIMER1, "TIMER1"), + DEFBASIC(AR_TIMER2, "TIMER2"), + DEFBASIC(AR_TIMER3, "TIMER3"), + DEFBASIC(AR_IFS0, "IFS0"), + DEFBASIC(AR_IFS1, "IFS1" ), + DEFBASIC(AR_CFP_DUR, "CFP_DUR"), + DEFBASICfmt(AR_RX_FILTER, "RXFILTER", AR_BEACON_BITS), + DEFBASIC(AR_MCAST_FIL0, "MCAST_0"), + DEFBASIC(AR_MCAST_FIL1, "MCAST_1"), + DEFBASIC(AR_TX_MASK0, "TX_MASK0"), + DEFBASIC(AR_TX_MASK1, "TX_MASK1"), + DEFVOID(AR_CLR_TMASK, "CLR_TMASK"), + DEFBASIC(AR_TRIG_LEV, "TRIG_LEV"), + DEFBASICfmt(AR_DIAG_SW, "DIAG_SW", AR_DIAG_SW_BITS), + DEFBASIC(AR_TSF_L32, "TSF_L32"), + DEFBASIC(AR_TSF_U32, "TSF_U32"), + DEFBASIC(AR_LAST_TSTP, "LAST_TST"), + DEFBASIC(AR_RETRY_CNT, "RETRYCNT"), + DEFBASIC(AR_BACKOFF, "BACKOFF"), + DEFBASIC(AR_NAV, "NAV"), + DEFBASIC(AR_RTS_OK, "RTS_OK"), + DEFBASIC(AR_RTS_FAIL, "RTS_FAIL"), + DEFBASIC(AR_ACK_FAIL, "ACK_FAIL"), + DEFBASIC(AR_FCS_FAIL, "FCS_FAIL"), + DEFBASIC(AR_BEACON_CNT, "BEAC_CNT"), + + DEFVOIDfmt(AR_PHY_FRCTL, "PHY_FRCTL", AR_PHY_FRCTL_BITS), + DEFVOIDfmt(AR_PHY_AGC, "PHY_AGC", AR_PHY_AGC_BITS), + DEFVOID(AR_PHY_CHIPID, "PHY_CHIPID"), + DEFVOIDfmt(AR_PHY_ACTIVE, "PHY_ACTIVE", AR_PHY_ACTIVE_BITS), + DEFVOIDfmt(AR_PHY_AGCCTL, "PHY_AGCCTL", AR_PHY_AGCCTL_BITS), }; static __constructor void Modified: head/tools/tools/ath/athregs/dumpregs_5211.c ============================================================================== --- head/tools/tools/ath/athregs/dumpregs_5211.c Wed Mar 11 16:32:00 2009 (r189700) +++ head/tools/tools/ath/athregs/dumpregs_5211.c Wed Mar 11 17:14:17 2009 (r189701) @@ -33,239 +33,251 @@ #include "ah.h" #include "ah_internal.h" #include "ar5211/ar5211reg.h" +#include "ar5211/ar5211phy.h" #include "dumpregs.h" #define N(a) (sizeof(a) / sizeof(a[0])) static struct dumpreg ar5211regs[] = { - { AR_CR, "CR", DUMP_BASIC }, - { AR_RXDP, "RXDP", DUMP_BASIC }, - { AR_CFG, "CFG", DUMP_BASIC }, - { AR_IER, "IER", DUMP_BASIC }, - { AR_RTSD0, "RTSD0", DUMP_BASIC }, - { AR_RTSD1, "RTSD1", DUMP_BASIC }, - { AR_TXCFG, "TXCFG", DUMP_BASIC }, - { AR_RXCFG, "RXCFG", DUMP_BASIC }, - { AR5211_JUMBO_LAST,"JLAST", DUMP_BASIC }, - { AR_MIBC, "MIBC", DUMP_BASIC }, - { AR_TOPS, "TOPS", DUMP_BASIC }, - { AR_RXNPTO, "RXNPTO", DUMP_BASIC }, - { AR_TXNPTO, "TXNPTO", DUMP_BASIC }, - { AR_RFGTO, "RFGTO", DUMP_BASIC }, - { AR_RFCNT, "RFCNT", DUMP_BASIC }, - { AR_MACMISC, "MISC", DUMP_BASIC }, - - { AR_ISR, "ISR", DUMP_INTERRUPT }, - { AR_ISR_S0, "ISR_S0", DUMP_INTERRUPT }, - { AR_ISR_S1, "ISR_S1", DUMP_INTERRUPT }, - { AR_ISR_S2, "ISR_S2", DUMP_INTERRUPT }, - { AR_ISR_S3, "ISR_S3", DUMP_INTERRUPT }, - { AR_ISR_S4, "ISR_S4", DUMP_INTERRUPT }, - { AR_IMR, "IMR", DUMP_INTERRUPT }, - { AR_IMR_S0, "IMR_S0", DUMP_INTERRUPT }, - { AR_IMR_S1, "IMR_S1", DUMP_INTERRUPT }, - { AR_IMR_S2, "IMR_S2", DUMP_INTERRUPT }, - { AR_IMR_S3, "IMR_S3", DUMP_INTERRUPT }, - { AR_IMR_S4, "IMR_S4", DUMP_INTERRUPT }, -#if 0 + DEFBASICfmt(AR_CR, "CR", AR_CR_BITS), + DEFBASIC(AR_RXDP, "RXDP"), + DEFBASICfmt(AR_CFG, "CFG", AR_CFG_BITS), + DEFBASICfmt(AR_IER, "IER", AR_IER_BITS), + DEFBASIC(AR_RTSD0, "RTSD0"), + DEFBASIC(AR_RTSD1, "RTSD1"), + DEFBASICfmt(AR_TXCFG, "TXCFG", AR_TXCFG_BITS), + DEFBASIC(AR_RXCFG, "RXCFG"), + DEFBASIC(AR5211_JUMBO_LAST, "JLAST"), + DEFBASIC(AR_MIBC, "MIBC"), + DEFBASIC(AR_TOPS, "TOPS"), + DEFBASIC(AR_RXNPTO, "RXNPTO"), + DEFBASIC(AR_TXNPTO, "TXNPTO"), + DEFBASIC(AR_RFGTO, "RFGTO"), + DEFBASIC(AR_RFCNT, "RFCNT"), + DEFBASIC(AR_MACMISC, "MISC"), + DEFVOID(AR5311_QDCLKGATE, "AR5311_QDCLKGATE"), + + DEFINT(AR_ISR, "ISR"), + DEFINT(AR_ISR_S0, "ISR_S0"), + DEFINT(AR_ISR_S1, "ISR_S1"), + DEFINT(AR_ISR_S2, "ISR_S2"), + DEFINT(AR_ISR_S3, "ISR_S3"), + DEFINT(AR_ISR_S4, "ISR_S4"), + DEFINT(AR_IMR, "IMR"), + DEFINT(AR_IMR_S0, "IMR_S0"), + DEFINT(AR_IMR_S1, "IMR_S1"), + DEFINT(AR_IMR_S2, "IMR_S2"), + DEFINT(AR_IMR_S3, "IMR_S3"), + DEFINT(AR_IMR_S4, "IMR_S4"), /* NB: don't read the RAC so we don't affect operation */ - { AR_ISR_RAC, "ISR_RAC", DUMP_INTERRUPT }, -#endif - { AR_ISR_S0_S, "ISR_S0_S", DUMP_INTERRUPT }, - { AR_ISR_S1_S, "ISR_S1_S", DUMP_INTERRUPT }, - { AR_ISR_S2_S, "ISR_S2_S", DUMP_INTERRUPT }, - { AR_ISR_S3_S, "ISR_S3_S", DUMP_INTERRUPT }, - { AR_ISR_S4_S, "ISR_S4_S", DUMP_INTERRUPT }, - - { AR_Q0_TXDP, "Q0_TXDP", DUMP_QCU }, - { AR_Q1_TXDP, "Q1_TXDP", DUMP_QCU }, - { AR_Q2_TXDP, "Q2_TXDP", DUMP_QCU }, - { AR_Q3_TXDP, "Q3_TXDP", DUMP_QCU }, - { AR_Q4_TXDP, "Q4_TXDP", DUMP_QCU }, - { AR_Q5_TXDP, "Q5_TXDP", DUMP_QCU }, - { AR_Q6_TXDP, "Q6_TXDP", DUMP_QCU }, - { AR_Q7_TXDP, "Q7_TXDP", DUMP_QCU }, - { AR_Q8_TXDP, "Q8_TXDP", DUMP_QCU }, - { AR_Q9_TXDP, "Q9_TXDP", DUMP_QCU }, - - { AR_Q_TXE, "Q_TXE", DUMP_QCU }, - { AR_Q_TXD, "Q_TXD", DUMP_QCU }, - - { AR_Q0_CBRCFG, "Q0_CBR", DUMP_QCU }, - { AR_Q1_CBRCFG, "Q1_CBR", DUMP_QCU }, - { AR_Q2_CBRCFG, "Q2_CBR", DUMP_QCU }, - { AR_Q3_CBRCFG, "Q3_CBR", DUMP_QCU }, - { AR_Q4_CBRCFG, "Q4_CBR", DUMP_QCU }, - { AR_Q5_CBRCFG, "Q5_CBR", DUMP_QCU }, - { AR_Q6_CBRCFG, "Q6_CBR", DUMP_QCU }, - { AR_Q7_CBRCFG, "Q7_CBR", DUMP_QCU }, - { AR_Q8_CBRCFG, "Q8_CBR", DUMP_QCU }, - { AR_Q9_CBRCFG, "Q9_CBR", DUMP_QCU }, - - { AR_Q0_RDYTIMECFG, "Q0_RDYT", DUMP_QCU }, - { AR_Q1_RDYTIMECFG, "Q1_RDYT", DUMP_QCU }, - { AR_Q2_RDYTIMECFG, "Q2_RDYT", DUMP_QCU }, - { AR_Q3_RDYTIMECFG, "Q3_RDYT", DUMP_QCU }, - { AR_Q4_RDYTIMECFG, "Q4_RDYT", DUMP_QCU }, - { AR_Q5_RDYTIMECFG, "Q5_RDYT", DUMP_QCU }, - { AR_Q6_RDYTIMECFG, "Q6_RDYT", DUMP_QCU }, - { AR_Q7_RDYTIMECFG, "Q7_RDYT", DUMP_QCU }, - { AR_Q8_RDYTIMECFG, "Q8_RDYT", DUMP_QCU }, - { AR_Q9_RDYTIMECFG, "Q9_RDYT", DUMP_QCU }, - - { AR_Q_ONESHOTARM_SC,"Q_ONESHOTARM_SC", DUMP_QCU }, - { AR_Q_ONESHOTARM_CC,"Q_ONESHOTARM_CC", DUMP_QCU }, - - { AR_Q0_MISC, "Q0_MISC", DUMP_QCU }, - { AR_Q1_MISC, "Q1_MISC", DUMP_QCU }, - { AR_Q2_MISC, "Q2_MISC", DUMP_QCU }, - { AR_Q3_MISC, "Q3_MISC", DUMP_QCU }, - { AR_Q4_MISC, "Q4_MISC", DUMP_QCU }, - { AR_Q5_MISC, "Q5_MISC", DUMP_QCU }, - { AR_Q6_MISC, "Q6_MISC", DUMP_QCU }, - { AR_Q7_MISC, "Q7_MISC", DUMP_QCU }, - { AR_Q8_MISC, "Q8_MISC", DUMP_QCU }, - { AR_Q9_MISC, "Q9_MISC", DUMP_QCU }, - - { AR_Q0_STS, "Q0_STS", DUMP_QCU }, - { AR_Q1_STS, "Q1_STS", DUMP_QCU }, - { AR_Q2_STS, "Q2_STS", DUMP_QCU }, - { AR_Q3_STS, "Q3_STS", DUMP_QCU }, - { AR_Q4_STS, "Q4_STS", DUMP_QCU }, - { AR_Q5_STS, "Q5_STS", DUMP_QCU }, - { AR_Q6_STS, "Q6_STS", DUMP_QCU }, - { AR_Q7_STS, "Q7_STS", DUMP_QCU }, - { AR_Q8_STS, "Q8_STS", DUMP_QCU }, - { AR_Q9_STS, "Q9_STS", DUMP_QCU }, - - { AR_Q_RDYTIMESHDN, "Q_RDYTIMSHD", DUMP_QCU }, - - { AR_D0_QCUMASK, "D0_MASK", DUMP_DCU }, - { AR_D1_QCUMASK, "D1_MASK", DUMP_DCU }, - { AR_D2_QCUMASK, "D2_MASK", DUMP_DCU }, - { AR_D3_QCUMASK, "D3_MASK", DUMP_DCU }, - { AR_D4_QCUMASK, "D4_MASK", DUMP_DCU }, - { AR_D5_QCUMASK, "D5_MASK", DUMP_DCU }, - { AR_D6_QCUMASK, "D6_MASK", DUMP_DCU }, - { AR_D7_QCUMASK, "D7_MASK", DUMP_DCU }, - { AR_D8_QCUMASK, "D8_MASK", DUMP_DCU }, - { AR_D9_QCUMASK, "D9_MASK", DUMP_DCU }, - - { AR_D0_LCL_IFS, "D0_IFS", DUMP_DCU }, - { AR_D1_LCL_IFS, "D1_IFS", DUMP_DCU }, - { AR_D2_LCL_IFS, "D2_IFS", DUMP_DCU }, - { AR_D3_LCL_IFS, "D3_IFS", DUMP_DCU }, - { AR_D4_LCL_IFS, "D4_IFS", DUMP_DCU }, - { AR_D5_LCL_IFS, "D5_IFS", DUMP_DCU }, - { AR_D6_LCL_IFS, "D6_IFS", DUMP_DCU }, - { AR_D7_LCL_IFS, "D7_IFS", DUMP_DCU }, - { AR_D8_LCL_IFS, "D8_IFS", DUMP_DCU }, - { AR_D9_LCL_IFS, "D9_IFS", DUMP_DCU }, - - { AR_D0_RETRY_LIMIT,"D0_RTRY", DUMP_DCU }, - { AR_D1_RETRY_LIMIT,"D1_RTRY", DUMP_DCU }, - { AR_D2_RETRY_LIMIT,"D2_RTRY", DUMP_DCU }, - { AR_D3_RETRY_LIMIT,"D3_RTRY", DUMP_DCU }, - { AR_D4_RETRY_LIMIT,"D4_RTRY", DUMP_DCU }, - { AR_D5_RETRY_LIMIT,"D5_RTRY", DUMP_DCU }, - { AR_D6_RETRY_LIMIT,"D6_RTRY", DUMP_DCU }, - { AR_D7_RETRY_LIMIT,"D7_RTRY", DUMP_DCU }, - { AR_D8_RETRY_LIMIT,"D8_RTRY", DUMP_DCU }, - { AR_D9_RETRY_LIMIT,"D9_RTRY", DUMP_DCU }, - - { AR_D0_CHNTIME, "D0_CHNT", DUMP_DCU }, - { AR_D1_CHNTIME, "D1_CHNT", DUMP_DCU }, - { AR_D2_CHNTIME, "D2_CHNT", DUMP_DCU }, - { AR_D3_CHNTIME, "D3_CHNT", DUMP_DCU }, - { AR_D4_CHNTIME, "D4_CHNT", DUMP_DCU }, - { AR_D5_CHNTIME, "D5_CHNT", DUMP_DCU }, - { AR_D6_CHNTIME, "D6_CHNT", DUMP_DCU }, - { AR_D7_CHNTIME, "D7_CHNT", DUMP_DCU }, - { AR_D8_CHNTIME, "D8_CHNT", DUMP_DCU }, - { AR_D9_CHNTIME, "D9_CHNT", DUMP_DCU }, - - { AR_D0_MISC, "D0_MISC", DUMP_DCU }, - { AR_D1_MISC, "D1_MISC", DUMP_DCU }, - { AR_D2_MISC, "D2_MISC", DUMP_DCU }, - { AR_D3_MISC, "D3_MISC", DUMP_DCU }, - { AR_D4_MISC, "D4_MISC", DUMP_DCU }, - { AR_D5_MISC, "D5_MISC", DUMP_DCU }, - { AR_D6_MISC, "D6_MISC", DUMP_DCU }, - { AR_D7_MISC, "D7_MISC", DUMP_DCU }, - { AR_D8_MISC, "D8_MISC", DUMP_DCU }, - { AR_D9_MISC, "D9_MISC", DUMP_DCU }, - - { AR_D0_SEQNUM, "D0_SEQ", DUMP_DCU }, - { AR_D1_SEQNUM, "D1_SEQ", DUMP_DCU }, - { AR_D2_SEQNUM, "D2_SEQ", DUMP_DCU }, - { AR_D3_SEQNUM, "D3_SEQ", DUMP_DCU }, - { AR_D4_SEQNUM, "D4_SEQ", DUMP_DCU }, - { AR_D5_SEQNUM, "D5_SEQ", DUMP_DCU }, - { AR_D6_SEQNUM, "D6_SEQ", DUMP_DCU }, - { AR_D7_SEQNUM, "D7_SEQ", DUMP_DCU }, - { AR_D8_SEQNUM, "D8_SEQ", DUMP_DCU }, - { AR_D9_SEQNUM, "D9_SEQ", DUMP_DCU }, - - { AR_D_GBL_IFS_SIFS,"D_SIFS", DUMP_BASIC }, - { AR_D_GBL_IFS_SLOT,"D_SLOT", DUMP_BASIC }, - { AR_D_GBL_IFS_EIFS,"D_EIFS", DUMP_BASIC }, - { AR_D_GBL_IFS_MISC,"D_MISC", DUMP_BASIC }, - { AR_D_FPCTL, "D_FPCTL", DUMP_BASIC }, - { AR_D_TXPSE, "D_TXPSE", DUMP_BASIC }, -#if 0 - { AR_D_TXBLK_CMD, "D_CMD", DUMP_BASIC }, - { AR_D_TXBLK_DATA, "D_DATA", DUMP_BASIC }, - { AR_D_TXBLK_CLR, "D_CLR", DUMP_BASIC }, - { AR_D_TXBLK_SET, "D_SET", DUMP_BASIC }, -#endif - { AR_RC, "RC", DUMP_BASIC }, - { AR_SCR, "SCR", DUMP_BASIC }, - { AR_INTPEND, "INTPEND", DUMP_BASIC }, - { AR_SFR, "SFR", DUMP_BASIC }, - { AR_PCICFG, "PCICFG", DUMP_BASIC }, - { AR_GPIOCR, "GPIOCR", DUMP_BASIC }, - { AR_GPIODO, "GPIODO", DUMP_BASIC }, - { AR_GPIODI, "GPIODI", DUMP_BASIC }, - { AR_SREV, "SREV", DUMP_BASIC }, + DEFVOID(AR_ISR_RAC, "ISR_RAC"), + DEFINT(AR_ISR_S0_S, "ISR_S0_S"), + DEFINT(AR_ISR_S1_S, "ISR_S1_S"), + DEFINT(AR_ISR_S2_S, "ISR_S2_S"), + DEFINT(AR_ISR_S3_S, "ISR_S3_S"), + DEFINT(AR_ISR_S4_S, "ISR_S4_S"), + + DEFQCU(AR_Q0_TXDP, "Q0_TXDP"), + DEFQCU(AR_Q1_TXDP, "Q1_TXDP"), + DEFQCU(AR_Q2_TXDP, "Q2_TXDP"), + DEFQCU(AR_Q3_TXDP, "Q3_TXDP"), + DEFQCU(AR_Q4_TXDP, "Q4_TXDP"), + DEFQCU(AR_Q5_TXDP, "Q5_TXDP"), + DEFQCU(AR_Q6_TXDP, "Q6_TXDP"), + DEFQCU(AR_Q7_TXDP, "Q7_TXDP"), + DEFQCU(AR_Q8_TXDP, "Q8_TXDP"), + DEFQCU(AR_Q9_TXDP, "Q9_TXDP"), + + DEFQCU(AR_Q_TXE, "Q_TXE"), + DEFQCU(AR_Q_TXD, "Q_TXD"), + + DEFQCU(AR_Q0_CBRCFG, "Q0_CBR"), + DEFQCU(AR_Q1_CBRCFG, "Q1_CBR"), + DEFQCU(AR_Q2_CBRCFG, "Q2_CBR"), + DEFQCU(AR_Q3_CBRCFG, "Q3_CBR"), + DEFQCU(AR_Q4_CBRCFG, "Q4_CBR"), + DEFQCU(AR_Q5_CBRCFG, "Q5_CBR"), + DEFQCU(AR_Q6_CBRCFG, "Q6_CBR"), + DEFQCU(AR_Q7_CBRCFG, "Q7_CBR"), + DEFQCU(AR_Q8_CBRCFG, "Q8_CBR"), + DEFQCU(AR_Q9_CBRCFG, "Q9_CBR"), + + DEFQCU(AR_Q0_RDYTIMECFG, "Q0_RDYT"), + DEFQCU(AR_Q1_RDYTIMECFG, "Q1_RDYT"), + DEFQCU(AR_Q2_RDYTIMECFG, "Q2_RDYT"), + DEFQCU(AR_Q3_RDYTIMECFG, "Q3_RDYT"), + DEFQCU(AR_Q4_RDYTIMECFG, "Q4_RDYT"), + DEFQCU(AR_Q5_RDYTIMECFG, "Q5_RDYT"), + DEFQCU(AR_Q6_RDYTIMECFG, "Q6_RDYT"), + DEFQCU(AR_Q7_RDYTIMECFG, "Q7_RDYT"), + DEFQCU(AR_Q8_RDYTIMECFG, "Q8_RDYT"), + DEFQCU(AR_Q9_RDYTIMECFG, "Q9_RDYT"), + + DEFQCU(AR_Q_ONESHOTARM_SC, "Q_ONESHOTARM_SC"), + DEFQCU(AR_Q_ONESHOTARM_CC, "Q_ONESHOTARM_CC"), + + DEFQCU(AR_Q0_MISC, "Q0_MISC"), + DEFQCU(AR_Q1_MISC, "Q1_MISC"), + DEFQCU(AR_Q2_MISC, "Q2_MISC"), + DEFQCU(AR_Q3_MISC, "Q3_MISC"), + DEFQCU(AR_Q4_MISC, "Q4_MISC"), + DEFQCU(AR_Q5_MISC, "Q5_MISC"), + DEFQCU(AR_Q6_MISC, "Q6_MISC"), + DEFQCU(AR_Q7_MISC, "Q7_MISC"), + DEFQCU(AR_Q8_MISC, "Q8_MISC"), + DEFQCU(AR_Q9_MISC, "Q9_MISC"), + + DEFQCU(AR_Q0_STS, "Q0_STS"), + DEFQCU(AR_Q1_STS, "Q1_STS"), + DEFQCU(AR_Q2_STS, "Q2_STS"), + DEFQCU(AR_Q3_STS, "Q3_STS"), + DEFQCU(AR_Q4_STS, "Q4_STS"), + DEFQCU(AR_Q5_STS, "Q5_STS"), + DEFQCU(AR_Q6_STS, "Q6_STS"), + DEFQCU(AR_Q7_STS, "Q7_STS"), + DEFQCU(AR_Q8_STS, "Q8_STS"), + DEFQCU(AR_Q9_STS, "Q9_STS"), + + DEFQCU(AR_Q_RDYTIMESHDN, "Q_RDYTIMSHD"), + + DEFQCU(AR_D0_QCUMASK, "D0_MASK"), + DEFQCU(AR_D1_QCUMASK, "D1_MASK"), + DEFQCU(AR_D2_QCUMASK, "D2_MASK"), + DEFQCU(AR_D3_QCUMASK, "D3_MASK"), + DEFQCU(AR_D4_QCUMASK, "D4_MASK"), + DEFQCU(AR_D5_QCUMASK, "D5_MASK"), + DEFQCU(AR_D6_QCUMASK, "D6_MASK"), + DEFQCU(AR_D7_QCUMASK, "D7_MASK"), + DEFQCU(AR_D8_QCUMASK, "D8_MASK"), + DEFQCU(AR_D9_QCUMASK, "D9_MASK"), + + DEFDCU(AR_D0_LCL_IFS, "D0_IFS"), + DEFDCU(AR_D1_LCL_IFS, "D1_IFS"), + DEFDCU(AR_D2_LCL_IFS, "D2_IFS"), + DEFDCU(AR_D3_LCL_IFS, "D3_IFS"), + DEFDCU(AR_D4_LCL_IFS, "D4_IFS"), + DEFDCU(AR_D5_LCL_IFS, "D5_IFS"), + DEFDCU(AR_D6_LCL_IFS, "D6_IFS"), + DEFDCU(AR_D7_LCL_IFS, "D7_IFS"), + DEFDCU(AR_D8_LCL_IFS, "D8_IFS"), + DEFDCU(AR_D9_LCL_IFS, "D9_IFS"), + + DEFDCU(AR_D0_RETRY_LIMIT, "D0_RTRY"), + DEFDCU(AR_D1_RETRY_LIMIT, "D1_RTRY"), + DEFDCU(AR_D2_RETRY_LIMIT, "D2_RTRY"), + DEFDCU(AR_D3_RETRY_LIMIT, "D3_RTRY"), + DEFDCU(AR_D4_RETRY_LIMIT, "D4_RTRY"), + DEFDCU(AR_D5_RETRY_LIMIT, "D5_RTRY"), + DEFDCU(AR_D6_RETRY_LIMIT, "D6_RTRY"), + DEFDCU(AR_D7_RETRY_LIMIT, "D7_RTRY"), + DEFDCU(AR_D8_RETRY_LIMIT, "D8_RTRY"), + DEFDCU(AR_D9_RETRY_LIMIT, "D9_RTRY"), + + DEFDCU(AR_D0_CHNTIME, "D0_CHNT"), + DEFDCU(AR_D1_CHNTIME, "D1_CHNT"), + DEFDCU(AR_D2_CHNTIME, "D2_CHNT"), + DEFDCU(AR_D3_CHNTIME, "D3_CHNT"), + DEFDCU(AR_D4_CHNTIME, "D4_CHNT"), + DEFDCU(AR_D5_CHNTIME, "D5_CHNT"), + DEFDCU(AR_D6_CHNTIME, "D6_CHNT"), + DEFDCU(AR_D7_CHNTIME, "D7_CHNT"), + DEFDCU(AR_D8_CHNTIME, "D8_CHNT"), + DEFDCU(AR_D9_CHNTIME, "D9_CHNT"), + + DEFDCU(AR_D0_MISC, "D0_MISC"), + DEFDCU(AR_D1_MISC, "D1_MISC"), + DEFDCU(AR_D2_MISC, "D2_MISC"), + DEFDCU(AR_D3_MISC, "D3_MISC"), + DEFDCU(AR_D4_MISC, "D4_MISC"), + DEFDCU(AR_D5_MISC, "D5_MISC"), + DEFDCU(AR_D6_MISC, "D6_MISC"), + DEFDCU(AR_D7_MISC, "D7_MISC"), + DEFDCU(AR_D8_MISC, "D8_MISC"), + DEFDCU(AR_D9_MISC, "D9_MISC"), + + DEFDCU(AR_D0_SEQNUM, "D0_SEQ"), + DEFDCU(AR_D1_SEQNUM, "D1_SEQ"), + DEFDCU(AR_D2_SEQNUM, "D2_SEQ"), + DEFDCU(AR_D3_SEQNUM, "D3_SEQ"), + DEFDCU(AR_D4_SEQNUM, "D4_SEQ"), + DEFDCU(AR_D5_SEQNUM, "D5_SEQ"), + DEFDCU(AR_D6_SEQNUM, "D6_SEQ"), + DEFDCU(AR_D7_SEQNUM, "D7_SEQ"), + DEFDCU(AR_D8_SEQNUM, "D8_SEQ"), + DEFDCU(AR_D9_SEQNUM, "D9_SEQ"), + + DEFBASIC(AR_D_GBL_IFS_SIFS, "D_SIFS"), + DEFBASIC(AR_D_GBL_IFS_SLOT, "D_SLOT"), + DEFBASIC(AR_D_GBL_IFS_EIFS, "D_EIFS"), + DEFBASIC(AR_D_GBL_IFS_MISC, "D_MISC"), + DEFBASIC(AR_D_FPCTL, "D_FPCTL"), + DEFBASIC(AR_D_TXPSE, "D_TXPSE"), + DEFVOID(AR_D_TXBLK_CMD, "D_CMD"), #if 0 - { AR_EEPROM_ADDR, "EEADDR", DUMP_BASIC }, - { AR_EEPROM_DATA, "EEDATA", DUMP_BASIC }, - { AR_EEPROM_CMD, "EECMD", DUMP_BASIC }, - { AR_EEPROM_STS, "EESTS", DUMP_BASIC }, - { AR_EEPROM_CFG, "EECFG", DUMP_BASIC }, + DEFVOID(AR_D_TXBLK_DATA, "D_DATA"), #endif - { AR_STA_ID0, "STA_ID0", DUMP_BASIC }, - { AR_STA_ID1, "STA_ID1", DUMP_BASIC }, - { AR_BSS_ID0, "BSS_ID0", DUMP_BASIC }, - { AR_BSS_ID1, "BSS_ID1", DUMP_BASIC }, - { AR_SLOT_TIME, "SLOTTIME", DUMP_BASIC }, - { AR_TIME_OUT, "TIME_OUT", DUMP_BASIC }, - { AR_RSSI_THR, "RSSI_THR", DUMP_BASIC }, - { AR_USEC, "USEC", DUMP_BASIC }, - { AR_BEACON, "BEACON", DUMP_BASIC }, - { AR_CFP_PERIOD, "CFP_PER", DUMP_BASIC }, - { AR_TIMER0, "TIMER0", DUMP_BASIC }, - { AR_TIMER1, "TIMER1", DUMP_BASIC }, - { AR_TIMER2, "TIMER2", DUMP_BASIC }, - { AR_TIMER3, "TIMER3", DUMP_BASIC }, - { AR_CFP_DUR, "CFP_DUR", DUMP_BASIC }, - { AR_RX_FILTER, "RXFILTER", DUMP_BASIC }, - { AR_MCAST_FIL0, "MCAST_0", DUMP_BASIC }, - { AR_MCAST_FIL1, "MCAST_1", DUMP_BASIC }, - { AR_DIAG_SW, "DIAG_SW", DUMP_BASIC }, - { AR_TSF_L32, "TSF_L32", DUMP_BASIC }, - { AR_TSF_U32, "TSF_U32", DUMP_BASIC }, - { AR_TST_ADDAC, "TST_ADAC", DUMP_BASIC }, - { AR_DEF_ANTENNA, "DEF_ANT", DUMP_BASIC }, - - { AR_LAST_TSTP, "LAST_TST", DUMP_BASIC }, - { AR_NAV, "NAV", DUMP_BASIC }, - { AR_RTS_OK, "RTS_OK", DUMP_BASIC }, - { AR_RTS_FAIL, "RTS_FAIL", DUMP_BASIC }, - { AR_ACK_FAIL, "ACK_FAIL", DUMP_BASIC }, - { AR_FCS_FAIL, "FCS_FAIL", DUMP_BASIC }, - { AR_BEACON_CNT, "BEAC_CNT", DUMP_BASIC }, + DEFVOID(AR_D_TXBLK_CLR, "D_CLR"), + DEFVOID(AR_D_TXBLK_SET, "D_SET"), + DEFBASICfmt(AR_RC, "RC", AR_RC_BITS), + DEFBASICfmt(AR_SCR, "SCR", AR_SCR_BITS), + DEFBASICfmt(AR_INTPEND, "INTPEND", AR_INTPEND_BITS), + DEFBASIC(AR_SFR, "SFR"), + DEFBASICfmt(AR_PCICFG, "PCICFG", AR_PCICFG_BITS), + DEFBASIC(AR_GPIOCR, "GPIOCR"), + DEFBASIC(AR_GPIODO, "GPIODO"), + DEFBASIC(AR_GPIODI, "GPIODI"), + DEFBASIC(AR_SREV, "SREV"), + DEFVOID(AR_EEPROM_ADDR, "EEADDR"), + DEFVOID(AR_EEPROM_DATA, "EEDATA"), + DEFVOID(AR_EEPROM_CMD, "EECMD"), + DEFVOID(AR_EEPROM_STS, "EESTS"), + DEFVOID(AR_EEPROM_CFG, "EECFG"), + DEFBASIC(AR_STA_ID0, "STA_ID0"), + DEFBASICfmt(AR_STA_ID1, "STA_ID1", AR_STA_ID1_BITS), + DEFBASIC(AR_BSS_ID0, "BSS_ID0"), + DEFBASIC(AR_BSS_ID1, "BSS_ID1"), + DEFBASIC(AR_SLOT_TIME, "SLOTTIME"), + DEFBASIC(AR_TIME_OUT, "TIME_OUT"), + DEFBASIC(AR_RSSI_THR, "RSSI_THR"), + DEFBASIC(AR_USEC, "USEC"), + DEFBASICfmt(AR_BEACON, "BEACON", AR_BEACON_BITS), + DEFBASIC(AR_CFP_PERIOD, "CFP_PER"), + DEFBASIC(AR_TIMER0, "TIMER0"), + DEFBASIC(AR_TIMER1, "TIMER1"), + DEFBASIC(AR_TIMER2, "TIMER2"), + DEFBASIC(AR_TIMER3, "TIMER3"), + DEFBASIC(AR_CFP_DUR, "CFP_DUR"), + DEFBASICfmt(AR_RX_FILTER, "RXFILTER", AR_RX_FILTER_BITS), + DEFBASIC(AR_MCAST_FIL0, "MCAST_0"), + DEFBASIC(AR_MCAST_FIL1, "MCAST_1"), + DEFBASICfmt(AR_DIAG_SW, "DIAG_SW", AR_DIAG_SW_BITS), + DEFBASIC(AR_TSF_L32, "TSF_L32"), + DEFBASIC(AR_TSF_U32, "TSF_U32"), + DEFBASIC(AR_TST_ADDAC, "TST_ADAC"), + DEFBASIC(AR_DEF_ANTENNA, "DEF_ANT"), + + DEFBASIC(AR_LAST_TSTP, "LAST_TST"), + DEFBASIC(AR_NAV, "NAV"), + DEFBASIC(AR_RTS_OK, "RTS_OK"), + DEFBASIC(AR_RTS_FAIL, "RTS_FAIL"), + DEFBASIC(AR_ACK_FAIL, "ACK_FAIL"), + DEFBASIC(AR_FCS_FAIL, "FCS_FAIL"), + DEFBASIC(AR_BEACON_CNT, "BEAC_CNT"), + + DEFVOID(AR_PHY_TURBO, "PHY_TURBO"), + DEFVOID(AR_PHY_CHIP_ID, "PHY_CHIP_ID"), + DEFVOID(AR_PHY_ACTIVE, "PHY_ACTIVE"), + DEFVOID(AR_PHY_AGC_CONTROL, "PHY_AGC_CONTROL"), + DEFVOID(AR_PHY_PLL_CTL, "PHY_PLL_CTL"), + DEFVOID(AR_PHY_RX_DELAY, "PHY_RX_DELAY"), + DEFVOID(AR_PHY_TIMING_CTRL4,"PHY_TIMING_CTRL4"), + DEFVOID(AR_PHY_RADAR_0, "PHY_RADAR_0"), + DEFVOID(AR_PHY_IQCAL_RES_PWR_MEAS_I,"PHY_IQCAL_RES_PWR_MEAS_I"), + DEFVOID(AR_PHY_IQCAL_RES_PWR_MEAS_Q,"PHY_IQCAL_RES_PWR_MEAS_Q"), + DEFVOID(AR_PHY_IQCAL_RES_IQ_CORR_MEAS,"PHY_IQCAL_RES_IQ_CORR_MEAS"), + DEFVOID(AR_PHY_CURRENT_RSSI,"PHY_CURRENT_RSSI"), + DEFVOID(AR5211_PHY_MODE, "PHY_MODE"), }; static __constructor void Modified: head/tools/tools/ath/athregs/dumpregs_5212.c ============================================================================== --- head/tools/tools/ath/athregs/dumpregs_5212.c Wed Mar 11 16:32:00 2009 (r189700) +++ head/tools/tools/ath/athregs/dumpregs_5212.c Wed Mar 11 17:14:17 2009 (r189701) @@ -43,279 +43,376 @@ #define MAC5213 SREV(5,9), SREV(16,0) static struct dumpreg ar5212regs[] = { - { AR_CR, "CR", DUMP_BASIC }, - { AR_RXDP, "RXDP", DUMP_BASIC }, - { AR_CFG, "CFG", DUMP_BASIC }, - { AR_IER, "IER", DUMP_BASIC }, - { AR_TXCFG, "TXCFG", DUMP_BASIC }, - { AR_RXCFG, "RXCFG", DUMP_BASIC }, - { AR_MIBC, "MIBC", DUMP_BASIC }, - { AR_TOPS, "TOPS", DUMP_BASIC }, - { AR_RXNPTO, "RXNPTO", DUMP_BASIC }, - { AR_TXNPTO, "TXNPTO", DUMP_BASIC }, - { AR_RPGTO, "RPGTO", DUMP_BASIC }, - { AR_RPCNT, "RPCNT", DUMP_BASIC }, - { AR_MACMISC, "MACMISC", DUMP_BASIC }, - { AR_SPC_0, "SPC_0", DUMP_BASIC }, - { AR_SPC_1, "SPC_1", DUMP_BASIC }, - - { AR_ISR, "ISR", DUMP_INTERRUPT }, - { AR_ISR_S0, "ISR_S0", DUMP_INTERRUPT }, - { AR_ISR_S1, "ISR_S1", DUMP_INTERRUPT }, - { AR_ISR_S2, "ISR_S2", DUMP_INTERRUPT }, - { AR_ISR_S3, "ISR_S3", DUMP_INTERRUPT }, - { AR_ISR_S4, "ISR_S4", DUMP_INTERRUPT }, - { AR_IMR, "IMR", DUMP_INTERRUPT }, - { AR_IMR_S0, "IMR_S0", DUMP_INTERRUPT }, - { AR_IMR_S1, "IMR_S1", DUMP_INTERRUPT }, - { AR_IMR_S2, "IMR_S2", DUMP_INTERRUPT }, - { AR_IMR_S3, "IMR_S3", DUMP_INTERRUPT }, - { AR_IMR_S4, "IMR_S4", DUMP_INTERRUPT }, -#if 0 + DEFBASIC(AR_CR, "CR"), + DEFBASIC(AR_RXDP, "RXDP"), + DEFBASICfmt(AR_CFG, "CFG", + "\20\1SWTD\2SWTB\3SWRD\4SWRB\5SWRG\6AP_ADHOC\11PHOK\12EEBS"), + DEFBASIC(AR_IER, "IER"), + DEFBASIC(AR_TXCFG, "TXCFG"), + DEFBASICfmt(AR_RXCFG, "RXCFG", + "\20\6JUMBO_ENA\7JUMBO_WRAP\10SLEEP_DEBUG"), + DEFBASIC(AR_MIBC, "MIBC"), + DEFBASIC(AR_TOPS, "TOPS"), + DEFBASIC(AR_RXNPTO, "RXNPTO"), + DEFBASIC(AR_TXNPTO, "TXNPTO"), + DEFBASIC(AR_RPGTO, "RPGTO"), + DEFBASIC(AR_RPCNT, "RPCNT"), + DEFBASIC(AR_MACMISC, "MACMISC"), + DEFBASIC(AR_SPC_0, "SPC_0"), + DEFBASIC(AR_SPC_1, "SPC_1"), + + DEFINTfmt(AR_ISR, "ISR", + "\20\1RXOK\2RXDESC\3RXERR\4RXNOPKT\5RXEOL\6RXORN\7TXOK\10TXDESC" + "\11TXERR\12TXNOPKT\13TXEOL\14TXURN\15MIB\16SWI\17RXPHY\20RXKCM" + "\21SWBA\22BRSSI\23BMISS\24HIUERR\25BNR\26RXCHIRP\27RXDOPPL\30BCNMISS" + "\31TIM\32GPIO\33QCBROVF\34QCBRURN\35QTRIG"), + DEFINT(AR_ISR_S0, "ISR_S0"), + DEFINT(AR_ISR_S1, "ISR_S1"), + DEFINTfmt(AR_ISR_S2, "ISR_S2", + "\20\21MCABT\22SSERR\23DPERR\24TIM\25CABEND\26DTIMSYNC\27BCNTO" + "\30CABTO\31DTIM"), + DEFINT(AR_ISR_S3, "ISR_S3"), + DEFINT(AR_ISR_S4, "ISR_S4"), + DEFINTfmt(AR_IMR, "IMR", + "\20\1RXOK\2RXDESC\3RXERR\4RXNOPKT\5RXEOL\6RXORN\7TXOK\10TXDESC" + "\11TXERR\12TXNOPKT\13TXEOL\14TXURN\15MIB\16SWI\17RXPHY\20RXKCM" + "\21SWBA\22BRSSI\23BMISS\24HIUERR\25BNR\26RXCHIRP\27RXDOPPL\30BCNMISS" + "\31TIM\32GPIO\33QCBROVF\34QCBRURN\35QTRIG"), + DEFINT(AR_IMR_S0, "IMR_S0"), + DEFINT(AR_IMR_S1, "IMR_S1"), + DEFINTfmt(AR_IMR_S2, "IMR_S2", + "\20\21MCABT\22SSERR\23DPERR\24TIM\25CABEND\26DTIMSYNC\27BCNTO" + "\30CABTO\31DTIM"), + DEFINT(AR_IMR_S3, "IMR_S3"), + DEFINT(AR_IMR_S4, "IMR_S4"), /* NB: don't read the RAC so we don't affect operation */ - { AR_ISR_RAC, "ISR_RAC", DUMP_INTERRUPT }, -#endif - { AR_ISR_S0_S, "ISR_S0_S", DUMP_INTERRUPT }, - { AR_ISR_S1_S, "ISR_S1_S", DUMP_INTERRUPT }, - { AR_ISR_S2_S, "ISR_S2_S", DUMP_INTERRUPT }, - { AR_ISR_S3_S, "ISR_S3_S", DUMP_INTERRUPT }, - { AR_ISR_S4_S, "ISR_S4_S", DUMP_INTERRUPT }, - - { AR_DMADBG_0, "DMADBG0", DUMP_BASIC }, - { AR_DMADBG_1, "DMADBG1", DUMP_BASIC }, - { AR_DMADBG_2, "DMADBG2", DUMP_BASIC }, - { AR_DMADBG_3, "DMADBG3", DUMP_BASIC }, - { AR_DMADBG_4, "DMADBG4", DUMP_BASIC }, - { AR_DMADBG_5, "DMADBG5", DUMP_BASIC }, - { AR_DMADBG_6, "DMADBG6", DUMP_BASIC }, - { AR_DMADBG_7, "DMADBG7", DUMP_BASIC }, - - { AR_DCM_A, "DCM_A", DUMP_BASIC }, - { AR_DCM_D, "DCM_D", DUMP_BASIC }, - { AR_DCCFG, "DCCFG", DUMP_BASIC }, - { AR_CCFG, "CCFG", DUMP_BASIC }, - { AR_CCUCFG, "CCUCFG", DUMP_BASIC }, - { AR_CPC_0, "CPC0", DUMP_BASIC }, - { AR_CPC_1, "CPC1", DUMP_BASIC }, - { AR_CPC_2, "CPC2", DUMP_BASIC }, - { AR_CPC_3, "CPC3", DUMP_BASIC }, - { AR_CPCOVF, "CPCOVF", DUMP_BASIC }, - - { AR_Q0_TXDP, "Q0_TXDP", DUMP_QCU }, - { AR_Q1_TXDP, "Q1_TXDP", DUMP_QCU }, - { AR_Q2_TXDP, "Q2_TXDP", DUMP_QCU }, - { AR_Q3_TXDP, "Q3_TXDP", DUMP_QCU }, - { AR_Q4_TXDP, "Q4_TXDP", DUMP_QCU }, - { AR_Q5_TXDP, "Q5_TXDP", DUMP_QCU }, - { AR_Q6_TXDP, "Q6_TXDP", DUMP_QCU }, - { AR_Q7_TXDP, "Q7_TXDP", DUMP_QCU }, - { AR_Q8_TXDP, "Q8_TXDP", DUMP_QCU }, - { AR_Q9_TXDP, "Q9_TXDP", DUMP_QCU }, - - { AR_Q_TXE, "Q_TXE", DUMP_QCU }, - { AR_Q_TXD, "Q_TXD", DUMP_QCU }, - - { AR_Q0_CBRCFG, "Q0_CBR", DUMP_QCU }, - { AR_Q1_CBRCFG, "Q1_CBR", DUMP_QCU }, - { AR_Q2_CBRCFG, "Q2_CBR", DUMP_QCU }, - { AR_Q3_CBRCFG, "Q3_CBR", DUMP_QCU }, - { AR_Q4_CBRCFG, "Q4_CBR", DUMP_QCU }, - { AR_Q5_CBRCFG, "Q5_CBR", DUMP_QCU }, - { AR_Q6_CBRCFG, "Q6_CBR", DUMP_QCU }, - { AR_Q7_CBRCFG, "Q7_CBR", DUMP_QCU }, - { AR_Q8_CBRCFG, "Q8_CBR", DUMP_QCU }, - { AR_Q9_CBRCFG, "Q9_CBR", DUMP_QCU }, - - { AR_Q0_RDYTIMECFG, "Q0_RDYT", DUMP_QCU }, - { AR_Q1_RDYTIMECFG, "Q1_RDYT", DUMP_QCU }, - { AR_Q2_RDYTIMECFG, "Q2_RDYT", DUMP_QCU }, - { AR_Q3_RDYTIMECFG, "Q3_RDYT", DUMP_QCU }, - { AR_Q4_RDYTIMECFG, "Q4_RDYT", DUMP_QCU }, - { AR_Q5_RDYTIMECFG, "Q5_RDYT", DUMP_QCU }, - { AR_Q6_RDYTIMECFG, "Q6_RDYT", DUMP_QCU }, - { AR_Q7_RDYTIMECFG, "Q7_RDYT", DUMP_QCU }, - { AR_Q8_RDYTIMECFG, "Q8_RDYT", DUMP_QCU }, - { AR_Q9_RDYTIMECFG, "Q9_RDYT", DUMP_QCU }, - - { AR_Q_ONESHOTARM_SC,"Q_ONESHOTARM_SC", DUMP_QCU }, - { AR_Q_ONESHOTARM_CC,"Q_ONESHOTARM_CC", DUMP_QCU }, - - { AR_Q0_MISC, "Q0_MISC", DUMP_QCU }, - { AR_Q1_MISC, "Q1_MISC", DUMP_QCU }, - { AR_Q2_MISC, "Q2_MISC", DUMP_QCU }, - { AR_Q3_MISC, "Q3_MISC", DUMP_QCU }, - { AR_Q4_MISC, "Q4_MISC", DUMP_QCU }, - { AR_Q5_MISC, "Q5_MISC", DUMP_QCU }, - { AR_Q6_MISC, "Q6_MISC", DUMP_QCU }, - { AR_Q7_MISC, "Q7_MISC", DUMP_QCU }, - { AR_Q8_MISC, "Q8_MISC", DUMP_QCU }, - { AR_Q9_MISC, "Q9_MISC", DUMP_QCU }, - - { AR_Q0_STS, "Q0_STS", DUMP_QCU }, - { AR_Q1_STS, "Q1_STS", DUMP_QCU }, - { AR_Q2_STS, "Q2_STS", DUMP_QCU }, - { AR_Q3_STS, "Q3_STS", DUMP_QCU }, - { AR_Q4_STS, "Q4_STS", DUMP_QCU }, - { AR_Q5_STS, "Q5_STS", DUMP_QCU }, - { AR_Q6_STS, "Q6_STS", DUMP_QCU }, - { AR_Q7_STS, "Q7_STS", DUMP_QCU }, - { AR_Q8_STS, "Q8_STS", DUMP_QCU }, - { AR_Q9_STS, "Q9_STS", DUMP_QCU }, - - { AR_Q_RDYTIMESHDN, "Q_RDYTIMSHD", DUMP_QCU }, - - { AR_Q_CBBS, "Q_CBBS", DUMP_QCU }, - { AR_Q_CBBA, "Q_CBBA", DUMP_QCU }, - { AR_Q_CBC, "Q_CBC", DUMP_QCU }, - - { AR_D0_QCUMASK, "D0_MASK", DUMP_DCU }, - { AR_D1_QCUMASK, "D1_MASK", DUMP_DCU }, - { AR_D2_QCUMASK, "D2_MASK", DUMP_DCU }, - { AR_D3_QCUMASK, "D3_MASK", DUMP_DCU }, - { AR_D4_QCUMASK, "D4_MASK", DUMP_DCU }, - { AR_D5_QCUMASK, "D5_MASK", DUMP_DCU }, - { AR_D6_QCUMASK, "D6_MASK", DUMP_DCU }, - { AR_D7_QCUMASK, "D7_MASK", DUMP_DCU }, - { AR_D8_QCUMASK, "D8_MASK", DUMP_DCU }, - { AR_D9_QCUMASK, "D9_MASK", DUMP_DCU }, - - { AR_D0_LCL_IFS, "D0_IFS", DUMP_DCU }, - { AR_D1_LCL_IFS, "D1_IFS", DUMP_DCU }, - { AR_D2_LCL_IFS, "D2_IFS", DUMP_DCU }, - { AR_D3_LCL_IFS, "D3_IFS", DUMP_DCU }, - { AR_D4_LCL_IFS, "D4_IFS", DUMP_DCU }, - { AR_D5_LCL_IFS, "D5_IFS", DUMP_DCU }, - { AR_D6_LCL_IFS, "D6_IFS", DUMP_DCU }, - { AR_D7_LCL_IFS, "D7_IFS", DUMP_DCU }, - { AR_D8_LCL_IFS, "D8_IFS", DUMP_DCU }, - { AR_D9_LCL_IFS, "D9_IFS", DUMP_DCU }, - - { AR_D0_RETRY_LIMIT,"D0_RTRY", DUMP_DCU }, - { AR_D1_RETRY_LIMIT,"D1_RTRY", DUMP_DCU }, - { AR_D2_RETRY_LIMIT,"D2_RTRY", DUMP_DCU }, - { AR_D3_RETRY_LIMIT,"D3_RTRY", DUMP_DCU }, - { AR_D4_RETRY_LIMIT,"D4_RTRY", DUMP_DCU }, - { AR_D5_RETRY_LIMIT,"D5_RTRY", DUMP_DCU }, - { AR_D6_RETRY_LIMIT,"D6_RTRY", DUMP_DCU }, - { AR_D7_RETRY_LIMIT,"D7_RTRY", DUMP_DCU }, - { AR_D8_RETRY_LIMIT,"D8_RTRY", DUMP_DCU }, - { AR_D9_RETRY_LIMIT,"D9_RTRY", DUMP_DCU }, - - { AR_D0_CHNTIME, "D0_CHNT", DUMP_DCU }, - { AR_D1_CHNTIME, "D1_CHNT", DUMP_DCU }, - { AR_D2_CHNTIME, "D2_CHNT", DUMP_DCU }, - { AR_D3_CHNTIME, "D3_CHNT", DUMP_DCU }, - { AR_D4_CHNTIME, "D4_CHNT", DUMP_DCU }, - { AR_D5_CHNTIME, "D5_CHNT", DUMP_DCU }, - { AR_D6_CHNTIME, "D6_CHNT", DUMP_DCU }, - { AR_D7_CHNTIME, "D7_CHNT", DUMP_DCU }, - { AR_D8_CHNTIME, "D8_CHNT", DUMP_DCU }, - { AR_D9_CHNTIME, "D9_CHNT", DUMP_DCU }, - - { AR_D0_MISC, "D0_MISC", DUMP_DCU }, - { AR_D1_MISC, "D1_MISC", DUMP_DCU }, - { AR_D2_MISC, "D2_MISC", DUMP_DCU }, - { AR_D3_MISC, "D3_MISC", DUMP_DCU }, - { AR_D4_MISC, "D4_MISC", DUMP_DCU }, - { AR_D5_MISC, "D5_MISC", DUMP_DCU }, - { AR_D6_MISC, "D6_MISC", DUMP_DCU }, - { AR_D7_MISC, "D7_MISC", DUMP_DCU }, - { AR_D8_MISC, "D8_MISC", DUMP_DCU }, - { AR_D9_MISC, "D9_MISC", DUMP_DCU }, - - { AR_D_SEQNUM, "D_SEQ", DUMP_BASIC | DUMP_DCU }, - { AR_D_GBL_IFS_SIFS,"D_SIFS", DUMP_BASIC }, - { AR_D_GBL_IFS_SLOT,"D_SLOT", DUMP_BASIC }, - { AR_D_GBL_IFS_EIFS,"D_EIFS", DUMP_BASIC }, - { AR_D_GBL_IFS_MISC,"D_MISC", DUMP_BASIC }, - { AR_D_FPCTL, "D_FPCTL", DUMP_BASIC }, - { AR_D_TXPSE, "D_TXPSE", DUMP_BASIC }, -#if 0 - { AR_D_TXBLK_CMD, "D_CMD", DUMP_BASIC }, - { AR_D_TXBLK_DATA, "D_DATA", DUMP_BASIC }, - { AR_D_TXBLK_CLR, "D_CLR", DUMP_BASIC }, - { AR_D_TXBLK_SET, "D_SET", DUMP_BASIC }, -#endif - { AR_RC, "RC", DUMP_BASIC }, - { AR_SCR, "SCR", DUMP_BASIC }, - { AR_INTPEND, "INTPEND", DUMP_BASIC }, - { AR_SFR, "SFR", DUMP_BASIC }, - { AR_PCICFG, "PCICFG", DUMP_BASIC }, - { AR_GPIOCR, "GPIOCR", DUMP_BASIC }, - { AR_GPIODO, "GPIODO", DUMP_BASIC }, - { AR_GPIODI, "GPIODI", DUMP_BASIC }, - { AR_SREV, "SREV", DUMP_BASIC }, - - { AR_PCIE_PMC, "PCIEPMC", DUMP_BASIC, SREV(4,8), SREV(13,7) }, - { AR_PCIE_SERDES, "SERDES", DUMP_BASIC, SREV(4,8), SREV(13,7) }, - { AR_PCIE_SERDES2, "SERDES2", DUMP_BASIC, SREV(4,8), SREV(13,7) }, + DEFVOID(AR_ISR_RAC, "ISR_RAC"), + DEFINT(AR_ISR_S0_S, "ISR_S0_S"), + DEFINT(AR_ISR_S1_S, "ISR_S1_S"), + DEFINT(AR_ISR_S2_S, "ISR_S2_S"), + DEFINT(AR_ISR_S3_S, "ISR_S3_S"), + DEFINT(AR_ISR_S4_S, "ISR_S4_S"), + + DEFBASIC(AR_DMADBG_0, "DMADBG0"), + DEFBASIC(AR_DMADBG_1, "DMADBG1"), + DEFBASIC(AR_DMADBG_2, "DMADBG2"), + DEFBASIC(AR_DMADBG_3, "DMADBG3"), + DEFBASIC(AR_DMADBG_4, "DMADBG4"), + DEFBASIC(AR_DMADBG_5, "DMADBG5"), + DEFBASIC(AR_DMADBG_6, "DMADBG6"), + DEFBASIC(AR_DMADBG_7, "DMADBG7"), + + DEFBASIC(AR_DCM_A, "DCM_A"), + DEFBASIC(AR_DCM_D, "DCM_D"), + DEFBASIC(AR_DCCFG, "DCCFG"), + DEFBASIC(AR_CCFG, "CCFG"), + DEFBASIC(AR_CCUCFG, "CCUCFG"), + DEFBASIC(AR_CPC_0, "CPC0"), + DEFBASIC(AR_CPC_1, "CPC1"), + DEFBASIC(AR_CPC_2, "CPC2"), + DEFBASIC(AR_CPC_3, "CPC3"), + DEFBASIC(AR_CPCOVF, "CPCOVF"), + + DEFQCU(AR_Q0_TXDP, "Q0_TXDP"), + DEFQCU(AR_Q1_TXDP, "Q1_TXDP"), + DEFQCU(AR_Q2_TXDP, "Q2_TXDP"), + DEFQCU(AR_Q3_TXDP, "Q3_TXDP"), + DEFQCU(AR_Q4_TXDP, "Q4_TXDP"), + DEFQCU(AR_Q5_TXDP, "Q5_TXDP"), + DEFQCU(AR_Q6_TXDP, "Q6_TXDP"), + DEFQCU(AR_Q7_TXDP, "Q7_TXDP"), + DEFQCU(AR_Q8_TXDP, "Q8_TXDP"), + DEFQCU(AR_Q9_TXDP, "Q9_TXDP"), + + DEFQCU(AR_Q_TXE, "Q_TXE"), + DEFQCU(AR_Q_TXD, "Q_TXD"), + + DEFQCU(AR_Q0_CBRCFG, "Q0_CBR"), + DEFQCU(AR_Q1_CBRCFG, "Q1_CBR"), + DEFQCU(AR_Q2_CBRCFG, "Q2_CBR"), + DEFQCU(AR_Q3_CBRCFG, "Q3_CBR"), + DEFQCU(AR_Q4_CBRCFG, "Q4_CBR"), + DEFQCU(AR_Q5_CBRCFG, "Q5_CBR"), + DEFQCU(AR_Q6_CBRCFG, "Q6_CBR"), + DEFQCU(AR_Q7_CBRCFG, "Q7_CBR"), + DEFQCU(AR_Q8_CBRCFG, "Q8_CBR"), + DEFQCU(AR_Q9_CBRCFG, "Q9_CBR"), + + DEFQCU(AR_Q0_RDYTIMECFG, "Q0_RDYT"), + DEFQCU(AR_Q1_RDYTIMECFG, "Q1_RDYT"), + DEFQCU(AR_Q2_RDYTIMECFG, "Q2_RDYT"), + DEFQCU(AR_Q3_RDYTIMECFG, "Q3_RDYT"), + DEFQCU(AR_Q4_RDYTIMECFG, "Q4_RDYT"), + DEFQCU(AR_Q5_RDYTIMECFG, "Q5_RDYT"), + DEFQCU(AR_Q6_RDYTIMECFG, "Q6_RDYT"), + DEFQCU(AR_Q7_RDYTIMECFG, "Q7_RDYT"), + DEFQCU(AR_Q8_RDYTIMECFG, "Q8_RDYT"), + DEFQCU(AR_Q9_RDYTIMECFG, "Q9_RDYT"), + + DEFQCU(AR_Q_ONESHOTARM_SC, "Q_ONESHOTARM_SC"), + DEFQCU(AR_Q_ONESHOTARM_CC, "Q_ONESHOTARM_CC"), + + DEFQCU(AR_Q0_MISC, "Q0_MISC"), + DEFQCU(AR_Q1_MISC, "Q1_MISC"), *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 17:15:34 2009 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 406991065670; Wed, 11 Mar 2009 17:15:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CC198FC1B; Wed, 11 Mar 2009 17:15:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BHFYGj001785; Wed, 11 Mar 2009 17:15:34 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BHFXNn001782; Wed, 11 Mar 2009 17:15:33 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903111715.n2BHFXNn001782@svn.freebsd.org> From: Sam Leffler Date: Wed, 11 Mar 2009 17:15: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: r189702 - in head/tools/tools/ath: . athdecode 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 Mar 2009 17:15:35 -0000 Author: sam Date: Wed Mar 11 17:15:33 2009 New Revision: 189702 URL: http://svn.freebsd.org/changeset/base/189702 Log: add athdecode, an app to decode register logs Added: head/tools/tools/ath/athdecode/ head/tools/tools/ath/athdecode/Makefile (contents, props changed) head/tools/tools/ath/athdecode/main.c (contents, props changed) Modified: head/tools/tools/ath/Makefile Modified: head/tools/tools/ath/Makefile ============================================================================== --- head/tools/tools/ath/Makefile Wed Mar 11 17:14:17 2009 (r189701) +++ head/tools/tools/ath/Makefile Wed Mar 11 17:15:33 2009 (r189702) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR= athdebug athkey athprom athrd athregs athstats +SUBDIR= athdebug athdecode athkey athprom athrd athregs athstats .include Added: head/tools/tools/ath/athdecode/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athdecode/Makefile Wed Mar 11 17:15:33 2009 (r189702) @@ -0,0 +1,17 @@ +# +# $FreeBSD$ + +PROG= athdecode + +.PATH.c: ${.CURDIR}/../athregs +CFLAGS+=-I${.CURDIR}/../athregs + +SRCS= main.c +SRCS+= dumpregs_5210.c +SRCS+= dumpregs_5211.c +SRCS+= dumpregs_5212.c +SRCS+= dumpregs_5416.c + +.include <../Makefile.inc> + +.include Added: head/tools/tools/ath/athdecode/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athdecode/main.c Wed Mar 11 17:15:33 2009 (r189702) @@ -0,0 +1,423 @@ +/*- + * 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 "diag.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ah_decode.h" + +#include "dumpregs.h" + +#include +#include +#include +#include + +typedef struct { + HAL_REVS revs; + int chipnum; +#define MAXREGS 5*1024 + struct dumpreg *regs[MAXREGS]; + u_int nregs; +} dumpregs_t; +static dumpregs_t state; + +static void opdevice(const struct athregrec *r); +static const char* opmark(FILE *, int, const struct athregrec *); +static void oprw(FILE *fd, int recnum, struct athregrec *r); + +int +main(int argc, char *argv[]) +{ + int fd, i, nrecs, same; + struct stat sb; + void *addr; + const char *filename = "/tmp/ath_hal.log"; + struct athregrec *rprev; + + if (argc > 1) + filename = argv[1]; + fd = open(filename, O_RDONLY); + if (fd < 0) + err(1, filename); + if (fstat(fd, &sb) < 0) + err(1, "fstat"); + addr = mmap(0, sb.st_size, PROT_READ, MAP_PRIVATE|MAP_NOCORE, fd, 0); + if (addr == MAP_FAILED) + err(1, "mmap"); + nrecs = sb.st_size / sizeof (struct athregrec); + printf("%u records", nrecs); + rprev = NULL; + same = 0; + state.chipnum = 5210; + for (i = 0; i < nrecs; i++) { + struct athregrec *r = &((struct athregrec *) addr)[i]; + if (rprev && bcmp(r, rprev, sizeof (*r)) == 0) { + same++; + continue; + } + if (same) + printf("\t\t+%u time%s", same, same == 1 ? "" : "s"); + switch (r->op) { + case OP_DEVICE: + opdevice(r); + break; + case OP_READ: + case OP_WRITE: + oprw(stdout, i, r); + break; + case OP_MARK: + opmark(stdout, i, r); + break; + } + rprev = r; + same = 0; + } + putchar('\n'); + return 0; +} + +static const char* +opmark(FILE *fd, int i, const struct athregrec *r) +{ + fprintf(fd, "\n%05d: ", i); + switch (r->reg) { + case AH_MARK_RESET: + fprintf(fd, "ar%uReset %s", state.chipnum, + r->val ? "change channel" : "no channel change"); + break; + case AH_MARK_RESET_LINE: + fprintf(fd, "ar%u_reset.c; line %u", state.chipnum, r->val); + break; + case AH_MARK_RESET_DONE: + if (r->val) + fprintf(fd, "ar%uReset (done), FAIL, error %u", + state.chipnum, r->val); + else + fprintf(fd, "ar%uReset (done), OK", state.chipnum); + break; + case AH_MARK_CHIPRESET: + fprintf(fd, "ar%uChipReset, channel %u Mhz", state.chipnum, r->val); + break; + case AH_MARK_PERCAL: + fprintf(fd, "ar%uPerCalibration, channel %u Mhz", state.chipnum, r->val); + break; + case AH_MARK_SETCHANNEL: + fprintf(fd, "ar%uSetChannel, channel %u Mhz", state.chipnum, r->val); + break; + case AH_MARK_ANI_RESET: + switch (r->val) { + case HAL_M_STA: + fprintf(fd, "ar%uAniReset, HAL_M_STA", state.chipnum); + break; + case HAL_M_IBSS: + fprintf(fd, "ar%uAniReset, HAL_M_IBSS", state.chipnum); + break; + case HAL_M_HOSTAP: + fprintf(fd, "ar%uAniReset, HAL_M_HOSTAP", state.chipnum); + break; + case HAL_M_MONITOR: + fprintf(fd, "ar%uAniReset, HAL_M_MONITOR", state.chipnum); + break; + default: + fprintf(fd, "ar%uAniReset, opmode %u", state.chipnum, r->val); + break; + } + break; + case AH_MARK_ANI_POLL: + fprintf(fd, "ar%uAniPoll, listenTime %u", state.chipnum, r->val); + break; + case AH_MARK_ANI_CONTROL: + switch (r->val) { + case HAL_ANI_PRESENT: + fprintf(fd, "ar%uAniControl, PRESENT", state.chipnum); + break; + case HAL_ANI_NOISE_IMMUNITY_LEVEL: + fprintf(fd, "ar%uAniControl, NOISE_IMMUNITY", state.chipnum); + break; + case HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION: + fprintf(fd, "ar%uAniControl, OFDM_WEAK_SIGNAL", state.chipnum); + break; + case HAL_ANI_CCK_WEAK_SIGNAL_THR: + fprintf(fd, "ar%uAniControl, CCK_WEAK_SIGNAL", state.chipnum); + break; + case HAL_ANI_FIRSTEP_LEVEL: + fprintf(fd, "ar%uAniControl, FIRSTEP_LEVEL", state.chipnum); + break; + case HAL_ANI_SPUR_IMMUNITY_LEVEL: + fprintf(fd, "ar%uAniControl, SPUR_IMMUNITY", state.chipnum); + break; + case HAL_ANI_MODE: + fprintf(fd, "ar%uAniControl, MODE", state.chipnum); + break; + case HAL_ANI_PHYERR_RESET: + fprintf(fd, "ar%uAniControl, PHYERR_RESET", state.chipnum); + break; + default: + fprintf(fd, "ar%uAniControl, cmd %u", state.chipnum, r->val); + break; + } + break; + default: + fprintf(fd, "mark #%u value %u/0x%x", r->reg, r->val, r->val); + break; + } +} + +#include "ah_devid.h" + +static void +opdevice(const struct athregrec *r) +{ + switch (r->val) { + case AR5210_PROD: + case AR5210_DEFAULT: + state.chipnum = 5210; + state.revs.ah_macVersion = 1; + state.revs.ah_macRev = 0; + break; + case AR5211_DEVID: + case AR5311_DEVID: + case AR5211_DEFAULT: + case AR5211_FPGA11B: + state.chipnum = 5211; + state.revs.ah_macVersion = 2; + state.revs.ah_macRev = 0; + break; + /* AR5212 */ + case AR5212_DEFAULT: + case AR5212_DEVID: + case AR5212_FPGA: + case AR5212_DEVID_IBM: + case AR5212_AR5312_REV2: + case AR5212_AR5312_REV7: + case AR5212_AR2313_REV8: + case AR5212_AR2315_REV6: + case AR5212_AR2315_REV7: + case AR5212_AR2317_REV1: + case AR5212_AR2317_REV2: + + /* AR5212 compatible devid's also attach to 5212 */ + case AR5212_DEVID_0014: + case AR5212_DEVID_0015: + case AR5212_DEVID_0016: + case AR5212_DEVID_0017: + case AR5212_DEVID_0018: + case AR5212_DEVID_0019: + case AR5212_AR2413: + case AR5212_AR5413: + case AR5212_AR5424: + case AR5212_AR2417: + case AR5212_DEVID_FF19: + state.chipnum = 5212; + state.revs.ah_macVersion = 4; + state.revs.ah_macRev = 5; + break; + + /* AR5213 */ + case AR5213_SREV_1_0: + case AR5213_SREV_REG: + state.chipnum = 5213; + state.revs.ah_macVersion = 5; + state.revs.ah_macRev = 9; + break; + + /* AR5416 compatible devid's */ + case AR5416_DEVID_PCI: + case AR5416_DEVID_PCIE: + case AR9160_DEVID_PCI: + case AR9280_DEVID_PCI: + case AR9280_DEVID_PCIE: + case AR9285_DEVID_PCIE: + state.chipnum = 5416; + state.revs.ah_macVersion = 13; + state.revs.ah_macRev = 8; + break; + default: + printf("Unknown device id 0x%x\n", r->val); + exit(-1); + } +} + +static int +regcompar(const void *a, const void *b) +{ + const struct dumpreg *ra = *(const struct dumpreg **)a; + const struct dumpreg *rb = *(const struct dumpreg **)b; + return ra->addr - rb->addr; +} + +void +register_regs(struct dumpreg *chipregs, u_int nchipregs, + int def_srev_min, int def_srev_max, int def_phy_min, int def_phy_max) +{ + const int existing_regs = state.nregs; + int i, j; + + for (i = 0; i < nchipregs; i++) { + struct dumpreg *nr = &chipregs[i]; + if (nr->srevMin == 0) + nr->srevMin = def_srev_min; + if (nr->srevMax == 0) + nr->srevMax = def_srev_max; + if (nr->phyMin == 0) + nr->phyMin = def_phy_min; + if (nr->phyMax == 0) + nr->phyMax = def_phy_max; + for (j = 0; j < existing_regs; j++) { + struct dumpreg *r = state.regs[j]; + /* + * Check if we can just expand the mac+phy + * coverage for the existing entry. + */ + if (nr->addr == r->addr && + (nr->name == r->name || + nr->name != NULL && r->name != NULL && + strcmp(nr->name, r->name) == 0)) { + if (nr->srevMin < r->srevMin && + (r->srevMin <= nr->srevMax && + nr->srevMax+1 <= r->srevMax)) { + r->srevMin = nr->srevMin; + goto skip; + } + if (nr->srevMax > r->srevMax && + (r->srevMin <= nr->srevMin && + nr->srevMin <= r->srevMax)) { + r->srevMax = nr->srevMax; + goto skip; + } + } + if (r->addr > nr->addr) + break; + } + /* + * New item, add to the end, it'll be sorted below. + */ + if (state.nregs == MAXREGS) + errx(-1, "too many registers; bump MAXREGS"); + state.regs[state.nregs++] = nr; + skip: + ; + } + qsort(state.regs, state.nregs, sizeof(struct dumpreg *), regcompar); +} + +void +register_keycache(u_int nslots, + int def_srev_min, int def_srev_max, int def_phy_min, int def_phy_max) +{ + /* discard, no use */ +} + +void +register_range(u_int brange, u_int erange, int type, + int def_srev_min, int def_srev_max, int def_phy_min, int def_phy_max) +{ + /* discard, no use */ +} + +static const struct dumpreg * +findreg(int reg) +{ + const HAL_REVS *revs = &state.revs; + int i; + + for (i = 0; i < state.nregs; i++) { + const struct dumpreg *dr = state.regs[i]; + if (dr->addr == reg && + MAC_MATCH(dr, revs->ah_macVersion, revs->ah_macRev)) + return dr; + } + return NULL; +} + +/* XXX cheat, 5212 has a superset of the key table defs */ +#include "ar5212/ar5212reg.h" +#include "ar5212/ar5212phy.h" + +#define PWR_TABLE_SIZE 64 + +static void +oprw(FILE *fd, int recnum, struct athregrec *r) +{ + const struct dumpreg *dr; + char buf[64]; + const char* bits; + int i; + + fprintf(fd, "\n%05d: ", recnum); + dr = findreg(r->reg); + if (dr != NULL && dr->name != NULL) { + snprintf(buf, sizeof (buf), "AR_%s (0x%x)", dr->name, r->reg); + bits = dr->bits; + } else if (AR_KEYTABLE(0) <= r->reg && r->reg < AR_KEYTABLE(128)) { + snprintf(buf, sizeof (buf), "AR_KEYTABLE%u(%u) (0x%x)", + ((r->reg - AR_KEYTABLE_0) >> 2) & 7, + (r->reg - AR_KEYTABLE_0) >> 5, r->reg); + bits = NULL; +#if 0 + } else if (AR_PHY_PCDAC_TX_POWER(0) <= r->reg && r->reg < AR_PHY_PCDAC_TX_POWER(PWR_TABLE_SIZE/2)) { + snprintf(buf, sizeof (buf), "AR_PHY_PCDAC_TX_POWER(%u) (0x%x)", + (r->reg - AR_PHY_PCDAC_TX_POWER_0) >> 2, r->reg); + bits = NULL; +#endif + } else if (AR_RATE_DURATION(0) <= r->reg && r->reg < AR_RATE_DURATION(32)) { + snprintf(buf, sizeof (buf), "AR_RATE_DURATION(0x%x) (0x%x)", + (r->reg - AR_RATE_DURATION_0) >> 2, r->reg); + bits = NULL; + } else if (AR_PHY_BASE <= r->reg) { + snprintf(buf, sizeof (buf), "AR_PHY(%u) (0x%x)", + (r->reg - AR_PHY_BASE) >> 2, r->reg); + bits = NULL; + } else { + snprintf(buf, sizeof (buf), "0x%x", r->reg); + bits = NULL; + } + fprintf(fd, "%-30s %s 0x%x", buf, r->op ? "<=" : "=>", r->val); + if (bits) { + const char *p = bits; + int tmp, n; + + for (tmp = 0, p++; *p;) { + n = *p++; + if (r->val & (1 << (n - 1))) { + putc(tmp ? ',' : '<', fd); + for (; (n = *p) > ' '; ++p) + putc(n, fd); + tmp = 1; + } else + for (; *p > ' '; ++p) + continue; + } + if (tmp) + putc('>', fd); + } +} From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 17:40:40 2009 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 32A601065675; Wed, 11 Mar 2009 17:40:40 +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 20F568FC1E; Wed, 11 Mar 2009 17:40:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BHeepS002326; Wed, 11 Mar 2009 17:40:40 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BHeelF002325; Wed, 11 Mar 2009 17:40:40 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200903111740.n2BHeelF002325@svn.freebsd.org> From: Ed Schouten Date: Wed, 11 Mar 2009 17:40: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: r189703 - head/sbin/recoverdisk 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 Mar 2009 17:40:40 -0000 Author: ed Date: Wed Mar 11 17:40:39 2009 New Revision: 189703 URL: http://svn.freebsd.org/changeset/base/189703 Log: Also use %zu to print the allocation size when malloc(3) fails. Discussed with: phk Modified: head/sbin/recoverdisk/recoverdisk.c Modified: head/sbin/recoverdisk/recoverdisk.c ============================================================================== --- head/sbin/recoverdisk/recoverdisk.c Wed Mar 11 17:15:33 2009 (r189702) +++ head/sbin/recoverdisk/recoverdisk.c Wed Mar 11 17:40:39 2009 (r189703) @@ -226,7 +226,7 @@ main(int argc, char * const argv[]) buf = malloc(bigsize); if (buf == NULL) - err(1, "Cannot allocate %jd bytes buffer", (intmax_t)bigsize); + err(1, "Cannot allocate %zu bytes buffer", bigsize); if (argc > 1) { fdw = open(argv[1], flags, DEFFILEMODE); From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 17:41:47 2009 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 10B39106567A; Wed, 11 Mar 2009 17:41:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F15AB8FC33; Wed, 11 Mar 2009 17:41:46 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BHfkCT002381; Wed, 11 Mar 2009 17:41:46 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BHfkGQ002378; Wed, 11 Mar 2009 17:41:46 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903111741.n2BHfkGQ002378@svn.freebsd.org> From: Sam Leffler Date: Wed, 11 Mar 2009 17:41: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: r189704 - in head/tools/tools/ath: . athpoke 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 Mar 2009 17:41:48 -0000 Author: sam Date: Wed Mar 11 17:41:46 2009 New Revision: 189704 URL: http://svn.freebsd.org/changeset/base/189704 Log: add athpoke, a tool to peek/poke registers Added: head/tools/tools/ath/athpoke/ head/tools/tools/ath/athpoke/Makefile (contents, props changed) head/tools/tools/ath/athpoke/athpoke.c (contents, props changed) Modified: head/tools/tools/ath/Makefile Modified: head/tools/tools/ath/Makefile ============================================================================== --- head/tools/tools/ath/Makefile Wed Mar 11 17:40:39 2009 (r189703) +++ head/tools/tools/ath/Makefile Wed Mar 11 17:41:46 2009 (r189704) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR= athdebug athdecode athkey athprom athrd athregs athstats +SUBDIR= athdebug athdecode athkey athpoke athprom athrd athregs athstats .include Added: head/tools/tools/ath/athpoke/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athpoke/Makefile Wed Mar 11 17:41:46 2009 (r189704) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +PROG= athpoke + +.PATH.c: ${.CURDIR}/../athregs +CFLAGS+=-I${.CURDIR}/../athregs + +SRCS= athpoke.c +SRCS+= dumpregs_5210.c +SRCS+= dumpregs_5211.c +SRCS+= dumpregs_5212.c +SRCS+= dumpregs_5416.c + +.include <../Makefile.inc> + +.include Added: head/tools/tools/ath/athpoke/athpoke.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athpoke/athpoke.c Wed Mar 11 17:41:46 2009 (r189704) @@ -0,0 +1,239 @@ +/*- + * Copyright (c) 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 "diag.h" + +#include "ah.h" +#include "ah_internal.h" + +#include "dumpregs.h" + +#include +#include +#include +#include + +typedef struct { + HAL_REVS revs; +#define MAXREGS 5*1024 + struct dumpreg *regs[MAXREGS]; + u_int nregs; +} dumpregs_t; +static dumpregs_t state; + +static uint32_t regread(int s, struct ath_diag *atd, uint32_t r); +static void regwrite(int s, struct ath_diag *atd, uint32_t r, uint32_t v); +static const struct dumpreg *reglookup(const char *v); + +static void +usage(void) +{ + fprintf(stderr, "usage: athpoke [-i interface] [reg[=value]] ...\n"); + exit(-1); +} + +int +main(int argc, char *argv[]) +{ + struct ath_diag atd; + const char *ifname; + int c, s; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) + err(1, "socket"); + ifname = getenv("ATH"); + if (!ifname) + ifname = ATH_DEFAULT; + + while ((c = getopt(argc, argv, "i:")) != -1) + switch (c) { + case 'i': + ifname = optarg; + break; + default: + usage(); + /*NOTREACHED*/ + } + strncpy(atd.ad_name, ifname, sizeof (atd.ad_name)); + + atd.ad_id = HAL_DIAG_REVS; + atd.ad_out_data = (caddr_t) &state.revs; + atd.ad_out_size = sizeof(state.revs); + if (ioctl(s, SIOCGATHDIAG, &atd) < 0) + err(1, atd.ad_name); + + argc -= optind; + argv += optind; + + for (; argc > 0; argc--, argv++) { + char *cp; + const struct dumpreg *dr; + uint32_t reg; + + cp = strchr(argv[0], '='); + if (cp != NULL) + *cp++ = '\0'; + dr = reglookup(argv[0]); + reg = (dr != NULL) ? dr->addr : (uint32_t) strtoul(argv[0], NULL, 0); + if (cp != NULL) + regwrite(s, &atd, reg, (uint32_t) strtoul(cp, NULL, 0)); + else + printf("%s = %08x\n", argv[0], regread(s, &atd, reg)); + } + return 0; +} + +static uint32_t +regread(int s, struct ath_diag *atd, uint32_t r) +{ + HAL_REGRANGE ra; + uint32_t v[2]; + + ra.start = r; + ra.end = 0; + + atd->ad_in_data = (caddr_t) &ra; + atd->ad_in_size = sizeof(ra); + atd->ad_out_data = (caddr_t) v; + atd->ad_out_size = sizeof(v); + atd->ad_id = HAL_DIAG_REGS | ATH_DIAG_IN | ATH_DIAG_DYN; + if (ioctl(s, SIOCGATHDIAG, atd) < 0) + err(1, atd->ad_name); + return v[1]; +} + +static void +regwrite(int s, struct ath_diag *atd, uint32_t r, uint32_t v) +{ + HAL_REGWRITE rw; + + rw.addr = r; + rw.value = v; + atd->ad_in_data = (caddr_t) &rw; + atd->ad_in_size = sizeof(rw); + atd->ad_id = HAL_DIAG_SETREGS | ATH_DIAG_IN; + if (ioctl(s, SIOCGATHDIAG, atd) < 0) + err(1, atd->ad_name); +} + +static int +regcompar(const void *a, const void *b) +{ + const struct dumpreg *ra = *(const struct dumpreg **)a; + const struct dumpreg *rb = *(const struct dumpreg **)b; + return ra->addr - rb->addr; +} + +void +register_regs(struct dumpreg *chipregs, u_int nchipregs, + int def_srev_min, int def_srev_max, int def_phy_min, int def_phy_max) +{ + const int existing_regs = state.nregs; + int i, j; + + for (i = 0; i < nchipregs; i++) { + struct dumpreg *nr = &chipregs[i]; + if (nr->srevMin == 0) + nr->srevMin = def_srev_min; + if (nr->srevMax == 0) + nr->srevMax = def_srev_max; + if (nr->phyMin == 0) + nr->phyMin = def_phy_min; + if (nr->phyMax == 0) + nr->phyMax = def_phy_max; + for (j = 0; j < existing_regs; j++) { + struct dumpreg *r = state.regs[j]; + /* + * Check if we can just expand the mac+phy + * coverage for the existing entry. + */ + if (nr->addr == r->addr && + (nr->name == r->name || + nr->name != NULL && r->name != NULL && + strcmp(nr->name, r->name) == 0)) { + if (nr->srevMin < r->srevMin && + (r->srevMin <= nr->srevMax && + nr->srevMax+1 <= r->srevMax)) { + r->srevMin = nr->srevMin; + goto skip; + } + if (nr->srevMax > r->srevMax && + (r->srevMin <= nr->srevMin && + nr->srevMin <= r->srevMax)) { + r->srevMax = nr->srevMax; + goto skip; + } + } + if (r->addr > nr->addr) + break; + } + /* + * New item, add to the end, it'll be sorted below. + */ + if (state.nregs == MAXREGS) + errx(-1, "too many registers; bump MAXREGS"); + state.regs[state.nregs++] = nr; + skip: + ; + } + qsort(state.regs, state.nregs, sizeof(struct dumpreg *), regcompar); +} + +void +register_keycache(u_int nslots, + int def_srev_min, int def_srev_max, int def_phy_min, int def_phy_max) +{ + /* discard, no use */ +} + +void +register_range(u_int brange, u_int erange, int type, + int def_srev_min, int def_srev_max, int def_phy_min, int def_phy_max) +{ + /* discard, no use */ +} + +static const struct dumpreg * +reglookup(const char *v) +{ + const HAL_REVS *revs = &state.revs; + int i; + + if (strncasecmp(v, "AR_", 3) == 0) + v += 3; + for (i = 0; i < state.nregs; i++) { + const struct dumpreg *dr = state.regs[i]; + if (MAC_MATCH(dr, revs->ah_macVersion, revs->ah_macRev) && + strcasecmp(v, dr->name) == 0) + return dr; + } + return NULL; +} From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 17:46:02 2009 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 37516106566C; Wed, 11 Mar 2009 17:46:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 237F78FC0A; Wed, 11 Mar 2009 17:46:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BHk1Ak002529; Wed, 11 Mar 2009 17:46:01 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BHk1uD002521; Wed, 11 Mar 2009 17:46:01 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903111746.n2BHk1uD002521@svn.freebsd.org> From: Sam Leffler Date: Wed, 11 Mar 2009 17:46: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: r189705 - in head/tools/tools/ath: athdecode athpoke athregs common 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 Mar 2009 17:46:02 -0000 Author: sam Date: Wed Mar 11 17:46:01 2009 New Revision: 189705 URL: http://svn.freebsd.org/changeset/base/189705 Log: move shared register support code to common Added: head/tools/tools/ath/common/dumpregs.h (props changed) - copied unchanged from r189701, head/tools/tools/ath/athregs/dumpregs.h head/tools/tools/ath/common/dumpregs_5210.c (props changed) - copied unchanged from r189701, head/tools/tools/ath/athregs/dumpregs_5210.c head/tools/tools/ath/common/dumpregs_5211.c (props changed) - copied unchanged from r189701, head/tools/tools/ath/athregs/dumpregs_5211.c head/tools/tools/ath/common/dumpregs_5212.c (props changed) - copied unchanged from r189701, head/tools/tools/ath/athregs/dumpregs_5212.c head/tools/tools/ath/common/dumpregs_5416.c (props changed) - copied unchanged from r189701, head/tools/tools/ath/athregs/dumpregs_5416.c Deleted: head/tools/tools/ath/athregs/dumpregs.h head/tools/tools/ath/athregs/dumpregs_5210.c head/tools/tools/ath/athregs/dumpregs_5211.c head/tools/tools/ath/athregs/dumpregs_5212.c head/tools/tools/ath/athregs/dumpregs_5416.c Modified: head/tools/tools/ath/athdecode/Makefile head/tools/tools/ath/athpoke/Makefile head/tools/tools/ath/athregs/Makefile Modified: head/tools/tools/ath/athdecode/Makefile ============================================================================== --- head/tools/tools/ath/athdecode/Makefile Wed Mar 11 17:41:46 2009 (r189704) +++ head/tools/tools/ath/athdecode/Makefile Wed Mar 11 17:46:01 2009 (r189705) @@ -3,8 +3,7 @@ PROG= athdecode -.PATH.c: ${.CURDIR}/../athregs -CFLAGS+=-I${.CURDIR}/../athregs +.PATH.c: ${.CURDIR}/../common SRCS= main.c SRCS+= dumpregs_5210.c Modified: head/tools/tools/ath/athpoke/Makefile ============================================================================== --- head/tools/tools/ath/athpoke/Makefile Wed Mar 11 17:41:46 2009 (r189704) +++ head/tools/tools/ath/athpoke/Makefile Wed Mar 11 17:46:01 2009 (r189705) @@ -2,8 +2,7 @@ PROG= athpoke -.PATH.c: ${.CURDIR}/../athregs -CFLAGS+=-I${.CURDIR}/../athregs +.PATH.c: ${.CURDIR}/../common SRCS= athpoke.c SRCS+= dumpregs_5210.c Modified: head/tools/tools/ath/athregs/Makefile ============================================================================== --- head/tools/tools/ath/athregs/Makefile Wed Mar 11 17:41:46 2009 (r189704) +++ head/tools/tools/ath/athregs/Makefile Wed Mar 11 17:46:01 2009 (r189705) @@ -2,6 +2,8 @@ PROG= athregs +.PATH.c: ${.CURDIR}/../common + SRCS= dumpregs.c SRCS+= dumpregs_5210.c SRCS+= dumpregs_5211.c Copied: head/tools/tools/ath/common/dumpregs.h (from r189701, head/tools/tools/ath/athregs/dumpregs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/common/dumpregs.h Wed Mar 11 17:46:01 2009 (r189705, copy of r189701, head/tools/tools/ath/athregs/dumpregs.h) @@ -0,0 +1,98 @@ +#ifndef _DUMPREGS_ +#define _DUMPREGS_ +/*- + * Copyright (c) 2002-2008 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$ + */ + +#define __constructor __attribute__((constructor)) + +struct dumpreg { + uint32_t addr; + const char *name; + const char *bits; + int type; + u_int srevMin, srevMax; + u_int phyMin, phyMax; +}; +#define SREV(v,r) (((v) << 16) | (r)) +#define MAC_MATCH(dr, mv, mr) \ + ((dr)->srevMin <= SREV(mv,mr) && SREV(mv,mr) < (dr)->srevMax) + +#define PHY_MATCH(dr, pr) \ + ((dr)->phyMin <= (pr) && (pr) < (dr)->phyMax) +#define PHYANY 0,0xffff + +enum { + DUMP_BASIC = 0x0001, /* basic/default registers */ + DUMP_KEYCACHE = 0x0002, /* key cache */ + DUMP_BASEBAND = 0x0004, /* baseband */ + DUMP_INTERRUPT = 0x0008, /* interrupt state */ + DUMP_XR = 0x0010, /* XR state */ + DUMP_QCU = 0x0020, /* QCU state */ + DUMP_DCU = 0x0040, /* DCU state */ + + DUMP_PUBLIC = 0x0061, /* public = BASIC+QCU+DCU */ + DUMP_ALL = 0xffff +}; + +#define _DEFREG(_addr, _name, _type) \ + { .addr = _addr, .name = _name, .type = _type } +#define _DEFREGx(_addr, _name, _type, _srevmin, _srevmax) \ + { .addr = _addr, .name = _name, .type = _type, \ + .srevMin = _srevmin, .srevMax = _srevmax } +#define _DEFREGfmt(_addr, _name, _type, _fmt) \ + { .addr = _addr, .name = _name, .type = _type, .bits = _fmt } +#define DEFVOID(_addr, _name) _DEFREG(_addr, _name, 0) +#define DEFVOIDx(_addr, _name, _smin, _smax) \ + __DEFREGx(_addr, _name, _smin, _smax, 0) +#define DEFVOIDfmt(_addr, _name, _fmt) \ + _DEFREGfmt(_addr, _name, 0, _fmt) +#define DEFBASIC(_addr, _name) _DEFREG(_addr, _name, DUMP_BASIC) +#define DEFBASICfmt(_addr, _name, _fmt) \ + _DEFREGfmt(_addr, _name, DUMP_BASIC, _fmt) +#define DEFBASICx(_addr, _name, _smin, _smax) \ + _DEFREGx(_addr, _name, DUMP_BASIC, _smin, _smax) +#define DEFBB(_addr, _name) _DEFREG(_addr, _name, DUMP_BASEBAND) +#define DEFINT(_addr, _name) _DEFREG(_addr, _name, DUMP_INTERRUPT) +#define DEFINTfmt(_addr, _name, _fmt) \ + _DEFREGfmt(_addr, _name, DUMP_INTERRUPT, _fmt) +#define DEFQCU(_addr, _name) _DEFREG(_addr, _name, DUMP_QCU) +#define DEFDCU(_addr, _name) _DEFREG(_addr, _name, DUMP_DCU) + +void register_regs(struct dumpreg *_regs, u_int _nregs, + int def_srev_min, int def_srev_max, + int def_phy_min, int def_phy_max); +void register_keycache(u_int nslots, + int def_srev_min, int def_srev_max, + int def_phy_min, int def_phy_max); +void register_range(u_int brange, u_int erange, int what, + int def_srev_min, int def_srev_max, + int def_phy_min, int def_phy_max); +#endif /* _DUMPREGS_ */ Copied: head/tools/tools/ath/common/dumpregs_5210.c (from r189701, head/tools/tools/ath/athregs/dumpregs_5210.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/common/dumpregs_5210.c Wed Mar 11 17:46:01 2009 (r189705, copy of r189701, head/tools/tools/ath/athregs/dumpregs_5210.c) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2002-2008 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 "diag.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ar5210/ar5210reg.h" +#include "ar5210/ar5210phy.h" + +#include "dumpregs.h" + +#define N(a) (sizeof(a) / sizeof(a[0])) + +static struct dumpreg ar5210regs[] = { + DEFBASIC(AR_TXDP0, "TXDP0"), + DEFBASIC(AR_TXDP1, "TXDP1"), + DEFBASICfmt(AR_CR, "CR", AR_CR_BITS), + DEFBASIC(AR_RXDP, "RXDP"), + DEFBASICfmt(AR_CFG, "CFG", AR_CFG_BITS), + /* NB: read clears pending interrupts */ + DEFVOIDfmt(AR_ISR, "ISR", AR_ISR_BITS), + DEFBASICfmt(AR_IMR, "IMR", AR_IMR_BITS), + DEFBASICfmt(AR_IER, "IER", AR_IER_BITS), + DEFBASICfmt(AR_BCR, "BCR", AR_BCR_BITS), + DEFBASICfmt(AR_BSR, "BSR", AR_BSR_BITS), + DEFBASICfmt(AR_TXCFG, "TXCFG", AR_TXCFG_BITS), + DEFBASIC(AR_RXCFG, "RXCFG"), + DEFBASIC(AR_MIBC, "MIBC"), + DEFBASIC(AR_TOPS, "TOPS"), + DEFBASIC(AR_RXNOFRM, "RXNOFR"), + DEFBASIC(AR_TXNOFRM, "TXNOFR"), + DEFBASIC(AR_RPGTO, "RPGTO"), + DEFBASIC(AR_RFCNT, "RFCNT"), + DEFBASIC(AR_MISC, "MISC"), + DEFBASICfmt(AR_RC, "RC", AR_RC_BITS), + DEFBASICfmt(AR_SCR, "SCR", AR_SCR_BITS), + DEFBASICfmt(AR_INTPEND, "INTPEND", AR_INTPEND_BITS), + DEFBASIC(AR_SFR, "SFR"), + DEFBASICfmt(AR_PCICFG, "PCICFG", AR_PCICFG_BITS), + DEFBASIC(AR_GPIOCR, "GPIOCR"), + DEFVOID(AR_GPIODO, "GPIODO"), + DEFVOID(AR_GPIODI, "GPIODI"), + DEFBASIC(AR_SREV, "SREV"), + DEFBASIC(AR_STA_ID0, "STA_ID0"), + DEFBASICfmt(AR_STA_ID1, "STA_ID1", AR_STA_ID1_BITS), + DEFBASIC(AR_BSS_ID0, "BSS_ID0"), + DEFBASIC(AR_BSS_ID1, "BSS_ID1"), + DEFBASIC(AR_SLOT_TIME, "SLOTTIME"), + DEFBASIC(AR_TIME_OUT, "TIME_OUT"), + DEFBASIC(AR_RSSI_THR, "RSSI_THR"), + DEFBASIC(AR_RETRY_LMT, "RETRY_LM"), + DEFBASIC(AR_USEC, "USEC"), + DEFBASICfmt(AR_BEACON, "BEACON", AR_BEACON_BITS), + DEFBASIC(AR_CFP_PERIOD, "CFP_PER"), + DEFBASIC(AR_TIMER0, "TIMER0"), + DEFBASIC(AR_TIMER1, "TIMER1"), + DEFBASIC(AR_TIMER2, "TIMER2"), + DEFBASIC(AR_TIMER3, "TIMER3"), + DEFBASIC(AR_IFS0, "IFS0"), + DEFBASIC(AR_IFS1, "IFS1" ), + DEFBASIC(AR_CFP_DUR, "CFP_DUR"), + DEFBASICfmt(AR_RX_FILTER, "RXFILTER", AR_BEACON_BITS), + DEFBASIC(AR_MCAST_FIL0, "MCAST_0"), + DEFBASIC(AR_MCAST_FIL1, "MCAST_1"), + DEFBASIC(AR_TX_MASK0, "TX_MASK0"), + DEFBASIC(AR_TX_MASK1, "TX_MASK1"), + DEFVOID(AR_CLR_TMASK, "CLR_TMASK"), + DEFBASIC(AR_TRIG_LEV, "TRIG_LEV"), + DEFBASICfmt(AR_DIAG_SW, "DIAG_SW", AR_DIAG_SW_BITS), + DEFBASIC(AR_TSF_L32, "TSF_L32"), + DEFBASIC(AR_TSF_U32, "TSF_U32"), + DEFBASIC(AR_LAST_TSTP, "LAST_TST"), + DEFBASIC(AR_RETRY_CNT, "RETRYCNT"), + DEFBASIC(AR_BACKOFF, "BACKOFF"), + DEFBASIC(AR_NAV, "NAV"), + DEFBASIC(AR_RTS_OK, "RTS_OK"), + DEFBASIC(AR_RTS_FAIL, "RTS_FAIL"), + DEFBASIC(AR_ACK_FAIL, "ACK_FAIL"), + DEFBASIC(AR_FCS_FAIL, "FCS_FAIL"), + DEFBASIC(AR_BEACON_CNT, "BEAC_CNT"), + + DEFVOIDfmt(AR_PHY_FRCTL, "PHY_FRCTL", AR_PHY_FRCTL_BITS), + DEFVOIDfmt(AR_PHY_AGC, "PHY_AGC", AR_PHY_AGC_BITS), + DEFVOID(AR_PHY_CHIPID, "PHY_CHIPID"), + DEFVOIDfmt(AR_PHY_ACTIVE, "PHY_ACTIVE", AR_PHY_ACTIVE_BITS), + DEFVOIDfmt(AR_PHY_AGCCTL, "PHY_AGCCTL", AR_PHY_AGCCTL_BITS), +}; + +static __constructor void +ar5210_ctor(void) +{ +#define MAC5210 SREV(1,0), SREV(2,0) + register_regs(ar5210regs, N(ar5210regs), MAC5210, PHYANY); + register_keycache(64, MAC5210, PHYANY); + + register_range(0x9800, 0x9840, DUMP_BASEBAND, MAC5210, PHYANY); +} Copied: head/tools/tools/ath/common/dumpregs_5211.c (from r189701, head/tools/tools/ath/athregs/dumpregs_5211.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/common/dumpregs_5211.c Wed Mar 11 17:46:01 2009 (r189705, copy of r189701, head/tools/tools/ath/athregs/dumpregs_5211.c) @@ -0,0 +1,293 @@ +/*- + * Copyright (c) 2002-2008 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 "diag.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ar5211/ar5211reg.h" +#include "ar5211/ar5211phy.h" + +#include "dumpregs.h" + +#define N(a) (sizeof(a) / sizeof(a[0])) + +static struct dumpreg ar5211regs[] = { + DEFBASICfmt(AR_CR, "CR", AR_CR_BITS), + DEFBASIC(AR_RXDP, "RXDP"), + DEFBASICfmt(AR_CFG, "CFG", AR_CFG_BITS), + DEFBASICfmt(AR_IER, "IER", AR_IER_BITS), + DEFBASIC(AR_RTSD0, "RTSD0"), + DEFBASIC(AR_RTSD1, "RTSD1"), + DEFBASICfmt(AR_TXCFG, "TXCFG", AR_TXCFG_BITS), + DEFBASIC(AR_RXCFG, "RXCFG"), + DEFBASIC(AR5211_JUMBO_LAST, "JLAST"), + DEFBASIC(AR_MIBC, "MIBC"), + DEFBASIC(AR_TOPS, "TOPS"), + DEFBASIC(AR_RXNPTO, "RXNPTO"), + DEFBASIC(AR_TXNPTO, "TXNPTO"), + DEFBASIC(AR_RFGTO, "RFGTO"), + DEFBASIC(AR_RFCNT, "RFCNT"), + DEFBASIC(AR_MACMISC, "MISC"), + DEFVOID(AR5311_QDCLKGATE, "AR5311_QDCLKGATE"), + + DEFINT(AR_ISR, "ISR"), + DEFINT(AR_ISR_S0, "ISR_S0"), + DEFINT(AR_ISR_S1, "ISR_S1"), + DEFINT(AR_ISR_S2, "ISR_S2"), + DEFINT(AR_ISR_S3, "ISR_S3"), + DEFINT(AR_ISR_S4, "ISR_S4"), + DEFINT(AR_IMR, "IMR"), + DEFINT(AR_IMR_S0, "IMR_S0"), + DEFINT(AR_IMR_S1, "IMR_S1"), + DEFINT(AR_IMR_S2, "IMR_S2"), + DEFINT(AR_IMR_S3, "IMR_S3"), + DEFINT(AR_IMR_S4, "IMR_S4"), + /* NB: don't read the RAC so we don't affect operation */ + DEFVOID(AR_ISR_RAC, "ISR_RAC"), + DEFINT(AR_ISR_S0_S, "ISR_S0_S"), + DEFINT(AR_ISR_S1_S, "ISR_S1_S"), + DEFINT(AR_ISR_S2_S, "ISR_S2_S"), + DEFINT(AR_ISR_S3_S, "ISR_S3_S"), + DEFINT(AR_ISR_S4_S, "ISR_S4_S"), + + DEFQCU(AR_Q0_TXDP, "Q0_TXDP"), + DEFQCU(AR_Q1_TXDP, "Q1_TXDP"), + DEFQCU(AR_Q2_TXDP, "Q2_TXDP"), + DEFQCU(AR_Q3_TXDP, "Q3_TXDP"), + DEFQCU(AR_Q4_TXDP, "Q4_TXDP"), + DEFQCU(AR_Q5_TXDP, "Q5_TXDP"), + DEFQCU(AR_Q6_TXDP, "Q6_TXDP"), + DEFQCU(AR_Q7_TXDP, "Q7_TXDP"), + DEFQCU(AR_Q8_TXDP, "Q8_TXDP"), + DEFQCU(AR_Q9_TXDP, "Q9_TXDP"), + + DEFQCU(AR_Q_TXE, "Q_TXE"), + DEFQCU(AR_Q_TXD, "Q_TXD"), + + DEFQCU(AR_Q0_CBRCFG, "Q0_CBR"), + DEFQCU(AR_Q1_CBRCFG, "Q1_CBR"), + DEFQCU(AR_Q2_CBRCFG, "Q2_CBR"), + DEFQCU(AR_Q3_CBRCFG, "Q3_CBR"), + DEFQCU(AR_Q4_CBRCFG, "Q4_CBR"), + DEFQCU(AR_Q5_CBRCFG, "Q5_CBR"), + DEFQCU(AR_Q6_CBRCFG, "Q6_CBR"), + DEFQCU(AR_Q7_CBRCFG, "Q7_CBR"), + DEFQCU(AR_Q8_CBRCFG, "Q8_CBR"), + DEFQCU(AR_Q9_CBRCFG, "Q9_CBR"), + + DEFQCU(AR_Q0_RDYTIMECFG, "Q0_RDYT"), + DEFQCU(AR_Q1_RDYTIMECFG, "Q1_RDYT"), + DEFQCU(AR_Q2_RDYTIMECFG, "Q2_RDYT"), + DEFQCU(AR_Q3_RDYTIMECFG, "Q3_RDYT"), + DEFQCU(AR_Q4_RDYTIMECFG, "Q4_RDYT"), + DEFQCU(AR_Q5_RDYTIMECFG, "Q5_RDYT"), + DEFQCU(AR_Q6_RDYTIMECFG, "Q6_RDYT"), + DEFQCU(AR_Q7_RDYTIMECFG, "Q7_RDYT"), + DEFQCU(AR_Q8_RDYTIMECFG, "Q8_RDYT"), + DEFQCU(AR_Q9_RDYTIMECFG, "Q9_RDYT"), + + DEFQCU(AR_Q_ONESHOTARM_SC, "Q_ONESHOTARM_SC"), + DEFQCU(AR_Q_ONESHOTARM_CC, "Q_ONESHOTARM_CC"), + + DEFQCU(AR_Q0_MISC, "Q0_MISC"), + DEFQCU(AR_Q1_MISC, "Q1_MISC"), + DEFQCU(AR_Q2_MISC, "Q2_MISC"), + DEFQCU(AR_Q3_MISC, "Q3_MISC"), + DEFQCU(AR_Q4_MISC, "Q4_MISC"), + DEFQCU(AR_Q5_MISC, "Q5_MISC"), + DEFQCU(AR_Q6_MISC, "Q6_MISC"), + DEFQCU(AR_Q7_MISC, "Q7_MISC"), + DEFQCU(AR_Q8_MISC, "Q8_MISC"), + DEFQCU(AR_Q9_MISC, "Q9_MISC"), + + DEFQCU(AR_Q0_STS, "Q0_STS"), + DEFQCU(AR_Q1_STS, "Q1_STS"), + DEFQCU(AR_Q2_STS, "Q2_STS"), + DEFQCU(AR_Q3_STS, "Q3_STS"), + DEFQCU(AR_Q4_STS, "Q4_STS"), + DEFQCU(AR_Q5_STS, "Q5_STS"), + DEFQCU(AR_Q6_STS, "Q6_STS"), + DEFQCU(AR_Q7_STS, "Q7_STS"), + DEFQCU(AR_Q8_STS, "Q8_STS"), + DEFQCU(AR_Q9_STS, "Q9_STS"), + + DEFQCU(AR_Q_RDYTIMESHDN, "Q_RDYTIMSHD"), + + DEFQCU(AR_D0_QCUMASK, "D0_MASK"), + DEFQCU(AR_D1_QCUMASK, "D1_MASK"), + DEFQCU(AR_D2_QCUMASK, "D2_MASK"), + DEFQCU(AR_D3_QCUMASK, "D3_MASK"), + DEFQCU(AR_D4_QCUMASK, "D4_MASK"), + DEFQCU(AR_D5_QCUMASK, "D5_MASK"), + DEFQCU(AR_D6_QCUMASK, "D6_MASK"), + DEFQCU(AR_D7_QCUMASK, "D7_MASK"), + DEFQCU(AR_D8_QCUMASK, "D8_MASK"), + DEFQCU(AR_D9_QCUMASK, "D9_MASK"), + + DEFDCU(AR_D0_LCL_IFS, "D0_IFS"), + DEFDCU(AR_D1_LCL_IFS, "D1_IFS"), + DEFDCU(AR_D2_LCL_IFS, "D2_IFS"), + DEFDCU(AR_D3_LCL_IFS, "D3_IFS"), + DEFDCU(AR_D4_LCL_IFS, "D4_IFS"), + DEFDCU(AR_D5_LCL_IFS, "D5_IFS"), + DEFDCU(AR_D6_LCL_IFS, "D6_IFS"), + DEFDCU(AR_D7_LCL_IFS, "D7_IFS"), + DEFDCU(AR_D8_LCL_IFS, "D8_IFS"), + DEFDCU(AR_D9_LCL_IFS, "D9_IFS"), + + DEFDCU(AR_D0_RETRY_LIMIT, "D0_RTRY"), + DEFDCU(AR_D1_RETRY_LIMIT, "D1_RTRY"), + DEFDCU(AR_D2_RETRY_LIMIT, "D2_RTRY"), + DEFDCU(AR_D3_RETRY_LIMIT, "D3_RTRY"), + DEFDCU(AR_D4_RETRY_LIMIT, "D4_RTRY"), + DEFDCU(AR_D5_RETRY_LIMIT, "D5_RTRY"), + DEFDCU(AR_D6_RETRY_LIMIT, "D6_RTRY"), + DEFDCU(AR_D7_RETRY_LIMIT, "D7_RTRY"), + DEFDCU(AR_D8_RETRY_LIMIT, "D8_RTRY"), + DEFDCU(AR_D9_RETRY_LIMIT, "D9_RTRY"), + + DEFDCU(AR_D0_CHNTIME, "D0_CHNT"), + DEFDCU(AR_D1_CHNTIME, "D1_CHNT"), + DEFDCU(AR_D2_CHNTIME, "D2_CHNT"), + DEFDCU(AR_D3_CHNTIME, "D3_CHNT"), + DEFDCU(AR_D4_CHNTIME, "D4_CHNT"), + DEFDCU(AR_D5_CHNTIME, "D5_CHNT"), + DEFDCU(AR_D6_CHNTIME, "D6_CHNT"), + DEFDCU(AR_D7_CHNTIME, "D7_CHNT"), + DEFDCU(AR_D8_CHNTIME, "D8_CHNT"), + DEFDCU(AR_D9_CHNTIME, "D9_CHNT"), + + DEFDCU(AR_D0_MISC, "D0_MISC"), + DEFDCU(AR_D1_MISC, "D1_MISC"), + DEFDCU(AR_D2_MISC, "D2_MISC"), + DEFDCU(AR_D3_MISC, "D3_MISC"), + DEFDCU(AR_D4_MISC, "D4_MISC"), + DEFDCU(AR_D5_MISC, "D5_MISC"), + DEFDCU(AR_D6_MISC, "D6_MISC"), + DEFDCU(AR_D7_MISC, "D7_MISC"), + DEFDCU(AR_D8_MISC, "D8_MISC"), + DEFDCU(AR_D9_MISC, "D9_MISC"), + + DEFDCU(AR_D0_SEQNUM, "D0_SEQ"), + DEFDCU(AR_D1_SEQNUM, "D1_SEQ"), + DEFDCU(AR_D2_SEQNUM, "D2_SEQ"), + DEFDCU(AR_D3_SEQNUM, "D3_SEQ"), + DEFDCU(AR_D4_SEQNUM, "D4_SEQ"), + DEFDCU(AR_D5_SEQNUM, "D5_SEQ"), + DEFDCU(AR_D6_SEQNUM, "D6_SEQ"), + DEFDCU(AR_D7_SEQNUM, "D7_SEQ"), + DEFDCU(AR_D8_SEQNUM, "D8_SEQ"), + DEFDCU(AR_D9_SEQNUM, "D9_SEQ"), + + DEFBASIC(AR_D_GBL_IFS_SIFS, "D_SIFS"), + DEFBASIC(AR_D_GBL_IFS_SLOT, "D_SLOT"), + DEFBASIC(AR_D_GBL_IFS_EIFS, "D_EIFS"), + DEFBASIC(AR_D_GBL_IFS_MISC, "D_MISC"), + DEFBASIC(AR_D_FPCTL, "D_FPCTL"), + DEFBASIC(AR_D_TXPSE, "D_TXPSE"), + DEFVOID(AR_D_TXBLK_CMD, "D_CMD"), +#if 0 + DEFVOID(AR_D_TXBLK_DATA, "D_DATA"), +#endif + DEFVOID(AR_D_TXBLK_CLR, "D_CLR"), + DEFVOID(AR_D_TXBLK_SET, "D_SET"), + DEFBASICfmt(AR_RC, "RC", AR_RC_BITS), + DEFBASICfmt(AR_SCR, "SCR", AR_SCR_BITS), + DEFBASICfmt(AR_INTPEND, "INTPEND", AR_INTPEND_BITS), + DEFBASIC(AR_SFR, "SFR"), + DEFBASICfmt(AR_PCICFG, "PCICFG", AR_PCICFG_BITS), + DEFBASIC(AR_GPIOCR, "GPIOCR"), + DEFBASIC(AR_GPIODO, "GPIODO"), + DEFBASIC(AR_GPIODI, "GPIODI"), + DEFBASIC(AR_SREV, "SREV"), + DEFVOID(AR_EEPROM_ADDR, "EEADDR"), + DEFVOID(AR_EEPROM_DATA, "EEDATA"), + DEFVOID(AR_EEPROM_CMD, "EECMD"), + DEFVOID(AR_EEPROM_STS, "EESTS"), + DEFVOID(AR_EEPROM_CFG, "EECFG"), + DEFBASIC(AR_STA_ID0, "STA_ID0"), + DEFBASICfmt(AR_STA_ID1, "STA_ID1", AR_STA_ID1_BITS), + DEFBASIC(AR_BSS_ID0, "BSS_ID0"), + DEFBASIC(AR_BSS_ID1, "BSS_ID1"), + DEFBASIC(AR_SLOT_TIME, "SLOTTIME"), + DEFBASIC(AR_TIME_OUT, "TIME_OUT"), + DEFBASIC(AR_RSSI_THR, "RSSI_THR"), + DEFBASIC(AR_USEC, "USEC"), + DEFBASICfmt(AR_BEACON, "BEACON", AR_BEACON_BITS), + DEFBASIC(AR_CFP_PERIOD, "CFP_PER"), + DEFBASIC(AR_TIMER0, "TIMER0"), + DEFBASIC(AR_TIMER1, "TIMER1"), + DEFBASIC(AR_TIMER2, "TIMER2"), + DEFBASIC(AR_TIMER3, "TIMER3"), + DEFBASIC(AR_CFP_DUR, "CFP_DUR"), + DEFBASICfmt(AR_RX_FILTER, "RXFILTER", AR_RX_FILTER_BITS), + DEFBASIC(AR_MCAST_FIL0, "MCAST_0"), + DEFBASIC(AR_MCAST_FIL1, "MCAST_1"), + DEFBASICfmt(AR_DIAG_SW, "DIAG_SW", AR_DIAG_SW_BITS), + DEFBASIC(AR_TSF_L32, "TSF_L32"), + DEFBASIC(AR_TSF_U32, "TSF_U32"), + DEFBASIC(AR_TST_ADDAC, "TST_ADAC"), + DEFBASIC(AR_DEF_ANTENNA, "DEF_ANT"), + + DEFBASIC(AR_LAST_TSTP, "LAST_TST"), + DEFBASIC(AR_NAV, "NAV"), + DEFBASIC(AR_RTS_OK, "RTS_OK"), + DEFBASIC(AR_RTS_FAIL, "RTS_FAIL"), + DEFBASIC(AR_ACK_FAIL, "ACK_FAIL"), + DEFBASIC(AR_FCS_FAIL, "FCS_FAIL"), + DEFBASIC(AR_BEACON_CNT, "BEAC_CNT"), + + DEFVOID(AR_PHY_TURBO, "PHY_TURBO"), + DEFVOID(AR_PHY_CHIP_ID, "PHY_CHIP_ID"), + DEFVOID(AR_PHY_ACTIVE, "PHY_ACTIVE"), + DEFVOID(AR_PHY_AGC_CONTROL, "PHY_AGC_CONTROL"), + DEFVOID(AR_PHY_PLL_CTL, "PHY_PLL_CTL"), + DEFVOID(AR_PHY_RX_DELAY, "PHY_RX_DELAY"), + DEFVOID(AR_PHY_TIMING_CTRL4,"PHY_TIMING_CTRL4"), + DEFVOID(AR_PHY_RADAR_0, "PHY_RADAR_0"), + DEFVOID(AR_PHY_IQCAL_RES_PWR_MEAS_I,"PHY_IQCAL_RES_PWR_MEAS_I"), + DEFVOID(AR_PHY_IQCAL_RES_PWR_MEAS_Q,"PHY_IQCAL_RES_PWR_MEAS_Q"), + DEFVOID(AR_PHY_IQCAL_RES_IQ_CORR_MEAS,"PHY_IQCAL_RES_IQ_CORR_MEAS"), + DEFVOID(AR_PHY_CURRENT_RSSI,"PHY_CURRENT_RSSI"), + DEFVOID(AR5211_PHY_MODE, "PHY_MODE"), +}; + +static __constructor void +ar5211_ctor(void) +{ +#define MAC5211 SREV(2,0), SREV(4,5) + register_regs(ar5211regs, N(ar5211regs), MAC5211, PHYANY); + register_keycache(128, MAC5211, PHYANY); + + register_range(0x9800, 0x987c, DUMP_BASEBAND, MAC5211, PHYANY); + register_range(0x9900, 0x995c, DUMP_BASEBAND, MAC5211, PHYANY); + register_range(0x9c00, 0x9c1c, DUMP_BASEBAND, MAC5211, PHYANY); +} Copied: head/tools/tools/ath/common/dumpregs_5212.c (from r189701, head/tools/tools/ath/athregs/dumpregs_5212.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/common/dumpregs_5212.c Wed Mar 11 17:46:01 2009 (r189705, copy of r189701, head/tools/tools/ath/athregs/dumpregs_5212.c) @@ -0,0 +1,432 @@ +/*- + * Copyright (c) 2002-2008 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 "diag.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ar5212/ar5212reg.h" +#include "ar5212/ar5212phy.h" + +#include "dumpregs.h" + +#define N(a) (sizeof(a) / sizeof(a[0])) + +#define MAC5212 SREV(4,5), SREV(16,0) +#define MAC5213 SREV(5,9), SREV(16,0) + +static struct dumpreg ar5212regs[] = { + DEFBASIC(AR_CR, "CR"), + DEFBASIC(AR_RXDP, "RXDP"), + DEFBASICfmt(AR_CFG, "CFG", + "\20\1SWTD\2SWTB\3SWRD\4SWRB\5SWRG\6AP_ADHOC\11PHOK\12EEBS"), + DEFBASIC(AR_IER, "IER"), + DEFBASIC(AR_TXCFG, "TXCFG"), + DEFBASICfmt(AR_RXCFG, "RXCFG", + "\20\6JUMBO_ENA\7JUMBO_WRAP\10SLEEP_DEBUG"), + DEFBASIC(AR_MIBC, "MIBC"), + DEFBASIC(AR_TOPS, "TOPS"), + DEFBASIC(AR_RXNPTO, "RXNPTO"), + DEFBASIC(AR_TXNPTO, "TXNPTO"), + DEFBASIC(AR_RPGTO, "RPGTO"), + DEFBASIC(AR_RPCNT, "RPCNT"), + DEFBASIC(AR_MACMISC, "MACMISC"), + DEFBASIC(AR_SPC_0, "SPC_0"), + DEFBASIC(AR_SPC_1, "SPC_1"), + + DEFINTfmt(AR_ISR, "ISR", + "\20\1RXOK\2RXDESC\3RXERR\4RXNOPKT\5RXEOL\6RXORN\7TXOK\10TXDESC" + "\11TXERR\12TXNOPKT\13TXEOL\14TXURN\15MIB\16SWI\17RXPHY\20RXKCM" + "\21SWBA\22BRSSI\23BMISS\24HIUERR\25BNR\26RXCHIRP\27RXDOPPL\30BCNMISS" + "\31TIM\32GPIO\33QCBROVF\34QCBRURN\35QTRIG"), + DEFINT(AR_ISR_S0, "ISR_S0"), + DEFINT(AR_ISR_S1, "ISR_S1"), + DEFINTfmt(AR_ISR_S2, "ISR_S2", + "\20\21MCABT\22SSERR\23DPERR\24TIM\25CABEND\26DTIMSYNC\27BCNTO" + "\30CABTO\31DTIM"), + DEFINT(AR_ISR_S3, "ISR_S3"), + DEFINT(AR_ISR_S4, "ISR_S4"), + DEFINTfmt(AR_IMR, "IMR", + "\20\1RXOK\2RXDESC\3RXERR\4RXNOPKT\5RXEOL\6RXORN\7TXOK\10TXDESC" + "\11TXERR\12TXNOPKT\13TXEOL\14TXURN\15MIB\16SWI\17RXPHY\20RXKCM" + "\21SWBA\22BRSSI\23BMISS\24HIUERR\25BNR\26RXCHIRP\27RXDOPPL\30BCNMISS" + "\31TIM\32GPIO\33QCBROVF\34QCBRURN\35QTRIG"), + DEFINT(AR_IMR_S0, "IMR_S0"), + DEFINT(AR_IMR_S1, "IMR_S1"), + DEFINTfmt(AR_IMR_S2, "IMR_S2", + "\20\21MCABT\22SSERR\23DPERR\24TIM\25CABEND\26DTIMSYNC\27BCNTO" + "\30CABTO\31DTIM"), + DEFINT(AR_IMR_S3, "IMR_S3"), + DEFINT(AR_IMR_S4, "IMR_S4"), + /* NB: don't read the RAC so we don't affect operation */ + DEFVOID(AR_ISR_RAC, "ISR_RAC"), + DEFINT(AR_ISR_S0_S, "ISR_S0_S"), + DEFINT(AR_ISR_S1_S, "ISR_S1_S"), + DEFINT(AR_ISR_S2_S, "ISR_S2_S"), + DEFINT(AR_ISR_S3_S, "ISR_S3_S"), + DEFINT(AR_ISR_S4_S, "ISR_S4_S"), + + DEFBASIC(AR_DMADBG_0, "DMADBG0"), + DEFBASIC(AR_DMADBG_1, "DMADBG1"), + DEFBASIC(AR_DMADBG_2, "DMADBG2"), + DEFBASIC(AR_DMADBG_3, "DMADBG3"), + DEFBASIC(AR_DMADBG_4, "DMADBG4"), + DEFBASIC(AR_DMADBG_5, "DMADBG5"), + DEFBASIC(AR_DMADBG_6, "DMADBG6"), + DEFBASIC(AR_DMADBG_7, "DMADBG7"), + + DEFBASIC(AR_DCM_A, "DCM_A"), + DEFBASIC(AR_DCM_D, "DCM_D"), + DEFBASIC(AR_DCCFG, "DCCFG"), + DEFBASIC(AR_CCFG, "CCFG"), + DEFBASIC(AR_CCUCFG, "CCUCFG"), + DEFBASIC(AR_CPC_0, "CPC0"), + DEFBASIC(AR_CPC_1, "CPC1"), + DEFBASIC(AR_CPC_2, "CPC2"), + DEFBASIC(AR_CPC_3, "CPC3"), + DEFBASIC(AR_CPCOVF, "CPCOVF"), + + DEFQCU(AR_Q0_TXDP, "Q0_TXDP"), + DEFQCU(AR_Q1_TXDP, "Q1_TXDP"), + DEFQCU(AR_Q2_TXDP, "Q2_TXDP"), + DEFQCU(AR_Q3_TXDP, "Q3_TXDP"), + DEFQCU(AR_Q4_TXDP, "Q4_TXDP"), + DEFQCU(AR_Q5_TXDP, "Q5_TXDP"), + DEFQCU(AR_Q6_TXDP, "Q6_TXDP"), + DEFQCU(AR_Q7_TXDP, "Q7_TXDP"), + DEFQCU(AR_Q8_TXDP, "Q8_TXDP"), + DEFQCU(AR_Q9_TXDP, "Q9_TXDP"), + + DEFQCU(AR_Q_TXE, "Q_TXE"), + DEFQCU(AR_Q_TXD, "Q_TXD"), + + DEFQCU(AR_Q0_CBRCFG, "Q0_CBR"), + DEFQCU(AR_Q1_CBRCFG, "Q1_CBR"), + DEFQCU(AR_Q2_CBRCFG, "Q2_CBR"), + DEFQCU(AR_Q3_CBRCFG, "Q3_CBR"), + DEFQCU(AR_Q4_CBRCFG, "Q4_CBR"), + DEFQCU(AR_Q5_CBRCFG, "Q5_CBR"), + DEFQCU(AR_Q6_CBRCFG, "Q6_CBR"), + DEFQCU(AR_Q7_CBRCFG, "Q7_CBR"), + DEFQCU(AR_Q8_CBRCFG, "Q8_CBR"), + DEFQCU(AR_Q9_CBRCFG, "Q9_CBR"), + + DEFQCU(AR_Q0_RDYTIMECFG, "Q0_RDYT"), + DEFQCU(AR_Q1_RDYTIMECFG, "Q1_RDYT"), + DEFQCU(AR_Q2_RDYTIMECFG, "Q2_RDYT"), + DEFQCU(AR_Q3_RDYTIMECFG, "Q3_RDYT"), + DEFQCU(AR_Q4_RDYTIMECFG, "Q4_RDYT"), + DEFQCU(AR_Q5_RDYTIMECFG, "Q5_RDYT"), + DEFQCU(AR_Q6_RDYTIMECFG, "Q6_RDYT"), + DEFQCU(AR_Q7_RDYTIMECFG, "Q7_RDYT"), + DEFQCU(AR_Q8_RDYTIMECFG, "Q8_RDYT"), + DEFQCU(AR_Q9_RDYTIMECFG, "Q9_RDYT"), + + DEFQCU(AR_Q_ONESHOTARM_SC, "Q_ONESHOTARM_SC"), + DEFQCU(AR_Q_ONESHOTARM_CC, "Q_ONESHOTARM_CC"), + + DEFQCU(AR_Q0_MISC, "Q0_MISC"), + DEFQCU(AR_Q1_MISC, "Q1_MISC"), + DEFQCU(AR_Q2_MISC, "Q2_MISC"), + DEFQCU(AR_Q3_MISC, "Q3_MISC"), + DEFQCU(AR_Q4_MISC, "Q4_MISC"), + DEFQCU(AR_Q5_MISC, "Q5_MISC"), + DEFQCU(AR_Q6_MISC, "Q6_MISC"), + DEFQCU(AR_Q7_MISC, "Q7_MISC"), + DEFQCU(AR_Q8_MISC, "Q8_MISC"), + DEFQCU(AR_Q9_MISC, "Q9_MISC"), + + DEFQCU(AR_Q0_STS, "Q0_STS"), + DEFQCU(AR_Q1_STS, "Q1_STS"), + DEFQCU(AR_Q2_STS, "Q2_STS"), + DEFQCU(AR_Q3_STS, "Q3_STS"), + DEFQCU(AR_Q4_STS, "Q4_STS"), + DEFQCU(AR_Q5_STS, "Q5_STS"), + DEFQCU(AR_Q6_STS, "Q6_STS"), + DEFQCU(AR_Q7_STS, "Q7_STS"), + DEFQCU(AR_Q8_STS, "Q8_STS"), + DEFQCU(AR_Q9_STS, "Q9_STS"), + + DEFQCU(AR_Q_RDYTIMESHDN, "Q_RDYTIMSHD"), + + DEFQCU(AR_Q_CBBS, "Q_CBBS"), + DEFQCU(AR_Q_CBBA, "Q_CBBA"), + DEFQCU(AR_Q_CBC, "Q_CBC"), + + DEFDCU(AR_D0_QCUMASK, "D0_MASK"), + DEFDCU(AR_D1_QCUMASK, "D1_MASK"), + DEFDCU(AR_D2_QCUMASK, "D2_MASK"), + DEFDCU(AR_D3_QCUMASK, "D3_MASK"), + DEFDCU(AR_D4_QCUMASK, "D4_MASK"), + DEFDCU(AR_D5_QCUMASK, "D5_MASK"), + DEFDCU(AR_D6_QCUMASK, "D6_MASK"), + DEFDCU(AR_D7_QCUMASK, "D7_MASK"), + DEFDCU(AR_D8_QCUMASK, "D8_MASK"), + DEFDCU(AR_D9_QCUMASK, "D9_MASK"), + + DEFDCU(AR_D0_LCL_IFS, "D0_IFS"), + DEFDCU(AR_D1_LCL_IFS, "D1_IFS"), + DEFDCU(AR_D2_LCL_IFS, "D2_IFS"), + DEFDCU(AR_D3_LCL_IFS, "D3_IFS"), + DEFDCU(AR_D4_LCL_IFS, "D4_IFS"), + DEFDCU(AR_D5_LCL_IFS, "D5_IFS"), + DEFDCU(AR_D6_LCL_IFS, "D6_IFS"), + DEFDCU(AR_D7_LCL_IFS, "D7_IFS"), + DEFDCU(AR_D8_LCL_IFS, "D8_IFS"), + DEFDCU(AR_D9_LCL_IFS, "D9_IFS"), + + DEFDCU(AR_D0_RETRY_LIMIT, "D0_RTRY"), + DEFDCU(AR_D1_RETRY_LIMIT, "D1_RTRY"), + DEFDCU(AR_D2_RETRY_LIMIT, "D2_RTRY"), + DEFDCU(AR_D3_RETRY_LIMIT, "D3_RTRY"), + DEFDCU(AR_D4_RETRY_LIMIT, "D4_RTRY"), + DEFDCU(AR_D5_RETRY_LIMIT, "D5_RTRY"), + DEFDCU(AR_D6_RETRY_LIMIT, "D6_RTRY"), + DEFDCU(AR_D7_RETRY_LIMIT, "D7_RTRY"), + DEFDCU(AR_D8_RETRY_LIMIT, "D8_RTRY"), + DEFDCU(AR_D9_RETRY_LIMIT, "D9_RTRY"), + + DEFDCU(AR_D0_CHNTIME, "D0_CHNT"), + DEFDCU(AR_D1_CHNTIME, "D1_CHNT"), + DEFDCU(AR_D2_CHNTIME, "D2_CHNT"), + DEFDCU(AR_D3_CHNTIME, "D3_CHNT"), + DEFDCU(AR_D4_CHNTIME, "D4_CHNT"), + DEFDCU(AR_D5_CHNTIME, "D5_CHNT"), + DEFDCU(AR_D6_CHNTIME, "D6_CHNT"), + DEFDCU(AR_D7_CHNTIME, "D7_CHNT"), + DEFDCU(AR_D8_CHNTIME, "D8_CHNT"), + DEFDCU(AR_D9_CHNTIME, "D9_CHNT"), + + DEFDCU(AR_D0_MISC, "D0_MISC"), + DEFDCU(AR_D1_MISC, "D1_MISC"), + DEFDCU(AR_D2_MISC, "D2_MISC"), + DEFDCU(AR_D3_MISC, "D3_MISC"), + DEFDCU(AR_D4_MISC, "D4_MISC"), + DEFDCU(AR_D5_MISC, "D5_MISC"), + DEFDCU(AR_D6_MISC, "D6_MISC"), + DEFDCU(AR_D7_MISC, "D7_MISC"), + DEFDCU(AR_D8_MISC, "D8_MISC"), + DEFDCU(AR_D9_MISC, "D9_MISC"), + + _DEFREG(AR_D_SEQNUM, "D_SEQ", DUMP_BASIC | DUMP_DCU), + DEFBASIC(AR_D_GBL_IFS_SIFS, "D_SIFS"), + DEFBASIC(AR_D_GBL_IFS_SLOT, "D_SLOT"), + DEFBASIC(AR_D_GBL_IFS_EIFS, "D_EIFS"), + DEFBASIC(AR_D_GBL_IFS_MISC, "D_MISC"), + DEFBASIC(AR_D_FPCTL, "D_FPCTL"), + DEFBASIC(AR_D_TXPSE, "D_TXPSE"), + DEFVOID(AR_D_TXBLK_CMD, "D_CMD"), +#if 0 + DEFVOID(AR_D_TXBLK_DATA, "D_DATA"), +#endif + DEFVOID(AR_D_TXBLK_CLR, "D_CLR"), + DEFVOID(AR_D_TXBLK_SET, "D_SET"), + DEFBASIC(AR_RC, "RC"), + DEFBASICfmt(AR_SCR, "SCR", + "\20\22SLDTP\23SLDWP\24SLEPOL\25MIBIE"), + DEFBASIC(AR_INTPEND, "INTPEND"), + DEFBASIC(AR_SFR, "SFR"), + DEFBASIC(AR_PCICFG, "PCICFG"), + DEFBASIC(AR_GPIOCR, "GPIOCR"), + DEFBASIC(AR_GPIODO, "GPIODO"), + DEFBASIC(AR_GPIODI, "GPIODI"), + DEFBASIC(AR_SREV, "SREV"), + + DEFBASICx(AR_PCIE_PMC, "PCIEPMC", SREV(4,8), SREV(13,7)), + DEFBASICx(AR_PCIE_SERDES, "SERDES", SREV(4,8), SREV(13,7)), + DEFBASICx(AR_PCIE_SERDES2, "SERDES2", SREV(4,8), SREV(13,7)), + DEFVOID(AR_EEPROM_ADDR, "EEADDR"), + DEFVOID(AR_EEPROM_DATA, "EEDATA"), + DEFVOID(AR_EEPROM_CMD, "EECMD"), + DEFVOID(AR_EEPROM_STS, "EESTS"), + DEFVOID(AR_EEPROM_CFG, "EECFG"), + DEFBASIC(AR_STA_ID0, "STA_ID0"), + DEFBASICfmt(AR_STA_ID1, "STA_ID1", + "\20\21STA_AP\22ADHOC\23PWR_SAV\24KSRCHDIS\25PCF\26USE_DEFANT" + "\27UPD_DEFANT\30RTS_USE_DEF\31ACKCTS_6MB\32BASE_RATE11B\33USE_DA_SG" + "\34CRPT_MIC_ENABLE\35KSRCH_MODE\36PRE_SEQNUM\37CBCIV_ENDIAN" + "\40MCAST_KSRCH"), + DEFBASIC(AR_BSS_ID0, "BSS_ID0"), + DEFBASIC(AR_BSS_ID1, "BSS_ID1"), + DEFBASIC(AR_SLOT_TIME, "SLOTTIME"), + DEFBASIC(AR_TIME_OUT, "TIME_OUT"), + DEFBASIC(AR_RSSI_THR, "RSSI_THR"), + DEFBASIC(AR_USEC, "USEC"), + DEFBASIC(AR_BEACON, "BEACON"), + DEFBASIC(AR_CFP_PERIOD, "CFP_PER"), + DEFBASIC(AR_TIMER0, "TIMER0"), + DEFBASIC(AR_TIMER1, "TIMER1"), + DEFBASIC(AR_TIMER2, "TIMER2"), + DEFBASIC(AR_TIMER3, "TIMER3"), + DEFBASIC(AR_CFP_DUR, "CFP_DUR"), + DEFBASICfmt(AR_RX_FILTER, "RXFILTER", + "\20\1UCAST\2MCAST\3BCAST\4CONTROL\5BEACON\6PROM\7XR_POLL\10PROBE_REQ"), + DEFBASIC(AR_MCAST_FIL0, "MCAST_0"), + DEFBASIC(AR_MCAST_FIL1, "MCAST_1"), + DEFBASICfmt(AR_DIAG_SW, "DIAG_SW", + "\20\1CACHE_ACK\2ACK_DIS\3CTS_DIS\4ENCRYPT_DIS\5DECRYPT_DIS\6RX_DIS" + "\7CORR_FCS\10CHAN_INFO\11EN_SCRAMSD\22FRAME_NV0\25RX_CLR_HI" + "\26IGNORE_CS\27CHAN_IDLE\30PHEAR_ME"), + DEFBASIC(AR_TSF_L32, "TSF_L32"), + DEFBASIC(AR_TSF_U32, "TSF_U32"), + DEFBASIC(AR_TST_ADDAC, "TST_ADAC"), + DEFBASIC(AR_DEF_ANTENNA, "DEF_ANT"), + DEFBASIC(AR_QOS_MASK, "QOS_MASK"), + DEFBASIC(AR_SEQ_MASK, "SEQ_MASK"), + DEFBASIC(AR_OBSERV_2, "OBSERV2"), + DEFBASIC(AR_OBSERV_1, "OBSERV1"), + + DEFBASIC(AR_LAST_TSTP, "LAST_TST"), + DEFBASIC(AR_NAV, "NAV"), + DEFBASIC(AR_RTS_OK, "RTS_OK"), + DEFBASIC(AR_RTS_FAIL, "RTS_FAIL"), + DEFBASIC(AR_ACK_FAIL, "ACK_FAIL"), + DEFBASIC(AR_FCS_FAIL, "FCS_FAIL"), + DEFBASIC(AR_BEACON_CNT, "BEAC_CNT"), + + DEFBASIC(AR_SLEEP1, "SLEEP1"), + DEFBASIC(AR_SLEEP2, "SLEEP2"), + DEFBASIC(AR_SLEEP3, "SLEEP3"), + DEFBASIC(AR_BSSMSKL, "BSSMSKL"), + DEFBASIC(AR_BSSMSKU, "BSSMSKU"), + DEFBASIC(AR_TPC, "TPC"), + DEFBASIC(AR_TFCNT, "TFCNT"), + DEFBASIC(AR_RFCNT, "RFCNT"), + DEFBASIC(AR_RCCNT, "RCCNT"), + DEFBASIC(AR_CCCNT, "CCCNT"), + DEFBASIC(AR_QUIET1, "QUIET1"), + DEFBASIC(AR_QUIET2, "QUIET2"), + DEFBASIC(AR_TSF_PARM, "TSF_PARM"), + DEFBASIC(AR_NOACK, "NOACK"), + DEFBASIC(AR_PHY_ERR, "PHY_ERR"), + DEFBASIC(AR_QOS_CONTROL, "QOS_CTRL"), + DEFBASIC(AR_QOS_SELECT, "QOS_SEL"), + DEFBASIC(AR_MISC_MODE, "MISCMODE"), + DEFBASIC(AR_FILTOFDM, "FILTOFDM"), + DEFBASIC(AR_FILTCCK, "FILTCCK"), + DEFBASIC(AR_PHYCNT1, "PHYCNT1"), + DEFBASIC(AR_PHYCNTMASK1, "PHYCMSK1"), + DEFBASIC(AR_PHYCNT2, "PHYCNT2"), + DEFBASIC(AR_PHYCNTMASK2, "PHYCMSK2"), + + DEFVOID(AR_PHYCNT1, "PHYCNT1"), + DEFVOID(AR_PHYCNTMASK1, "PHYCNTMASK1"), + DEFVOID(AR_PHYCNT2, "PHYCNT2"), + DEFVOID(AR_PHYCNTMASK2, "PHYCNTMASK2"), + + DEFVOID(AR_PHY_TEST, "PHY_TEST"), + DEFVOID(AR_PHY_TURBO, "PHY_TURBO"), + DEFVOID(AR_PHY_TESTCTRL, "PHY_TESTCTRL"), + DEFVOID(AR_PHY_TIMING3, "PHY_TIMING3"), + DEFVOID(AR_PHY_CHIP_ID, "PHY_CHIP_ID"), + DEFVOIDfmt(AR_PHY_ACTIVE, "PHY_ACTIVE", "\20\1ENA"), + DEFVOID(AR_PHY_TX_CTL, "PHY_TX_CTL"), + DEFVOID(AR_PHY_ADC_CTL, "PHY_ADC_CTL"), + DEFVOID(AR_PHY_BB_XP_PA_CTL,"PHY_BB_XP_PA_CTL"), + DEFVOID(AR_PHY_TSTDAC_CONST,"PHY_TSTDAC_CONST"), + DEFVOID(AR_PHY_SETTLING, "PHY_SETTLING"), + DEFVOID(AR_PHY_RXGAIN, "PHY_RXGAIN"), + DEFVOID(AR_PHY_DESIRED_SZ, "PHY_DESIRED_SZ"), + DEFVOID(AR_PHY_FIND_SIG, "PHY_FIND_SIG"), + DEFVOID(AR_PHY_AGC_CTL1, "PHY_AGC_CTL1"), + DEFVOIDfmt(AR_PHY_AGC_CONTROL, "PHY_AGC_CONTROL", + "\20\1CAL\2NF\16ENA_NF\22NO_UPDATE_NF"), + DEFVOIDfmt(AR_PHY_SFCORR_LOW, "PHY_SFCORR_LOW", + "\20\1USE_SELF_CORR_LOW"), + DEFVOID(AR_PHY_SFCORR, "PHY_SFCORR"), + DEFVOID(AR_PHY_SLEEP_CTR_CONTROL, "PHY_SLEEP_CTR_CONTROL"), + DEFVOID(AR_PHY_SLEEP_CTR_LIMIT, "PHY_SLEEP_CTR_LIMIT"), + DEFVOID(AR_PHY_SLEEP_SCAL, "PHY_SLEEP_SCAL"), + DEFVOID(AR_PHY_BIN_MASK_1, "PHY_BIN_MASK_1"), + DEFVOID(AR_PHY_BIN_MASK_2, "PHY_BIN_MASK_2"), + DEFVOID(AR_PHY_BIN_MASK_3, "PHY_BIN_MASK_3"), + DEFVOID(AR_PHY_MASK_CTL, "PHY_MASK_CTL"), + DEFVOID(AR_PHY_PLL_CTL, "PHY_PLL_CTL"), + DEFVOID(AR_PHY_RX_DELAY, "PHY_RX_DELAY"), + DEFVOID(AR_PHY_TIMING_CTRL4,"PHY_TIMING_CTRL4"), + DEFVOID(AR_PHY_TIMING5, "PHY_TIMING5"), + DEFVOID(AR_PHY_PAPD_PROBE, "PHY_PAPD_PROBE"), + DEFVOID(AR_PHY_POWER_TX_RATE1,"PHY_POWER_TX_RATE1"), + DEFVOID(AR_PHY_POWER_TX_RATE2,"PHY_POWER_TX_RATE2"), + DEFVOID(AR_PHY_POWER_TX_RATE_MAX, "PHY_POWER_TX_RATE_MAX"), + DEFVOID(AR_PHY_FRAME_CTL, "PHY_FRAME_CTL"), + DEFVOID(AR_PHY_TXPWRADJ, "PHY_TXPWRADJ"), + DEFVOID(AR_PHY_RADAR_0, "PHY_RADAR_0"), + DEFVOID(AR_PHY_SIGMA_DELTA, "PHY_SIGMA_DELTA"), + DEFVOID(AR_PHY_RESTART, "PHY_RESTART"), + DEFVOID(AR_PHY_RFBUS_REQ, "PHY_RFBUS_REQ"), + DEFVOID(AR_PHY_TIMING7, "PHY_TIMING7"), + DEFVOID(AR_PHY_TIMING8, "PHY_TIMING8"), + DEFVOID(AR_PHY_BIN_MASK2_1, "PHY_BIN_MASK2_1"), + DEFVOID(AR_PHY_BIN_MASK2_2, "PHY_BIN_MASK2_2"), + DEFVOID(AR_PHY_BIN_MASK2_3, "PHY_BIN_MASK2_3"), + DEFVOID(AR_PHY_BIN_MASK2_4, "PHY_BIN_MASK2_4"), + DEFVOID(AR_PHY_TIMING9, "PHY_TIMING9"), + DEFVOID(AR_PHY_TIMING10, "PHY_TIMING10"), + DEFVOID(AR_PHY_TIMING11, "PHY_TIMING11"), + DEFVOID(AR_PHY_HEAVY_CLIP_ENABLE, "PHY_HEAVY_CLIP_ENABLE"), + DEFVOID(AR_PHY_M_SLEEP, "PHY_M_SLEEP"), + DEFVOID(AR_PHY_REFCLKDLY, "PHY_REFCLKDLY"), + DEFVOID(AR_PHY_REFCLKPD, "PHY_REFCLKPD"), + DEFVOID(AR_PHY_IQCAL_RES_PWR_MEAS_I, "PHY_IQCAL_RES_PWR_MEAS_I"), + DEFVOID(AR_PHY_IQCAL_RES_PWR_MEAS_Q, "PHY_IQCAL_RES_PWR_MEAS_Q"), + DEFVOID(AR_PHY_IQCAL_RES_IQ_CORR_MEAS, "PHY_IQCAL_RES_IQ_CORR_MEAS"), + DEFVOID(AR_PHY_CURRENT_RSSI,"PHY_CURRENT_RSSI"), + DEFVOID(AR_PHY_RFBUS_GNT, "PHY_RFBUS_GNT"), + DEFVOID(AR_PHY_MODE, "PHY_MODE"), + DEFVOID(AR_PHY_CCK_TX_CTRL, "PHY_CCK_TX_CTRL"), + DEFVOID(AR_PHY_CCK_DETECT, "PHY_CCK_DETECT"), + DEFVOID(AR_PHY_GAIN_2GHZ, "PHY_GAIN_2GHZ"), + DEFVOID(AR_PHY_CCK_RXCTRL4, "PHY_CCK_RXCTRL4"), + DEFVOID(AR_PHY_DAG_CTRLCCK, "PHY_DAG_CTRLCCK"), + DEFVOID(AR_PHY_DAG_CTRLCCK, "PHY_DAG_CTRLCCK"), + DEFVOID(AR_PHY_POWER_TX_RATE3,"PHY_POWER_TX_RATE3"), + DEFVOID(AR_PHY_POWER_TX_RATE4,"PHY_POWER_TX_RATE4"), + DEFVOID(AR_PHY_FAST_ADC, "PHY_FAST_ADC"), + DEFVOID(AR_PHY_BLUETOOTH, "PHY_BLUETOOTH"), + DEFVOID(AR_PHY_TPCRG1, "PHY_TPCRG1"), + DEFVOID(AR_PHY_TPCRG5, "PHY_TPCRG5"), + + /* XXX { AR_RATE_DURATION(0), AR_RATE_DURATION(0x20) }, */ +}; + +static __constructor void +ar5212_ctor(void) +{ + register_regs(ar5212regs, N(ar5212regs), MAC5212, PHYANY); + register_keycache(128, MAC5212, PHYANY); + + register_range(0x9800, 0x987c, DUMP_BASEBAND, MAC5212, PHYANY); + register_range(0x9900, 0x995c, DUMP_BASEBAND, MAC5212, PHYANY); + register_range(0x9c00, 0x9c1c, DUMP_BASEBAND, MAC5212, PHYANY); + register_range(0xa180, 0xa238, DUMP_BASEBAND, MAC5212, PHYANY); + register_range(0xa258, 0xa26c, DUMP_BASEBAND, + SREV(7,8), SREV(15,15), PHYANY); +} Copied: head/tools/tools/ath/common/dumpregs_5416.c (from r189701, head/tools/tools/ath/athregs/dumpregs_5416.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/common/dumpregs_5416.c Wed Mar 11 17:46:01 2009 (r189705, copy of r189701, head/tools/tools/ath/athregs/dumpregs_5416.c) @@ -0,0 +1,394 @@ +/*- + * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 19:45:53 2009 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 2F1821065670; Wed, 11 Mar 2009 19:45: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 1E2FF8FC0A; Wed, 11 Mar 2009 19:45:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BJjrWB005167; Wed, 11 Mar 2009 19:45:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BJjrHZ005166; Wed, 11 Mar 2009 19:45:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903111945.n2BJjrHZ005166@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 11 Mar 2009 19:45: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: r189706 - 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: Wed, 11 Mar 2009 19:45:54 -0000 Author: kib Date: Wed Mar 11 19:45:52 2009 New Revision: 189706 URL: http://svn.freebsd.org/changeset/base/189706 Log: Do not double-free the struct inode when insmntque failed. Default insmntque destructor reclaims the vnode, and ufs_reclaim frees the memory. Reviewed by: tegge MFC after: 3 days Modified: head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Wed Mar 11 17:46:01 2009 (r189705) +++ head/sys/ufs/ffs/ffs_vfsops.c Wed Mar 11 19:45:52 2009 (r189706) @@ -1464,7 +1464,6 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags vp->v_vflag |= VV_FORCEINSMQ; error = insmntque(vp, mp); if (error != 0) { - uma_zfree(uma_inode, ip); *vpp = NULL; return (error); } From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 21:18:57 2009 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 D34EB10656F5; Wed, 11 Mar 2009 21:18:57 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 2A6C28FC2C; Wed, 11 Mar 2009 21:18:56 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id n2BLIeIe050475; Thu, 12 Mar 2009 00:18:40 +0300 (MSK) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru; s=default; t=1236806320; bh=SM0PNqphXp3TSzQRK2lOyxSMqNixY9C+D+gbefZLA0A=; l=1561; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=IveebqzLHZLS8ZiP8Br8764XHTWcXIi/HDZEEeAWOSqFGbnvm7pOOzwxmd8mEKytc DSZG7cLfpXCG1om08dBEOTPw2nSXKvzu5oEEkNCX28bWBqXSiTL7q1Wva9Kfw7kAXN WuUW41m4uIzGbZyyKi51YH54hz8Q93/hCAjGOw04= Received: (from ache@localhost) by nagual.pp.ru (8.14.3/8.14.3/Submit) id n2BLIdNx050474; Thu, 12 Mar 2009 00:18:39 +0300 (MSK) (envelope-from ache) Date: Thu, 12 Mar 2009 00:18:38 +0300 From: Andrey Chernov To: Ed Schouten Message-ID: <20090311211838.GA47787@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Ed Schouten , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <200903101128.n2ABSsvZ060914@svn.freebsd.org> <20090311012704.GA66313@nagual.pp.ru> <20090311021646.GA67589@nagual.pp.ru> <20090311135403.GK31961@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline In-Reply-To: <20090311135403.GK31961@hoeg.nl> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189617 - in head/sys: dev/syscons dev/syscons/teken pc98/cbus 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 Mar 2009 21:19:02 -0000 --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 11, 2009 at 02:54:03PM +0100, Ed Schouten wrote: > So the screen isn't correctly blanked when switching modes? Messages > shouldn't overlap anymore, because we use the same terminal emulator to > print both user and kernel messages now. It seems that rc don't use NL with some output while kernel messages (from= =20 USB) are delayed for some time. Here is example what is in dmesg and what= =20 is actually on the screen: device_attach: uhid1 attach returned 12 Entropy harvesting: interrupts ethernet point_to_point ugen2.3: at usbus2 uhid1: on usbus2 kickstart =2E /dev/ad6s1a: FILE SYSTEM CLEAN; SKIPPING CHECKS -------------------------------------------------------------------------- device_attach: uhid1 attach returned 12 Entropy harvesting: interrupts ethernet point_to_pointugen2.3: at = usbus2 uhid1: on usbus2 kickstart. /dev/ad6s1a: FILE SYSTEM CLEAN; SKIPPING CHECKS --=20 http://ache.pp.ru/ --VbJkn9YxBvnuCH5J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkm4Kq4ACgkQVg5YK5ZEdN2vnACgvqRrORKgwhzT82XQJl3dhefe XJIAnik3nfqVOQkjWr2JMud+SFoPzA/6 =9S2L -----END PGP SIGNATURE----- --VbJkn9YxBvnuCH5J-- From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 21:48:36 2009 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 E6B76106566C; Wed, 11 Mar 2009 21:48:36 +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 D44518FC15; Wed, 11 Mar 2009 21:48:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BLma6V007492; Wed, 11 Mar 2009 21:48:36 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BLmaQJ007484; Wed, 11 Mar 2009 21:48:36 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903112148.n2BLmaQJ007484@svn.freebsd.org> From: John Baldwin Date: Wed, 11 Mar 2009 21: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: r189707 - in head: sys/kern sys/sys usr.bin/kdump usr.bin/ktrace 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 Mar 2009 21:48:37 -0000 Author: jhb Date: Wed Mar 11 21:48:36 2009 New Revision: 189707 URL: http://svn.freebsd.org/changeset/base/189707 Log: Add a new type of KTRACE record for sysctl(3) invocations. It uses the internal sysctl_sysctl_name() handler to map the MIB array to a string name and logs this name in the trace log. This can be useful to see exactly which sysctls a thread is invoking. MFC after: 1 month Modified: head/sys/kern/kern_ktrace.c head/sys/kern/kern_sysctl.c head/sys/sys/ktrace.h head/usr.bin/kdump/kdump.1 head/usr.bin/kdump/kdump.c head/usr.bin/ktrace/ktrace.1 head/usr.bin/ktrace/ktrace.h head/usr.bin/ktrace/subr.c Modified: head/sys/kern/kern_ktrace.c ============================================================================== --- head/sys/kern/kern_ktrace.c Wed Mar 11 19:45:52 2009 (r189706) +++ head/sys/kern/kern_ktrace.c Wed Mar 11 21:48:36 2009 (r189707) @@ -111,6 +111,7 @@ static int data_lengths[] = { sizeof(struct ktr_csw), /* KTR_CSW */ 0, /* KTR_USER */ 0, /* KTR_STRUCT */ + 0, /* KTR_SYSCTL */ }; static STAILQ_HEAD(, ktr_request) ktr_free; @@ -319,7 +320,7 @@ ktr_enqueuerequest(struct thread *td, st * is used both internally before committing other records, and also on * system call return. We drain all the ones we can find at the time when * drain is requested, but don't keep draining after that as those events - * may me approximately "after" the current event. + * may be approximately "after" the current event. */ static void ktr_drain(struct thread *td) @@ -481,6 +482,40 @@ ktrnamei(path) } void +ktrsysctl(name, namelen) + int *name; + u_int namelen; +{ + struct ktr_request *req; + u_int mib[CTL_MAXNAME + 2]; + char *mibname; + size_t mibnamelen; + int error; + + /* Lookup name of mib. */ + KASSERT(namelen <= CTL_MAXNAME, ("sysctl MIB too long")); + mib[0] = 0; + mib[1] = 1; + bcopy(name, mib + 2, namelen * sizeof(*name)); + mibnamelen = 128; + mibname = malloc(mibnamelen, M_KTRACE, M_WAITOK); + error = kernel_sysctl(curthread, mib, namelen + 2, mibname, &mibnamelen, + NULL, 0, &mibnamelen, 0); + if (error) { + free(mibname, M_KTRACE); + return; + } + req = ktr_getrequest(KTR_SYSCTL); + if (req == NULL) { + free(mibname, M_KTRACE); + return; + } + req->ktr_header.ktr_len = mibnamelen; + req->ktr_buffer = mibname; + ktr_submitrequest(curthread, req); +} + +void ktrgenio(fd, rw, uio, error) int fd; enum uio_rw rw; @@ -925,6 +960,9 @@ ktr_writerequest(struct thread *td, stru mtx_unlock(&ktrace_mtx); kth = &req->ktr_header; + KASSERT(((u_short)kth->ktr_type & ~KTR_DROP) < + sizeof(data_lengths) / sizeof(data_lengths[0]), + ("data_lengths array overflow")); datalen = data_lengths[(u_short)kth->ktr_type & ~KTR_DROP]; buflen = kth->ktr_len; auio.uio_iov = &aiov[0]; Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Wed Mar 11 19:45:52 2009 (r189706) +++ head/sys/kern/kern_sysctl.c Wed Mar 11 21:48:36 2009 (r189707) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" +#include "opt_ktrace.h" #include "opt_mac.h" #include @@ -54,6 +55,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#endif #include @@ -758,7 +762,7 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD, sysctl_sysctl_next, ""); static int -name2oid (char *name, int *oid, int *len, struct sysctl_oid **oidpp) +name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) { int i; struct sysctl_oid *oidp; @@ -1499,6 +1503,11 @@ userland_sysctl(struct thread *td, int * req.newfunc = sysctl_new_user; req.lock = REQ_LOCKED; +#ifdef KTRACE + if (KTRPOINT(curthread, KTR_SYSCTL)) + ktrsysctl(name, namelen); +#endif + SYSCTL_XLOCK(); CURVNET_SET(TD_TO_VNET(curthread)); Modified: head/sys/sys/ktrace.h ============================================================================== --- head/sys/sys/ktrace.h Wed Mar 11 19:45:52 2009 (r189706) +++ head/sys/sys/ktrace.h Wed Mar 11 21:48:36 2009 (r189707) @@ -158,6 +158,12 @@ struct sockaddr; struct stat; /* + * KTR_SYSCTL - name of a sysctl MIB + */ +#define KTR_SYSCTL 9 + /* record contains null-terminated MIB name */ + +/* * KTR_DROP - If this bit is set in ktr_type, then at least one event * between the previous record and this record was dropped. */ @@ -175,6 +181,8 @@ struct stat; #define KTRFAC_CSW (1<ktr_type); type = unknown; Modified: head/usr.bin/ktrace/ktrace.1 ============================================================================== --- head/usr.bin/ktrace/ktrace.1 Wed Mar 11 19:45:52 2009 (r189706) +++ head/usr.bin/ktrace/ktrace.1 Wed Mar 11 21:48:36 2009 (r189707) @@ -125,6 +125,10 @@ trace various structures userland traces .It Cm w context switches +.It Cm y +trace +.Xr sysctl 3 +requests .It Cm + trace the default set of trace points - .Cm c , n , i , s , t , u Modified: head/usr.bin/ktrace/ktrace.h ============================================================================== --- head/usr.bin/ktrace/ktrace.h Wed Mar 11 19:45:52 2009 (r189706) +++ head/usr.bin/ktrace/ktrace.h Wed Mar 11 21:48:36 2009 (r189707) @@ -35,7 +35,8 @@ */ #define DEF_POINTS (KTRFAC_SYSCALL | KTRFAC_SYSRET | KTRFAC_NAMEI | \ - KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | KTRFAC_STRUCT) + KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | \ + KTRFAC_STRUCT | KTRFAC_SYSCTL) #define ALL_POINTS (DEF_POINTS | KTRFAC_CSW) Modified: head/usr.bin/ktrace/subr.c ============================================================================== --- head/usr.bin/ktrace/subr.c Wed Mar 11 19:45:52 2009 (r189706) +++ head/usr.bin/ktrace/subr.c Wed Mar 11 21:48:36 2009 (r189707) @@ -83,6 +83,9 @@ getpoints(char *s) case 'w': facs |= KTRFAC_CSW; break; + case 'y': + facs |= KTRFAC_SYSCTL; + break; case '+': facs |= DEF_POINTS; break; From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 21:56:23 2009 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 A36D01065673; Wed, 11 Mar 2009 21:56: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 751408FC1D; Wed, 11 Mar 2009 21:56:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id EA6BE46B09; Wed, 11 Mar 2009 17:56:22 -0400 (EDT) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n2BLuHM5039247; Wed, 11 Mar 2009 17:56:17 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: src-committers@freebsd.org Date: Wed, 11 Mar 2009 17:56:11 -0400 User-Agent: KMail/1.9.7 References: <200903112148.n2BLmaQJ007484@svn.freebsd.org> In-Reply-To: <200903112148.n2BLmaQJ007484@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903111756.12301.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 11 Mar 2009 17:56:17 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9093/Wed Mar 11 11:32:37 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r189707 - in head: sys/kern sys/sys usr.bin/kdump usr.bin/ktrace 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 Mar 2009 21:56:24 -0000 On Wednesday 11 March 2009 5:48:36 pm John Baldwin wrote: > Author: jhb > Date: Wed Mar 11 21:48:36 2009 > New Revision: 189707 > URL: http://svn.freebsd.org/changeset/base/189707 > > Log: > Add a new type of KTRACE record for sysctl(3) invocations. It uses the > internal sysctl_sysctl_name() handler to map the MIB array to a string > name and logs this name in the trace log. This can be useful to see > exactly which sysctls a thread is invoking. > > MFC after: 1 month Sample output below: 884 ktrace CALL execve(0x7fffffffe3a0,0x7fffffffe990,0x7fffffffe9a0) 884 ktrace NAMI "/bin/sh" 884 ktrace NAMI "/libexec/ld-elf.so.1" 884 sh RET execve 0 884 sh CALL __sysctl(0x7fffffffe580,0x2,0x7fffffffe59c,0x7fffffffe590,0,0) 884 sh SCTL "kern.osreldate" 884 sh RET __sysctl 0 884 sh CALL mmap(0,0x240,PROT_READ|PROT_WRITE,MAP_ANON,0xffffffff,0) 884 sh RET mmap 5513216/0x800542000 Some of the sysctl's from a simple ps: 935 ps SCTL "kern.proc.uid.1059" 935 ps SCTL "kern.proc.uid.1059" 935 ps SCTL "sysctl.name2oid" 935 ps SCTL "kern.ccpu" 935 ps SCTL "sysctl.name2oid" 935 ps SCTL "kern.fscale" 935 ps SCTL "sysctl.name2oid" 935 ps SCTL "hw.availpages" 935 ps SCTL "sysctl.name2oid" 935 ps SCTL "kern.ps_arg_cache_limit" 935 ps SCTL "kern.proc.args.935" 935 ps SCTL "kern.argmax" 935 ps SCTL "kern.proc.args.854" -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 22:00:03 2009 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 9C9FF106566C; Wed, 11 Mar 2009 22:00:03 +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 6D00A8FC17; Wed, 11 Mar 2009 22:00:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2BM03A0007743; Wed, 11 Mar 2009 22:00:03 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2BM03Q2007742; Wed, 11 Mar 2009 22:00:03 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903112200.n2BM03Q2007742@svn.freebsd.org> From: Robert Watson Date: Wed, 11 Mar 2009 22:00: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: r189708 - 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: Wed, 11 Mar 2009 22:00:04 -0000 Author: rwatson Date: Wed Mar 11 22:00:03 2009 New Revision: 189708 URL: http://svn.freebsd.org/changeset/base/189708 Log: When writing out updated pollfd records when returning from poll(), only copy out the revents field, not the whole pollfd structure. Otherwise, if the events field is updated concurrently by another thread, that update may be lost. This issue apparently causes problems for the JDK on FreeBSD, which expects the Linux behavior of not updating all fields (somewhat oddly, Solaris does not implement the required behavior, but presumably our adaptation of the JDK is based on the Linux port?). MFC after: 2 weeks PR: kern/130924 Submitted by: Kurt Miller Discussed with: kib Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Wed Mar 11 21:48:36 2009 (r189707) +++ head/sys/kern/sys_generic.c Wed Mar 11 22:00:03 2009 (r189708) @@ -76,6 +76,7 @@ static MALLOC_DEFINE(M_IOCTLOPS, "ioctlo static MALLOC_DEFINE(M_SELECT, "select", "select() buffer"); MALLOC_DEFINE(M_IOV, "iov", "large iov's"); +static int pollout(struct pollfd *, struct pollfd *, u_int); static int pollscan(struct thread *, struct pollfd *, u_int); static int pollrescan(struct thread *); static int selscan(struct thread *, fd_mask **, fd_mask **, int); @@ -1128,7 +1129,7 @@ done: if (error == EWOULDBLOCK) error = 0; if (error == 0) { - error = copyout(bits, uap->fds, ni); + error = pollout(bits, uap->fds, nfds); if (error) goto out; } @@ -1183,6 +1184,26 @@ pollrescan(struct thread *td) static int +pollout(fds, ufds, nfd) + struct pollfd *fds; + struct pollfd *ufds; + u_int nfd; +{ + int error = 0; + u_int i = 0; + + for (i = 0; i < nfd; i++) { + error = copyout(&fds->revents, &ufds->revents, + sizeof(ufds->revents)); + if (error) + return (error); + fds++; + ufds++; + } + return (0); +} + +static int pollscan(td, fds, nfd) struct thread *td; struct pollfd *fds; From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 22:08:08 2009 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 AA923106564A; Wed, 11 Mar 2009 22:08:08 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 456D58FC1A; Wed, 11 Mar 2009 22:08:08 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 0CCD91CE0D; Wed, 11 Mar 2009 23:08:07 +0100 (CET) Date: Wed, 11 Mar 2009 23:08:07 +0100 From: Ed Schouten To: Andrey Chernov , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Message-ID: <20090311220807.GO31961@hoeg.nl> References: <200903101128.n2ABSsvZ060914@svn.freebsd.org> <20090311012704.GA66313@nagual.pp.ru> <20090311021646.GA67589@nagual.pp.ru> <20090311135403.GK31961@hoeg.nl> <20090311211838.GA47787@nagual.pp.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="f54savKjS/tSNRaU" Content-Disposition: inline In-Reply-To: <20090311211838.GA47787@nagual.pp.ru> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: Subject: Re: svn commit: r189617 - in head/sys: dev/syscons dev/syscons/teken pc98/cbus 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 Mar 2009 22:08:09 -0000 --f54savKjS/tSNRaU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Andrey Chernov wrote: > On Wed, Mar 11, 2009 at 02:54:03PM +0100, Ed Schouten wrote: > > So the screen isn't correctly blanked when switching modes? Messages > > shouldn't overlap anymore, because we use the same terminal emulator to > > print both user and kernel messages now. >=20 > It seems that rc don't use NL with some output while kernel messages (fro= m=20 > USB) are delayed for some time. Here is example what is in dmesg and what= =20 > is actually on the screen: >=20 > This is not a bug, but a feature. It has always been like this... --=20 Ed Schouten WWW: http://80386.nl/ --f54savKjS/tSNRaU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm4NkYACgkQ52SDGA2eCwUAaACfcObTbZ5tk0oG+6VUdVt+2LVK rvcAmgPulDNJ7CRQ0D2s0rsrTUdgdERm =kJDd -----END PGP SIGNATURE----- --f54savKjS/tSNRaU-- From owner-svn-src-head@FreeBSD.ORG Wed Mar 11 22:17:51 2009 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 827D81065686; Wed, 11 Mar 2009 22:17:51 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id 172C28FC08; Wed, 11 Mar 2009 22:17:50 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from wolfram.andreas.nets ([91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id n2BLiIPM090757; Wed, 11 Mar 2009 22:44:18 +0100 (CET) (envelope-from andreast-list@fgznet.ch) Message-ID: <49B830B1.1000602@fgznet.ch> Date: Wed, 11 Mar 2009 22:44:17 +0100 From: Andreas Tobler User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: Nathan Whitehorn References: <200903110319.n2B3JJbO082647@svn.freebsd.org> In-Reply-To: <200903110319.n2B3JJbO082647@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189675 - head/sys/powerpc/aim 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 Mar 2009 22:17:52 -0000 Nathan Whitehorn wrote: > Author: nwhitehorn > Date: Wed Mar 11 03:19:19 2009 > New Revision: 189675 > URL: http://svn.freebsd.org/changeset/base/189675 > > Log: > Change the PVO zone for fictitious pages to the unmanaged PVO zone, to match > the unmanaged flag set in the PVO attributes. Without doing this, > pmap_remove() could try to remove fictitious pages (like those created > by mmap of physical memory) from the wrong UMA zone, causing a panic. > This fixes a hard lock on my imac (G3) when running glxgears. Now running glxgears only 'kills' the Xserver. Thanks! Andreas From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 00:03:56 2009 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 50D031065670; Thu, 12 Mar 2009 00:03:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7498FC0C; Thu, 12 Mar 2009 00:03:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C03uV5010270; Thu, 12 Mar 2009 00:03:56 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C03uDE010268; Thu, 12 Mar 2009 00:03:56 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903120003.n2C03uDE010268@svn.freebsd.org> From: Sam Leffler Date: Thu, 12 Mar 2009 00:03: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: r189712 - head/tools/tools/ath/common 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 Mar 2009 00:03:56 -0000 Author: sam Date: Thu Mar 12 00:03:55 2009 New Revision: 189712 URL: http://svn.freebsd.org/changeset/base/189712 Log: add more register bit defs Modified: head/tools/tools/ath/common/dumpregs_5212.c head/tools/tools/ath/common/dumpregs_5416.c Modified: head/tools/tools/ath/common/dumpregs_5212.c ============================================================================== --- head/tools/tools/ath/common/dumpregs_5212.c Wed Mar 11 22:43:31 2009 (r189711) +++ head/tools/tools/ath/common/dumpregs_5212.c Thu Mar 12 00:03:55 2009 (r189712) @@ -400,7 +400,8 @@ static struct dumpreg ar5212regs[] = { DEFVOID(AR_PHY_IQCAL_RES_IQ_CORR_MEAS, "PHY_IQCAL_RES_IQ_CORR_MEAS"), DEFVOID(AR_PHY_CURRENT_RSSI,"PHY_CURRENT_RSSI"), DEFVOID(AR_PHY_RFBUS_GNT, "PHY_RFBUS_GNT"), - DEFVOID(AR_PHY_MODE, "PHY_MODE"), + DEFVOIDfmt(AR_PHY_MODE, "PHY_MODE", + "\20\1CCK\2RF2GHZ\3DYNAMIC\4AR5112\5HALF\6QUARTER"), DEFVOID(AR_PHY_CCK_TX_CTRL, "PHY_CCK_TX_CTRL"), DEFVOID(AR_PHY_CCK_DETECT, "PHY_CCK_DETECT"), DEFVOID(AR_PHY_GAIN_2GHZ, "PHY_GAIN_2GHZ"), Modified: head/tools/tools/ath/common/dumpregs_5416.c ============================================================================== --- head/tools/tools/ath/common/dumpregs_5416.c Wed Mar 11 22:43:31 2009 (r189711) +++ head/tools/tools/ath/common/dumpregs_5416.c Thu Mar 12 00:03:55 2009 (r189712) @@ -50,7 +50,8 @@ static struct dumpreg ar5416regs[] = { DEFBASIC(AR_CST, "CST"), DEFBASIC(AR_IER, "IER"), DEFBASIC(AR_TXCFG, "TXCFG"), - DEFBASIC(AR_RXCFG, "RXCFG"), + DEFBASICfmt(AR_RXCFG, "RXCFG", + "\20\6JUMBO_ENA\7JUMBO_WRAP\10SLEEP_DEBUG"), DEFBASIC(AR_MIBC, "MIBC"), DEFBASIC(AR_TOPS, "TOPS"), DEFBASIC(AR_RXNPTO, "RXNPTO"), @@ -63,16 +64,28 @@ static struct dumpreg ar5416regs[] = { DEFBASIC(AR_GTXTO, "GTXTO"), DEFBASIC(AR_GTTM, "GTTM"), - DEFINT(AR_ISR, "ISR"), + DEFINTfmt(AR_ISR, "ISR", + "\20\1RXOK\2RXDESC\3RXERR\4RXNOPKT\5RXEOL\6RXORN\7TXOK\10TXDESC" + "\11TXERR\12TXNOPKT\13TXEOL\14TXURN\15MIB\16SWI\17RXPHY\20RXKCM" + "\21SWBA\22BRSSI\23BMISS\24HIUERR\25BNR\26RXCHIRP\27RXDOPPL\30BCNMISS" + "\31TIM\32GPIO\33QCBROVF\34QCBRURN\35QTRIG"), DEFINT(AR_ISR_S0, "ISR_S0"), DEFINT(AR_ISR_S1, "ISR_S1"), - DEFINT(AR_ISR_S2, "ISR_S2"), + DEFINTfmt(AR_ISR_S2, "ISR_S2", + "\20\21MCABT\22SSERR\23DPERR\24TIM\25CABEND\26DTIMSYNC\27BCNTO" + "\30CABTO\31DTIM"), DEFINT(AR_ISR_S3, "ISR_S3"), DEFINT(AR_ISR_S4, "ISR_S4"), - DEFINT(AR_IMR, "IMR"), + DEFINTfmt(AR_IMR, "IMR", + "\20\1RXOK\2RXDESC\3RXERR\4RXNOPKT\5RXEOL\6RXORN\7TXOK\10TXDESC" + "\11TXERR\12TXNOPKT\13TXEOL\14TXURN\15MIB\16SWI\17RXPHY\20RXKCM" + "\21SWBA\22BRSSI\23BMISS\24HIUERR\25BNR\26RXCHIRP\27RXDOPPL\30BCNMISS" + "\31TIM\32GPIO\33QCBROVF\34QCBRURN\35QTRIG"), DEFINT(AR_IMR_S0, "IMR_S0"), DEFINT(AR_IMR_S1, "IMR_S1"), - DEFINT(AR_IMR_S2, "IMR_S2"), + DEFINTfmt(AR_IMR_S2, "IMR_S2", + "\20\21MCABT\22SSERR\23DPERR\24TIM\25CABEND\26DTIMSYNC\27BCNTO" + "\30CABTO\31DTIM"), DEFINT(AR_IMR_S3, "IMR_S3"), DEFINT(AR_IMR_S4, "IMR_S4"), /* NB: don't read the RAC so we don't affect operation */ @@ -240,7 +253,8 @@ static struct dumpreg ar5416regs[] = { DEFVOID(AR_D_TXBLK_SET, "D_SET"), DEFBASIC(AR_MAC_LED, "MAC_LED"), - DEFBASIC(AR_RC, "RC"), + DEFBASICfmt(AR_RC, "RC", + "\20\1AHB\2APB\11HOSTIF"), DEFBASIC(AR_SCR, "SCR"), DEFBASIC(AR_INTPEND, "INTPEND"), DEFBASIC(AR_SFR, "SFR"), @@ -260,12 +274,15 @@ static struct dumpreg ar5416regs[] = { DEFVOID(AR_INTR_ASYNC_CAUSE,"INTR_ASYNC_CAUSE"), DEFVOID(AR_INTR_ASYNC_ENABLE,"INTR_ASYNC_ENABLE"), - DEFBASIC(AR_RTC_RC, "RTC_RC"), + DEFBASICfmt(AR_RTC_RC, "RTC_RC", + "\20\1MAC_WARM\2MAC_COLD"), DEFBASIC(AR_RTC_PLL_CONTROL,"RTC_PLL"), DEFVOID(AR_RTC_RESET, "RTC_RESET"), - DEFVOID(AR_RTC_STATUS, "RTC_STATUS"), + DEFVOIDfmt(AR_RTC_STATUS, "RTC_STATUS", + "\20\1SHUTDOWN\2ON\3SLEEP\4WAKEUP\5COLDRESET\6PLLCHANGE"), DEFVOID(AR_RTC_SLEEP_CLK, "RTC_SLEEP_CLK"), - DEFVOID(AR_RTC_FORCE_WAKE, "RTC_FORCE_WAKE"), + DEFVOIDfmt(AR_RTC_FORCE_WAKE,"RTC_FORCE_WAKE", + "\20\1EN\2WAKE_ON_INT"), DEFVOID(AR_RTC_INTR_CAUSE, "RTC_INTR_CAUSE"), DEFVOID(AR_RTC_INTR_MASK, "RTC_INTR_MASK"), @@ -285,7 +302,11 @@ static struct dumpreg ar5416regs[] = { DEFVOID(AR_EEPROM_STS, "EESTS"), DEFVOID(AR_EEPROM_CFG, "EECFG"), DEFBASIC(AR_STA_ID0, "STA_ID0"), - DEFBASIC(AR_STA_ID1, "STA_ID1"), + DEFBASICfmt(AR_STA_ID1, "STA_ID1", + "\20\21AP\22ADHOC\23PWR_SAV\24KSRCHDIS\25PCF\26USE_DEFANT" + "\27UPD_DEFANT\30RTS_USE_DEF\31ACKCTS_6MB\32BASE_RATE_11B" + "\33USE_DA_SG\34CRPT_MIC_ENABLE\35KSRCH_MODE\36PRE_SEQNUM" + "\37CBCIV_ENDIAN\40MCAST_KSRC"), DEFBASIC(AR_BSS_ID0, "BSS_ID0"), DEFBASIC(AR_BSS_ID1, "BSS_ID1"), DEFBASIC(AR_SLOT_TIME, "SLOTTIME"), @@ -302,7 +323,10 @@ static struct dumpreg ar5416regs[] = { DEFBASIC(AR_RX_FILTER, "RXFILTER"), DEFBASIC(AR_MCAST_FIL0, "MCAST_0"), DEFBASIC(AR_MCAST_FIL1, "MCAST_1"), - DEFBASIC(AR_DIAG_SW, "DIAG_SW"), + DEFBASICfmt(AR_DIAG_SW, "DIAG_SW", + "\20\1CACHE_ACK\2ACK_DIS\3CTS_DIS\4ENCRYPT_DIS\5DECRYPT_DIS\6RX_DIS" + "\7CORR_FCS\10CHAN_INFO\11EN_SCRAMSD\22FRAME_NV0\25RX_CLR_HI" + "\26IGNORE_CS\27CHAN_IDLE\30PHEAR_ME"), DEFBASIC(AR_TSF_L32, "TSF_L32"), DEFBASIC(AR_TSF_U32, "TSF_U32"), DEFBASIC(AR_TST_ADDAC, "TST_ADAC"), @@ -371,6 +395,8 @@ static struct dumpreg ar5416regs[] = { DEFBASIC(AR_SLP_MIB_CTRL, "SLPMIB"), DEFBASIC(AR_EXTRCCNT, "EXTRCCNT"), + DEFVOID(AR_PHY_ADC_SERIAL_CTL, "PHY_ADC_SERIAL_CTL"), + /* XXX { AR_RATE_DURATION(0), AR_RATE_DURATION(0x20) }, */ }; From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 00:09:29 2009 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 B82FC1065747; Thu, 12 Mar 2009 00:09:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A552E8FC1A; Thu, 12 Mar 2009 00:09:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C09TM2010405; Thu, 12 Mar 2009 00:09:29 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C09TVP010404; Thu, 12 Mar 2009 00:09:29 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903120009.n2C09TVP010404@svn.freebsd.org> From: Sam Leffler Date: Thu, 12 Mar 2009 00:09: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: r189713 - head/sys/dev/ath/ath_hal 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 Mar 2009 00:09:30 -0000 Author: sam Date: Thu Mar 12 00:09:29 2009 New Revision: 189713 URL: http://svn.freebsd.org/changeset/base/189713 Log: add asserts Modified: head/sys/dev/ath/ath_hal/ah.c Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Thu Mar 12 00:03:55 2009 (r189712) +++ head/sys/dev/ath/ath_hal/ah.c Thu Mar 12 00:09:29 2009 (r189713) @@ -844,6 +844,7 @@ ath_hal_ini_write(struct ath_hal *ah, co { int r; + HALASSERT(col < ia->cols); for (r = 0; r < ia->rows; r++) { OS_REG_WRITE(ah, HAL_INI_VAL(ia, r, 0), HAL_INI_VAL(ia, r, col)); @@ -857,6 +858,7 @@ ath_hal_ini_bank_setup(uint32_t data[], { int r; + HALASSERT(col < ia->cols); for (r = 0; r < ia->rows; r++) data[r] = HAL_INI_VAL(ia, r, col); } From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 01:14:47 2009 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 D835F1065675; Thu, 12 Mar 2009 01:14:47 +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 C34A48FC16; Thu, 12 Mar 2009 01:14:47 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C1ElA5012325; Thu, 12 Mar 2009 01:14:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C1Elfx012323; Thu, 12 Mar 2009 01:14:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903120114.n2C1Elfx012323@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 12 Mar 2009 01:14: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: r189714 - head/sys/dev/txp 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 Mar 2009 01:14:48 -0000 Author: yongari Date: Thu Mar 12 01:14:47 2009 New Revision: 189714 URL: http://svn.freebsd.org/changeset/base/189714 Log: bus_dma(9) conversion and make txp(4) work on all architectures. o Header file cleanup. o bus_dma(9) conversion. - Removed all consumers of vtophys(9) and converted to use bus_dma(9). - Typhoon2 functional specification says the controller supports 64bit DMA addressing. However all Typhoon controllers are known to lack of DAC support so 64bit DMA support was disabled. - The hardware can't handle more 16 fragmented Tx DMA segments so teach txp(4) to collapse these segments to be less than 16. - Added Rx buffer alignment requirements(4 bytes alignment) and implemented fixup code to align receive frame. Previously txp(4) always copied Rx frame to align it on 2 byte boundary but its copy overhead is much higher than unaligned access on i386/amd64. Alignment fixup code is now applied only for strict-alignment architectures. With this change i386 and amd64 will get instant Rx performance boost. Typhoon2 datasheet mentions a command that pads arbitrary bytes in Rx buffer but that command does not work. - Nuked pointer trick in descriptor ring. This does not work on sparc64 and replaced it with bcopy. Alternatively txp(4) can embed a 32 bits index value into the descriptor and compute real buffer address but it may make code complicated. - Added endianness support code in various Tx/Rx/command/response descriptor access. With this change txp(4) should work on all architectures. o Added comments for known firmware bugs(Tx checksum offloading, TSO, VLAN stripping and Rx buffer padding control). o Prefer faster memory space register access to I/O space access. Added fall-back mechanism to use alternative I/O space access. The hardware supports both memory and I/O mapped access. Users can still force to use old I/O space access by setting hw.txp.prefer_iomap tunable to 1 in /boot/loader.conf. o Added experimental suspend/resume methods. o Nuke error prone Rx buffer handling code and implemented local buffer management with TAILQ. Be definition the controller can't pass the last received frame to host if no Rx free buffers are available to use as head and tail pointer of Rx descriptor ring can't have the same value. In that case the Rx buffer pointer in Rx buffer ring still holds a valid buffer and txp_rxbuf_reclaim() can't fill Rx buffers as the first buffer is still valid. Instead of relying on the value of Rx buffer ring, introduce local buffer management code to handle empty buffer situation. This should fix a long standing bug which completely hangs the controller under high network load. I could easily trigger the issue by sending 64 bytes UDP frames with netperf. I have no idea how this bugs was not fixed for a long time. o Converted ithread interrupt handler to filter based one. o Rearranged txp_detach routine such that it's now used for general clean-up routine. o Show sleep image version on device attach time. This will help to know what action should be taken depending on sleep image version. The version information in datasheet was wrong for newer NV images so I followed Linux which seems to correctly extract version numbers from response descriptors. o Firmware image is no longer downloaded in device attach time. Now it is reloaded whenever if_init is invoked. This is to ensure correct operation of hardware when something goes wrong. Previously the controller always run without regard to running state of firmware. This change will add additional controller initialization time but it give more robust operation as txp(4) always start off from a known state. The controller is put into sleep state until administrator explicitly up the interface. o As firmware is loaded in if_init handler, it's now possible to implement real watchdog timeout handler. When watchdog timer is expired, full-reset the controller and initialize the hardware again as most other drivers do. While I'm here use our own timer for watchdog instead of using if_watchdog/if_timer interface. o Instead of masking specific interrupts with TXP_IMR register, program TXP_IER register with the interrupts to be raised and use TXP_IMR to toggle interrupt generation. o Implemented txp_wait() to wait a specific state of a controller. o Separate boot related code from txp_download_fw() and name it txp_boot() to handle boot process. o Added bus_barrier(9) to host to ARM communication. o Added endianness to all typhoon command processing. The ARM93C always expects little-endian format of command/data. o Removed __STRICT_ALIGNMENT which is not valid on FreeBSD. __NO_STRICT_ALIGNMENT is provided for that purpose on FreeBSD. Previously __STRICT_ALIGNMENT was unconditionally defined for all architectures. o Rewrote SIOCSIFCAP ioctl handler such that each capability can be controlled by ifconfig(8). Note, disabling VLAN hardware tagging has no effect due to the bug of firmware. o Don't send TXP_CMD_CLEAR_STATISTICS to clear MAC statistics in txp_tick(). The command is not atomic. Instead, just read the statistics and reflect saved statistics to the statistics. dev.txp.%d.stats sysctl node provides detailed MAC statistics. This also reduces a lot of waste of CPU cycles as processing a command ring takes a very long time on ARM93C. Note, Rx multicast and broadcast statistics does not seem to right. It might be another bug of firmware. o Implemented link state change handling in txp_tick(). Now sending packets is allowed only after establishing a valid link. Also invoke link state change notification whenever its state is changed so pseudo drivers like lagg(4) that relies on link state can work with failover or link aggregation without hacks. if_baudrate is updated to resolved speed so SNMP agents can get correct bandwidth parameters. o Overhauled Tx routine such that it now honors number of allowable DMA segments and checks for 4 free descriptors before trying to send a frame. A frame may require 4 descriptors(1 frame descriptor, 1 or more frame descriptors, 1 TSO option descriptor, one free descriptor to prevent descriptor wrap-around) at least so it's necessary to check available free descriptors prior to setting up DMA operation. o Added a sysctl variable dev.txp.%d.process_limit to control how many received frames should be served in Rx handler. Valid ranges are 16 to 128(default 64) in unit of frames. o Added ALTQ(4) support. o Added missing IFCAP_VLAN_HWCSUM as txp(4) can offload checksum calculation as well as VLAN tag insertion/stripping. o Fixed media header length for VLAN. o Don't set if_mtu in device attach, it's already set in ether_ifattach(). o Enabled MWI. o Fixed module unload panic when bpf listeners are active. o Rearranged ethernet address programming logic such that it works on strict-alignment architectures. o Removed unused member variables in softc. o Added support for WOL. o Removed now unused TXP_PCI_LOMEM/TXP_PCI_LOIO. o Added wakeup command TXP_BOOTCMD_WAKEUP definition. o Added a new firmware version query command, TXP_CMD_READ_VERSION. o Removed volatile keyword in softc as bus_dmamap_sync(9) should take care of this. o Removed embedded union trick of a structure used to to access a pointer on LP64 systems. o Added a few TSO related definitions for struct txp_tcpseg_desc. However TSO is not used at all due to the limitation of hardware. o Redefined PKT_MAX_PKTLEN to theoretical maximum size of a frame. o Switched from bus_space_{read|write}_4 to bus_{read|write}_4. o Added a new macro TXP_DESC_INC to compute next descriptor index. Tested by: don.nasco <> gmail dot com Modified: head/sys/dev/txp/if_txp.c head/sys/dev/txp/if_txpreg.h Modified: head/sys/dev/txp/if_txp.c ============================================================================== --- head/sys/dev/txp/if_txp.c Thu Mar 12 00:09:29 2009 (r189713) +++ head/sys/dev/txp/if_txp.c Thu Mar 12 01:14:47 2009 (r189714) @@ -42,53 +42,82 @@ __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 -#include - -#include - -#include - -#include /* for vtophys */ -#include /* for vtophys */ -#include -#include -#include -#include #include -#include + #include #include -#define TXP_USEIOSPACE -#define __STRICT_ALIGNMENT +#include +#include #include #include -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif +MODULE_DEPEND(txp, pci, 1, 1, 1); +MODULE_DEPEND(txp, ether, 1, 1, 1); + +/* + * XXX Known Typhoon firmware issues. + * + * 1. It seems that firmware has Tx TCP/UDP checksum offloading bug. + * The firmware hangs when it's told to compute TCP/UDP checksum. + * I'm not sure whether the firmware requires special alignment to + * do checksum offloading but datasheet says nothing about that. + * 2. Datasheet says nothing for maximum number of fragmented + * descriptors supported. Experimentation shows up to 16 fragment + * descriptors are supported in the firmware. For TSO case, upper + * stack can send 64KB sized IP datagram plus link header size( + * ethernet header + VLAN tag) frame but controller can handle up + * to 64KB frame given that PAGE_SIZE is 4KB(i.e. 16 * PAGE_SIZE). + * Because frames that need TSO operation of hardware can be + * larger than 64KB I disabled TSO capability. TSO operation for + * less than or equal to 16 fragment descriptors works without + * problems, though. + * 3. VLAN hardware tag stripping is always enabled in the firmware + * even if it's explicitly told to not strip the tag. It's + * possible to add the tag back in Rx handler if VLAN hardware + * tag is not active but I didn't try that as it would be + * layering violation. + * 4. TXP_CMD_RECV_BUFFER_CONTROL does not work as expected in + * datasheet such that driver should handle the alignment + * restriction by copying received frame to align the frame on + * 32bit boundary on strict-alignment architectures. This adds a + * lot of CPU burden and it effectively reduce Rx performance on + * strict-alignment architectures(e.g. sparc64, arm, mips and ia64). + * + * Unfortunately it seems that 3Com have no longer interests in + * releasing fixed firmware so we may have to live with these bugs. + */ + +#define TXP_CSUM_FEATURES (CSUM_IP) /* * Various supported device vendors/types and their names. @@ -112,25 +141,36 @@ static struct txp_type txp_devs[] = { static int txp_probe(device_t); static int txp_attach(device_t); static int txp_detach(device_t); -static void txp_intr(void *); -static void txp_tick(void *); static int txp_shutdown(device_t); +static int txp_suspend(device_t); +static int txp_resume(device_t); +static int txp_intr(void *); +static void txp_int_task(void *, int); +static void txp_tick(void *); static int txp_ioctl(struct ifnet *, u_long, caddr_t); static void txp_start(struct ifnet *); static void txp_start_locked(struct ifnet *); +static int txp_encap(struct txp_softc *, struct txp_tx_ring *, struct mbuf **); static void txp_stop(struct txp_softc *); static void txp_init(void *); static void txp_init_locked(struct txp_softc *); -static void txp_watchdog(struct ifnet *); +static void txp_watchdog(struct txp_softc *); -static void txp_release_resources(struct txp_softc *); -static int txp_chip_init(struct txp_softc *); -static int txp_reset_adapter(struct txp_softc *); +static int txp_reset(struct txp_softc *); +static int txp_boot(struct txp_softc *, uint32_t); +static int txp_sleep(struct txp_softc *, int); +static int txp_wait(struct txp_softc *, uint32_t); static int txp_download_fw(struct txp_softc *); static int txp_download_fw_wait(struct txp_softc *); static int txp_download_fw_section(struct txp_softc *, struct txp_fw_section_header *, int); static int txp_alloc_rings(struct txp_softc *); +static void txp_init_rings(struct txp_softc *); +static int txp_dma_alloc(struct txp_softc *, char *, bus_dma_tag_t *, + bus_size_t, bus_size_t, bus_dmamap_t *, void **, bus_size_t, bus_addr_t *); +static void txp_dma_free(struct txp_softc *, bus_dma_tag_t *, bus_dmamap_t *, + void **); +static void txp_free_rings(struct txp_softc *); static int txp_rxring_fill(struct txp_softc *); static void txp_rxring_empty(struct txp_softc *); static void txp_set_filter(struct txp_softc *); @@ -138,14 +178,14 @@ static void txp_set_filter(struct txp_so static int txp_cmd_desc_numfree(struct txp_softc *); static int txp_command(struct txp_softc *, uint16_t, uint16_t, uint32_t, uint32_t, uint16_t *, uint32_t *, uint32_t *, int); -static int txp_command2(struct txp_softc *, uint16_t, uint16_t, +static int txp_ext_command(struct txp_softc *, uint16_t, uint16_t, uint32_t, uint32_t, struct txp_ext_desc *, uint8_t, struct txp_rsp_desc **, int); -static int txp_response(struct txp_softc *, uint32_t, uint16_t, uint16_t, +static int txp_response(struct txp_softc *, uint16_t, uint16_t, struct txp_rsp_desc **); static void txp_rsp_fixup(struct txp_softc *, struct txp_rsp_desc *, struct txp_rsp_desc *); -static void txp_capabilities(struct txp_softc *); +static int txp_set_capabilities(struct txp_softc *); static void txp_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int txp_ifmedia_upd(struct ifnet *); @@ -154,15 +194,18 @@ static void txp_show_descriptor(void *); #endif static void txp_tx_reclaim(struct txp_softc *, struct txp_tx_ring *); static void txp_rxbuf_reclaim(struct txp_softc *); -static void txp_rx_reclaim(struct txp_softc *, struct txp_rx_ring *); - -#ifdef TXP_USEIOSPACE -#define TXP_RES SYS_RES_IOPORT -#define TXP_RID TXP_PCI_LOIO -#else -#define TXP_RES SYS_RES_MEMORY -#define TXP_RID TXP_PCI_LOMEM +#ifndef __NO_STRICT_ALIGNMENT +static __inline void txp_fixup_rx(struct mbuf *); #endif +static int txp_rx_reclaim(struct txp_softc *, struct txp_rx_ring *, int); +static void txp_stats_save(struct txp_softc *); +static void txp_stats_update(struct txp_softc *, struct txp_rsp_desc *); +static void txp_sysctl_node(struct txp_softc *); +static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, int); +static int sysctl_hw_txp_proc_limit(SYSCTL_HANDLER_ARGS); + +static int prefer_iomap = 0; +TUNABLE_INT("hw.txp.prefer_iomap", &prefer_iomap); static device_method_t txp_methods[] = { /* Device interface */ @@ -170,7 +213,10 @@ static device_method_t txp_methods[] = { DEVMETHOD(device_attach, txp_attach), DEVMETHOD(device_detach, txp_detach), DEVMETHOD(device_shutdown, txp_shutdown), - { 0, 0 } + DEVMETHOD(device_suspend, txp_suspend), + DEVMETHOD(device_resume, txp_resume), + + { NULL, NULL } }; static driver_t txp_driver = { @@ -182,8 +228,6 @@ static driver_t txp_driver = { static devclass_t txp_devclass; DRIVER_MODULE(txp, pci, txp_driver, txp_devclass, 0, 0); -MODULE_DEPEND(txp, pci, 1, 1, 1); -MODULE_DEPEND(txp, ether, 1, 1, 1); static int txp_probe(device_t dev) @@ -209,36 +253,65 @@ txp_attach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; + struct txp_rsp_desc *rsp; uint16_t p1; - uint32_t p2; - int error = 0, rid; - u_char eaddr[6]; + uint32_t p2, reg; + int error = 0, pmc, rid; + uint8_t eaddr[ETHER_ADDR_LEN], *ver; sc = device_get_softc(dev); sc->sc_dev = dev; - sc->sc_cold = 1; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_int_task, 0, txp_int_task, sc); + TAILQ_INIT(&sc->sc_busy_list); + TAILQ_INIT(&sc->sc_free_list); - /* - * Map control/status registers. - */ - pci_enable_busmaster(dev); - - rid = TXP_RID; - sc->sc_res = bus_alloc_resource_any(dev, TXP_RES, &rid, - RF_ACTIVE); + ifmedia_init(&sc->sc_ifmedia, 0, txp_ifmedia_upd, txp_ifmedia_sts); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T | IFM_HDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX | IFM_HDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL); + pci_enable_busmaster(dev); + /* Prefer memory space register mapping over IO space. */ + if (prefer_iomap == 0) { + sc->sc_res_id = PCIR_BAR(1); + sc->sc_res_type = SYS_RES_MEMORY; + } else { + sc->sc_res_id = PCIR_BAR(0); + sc->sc_res_type = SYS_RES_IOPORT; + } + sc->sc_res = bus_alloc_resource_any(dev, sc->sc_res_type, + &sc->sc_res_id, RF_ACTIVE); + if (sc->sc_res == NULL && prefer_iomap == 0) { + sc->sc_res_id = PCIR_BAR(0); + sc->sc_res_type = SYS_RES_IOPORT; + sc->sc_res = bus_alloc_resource_any(dev, sc->sc_res_type, + &sc->sc_res_id, RF_ACTIVE); + } if (sc->sc_res == NULL) { device_printf(dev, "couldn't map ports/memory\n"); - error = ENXIO; - goto fail; + ifmedia_removeall(&sc->sc_ifmedia); + mtx_destroy(&sc->sc_mtx); + return (ENXIO); } - sc->sc_bt = rman_get_bustag(sc->sc_res); - sc->sc_bh = rman_get_bushandle(sc->sc_res); + /* Enable MWI. */ + reg = pci_read_config(dev, PCIR_COMMAND, 2); + reg |= PCIM_CMD_MWRICEN; + pci_write_config(dev, PCIR_COMMAND, reg, 2); + /* Check cache line size. */ + reg = pci_read_config(dev, PCIR_CACHELNSZ, 1); + reg <<= 4; + if (reg == 0 || (reg % 16) != 0) + device_printf(sc->sc_dev, + "invalid cache line size : %u\n", reg); /* Allocate interrupt */ rid = 0; @@ -251,112 +324,155 @@ txp_attach(device_t dev) goto fail; } - if (txp_chip_init(sc)) { - error = ENXIO; - goto fail; - } - - sc->sc_fwbuf = contigmalloc(32768, M_DEVBUF, - M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); - if (sc->sc_fwbuf == NULL) { - device_printf(dev, "no memory for firmware\n"); - error = ENXIO; - goto fail; - } - error = txp_download_fw(sc); - contigfree(sc->sc_fwbuf, 32768, M_DEVBUF); - sc->sc_fwbuf = NULL; - - if (error) + if ((error = txp_alloc_rings(sc)) != 0) goto fail; - - sc->sc_ldata = contigmalloc(sizeof(struct txp_ldata), M_DEVBUF, - M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); - if (sc->sc_ldata == NULL) { - device_printf(dev, "no memory for descriptor ring\n"); - error = ENXIO; - goto fail; - } - bzero(sc->sc_ldata, sizeof(struct txp_ldata)); - - if (txp_alloc_rings(sc)) { + txp_init_rings(sc); + txp_sysctl_node(sc); + /* Reset controller and make it reload sleep image. */ + if (txp_reset(sc) != 0) { error = ENXIO; goto fail; } - if (txp_command(sc, TXP_CMD_MAX_PKT_SIZE_WRITE, TXP_MAX_PKTLEN, 0, 0, - NULL, NULL, NULL, 1)) { + /* Let controller boot from sleep image. */ + if (txp_boot(sc, STAT_WAITING_FOR_HOST_REQUEST) != 0) { + device_printf(sc->sc_dev, "could not boot sleep image\n"); error = ENXIO; goto fail; } + /* Get station address. */ if (txp_command(sc, TXP_CMD_STATION_ADDRESS_READ, 0, 0, 0, - &p1, &p2, NULL, 1)) { + &p1, &p2, NULL, TXP_CMD_WAIT)) { error = ENXIO; goto fail; } + p1 = le16toh(p1); eaddr[0] = ((uint8_t *)&p1)[1]; eaddr[1] = ((uint8_t *)&p1)[0]; + p2 = le32toh(p2); eaddr[2] = ((uint8_t *)&p2)[3]; eaddr[3] = ((uint8_t *)&p2)[2]; eaddr[4] = ((uint8_t *)&p2)[1]; eaddr[5] = ((uint8_t *)&p2)[0]; - sc->sc_cold = 0; - - ifmedia_init(&sc->sc_ifmedia, 0, txp_ifmedia_upd, txp_ifmedia_sts); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_10_T, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_100_TX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_100_TX|IFM_HDX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL); - - sc->sc_xcvr = TXP_XCVR_AUTO; - txp_command(sc, TXP_CMD_XCVR_SELECT, TXP_XCVR_AUTO, 0, 0, - NULL, NULL, NULL, 0); - ifmedia_set(&sc->sc_ifmedia, IFM_ETHER|IFM_AUTO); - ifp = sc->sc_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { - device_printf(dev, "can not if_alloc()\n"); + device_printf(dev, "can not allocate ifnet structure\n"); error = ENOSPC; goto fail; } + + /* + * Show sleep image version information which may help to + * diagnose sleep image specific issues. + */ + rsp = NULL; + if (txp_ext_command(sc, TXP_CMD_READ_VERSION, 0, 0, 0, NULL, 0, + &rsp, TXP_CMD_WAIT)) { + device_printf(dev, "can not read sleep image version\n"); + error = ENXIO; + goto fail; + } + if (rsp->rsp_numdesc == 0) { + p2 = le32toh(rsp->rsp_par2) & 0xFFFF; + device_printf(dev, "Typhoon 1.0 sleep image (2000/%02u/%02u)\n", + p2 >> 8, p2 & 0xFF); + } else if (rsp->rsp_numdesc == 2) { + p2 = le32toh(rsp->rsp_par2); + ver = (uint8_t *)(rsp + 1); + /* + * Even if datasheet says the command returns a NULL + * terminated version string, explicitly terminate + * the string. Given that several bugs of firmware + * I can't trust this simple one. + */ + ver[25] = '\0'; + device_printf(dev, + "Typhoon 1.1+ sleep image %02u.%03u.%03u %s\n", + p2 >> 24, (p2 >> 12) & 0xFFF, p2 & 0xFFF, ver); + } else { + p2 = le32toh(rsp->rsp_par2); + device_printf(dev, + "Unknown Typhoon sleep image version: %u:0x%08x\n", + rsp->rsp_numdesc, p2); + } + if (rsp != NULL) + free(rsp, M_DEVBUF); + + sc->sc_xcvr = TXP_XCVR_AUTO; + txp_command(sc, TXP_CMD_XCVR_SELECT, TXP_XCVR_AUTO, 0, 0, + NULL, NULL, NULL, TXP_CMD_NOWAIT); + ifmedia_set(&sc->sc_ifmedia, IFM_ETHER | IFM_AUTO); + ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = txp_ioctl; ifp->if_start = txp_start; - ifp->if_watchdog = txp_watchdog; ifp->if_init = txp_init; - ifp->if_baudrate = 100000000; - ifp->if_snd.ifq_maxlen = TX_ENTRIES; - ifp->if_hwassist = 0; - txp_capabilities(sc); - + ifp->if_snd.ifq_drv_maxlen = TX_ENTRIES - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); + IFQ_SET_READY(&ifp->if_snd); /* - * Attach us everywhere + * It's possible to read firmware's offload capability but + * we have not downloaded the firmware yet so announce + * working capability here. We're not interested in IPSec + * capability and due to the lots of firmware bug we can't + * advertise the whole capability anyway. */ + ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_TXCSUM; + if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0) + ifp->if_capabilities |= IFCAP_WOL_MAGIC; + /* Enable all capabilities. */ + ifp->if_capenable = ifp->if_capabilities; + ether_ifattach(ifp, eaddr); + /* VLAN capability setup. */ + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM; + ifp->if_capenable = ifp->if_capabilities; + /* Tell the upper layer(s) we support long frames. */ + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); + + WRITE_REG(sc, TXP_IER, TXP_INTR_NONE); + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); + + /* Create local taskq. */ + sc->sc_tq = taskqueue_create_fast("txp_taskq", M_WAITOK, + taskqueue_thread_enqueue, &sc->sc_tq); + if (sc->sc_tq == NULL) { + device_printf(dev, "could not create taskqueue.\n"); + ether_ifdetach(ifp); + error = ENXIO; + goto fail; + } + taskqueue_start_threads(&sc->sc_tq, 1, PI_NET, "%s taskq", + device_get_nameunit(sc->sc_dev)); + + /* Put controller into sleep. */ + if (txp_sleep(sc, 0) != 0) { + ether_ifdetach(ifp); + error = ENXIO; + goto fail; + } + error = bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_NET | INTR_MPSAFE, - NULL, txp_intr, sc, &sc->sc_intrhand); + txp_intr, NULL, sc, &sc->sc_intrhand); - if (error) { + if (error != 0) { ether_ifdetach(ifp); - device_printf(dev, "couldn't set up irq\n"); + device_printf(dev, "couldn't set up interrupt handler.\n"); goto fail; } return (0); fail: - txp_release_resources(sc); - mtx_destroy(&sc->sc_mtx); + if (error != 0) + txp_detach(dev); return (error); } @@ -365,101 +481,57 @@ txp_detach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; - int i; sc = device_get_softc(dev); - ifp = sc->sc_ifp; - TXP_LOCK(sc); - txp_stop(sc); - TXP_UNLOCK(sc); - txp_shutdown(dev); - callout_drain(&sc->sc_tick); + ifp = sc->sc_ifp; + if (device_is_attached(dev)) { + TXP_LOCK(sc); + sc->sc_flags |= TXP_FLAG_DETACH; + txp_stop(sc); + TXP_UNLOCK(sc); + callout_drain(&sc->sc_tick); + taskqueue_drain(sc->sc_tq, &sc->sc_int_task); + ether_ifdetach(ifp); + } + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); ifmedia_removeall(&sc->sc_ifmedia); - ether_ifdetach(ifp); - - for (i = 0; i < RXBUF_ENTRIES; i++) - free(sc->sc_rxbufs[i].rb_sd, M_DEVBUF); - - txp_release_resources(sc); - - mtx_destroy(&sc->sc_mtx); - return (0); -} - -static void -txp_release_resources(struct txp_softc *sc) -{ - device_t dev; - - dev = sc->sc_dev; - if (sc->sc_intrhand != NULL) bus_teardown_intr(dev, sc->sc_irq, sc->sc_intrhand); - if (sc->sc_irq != NULL) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq); - if (sc->sc_res != NULL) - bus_release_resource(dev, TXP_RES, TXP_RID, sc->sc_res); - - if (sc->sc_ldata != NULL) - contigfree(sc->sc_ldata, sizeof(struct txp_ldata), M_DEVBUF); - - if (sc->sc_ifp) + bus_release_resource(dev, sc->sc_res_type, sc->sc_res_id, + sc->sc_res); + if (sc->sc_ifp != NULL) { if_free(sc->sc_ifp); -} - -static int -txp_chip_init(struct txp_softc *sc) -{ - /* disable interrupts */ - WRITE_REG(sc, TXP_IER, 0); - WRITE_REG(sc, TXP_IMR, - TXP_INT_SELF | TXP_INT_PCI_TABORT | TXP_INT_PCI_MABORT | - TXP_INT_DMA3 | TXP_INT_DMA2 | TXP_INT_DMA1 | TXP_INT_DMA0 | - TXP_INT_LATCH); - - /* ack all interrupts */ - WRITE_REG(sc, TXP_ISR, TXP_INT_RESERVED | TXP_INT_LATCH | - TXP_INT_A2H_7 | TXP_INT_A2H_6 | TXP_INT_A2H_5 | TXP_INT_A2H_4 | - TXP_INT_SELF | TXP_INT_PCI_TABORT | TXP_INT_PCI_MABORT | - TXP_INT_DMA3 | TXP_INT_DMA2 | TXP_INT_DMA1 | TXP_INT_DMA0 | - TXP_INT_A2H_3 | TXP_INT_A2H_2 | TXP_INT_A2H_1 | TXP_INT_A2H_0); - - if (txp_reset_adapter(sc)) - return (-1); - - /* disable interrupts */ - WRITE_REG(sc, TXP_IER, 0); - WRITE_REG(sc, TXP_IMR, - TXP_INT_SELF | TXP_INT_PCI_TABORT | TXP_INT_PCI_MABORT | - TXP_INT_DMA3 | TXP_INT_DMA2 | TXP_INT_DMA1 | TXP_INT_DMA0 | - TXP_INT_LATCH); - - /* ack all interrupts */ - WRITE_REG(sc, TXP_ISR, TXP_INT_RESERVED | TXP_INT_LATCH | - TXP_INT_A2H_7 | TXP_INT_A2H_6 | TXP_INT_A2H_5 | TXP_INT_A2H_4 | - TXP_INT_SELF | TXP_INT_PCI_TABORT | TXP_INT_PCI_MABORT | - TXP_INT_DMA3 | TXP_INT_DMA2 | TXP_INT_DMA1 | TXP_INT_DMA0 | - TXP_INT_A2H_3 | TXP_INT_A2H_2 | TXP_INT_A2H_1 | TXP_INT_A2H_0); + sc->sc_ifp = NULL; + } + txp_free_rings(sc); + mtx_destroy(&sc->sc_mtx); return (0); } static int -txp_reset_adapter(struct txp_softc *sc) +txp_reset(struct txp_softc *sc) { uint32_t r; int i; + /* Disable interrupts. */ + WRITE_REG(sc, TXP_IER, TXP_INTR_NONE); + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); + /* Ack all pending interrupts. */ + WRITE_REG(sc, TXP_ISR, TXP_INTR_ALL); + r = 0; WRITE_REG(sc, TXP_SRR, TXP_SRR_ALL); DELAY(1000); WRITE_REG(sc, TXP_SRR, 0); - /* Should wait max 6 seconds */ + /* Should wait max 6 seconds. */ for (i = 0; i < 6000; i++) { r = READ_REG(sc, TXP_A2H_0); if (r == STAT_WAITING_FOR_HOST_REQUEST) @@ -467,11 +539,55 @@ txp_reset_adapter(struct txp_softc *sc) DELAY(1000); } - if (r != STAT_WAITING_FOR_HOST_REQUEST) { + if (r != STAT_WAITING_FOR_HOST_REQUEST) device_printf(sc->sc_dev, "reset hung\n"); - return (-1); + + WRITE_REG(sc, TXP_IER, TXP_INTR_NONE); + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); + WRITE_REG(sc, TXP_ISR, TXP_INTR_ALL); + + /* + * Give more time to complete loading sleep image before + * trying to boot from sleep image. + */ + DELAY(5000); + + return (0); +} + +static int +txp_boot(struct txp_softc *sc, uint32_t state) +{ + + /* See if it's waiting for boot, and try to boot it. */ + if (txp_wait(sc, state) != 0) { + device_printf(sc->sc_dev, "not waiting for boot\n"); + return (ENXIO); + } + + WRITE_REG(sc, TXP_H2A_2, TXP_ADDR_HI(sc->sc_ldata.txp_boot_paddr)); + TXP_BARRIER(sc, TXP_H2A_2, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_1, TXP_ADDR_LO(sc->sc_ldata.txp_boot_paddr)); + TXP_BARRIER(sc, TXP_H2A_1, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_REGISTER_BOOT_RECORD); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); + + /* See if it booted. */ + if (txp_wait(sc, STAT_RUNNING) != 0) { + device_printf(sc->sc_dev, "firmware not running\n"); + return (ENXIO); } + /* Clear TX and CMD ring write registers. */ + WRITE_REG(sc, TXP_H2A_1, TXP_BOOTCMD_NULL); + TXP_BARRIER(sc, TXP_H2A_1, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_2, TXP_BOOTCMD_NULL); + TXP_BARRIER(sc, TXP_H2A_2, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_3, TXP_BOOTCMD_NULL); + TXP_BARRIER(sc, TXP_H2A_3, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_NULL); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); + return (0); } @@ -480,10 +596,11 @@ txp_download_fw(struct txp_softc *sc) { struct txp_fw_file_header *fileheader; struct txp_fw_section_header *secthead; - int error, sect; - uint32_t r, i, ier, imr; + int sect; + uint32_t error, ier, imr; + + TXP_LOCK_ASSERT(sc); - r = 0; error = 0; ier = READ_REG(sc, TXP_IER); WRITE_REG(sc, TXP_IER, ier | TXP_INT_A2H_0); @@ -491,68 +608,60 @@ txp_download_fw(struct txp_softc *sc) imr = READ_REG(sc, TXP_IMR); WRITE_REG(sc, TXP_IMR, imr | TXP_INT_A2H_0); - for (i = 0; i < 10000; i++) { - r = READ_REG(sc, TXP_A2H_0); - if (r == STAT_WAITING_FOR_HOST_REQUEST) - break; - DELAY(50); - } - if (r != STAT_WAITING_FOR_HOST_REQUEST) { + if (txp_wait(sc, STAT_WAITING_FOR_HOST_REQUEST) != 0) { device_printf(sc->sc_dev, "not waiting for host request\n"); - error = -1; + error = ETIMEDOUT; goto fail; } - /* Ack the status */ + /* Ack the status. */ WRITE_REG(sc, TXP_ISR, TXP_INT_A2H_0); fileheader = (struct txp_fw_file_header *)tc990image; if (bcmp("TYPHOON", fileheader->magicid, sizeof(fileheader->magicid))) { - device_printf(sc->sc_dev, "fw invalid magic\n"); - error = -1; + device_printf(sc->sc_dev, "firmware invalid magic\n"); goto fail; } - /* Tell boot firmware to get ready for image */ - WRITE_REG(sc, TXP_H2A_1, fileheader->addr); - WRITE_REG(sc, TXP_H2A_2, fileheader->hmac[0]); - WRITE_REG(sc, TXP_H2A_3, fileheader->hmac[1]); - WRITE_REG(sc, TXP_H2A_4, fileheader->hmac[2]); - WRITE_REG(sc, TXP_H2A_5, fileheader->hmac[3]); - WRITE_REG(sc, TXP_H2A_6, fileheader->hmac[4]); + /* Tell boot firmware to get ready for image. */ + WRITE_REG(sc, TXP_H2A_1, le32toh(fileheader->addr)); + TXP_BARRIER(sc, TXP_H2A_1, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_2, le32toh(fileheader->hmac[0])); + TXP_BARRIER(sc, TXP_H2A_2, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_3, le32toh(fileheader->hmac[1])); + TXP_BARRIER(sc, TXP_H2A_3, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_4, le32toh(fileheader->hmac[2])); + TXP_BARRIER(sc, TXP_H2A_4, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_5, le32toh(fileheader->hmac[3])); + TXP_BARRIER(sc, TXP_H2A_5, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_6, le32toh(fileheader->hmac[4])); + TXP_BARRIER(sc, TXP_H2A_6, 4, BUS_SPACE_BARRIER_WRITE); WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_RUNTIME_IMAGE); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); if (txp_download_fw_wait(sc)) { - device_printf(sc->sc_dev, "fw wait failed, initial\n"); - error = -1; + device_printf(sc->sc_dev, "firmware wait failed, initial\n"); + error = ETIMEDOUT; goto fail; } secthead = (struct txp_fw_section_header *)(((uint8_t *)tc990image) + sizeof(struct txp_fw_file_header)); - for (sect = 0; sect < fileheader->nsections; sect++) { - - if (txp_download_fw_section(sc, secthead, sect)) { - error = -1; + for (sect = 0; sect < le32toh(fileheader->nsections); sect++) { + if ((error = txp_download_fw_section(sc, secthead, sect)) != 0) goto fail; - } secthead = (struct txp_fw_section_header *) - (((uint8_t *)secthead) + secthead->nbytes + + (((uint8_t *)secthead) + le32toh(secthead->nbytes) + sizeof(*secthead)); } WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_DOWNLOAD_COMPLETE); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); - for (i = 0; i < 10000; i++) { - r = READ_REG(sc, TXP_A2H_0); - if (r == STAT_WAITING_FOR_BOOT) - break; - DELAY(50); - } - if (r != STAT_WAITING_FOR_BOOT) { + if (txp_wait(sc, STAT_WAITING_FOR_BOOT) != 0) { device_printf(sc->sc_dev, "not waiting for boot\n"); - error = -1; + error = ETIMEDOUT; goto fail; } @@ -566,27 +675,26 @@ fail: static int txp_download_fw_wait(struct txp_softc *sc) { - uint32_t i, r; + uint32_t i; - r = 0; - for (i = 0; i < 10000; i++) { - r = READ_REG(sc, TXP_ISR); - if (r & TXP_INT_A2H_0) + TXP_LOCK_ASSERT(sc); + + for (i = 0; i < TXP_TIMEOUT; i++) { + if ((READ_REG(sc, TXP_ISR) & TXP_INT_A2H_0) != 0) break; DELAY(50); } - if (!(r & TXP_INT_A2H_0)) { - device_printf(sc->sc_dev, "fw wait failed comm0\n"); - return (-1); + if (i == TXP_TIMEOUT) { + device_printf(sc->sc_dev, "firmware wait failed comm0\n"); + return (ETIMEDOUT); } WRITE_REG(sc, TXP_ISR, TXP_INT_A2H_0); - r = READ_REG(sc, TXP_A2H_0); - if (r != STAT_WAITING_FOR_SEGMENT) { - device_printf(sc->sc_dev, "fw not waiting for segment\n"); - return (-1); + if (READ_REG(sc, TXP_A2H_0) != STAT_WAITING_FOR_SEGMENT) { + device_printf(sc->sc_dev, "firmware not waiting for segment\n"); + return (ETIMEDOUT); } return (0); } @@ -595,180 +703,262 @@ static int txp_download_fw_section(struct txp_softc *sc, struct txp_fw_section_header *sect, int sectnum) { - vm_offset_t dma; + bus_dma_tag_t sec_tag; + bus_dmamap_t sec_map; + bus_addr_t sec_paddr; + uint8_t *sec_buf; int rseg, err = 0; struct mbuf m; uint16_t csum; - /* Skip zero length sections */ - if (sect->nbytes == 0) + TXP_LOCK_ASSERT(sc); + + /* Skip zero length sections. */ + if (le32toh(sect->nbytes) == 0) return (0); - /* Make sure we aren't past the end of the image */ + /* Make sure we aren't past the end of the image. */ rseg = ((uint8_t *)sect) - ((uint8_t *)tc990image); if (rseg >= sizeof(tc990image)) { - device_printf(sc->sc_dev, "fw invalid section address, " - "section %d\n", sectnum); - return (-1); + device_printf(sc->sc_dev, + "firmware invalid section address, section %d\n", sectnum); + return (EIO); } - /* Make sure this section doesn't go past the end */ - rseg += sect->nbytes; + /* Make sure this section doesn't go past the end. */ + rseg += le32toh(sect->nbytes); if (rseg >= sizeof(tc990image)) { - device_printf(sc->sc_dev, "fw truncated section %d\n", + device_printf(sc->sc_dev, "firmware truncated section %d\n", sectnum); - return (-1); + return (EIO); } - bcopy(((uint8_t *)sect) + sizeof(*sect), sc->sc_fwbuf, sect->nbytes); - dma = vtophys(sc->sc_fwbuf); + sec_tag = NULL; + sec_map = NULL; + sec_buf = NULL; + /* XXX */ + TXP_UNLOCK(sc); + err = txp_dma_alloc(sc, "firmware sections", &sec_tag, sizeof(uint32_t), + 0, &sec_map, (void **)&sec_buf, le32toh(sect->nbytes), &sec_paddr); + TXP_LOCK(sc); + if (err != 0) + goto bail; + bcopy(((uint8_t *)sect) + sizeof(*sect), sec_buf, + le32toh(sect->nbytes)); /* * dummy up mbuf and verify section checksum */ m.m_type = MT_DATA; m.m_next = m.m_nextpkt = NULL; - m.m_len = sect->nbytes; - m.m_data = sc->sc_fwbuf; + m.m_len = le32toh(sect->nbytes); + m.m_data = sec_buf; m.m_flags = 0; - csum = in_cksum(&m, sect->nbytes); + csum = in_cksum(&m, le32toh(sect->nbytes)); if (csum != sect->cksum) { - device_printf(sc->sc_dev, "fw section %d, bad " - "cksum (expected 0x%x got 0x%x)\n", - sectnum, sect->cksum, csum); - err = -1; + device_printf(sc->sc_dev, + "firmware section %d, bad cksum (expected 0x%x got 0x%x)\n", + sectnum, le16toh(sect->cksum), csum); + err = EIO; goto bail; } - WRITE_REG(sc, TXP_H2A_1, sect->nbytes); - WRITE_REG(sc, TXP_H2A_2, sect->cksum); - WRITE_REG(sc, TXP_H2A_3, sect->addr); - WRITE_REG(sc, TXP_H2A_4, 0); - WRITE_REG(sc, TXP_H2A_5, dma & 0xffffffff); + bus_dmamap_sync(sec_tag, sec_map, BUS_DMASYNC_PREWRITE); + + WRITE_REG(sc, TXP_H2A_1, le32toh(sect->nbytes)); + TXP_BARRIER(sc, TXP_H2A_1, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_2, le16toh(sect->cksum)); + TXP_BARRIER(sc, TXP_H2A_2, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_3, le32toh(sect->addr)); + TXP_BARRIER(sc, TXP_H2A_3, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_4, TXP_ADDR_HI(sec_paddr)); + TXP_BARRIER(sc, TXP_H2A_4, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_5, TXP_ADDR_LO(sec_paddr)); + TXP_BARRIER(sc, TXP_H2A_5, 4, BUS_SPACE_BARRIER_WRITE); WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_SEGMENT_AVAILABLE); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); if (txp_download_fw_wait(sc)) { - device_printf(sc->sc_dev, "fw wait failed, " - "section %d\n", sectnum); - err = -1; + device_printf(sc->sc_dev, + "firmware wait failed, section %d\n", sectnum); + err = ETIMEDOUT; } + bus_dmamap_sync(sec_tag, sec_map, BUS_DMASYNC_POSTWRITE); bail: + txp_dma_free(sc, &sec_tag, &sec_map, (void **)&sec_buf); return (err); } -static void +static int txp_intr(void *vsc) { - struct txp_softc *sc = vsc; - struct txp_hostvar *hv = sc->sc_hostvar; + struct txp_softc *sc; + uint32_t status; + + sc = vsc; + status = READ_REG(sc, TXP_ISR); + if ((status & TXP_INT_LATCH) == 0) + return (FILTER_STRAY); + WRITE_REG(sc, TXP_ISR, status); + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); + taskqueue_enqueue(sc->sc_tq, &sc->sc_int_task); + + return (FILTER_HANDLED); +} + +static void +txp_int_task(void *arg, int pending) +{ + struct txp_softc *sc; + struct ifnet *ifp; + struct txp_hostvar *hv; uint32_t isr; + int more; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 01:17:35 2009 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 75E0D1065672; Thu, 12 Mar 2009 01:17:35 +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 62EB78FC14; Thu, 12 Mar 2009 01:17:35 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C1HZaH012415; Thu, 12 Mar 2009 01:17:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C1HZZX012414; Thu, 12 Mar 2009 01:17:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903120117.n2C1HZZX012414@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 12 Mar 2009 01:17: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: r189715 - head/sys/sparc64/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: Thu, 12 Mar 2009 01:17:35 -0000 Author: yongari Date: Thu Mar 12 01:17:35 2009 New Revision: 189715 URL: http://svn.freebsd.org/changeset/base/189715 Log: Uncomment txp(4), txp(4) should work on all architectures. Modified: head/sys/sparc64/conf/GENERIC Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Thu Mar 12 01:14:47 2009 (r189714) +++ head/sys/sparc64/conf/GENERIC Thu Mar 12 01:17:35 2009 (r189715) @@ -165,7 +165,7 @@ device em # Intel PRO/1000 adapter Gig #device ixgb # Intel PRO/10GbE Ethernet Card device le # AMD Am7900 LANCE and Am79C9xx PCnet device ti # Alteon Networks Tigon I/II gigabit Ethernet -#device txp # 3Com 3cR990 (``Typhoon'') +device txp # 3Com 3cR990 (``Typhoon'') #device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Ethernet NICs that use the common MII bus controller code. From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 01:21:48 2009 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 DC2BB106566B; Thu, 12 Mar 2009 01:21:48 +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 C91C08FC0C; Thu, 12 Mar 2009 01:21:48 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C1Lm7j012524; Thu, 12 Mar 2009 01:21:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C1Lmva012523; Thu, 12 Mar 2009 01:21:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903120121.n2C1Lmva012523@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 12 Mar 2009 01:21: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: r189716 - 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: Thu, 12 Mar 2009 01:21:49 -0000 Author: yongari Date: Thu Mar 12 01:21:48 2009 New Revision: 189716 URL: http://svn.freebsd.org/changeset/base/189716 Log: Add txp(4) to the list of drivers supporting ALTQ. Modified: head/share/man/man4/altq.4 Modified: head/share/man/man4/altq.4 ============================================================================== --- head/share/man/man4/altq.4 Thu Mar 12 01:17:35 2009 (r189715) +++ head/share/man/man4/altq.4 Thu Mar 12 01:21:48 2009 (r189716) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 12, 2008 +.Dd March 12, 2009 .Dt ALTQ 4 .Os .Sh NAME @@ -151,6 +151,7 @@ They have been applied to the following .Xr sk 4 , .Xr ste 4 , .Xr stge 4 , +.Xr txp 4 , .Xr udav 4 , .Xr ural 4 , .Xr vge 4 , From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 01:27:16 2009 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 091A9106566B; Thu, 12 Mar 2009 01:27:16 +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 EA5BB8FC14; Thu, 12 Mar 2009 01:27:15 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C1RFEp012667; Thu, 12 Mar 2009 01:27:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C1RFIx012666; Thu, 12 Mar 2009 01:27:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903120127.n2C1RFIx012666@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 12 Mar 2009 01:27: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: r189717 - 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: Thu, 12 Mar 2009 01:27:16 -0000 Author: yongari Date: Thu Mar 12 01:27:15 2009 New Revision: 189717 URL: http://svn.freebsd.org/changeset/base/189717 Log: Xref altq.4 and bump .Dd Modified: head/share/man/man4/txp.4 Modified: head/share/man/man4/txp.4 ============================================================================== --- head/share/man/man4/txp.4 Thu Mar 12 01:21:48 2009 (r189716) +++ head/share/man/man4/txp.4 Thu Mar 12 01:27:15 2009 (r189717) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd March 12, 2009 .Dt TXP 4 .Os .Sh NAME @@ -134,6 +134,7 @@ driver supports the following cards: 3Com 3cR990B-SRV .El .Sh SEE ALSO +.Xr altq 4 , .Xr arp 4 , .Xr inet 4 , .Xr intro 4 , From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 02:32:54 2009 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 98BEE106566B; Thu, 12 Mar 2009 02:32:54 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8578F8FC0C; Thu, 12 Mar 2009 02:32:54 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C2Wsjh013937; Thu, 12 Mar 2009 02:32:54 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C2WsnM013936; Thu, 12 Mar 2009 02:32:54 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903120232.n2C2WsnM013936@svn.freebsd.org> From: Andrew Thompson Date: Thu, 12 Mar 2009 02:32: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: r189718 - 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: Thu, 12 Mar 2009 02:32:55 -0000 Author: thompsa Date: Thu Mar 12 02:32:54 2009 New Revision: 189718 URL: http://svn.freebsd.org/changeset/base/189718 Log: MFp4 //depot/projects/usb 159004,159053,159091 More HID parsing fixes for usb mice. - be less strict on the last HID item usage. - preserve item size and count accross items - improve default HID usage selection. Tested by: ache Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_hid.c Modified: head/sys/dev/usb/usb_hid.c ============================================================================== --- head/sys/dev/usb/usb_hid.c Thu Mar 12 01:27:15 2009 (r189717) +++ head/sys/dev/usb/usb_hid.c Thu Mar 12 02:32:54 2009 (r189718) @@ -68,7 +68,10 @@ struct hid_data { struct hid_item cur[MAXPUSH]; int32_t usages_min[MAXUSAGE]; int32_t usages_max[MAXUSAGE]; - int kindset; + int32_t usage_last; /* last seen usage */ + uint32_t loc_size; /* last seen size */ + uint32_t loc_count; /* last seen count */ + uint8_t kindset; /* we have 5 kinds so 8 bits are enough */ uint8_t pushlevel; /* current pushlevel */ uint8_t ncount; /* end usage item count */ uint8_t icount; /* current usage item count */ @@ -181,15 +184,21 @@ hid_get_item(struct hid_data *s, struct top: /* check if there is an array of items */ - if ((s->icount != s->ncount) && - (s->iusage != s->nusage)) { - dval = s->usages_min[s->iusage] + s->ousage; - c->usage = dval; - if (dval == s->usages_max[s->iusage]) { - s->iusage ++; - s->ousage = 0; + if (s->icount < s->ncount) { + /* get current usage */ + if (s->iusage < s->nusage) { + dval = s->usages_min[s->iusage] + s->ousage; + c->usage = dval; + s->usage_last = dval; + if (dval == s->usages_max[s->iusage]) { + s->iusage ++; + s->ousage = 0; + } else { + s->ousage ++; + } } else { - s->ousage ++; + DPRINTFN(1, "Using last usage\n"); + dval = s->usage_last; } s->icount ++; /* @@ -268,6 +277,9 @@ hid_get_item(struct hid_data *s, struct c->kind = hid_input; c->flags = dval; ret: + c->loc.count = s->loc_count; + c->loc.size = s->loc_size; + if (c->flags & HIO_VARIABLE) { /* range check usage count */ if (c->loc.count > 255) { @@ -285,13 +297,9 @@ hid_get_item(struct hid_data *s, struct } else { s->ncount = 1; } - /* make sure we have a usage */ - if (s->nusage == 0) { - /* use the undefined HID PAGE */ - s->usages_min[s->nusage] = 0x0000; - s->usages_max[s->nusage] = 0xFFFF; - s->nusage = s->ncount; - } + /* set default usage */ + /* use the undefined HID PAGE */ + s->usage_last = 0; goto top; case 9: /* Output */ @@ -346,7 +354,8 @@ hid_get_item(struct hid_data *s, struct c->unit = dval; break; case 7: - c->loc.size = dval; + /* mask because value is unsigned */ + s->loc_size = dval & mask; break; case 8: c->report_ID = dval; @@ -354,12 +363,17 @@ hid_get_item(struct hid_data *s, struct c->loc.pos = 0; break; case 9: - c->loc.count = dval; + /* mask because value is unsigned */ + s->loc_count = dval & mask; break; case 10: /* Push */ s->pushlevel ++; if (s->pushlevel < MAXPUSH) { s->cur[s->pushlevel] = *c; + /* store size and count */ + c->loc.size = s->loc_size; + c->loc.count = s->loc_count; + /* update current item pointer */ c = &s->cur[s->pushlevel]; } else { DPRINTFN(0, "Cannot push " @@ -372,7 +386,13 @@ hid_get_item(struct hid_data *s, struct /* preserve position */ oldpos = c->loc.pos; c = &s->cur[s->pushlevel]; + /* restore size and count */ + s->loc_size = c->loc.size; + s->loc_count = c->loc.count; + /* set default item location */ c->loc.pos = oldpos; + c->loc.size = 0; + c->loc.count = 0; } else { DPRINTFN(0, "Cannot pop " "item @ %d!\n", s->pushlevel); From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 02:51:55 2009 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 BF8F7106564A; Thu, 12 Mar 2009 02:51:55 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB4EA8FC0A; Thu, 12 Mar 2009 02:51:55 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C2ptw0014415; Thu, 12 Mar 2009 02:51:55 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C2pt04014409; Thu, 12 Mar 2009 02:51:55 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200903120251.n2C2pt04014409@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 12 Mar 2009 02:51: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: r189719 - in head/sys: compat/ndis dev/if_ndis 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 Mar 2009 02:51:56 -0000 Author: weongyo Date: Thu Mar 12 02:51:55 2009 New Revision: 189719 URL: http://svn.freebsd.org/changeset/base/189719 Log: o change a lock model based on HAL preemption lock to a normal mtx. Based on the HAL preemption lock there is a problem on SMP machines and causes a panic. o When a device detached the current tactic to detach NDIS USB driver is to call SURPRISE_REMOVED event. So it don't need to call ndis_halt_nic() again. This fixes some page faults when some drivers work abnormal. o it assumes now that URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER is in DISPATCH_LEVEL (non-sleepable) and as further work URB_FUNCTION_VENDOR_XXX and URB_FUNCTION_CLASS_XXX should be. Reviewed by: Hans Petter Selasky Tested by: Paul B. Mahol Modified: head/sys/compat/ndis/hal_var.h head/sys/compat/ndis/subr_hal.c head/sys/compat/ndis/subr_usbd.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/if_ndis/if_ndis_usb.c head/sys/dev/if_ndis/if_ndisvar.h Modified: head/sys/compat/ndis/hal_var.h ============================================================================== --- head/sys/compat/ndis/hal_var.h Thu Mar 12 02:32:54 2009 (r189718) +++ head/sys/compat/ndis/hal_var.h Thu Mar 12 02:51:55 2009 (r189719) @@ -48,7 +48,6 @@ extern image_patch_table hal_functbl[]; __BEGIN_DECLS extern int hal_libinit(void); extern int hal_libfini(void); -extern struct mtx *hal_getdisplock(void); extern uint8_t KfAcquireSpinLock(kspin_lock *); extern void KfReleaseSpinLock(kspin_lock *, uint8_t); extern uint8_t KfRaiseIrql(uint8_t); Modified: head/sys/compat/ndis/subr_hal.c ============================================================================== --- head/sys/compat/ndis/subr_hal.c Thu Mar 12 02:32:54 2009 (r189718) +++ head/sys/compat/ndis/subr_hal.c Thu Mar 12 02:51:55 2009 (r189719) @@ -124,13 +124,6 @@ hal_libfini() return(0); } -struct mtx * -hal_getdisplock() -{ - - return &disp_lock[curthread->td_oncpu]; -} - static void KeStallExecutionProcessor(usecs) uint32_t usecs; Modified: head/sys/compat/ndis/subr_usbd.c ============================================================================== --- head/sys/compat/ndis/subr_usbd.c Thu Mar 12 02:32:54 2009 (r189718) +++ head/sys/compat/ndis/subr_usbd.c Thu Mar 12 02:51:55 2009 (r189719) @@ -93,6 +93,8 @@ static int32_t usbd_power(device_objec static void usbd_irpcancel(device_object *, irp *); static int32_t usbd_submit_urb(irp *); static int32_t usbd_urb2nt(int32_t); +static void usbd_task(device_object *, void *); +static int32_t usbd_taskadd(irp *, unsigned); static void usbd_xfertask(device_object *, void *); static void dummy(void); @@ -118,6 +120,7 @@ static funcptr usbd_ioinvalid_wrap; static funcptr usbd_pnp_wrap; static funcptr usbd_power_wrap; static funcptr usbd_irpcancel_wrap; +static funcptr usbd_task_wrap; static funcptr usbd_xfertask_wrap; int @@ -144,6 +147,8 @@ usbd_libinit(void) (funcptr *)&usbd_power_wrap, 2, WINDRV_WRAP_STDCALL); windrv_wrap((funcptr)usbd_irpcancel, (funcptr *)&usbd_irpcancel_wrap, 2, WINDRV_WRAP_STDCALL); + windrv_wrap((funcptr)usbd_task, + (funcptr *)&usbd_task_wrap, 2, WINDRV_WRAP_STDCALL); windrv_wrap((funcptr)usbd_xfertask, (funcptr *)&usbd_xfertask_wrap, 2, WINDRV_WRAP_STDCALL); @@ -184,6 +189,7 @@ usbd_libfini(void) windrv_unwrap(usbd_pnp_wrap); windrv_unwrap(usbd_power_wrap); windrv_unwrap(usbd_irpcancel_wrap); + windrv_unwrap(usbd_task_wrap); windrv_unwrap(usbd_xfertask_wrap); free(usbd_driver.dro_drivername.us_buf, M_DEVBUF); @@ -417,7 +423,6 @@ usbd_func_getdesc(ip) device_t dev = IRP_NDIS_DEV(ip); struct ndis_softc *sc = device_get_softc(dev); struct usbd_urb_control_descriptor_request *ctldesc; - uint8_t irql; uint16_t actlen; uint32_t len; union usbd_urb *urb; @@ -450,13 +455,13 @@ usbd_func_getdesc(ip) actlen = len; status = USB_ERR_NORMAL_COMPLETION; } else { - KeRaiseIrql(DISPATCH_LEVEL, &irql); - status = usb2_req_get_desc(sc->ndisusb_dev, hal_getdisplock(), + NDISUSB_LOCK(sc); + status = usb2_req_get_desc(sc->ndisusb_dev, &sc->ndisusb_mtx, &actlen, ctldesc->ucd_trans_buf, 2, ctldesc->ucd_trans_buflen, ctldesc->ucd_langid, ctldesc->ucd_desctype, ctldesc->ucd_idx, NDISUSB_GETDESC_MAXRETRIES); - KeLowerIrql(irql); + NDISUSB_UNLOCK(sc); } exit: if (status != USB_ERR_NORMAL_COMPLETION) { @@ -497,11 +502,6 @@ usbd_func_selconf(ip) return usbd_usb2urb(USB_ERR_NORMAL_COMPLETION); } - if (conf->bConfigurationValue > NDISUSB_CONFIG_NO) - device_printf(dev, - "warning: config_no is larger than default (%#x/%#x)\n", - conf->bConfigurationValue, NDISUSB_CONFIG_NO); - intf = &selconf->usc_intf; for (i = 0; i < conf->bNumInterface && intf->uii_len > 0; i++) { ret = usb2_set_alt_interface_index(udev, @@ -594,7 +594,7 @@ usbd_setup_endpoint(ip, ifidx, ep) cfg.mh.flags.short_xfer_ok = 1; status = usb2_transfer_setup(sc->ndisusb_dev, &ifidx, ne->ne_xfer, - &cfg, 1, sc, hal_getdisplock()); + &cfg, 1, sc, &sc->ndisusb_mtx); if (status != USB_ERR_NORMAL_COMPLETION) { device_printf(dev, "couldn't setup xfer: %s\n", usb2_errstr(status)); @@ -618,8 +618,9 @@ static int32_t usbd_func_abort_pipe(ip) irp *ip; { + device_t dev = IRP_NDIS_DEV(ip); + struct ndis_softc *sc = device_get_softc(dev); struct ndisusb_ep *ne; - uint8_t irql; union usbd_urb *urb; urb = usbd_geturb(ip); @@ -629,10 +630,10 @@ usbd_func_abort_pipe(ip) return (USBD_STATUS_INVALID_PIPE_HANDLE); } - KeRaiseIrql(DISPATCH_LEVEL, &irql); + NDISUSB_LOCK(sc); usb2_transfer_stop(ne->ne_xfer[0]); usb2_transfer_start(ne->ne_xfer[0]); - KeLowerIrql(irql); + NDISUSB_UNLOCK(sc); return (USBD_STATUS_SUCCESS); } @@ -644,7 +645,7 @@ usbd_func_vendorclass(ip) device_t dev = IRP_NDIS_DEV(ip); struct ndis_softc *sc = device_get_softc(dev); struct usbd_urb_vendor_or_class_request *vcreq; - uint8_t irql, type = 0; + uint8_t type = 0; union usbd_urb *urb; struct usb2_device_request req; usb2_error_t status; @@ -692,10 +693,10 @@ usbd_func_vendorclass(ip) USETW(req.wValue, vcreq->uvc_value); USETW(req.wLength, vcreq->uvc_trans_buflen); - KeRaiseIrql(DISPATCH_LEVEL, &irql); - status = usb2_do_request(sc->ndisusb_dev, hal_getdisplock(), &req, + NDISUSB_LOCK(sc); + status = usb2_do_request(sc->ndisusb_dev, &sc->ndisusb_mtx, &req, vcreq->uvc_trans_buf); - KeLowerIrql(irql); + NDISUSB_UNLOCK(sc); return usbd_usb2urb(status); } @@ -755,19 +756,18 @@ static struct ndisusb_xfer * usbd_aq_getfirst(struct ndis_softc *sc, struct ndisusb_ep *ne) { struct ndisusb_xfer *nx; - uint8_t irql; - KeAcquireSpinLock(&ne->ne_lock, &irql); + KeAcquireSpinLockAtDpcLevel(&ne->ne_lock); if (IsListEmpty(&ne->ne_active)) { device_printf(sc->ndis_dev, "%s: the active queue can't be empty.\n", __func__); - KeReleaseSpinLock(&ne->ne_lock, irql); + KeReleaseSpinLockFromDpcLevel(&ne->ne_lock); return (NULL); } nx = CONTAINING_RECORD(ne->ne_active.nle_flink, struct ndisusb_xfer, nx_next); RemoveEntryList(&nx->nx_next); - KeReleaseSpinLock(&ne->ne_lock, irql); + KeReleaseSpinLockFromDpcLevel(&ne->ne_lock); return (nx); } @@ -881,10 +881,8 @@ usbd_get_ndisep(ip, ep) ne = &sc->ndisusb_ep[NDISUSB_GET_ENDPT(ep->bEndpointAddress)]; - IoAcquireCancelSpinLock(&ip->irp_cancelirql); IRP_NDISUSB_EP(ip) = ne; ip->irp_cancelfunc = (cancel_func)usbd_irpcancel_wrap; - IoReleaseCancelSpinLock(ip->irp_cancelirql); return (ne); } @@ -902,7 +900,6 @@ usbd_xfertask(dobj, arg) struct ndisusb_xferdone *nd; struct ndisusb_xfer *nq; struct usbd_urb_bulk_or_intr_transfer *ubi; - uint8_t irql; union usbd_urb *urb; usb2_error_t status; void *priv; @@ -912,7 +909,7 @@ usbd_xfertask(dobj, arg) if (IsListEmpty(&sc->ndisusb_xferdonelist)) return; - KeAcquireSpinLock(&sc->ndisusb_xferdonelock, &irql); + KeAcquireSpinLockAtDpcLevel(&sc->ndisusb_xferdonelock); l = sc->ndisusb_xferdonelist.nle_flink; while (l != &sc->ndisusb_xferdonelist) { nd = CONTAINING_RECORD(l, struct ndisusb_xferdone, nd_donelist); @@ -928,8 +925,6 @@ usbd_xfertask(dobj, arg) ("function(%d) isn't for bulk or interrupt", urb->uu_hdr.uuh_func)); - IoAcquireCancelSpinLock(&ip->irp_cancelirql); - ip->irp_cancelfunc = NULL; IRP_NDISUSB_EP(ip) = NULL; @@ -954,28 +949,114 @@ usbd_xfertask(dobj, arg) break; } - IoReleaseCancelSpinLock(ip->irp_cancelirql); - l = l->nle_flink; RemoveEntryList(&nd->nd_donelist); free(nq, M_USBDEV); free(nd, M_USBDEV); if (error) continue; + KeReleaseSpinLockFromDpcLevel(&sc->ndisusb_xferdonelock); /* NB: call after cleaning */ IoCompleteRequest(ip, IO_NO_INCREMENT); + KeAcquireSpinLockAtDpcLevel(&sc->ndisusb_xferdonelock); } - KeReleaseSpinLock(&sc->ndisusb_xferdonelock, irql); + KeReleaseSpinLockFromDpcLevel(&sc->ndisusb_xferdonelock); +} + +/* + * this function is for mainly deferring a task to the another thread because + * we don't want to be in the scope of HAL lock. + */ +static int32_t +usbd_taskadd(ip, type) + irp *ip; + unsigned type; +{ + device_t dev = IRP_NDIS_DEV(ip); + struct ndis_softc *sc = device_get_softc(dev); + struct ndisusb_task *nt; + + nt = malloc(sizeof(struct ndisusb_task), M_USBDEV, M_NOWAIT | M_ZERO); + if (nt == NULL) + return (USBD_STATUS_NO_MEMORY); + nt->nt_type = type; + nt->nt_ctx = ip; + + KeAcquireSpinLockAtDpcLevel(&sc->ndisusb_tasklock); + InsertTailList((&sc->ndisusb_tasklist), (&nt->nt_tasklist)); + KeReleaseSpinLockFromDpcLevel(&sc->ndisusb_tasklock); + + IoQueueWorkItem(sc->ndisusb_taskitem, + (io_workitem_func)usbd_task_wrap, WORKQUEUE_CRITICAL, sc); + + return (USBD_STATUS_SUCCESS); +} + +static void +usbd_task(dobj, arg) + device_object *dobj; + void *arg; +{ + irp *ip; + list_entry *l; + struct ndis_softc *sc = arg; + struct ndisusb_ep *ne; + struct ndisusb_task *nt; + union usbd_urb *urb; + + if (IsListEmpty(&sc->ndisusb_tasklist)) + return; + + KeAcquireSpinLockAtDpcLevel(&sc->ndisusb_tasklock); + l = sc->ndisusb_tasklist.nle_flink; + while (l != &sc->ndisusb_tasklist) { + nt = CONTAINING_RECORD(l, struct ndisusb_task, nt_tasklist); + + ip = nt->nt_ctx; + urb = usbd_geturb(ip); + + KeReleaseSpinLockFromDpcLevel(&sc->ndisusb_tasklock); + NDISUSB_LOCK(sc); + switch (nt->nt_type) { + case NDISUSB_TASK_TSTART: + ne = usbd_get_ndisep(ip, urb->uu_bulkintr.ubi_epdesc); + if (ne == NULL) + goto exit; + usb2_transfer_start(ne->ne_xfer[0]); + break; + case NDISUSB_TASK_IRPCANCEL: + ne = usbd_get_ndisep(ip, + (nt->nt_type == NDISUSB_TASK_IRPCANCEL) ? + urb->uu_bulkintr.ubi_epdesc : + urb->uu_pipe.upr_handle); + if (ne == NULL) + goto exit; + + usb2_transfer_stop(ne->ne_xfer[0]); + usb2_transfer_start(ne->ne_xfer[0]); + break; + default: + break; + } +exit: + NDISUSB_UNLOCK(sc); + KeAcquireSpinLockAtDpcLevel(&sc->ndisusb_tasklock); + + l = l->nle_flink; + RemoveEntryList(&nt->nt_tasklist); + free(nt, M_USBDEV); + } + KeReleaseSpinLockFromDpcLevel(&sc->ndisusb_tasklock); } static int32_t usbd_func_bulkintr(ip) irp *ip; { + int32_t error; struct ndisusb_ep *ne; struct ndisusb_xfer *nx; struct usbd_urb_bulk_or_intr_transfer *ubi; - uint8_t irql; union usbd_urb *urb; usb_endpoint_descriptor_t *ep; @@ -998,9 +1079,9 @@ usbd_func_bulkintr(ip) } nx->nx_ep = ne; nx->nx_priv = ip; - KeAcquireSpinLock(&ne->ne_lock, &irql); + KeAcquireSpinLockAtDpcLevel(&ne->ne_lock); InsertTailList((&ne->ne_pending), (&nx->nx_next)); - KeReleaseSpinLock(&ne->ne_lock, irql); + KeReleaseSpinLockFromDpcLevel(&ne->ne_lock); /* we've done to setup xfer. Let's transfer it. */ ip->irp_iostat.isb_status = STATUS_PENDING; @@ -1008,9 +1089,9 @@ usbd_func_bulkintr(ip) USBD_URB_STATUS(urb) = USBD_STATUS_PENDING; IoMarkIrpPending(ip); - KeRaiseIrql(DISPATCH_LEVEL, &irql); - usb2_transfer_start(ne->ne_xfer[0]); - KeLowerIrql(irql); + error = usbd_taskadd(ip, NDISUSB_TASK_TSTART); + if (error != USBD_STATUS_SUCCESS) + return (error); return (USBD_STATUS_PENDING); } Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Thu Mar 12 02:32:54 2009 (r189718) +++ head/sys/dev/if_ndis/if_ndis.c Thu Mar 12 02:51:55 2009 (r189719) @@ -557,8 +557,10 @@ ndis_attach(dev) mtx_init(&sc->ndis_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); KeInitializeSpinLock(&sc->ndis_rxlock); + KeInitializeSpinLock(&sc->ndisusb_tasklock); KeInitializeSpinLock(&sc->ndisusb_xferdonelock); InitializeListHead(&sc->ndis_shlist); + InitializeListHead(&sc->ndisusb_tasklist); InitializeListHead(&sc->ndisusb_xferdonelist); callout_init(&sc->ndis_stat_callout, CALLOUT_MPSAFE); @@ -625,6 +627,8 @@ ndis_attach(dev) sc->ndis_inputitem = IoAllocateWorkItem(sc->ndis_block->nmb_deviceobj); sc->ndisusb_xferdoneitem = IoAllocateWorkItem(sc->ndis_block->nmb_deviceobj); + sc->ndisusb_taskitem = + IoAllocateWorkItem(sc->ndis_block->nmb_deviceobj); KeInitializeDpc(&sc->ndis_rxdpc, ndis_rxeof_xfr_wrap, sc->ndis_block); /* Call driver's init routine. */ @@ -1066,6 +1070,8 @@ ndis_detach(dev) IoFreeWorkItem(sc->ndis_inputitem); if (sc->ndisusb_xferdoneitem != NULL) IoFreeWorkItem(sc->ndisusb_xferdoneitem); + if (sc->ndisusb_taskitem != NULL) + IoFreeWorkItem(sc->ndisusb_taskitem); bus_generic_detach(dev); ndis_unload_driver(sc); @@ -3236,8 +3242,10 @@ ndis_stop(sc) ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); NDIS_UNLOCK(sc); - if (!(sc->ndis_iftype == PNPBus && ndisusb_halt == 0) || - sc->ndisusb_status & NDISUSB_STATUS_DETACH) + if (sc->ndis_iftype != PNPBus || + (sc->ndis_iftype == PNPBus && + !(sc->ndisusb_status & NDISUSB_STATUS_DETACH) && + ndisusb_halt != 0)) ndis_halt_nic(sc); NDIS_LOCK(sc); Modified: head/sys/dev/if_ndis/if_ndis_usb.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis_usb.c Thu Mar 12 02:32:54 2009 (r189718) +++ head/sys/dev/if_ndis/if_ndis_usb.c Thu Mar 12 02:51:55 2009 (r189719) @@ -168,6 +168,7 @@ ndisusb_attach(device_t self) db = uaa->driver_info; sc = (struct ndis_softc *)dummy; sc->ndis_dev = self; + mtx_init(&sc->ndisusb_mtx, "NDIS USB", MTX_NETWORK_LOCK, MTX_DEF); sc->ndis_dobj = db->windrv_object; sc->ndis_regvals = db->windrv_regvals; sc->ndis_iftype = PNPBus; @@ -207,14 +208,17 @@ ndisusb_detach(device_t self) sc->ndisusb_status |= NDISUSB_STATUS_DETACH; + ndis_pnpevent_nic(self, NDIS_PNP_EVENT_SURPRISE_REMOVED); + for (i = 0; i < NDISUSB_ENDPT_MAX; i++) { ne = &sc->ndisusb_ep[i]; usb2_transfer_unsetup(ne->ne_xfer, 1); } - ndis_pnpevent_nic(self, NDIS_PNP_EVENT_SURPRISE_REMOVED); + (void)ndis_detach(self); - return ndis_detach(self); + mtx_destroy(&sc->ndisusb_mtx); + return (0); } static struct resource_list * Modified: head/sys/dev/if_ndis/if_ndisvar.h ============================================================================== --- head/sys/dev/if_ndis/if_ndisvar.h Thu Mar 12 02:32:54 2009 (r189718) +++ head/sys/dev/if_ndis/if_ndisvar.h Thu Mar 12 02:51:55 2009 (r189719) @@ -142,6 +142,14 @@ struct ndisusb_xferdone { list_entry nd_donelist; }; +struct ndisusb_task { + unsigned nt_type; +#define NDISUSB_TASK_TSTART 0 +#define NDISUSB_TASK_IRPCANCEL 1 + void *nt_ctx; + list_entry nt_tasklist; +}; + struct ndis_softc { struct ifnet *ifp; struct ifmedia ifmedia; /* media info */ @@ -220,6 +228,7 @@ struct ndis_softc { int ndis_hang_timer; struct usb2_device *ndisusb_dev; + struct mtx ndisusb_mtx; #define NDISUSB_GET_ENDPT(addr) \ ((UE_GET_DIR(addr) >> 7) | (UE_GET_ADDR(addr) << 1)) #define NDISUSB_ENDPT_MAX ((UE_ADDR + 1) * 2) @@ -227,6 +236,9 @@ struct ndis_softc { io_workitem *ndisusb_xferdoneitem; list_entry ndisusb_xferdonelist; kspin_lock ndisusb_xferdonelock; + io_workitem *ndisusb_taskitem; + list_entry ndisusb_tasklist; + kspin_lock ndisusb_tasklock; int ndisusb_status; #define NDISUSB_STATUS_DETACH 0x1 }; @@ -234,3 +246,7 @@ struct ndis_softc { #define NDIS_LOCK(_sc) mtx_lock(&(_sc)->ndis_mtx) #define NDIS_UNLOCK(_sc) mtx_unlock(&(_sc)->ndis_mtx) #define NDIS_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->ndis_mtx, t) +#define NDISUSB_LOCK(_sc) mtx_lock(&(_sc)->ndisusb_mtx) +#define NDISUSB_UNLOCK(_sc) mtx_unlock(&(_sc)->ndisusb_mtx) +#define NDISUSB_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->ndisusb_mtx, t) + From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 03:19:20 2009 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 0A2841065679; Thu, 12 Mar 2009 03:19:20 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id CDBC18FC1A; Thu, 12 Mar 2009 03:19:19 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 4C9F32ED8B7; Wed, 11 Mar 2009 23:19:19 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 11 Mar 2009 23:19:19 -0400 X-Sasl-enc: /qWqf4iac/2grbjgoYQ8z9k/H1ZHisfDDoX1vy9g4w5E 1236827958 Received: from anglepoise.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 71BDD50B6B; Wed, 11 Mar 2009 23:19:18 -0400 (EDT) Message-ID: <49B87F34.2050905@incunabulum.net> Date: Thu, 12 Mar 2009 03:19:16 +0000 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.19 (X11/20090125) MIME-Version: 1.0 To: John Baldwin References: <200903112148.n2BLmaQJ007484@svn.freebsd.org> <200903111756.12301.jhb@freebsd.org> In-Reply-To: <200903111756.12301.jhb@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: r189707 - in head: sys/kern sys/sys usr.bin/kdump usr.bin/ktrace 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 Mar 2009 03:19:20 -0000 John Baldwin wrote: >> Log: >> Add a new type of KTRACE record for sysctl(3) invocations. It uses the >> internal sysctl_sysctl_name() handler to map the MIB array to a string >> name and logs this name in the trace log. This can be useful to see >> exactly which sysctls a thread is invoking. >> This is really cool! From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 04:44:10 2009 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 23BC6106564A; Thu, 12 Mar 2009 04:44:10 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11B8B8FC13; Thu, 12 Mar 2009 04:44:10 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C4i9i4017080; Thu, 12 Mar 2009 04:44:09 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C4i9pe017079; Thu, 12 Mar 2009 04:44:09 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <200903120444.n2C4i9pe017079@svn.freebsd.org> From: "David E. O'Brien" Date: Thu, 12 Mar 2009 04:44: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: r189721 - head/lib/libelf 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 Mar 2009 04:44:10 -0000 Author: obrien Date: Thu Mar 12 04:44:09 2009 New Revision: 189721 URL: http://svn.freebsd.org/changeset/base/189721 Log: Don't need to set symbol, default value is OK. Modified: head/lib/libelf/Makefile Modified: head/lib/libelf/Makefile ============================================================================== --- head/lib/libelf/Makefile Thu Mar 12 03:09:11 2009 (r189720) +++ head/lib/libelf/Makefile Thu Mar 12 04:44:09 2009 (r189721) @@ -148,7 +148,7 @@ VERSION_MAP= ${.CURDIR}/Version.map LIBELF_TEST_HOOKS?= 1 .if defined(LIBELF_TEST_HOOKS) && (${LIBELF_TEST_HOOKS} > 0) -CFLAGS+= -DLIBELF_TEST_HOOKS=1 +CFLAGS+= -DLIBELF_TEST_HOOKS .endif libelf_convert.c: elf_types.m4 libelf_convert.m4 From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 06:25:31 2009 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 EFDD7106573B; Thu, 12 Mar 2009 06:25:30 +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 DCDC98FC1A; Thu, 12 Mar 2009 06:25:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C6PUrg019168; Thu, 12 Mar 2009 06:25:30 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C6PUHP019167; Thu, 12 Mar 2009 06:25:30 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903120625.n2C6PUHP019167@svn.freebsd.org> From: Warner Losh Date: Thu, 12 Mar 2009 06:25: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: r189723 - head/sys/dev/pccbb 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 Mar 2009 06:25:33 -0000 Author: imp Date: Thu Mar 12 06:25:30 2009 New Revision: 189723 URL: http://svn.freebsd.org/changeset/base/189723 Log: Better name for this routine... it doesn't reset the card, but resets the power to the card... Modified: head/sys/dev/pccbb/pccbb.c Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Thu Mar 12 06:24:00 2009 (r189722) +++ head/sys/dev/pccbb/pccbb.c Thu Mar 12 06:25:30 2009 (r189723) @@ -158,7 +158,7 @@ SYSCTL_ULONG(_hw_cbb, OID_AUTO, debug, C static void cbb_insert(struct cbb_softc *sc); static void cbb_removal(struct cbb_softc *sc); static uint32_t cbb_detect_voltage(device_t brdev); -static void cbb_cardbus_reset(device_t brdev, device_t child, int on); +static void cbb_cardbus_reset_power(device_t brdev, device_t child, int on); static int cbb_cardbus_io_open(device_t brdev, int win, uint32_t start, uint32_t end); static int cbb_cardbus_mem_open(device_t brdev, int win, @@ -943,7 +943,7 @@ cbb_do_power(device_t brdev) /************************************************************************/ static void -cbb_cardbus_reset(device_t brdev, device_t child, int on) +cbb_cardbus_reset_power(device_t brdev, device_t child, int on) { struct cbb_softc *sc = device_get_softc(brdev); uint32_t b; @@ -1003,7 +1003,7 @@ cbb_cardbus_power_enable_socket(device_t err = cbb_do_power(brdev); if (err) return (err); - cbb_cardbus_reset(brdev, child, 1); + cbb_cardbus_reset_power(brdev, child, 1); return (0); } @@ -1011,7 +1011,7 @@ static int cbb_cardbus_power_disable_socket(device_t brdev, device_t child) { cbb_power(brdev, CARD_OFF); - cbb_cardbus_reset(brdev, child, 0); + cbb_cardbus_reset_power(brdev, child, 0); return (0); } From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 06:30:59 2009 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 DDA991065678; Thu, 12 Mar 2009 06:30:59 +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 CCCA58FC23; Thu, 12 Mar 2009 06:30:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C6UxBH019298; Thu, 12 Mar 2009 06:30:59 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C6UxT8019297; Thu, 12 Mar 2009 06:30:59 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903120630.n2C6UxT8019297@svn.freebsd.org> From: Warner Losh Date: Thu, 12 Mar 2009 06:30: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: r189724 - head/sys/dev/ata 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 Mar 2009 06:31:00 -0000 Author: imp Date: Thu Mar 12 06:30:59 2009 New Revision: 189724 URL: http://svn.freebsd.org/changeset/base/189724 Log: Check the Disk FUNCE recorded in the CIS to see if we should probe for both disks, or if we should suppress the slave drive. Default to suppressing the slave, in the case that this REQIURED tuple turns out to not actually be present... Modified: head/sys/dev/ata/ata-card.c Modified: head/sys/dev/ata/ata-card.c ============================================================================== --- head/sys/dev/ata/ata-card.c Thu Mar 12 06:25:30 2009 (r189723) +++ head/sys/dev/ata/ata-card.c Thu Mar 12 06:30:59 2009 (r189724) @@ -90,6 +90,7 @@ ata_pccard_attach(device_t dev) struct ata_channel *ch = device_get_softc(dev); struct resource *io, *ctlio; int i, rid, err; + uint16_t funce; if (ch->attached) return (0); @@ -132,7 +133,11 @@ ata_pccard_attach(device_t dev) /* initialize softc for this channel */ ch->unit = 0; - ch->flags |= (ATA_USE_16BIT | ATA_NO_SLAVE); + ch->flags |= ATA_USE_16BIT; + funce = 0; /* Default to sane setting of FUNCE */ + pccard_get_funce_disk(dev, &funce); + if (!(funce & PFD_I_D)) + ch-> flags |= ATA_NO_SLAVE; ata_generic_hw(dev); err = ata_probe(dev); if (err) From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 06:32:31 2009 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 0544710656DF; Thu, 12 Mar 2009 06:32:31 +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 E86008FC2E; Thu, 12 Mar 2009 06:32:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C6WU7q019363; Thu, 12 Mar 2009 06:32:30 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C6WUSS019362; Thu, 12 Mar 2009 06:32:30 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903120632.n2C6WUSS019362@svn.freebsd.org> From: Warner Losh Date: Thu, 12 Mar 2009 06:32: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: r189725 - head/sys/dev/ppbus 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 Mar 2009 06:32:31 -0000 Author: imp Date: Thu Mar 12 06:32:30 2009 New Revision: 189725 URL: http://svn.freebsd.org/changeset/base/189725 Log: Make the bit-bang callbacks for i2c implementation match their prototypes. Modified: head/sys/dev/ppbus/lpbb.c Modified: head/sys/dev/ppbus/lpbb.c ============================================================================== --- head/sys/dev/ppbus/lpbb.c Thu Mar 12 06:30:59 2009 (r189724) +++ head/sys/dev/ppbus/lpbb.c Thu Mar 12 06:32:30 2009 (r189725) @@ -93,7 +93,7 @@ lpbb_attach(device_t dev) } static int -lpbb_callback(device_t dev, int index, caddr_t *data) +lpbb_callback(device_t dev, int index, caddr_t data) { device_t ppbus = device_get_parent(dev); int error = 0; @@ -165,7 +165,7 @@ lpbb_getsda(device_t dev) } static void -lpbb_setsda(device_t dev, char val) +lpbb_setsda(device_t dev, int val) { device_t ppbus = device_get_parent(dev); @@ -178,7 +178,7 @@ lpbb_setsda(device_t dev, char val) } static void -lpbb_setscl(device_t dev, unsigned char val) +lpbb_setscl(device_t dev, int val) { device_t ppbus = device_get_parent(dev); From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 06:35:01 2009 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 11BD0106564A; Thu, 12 Mar 2009 06:35:01 +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 009D88FC1D; Thu, 12 Mar 2009 06:35:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C6Z0TH019474; Thu, 12 Mar 2009 06:35:00 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C6Z0FA019473; Thu, 12 Mar 2009 06:35:00 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903120635.n2C6Z0FA019473@svn.freebsd.org> From: Warner Losh Date: Thu, 12 Mar 2009 06:35: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: r189726 - head/sys/dev/ed 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 Mar 2009 06:35:01 -0000 Author: imp Date: Thu Mar 12 06:35:00 2009 New Revision: 189726 URL: http://svn.freebsd.org/changeset/base/189726 Log: o writereg needs to return a vlue. o Add TJ PTJ-LAN_T card. Some more work may be needed to make this actually function correctly. Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Thu Mar 12 06:32:30 2009 (r189725) +++ head/sys/dev/ed/if_ed_pccard.c Thu Mar 12 06:35:00 2009 (r189726) @@ -222,6 +222,7 @@ static const struct ed_product { { PCMCIA_CARD(TDK, DFL5610WS), 0}, { PCMCIA_CARD(TELECOMDEVICE, LM5LT), 0 }, { PCMCIA_CARD(TELECOMDEVICE, TCD_HPC100), NE2000DVF_AX88X90}, + { PCMCIA_CARD(TJ, PTJ_LAN_T), 0 }, { PCMCIA_CARD(ZONET, ZEN), 0}, { { NULL } } }; @@ -1017,7 +1018,7 @@ ed_miibus_readreg(device_t dev, int phy, return (failed ? 0 : val); } -static void +static int ed_miibus_writereg(device_t dev, int phy, int reg, int data) { struct ed_softc *sc; @@ -1028,7 +1029,7 @@ ed_miibus_writereg(device_t dev, int phy * 0x11 through 0x1f. */ if (phy >= 0x11) - return; + return (0); sc = device_get_softc(dev); (*sc->mii_writebits)(sc, 0xffffffff, 32); @@ -1039,6 +1040,7 @@ ed_miibus_writereg(device_t dev, int phy (*sc->mii_writebits)(sc, ED_MII_TURNAROUND, ED_MII_TURNAROUND_BITS); (*sc->mii_writebits)(sc, data, ED_MII_DATA_BITS); (*sc->mii_writebits)(sc, ED_MII_IDLE, ED_MII_IDLE_BITS); + return (0); } static int From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 06:36:44 2009 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 BF88E106564A; Thu, 12 Mar 2009 06:36:44 +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 AECBD8FC1A; Thu, 12 Mar 2009 06:36:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C6aito019546; Thu, 12 Mar 2009 06:36:44 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C6aiuB019545; Thu, 12 Mar 2009 06:36:44 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903120636.n2C6aiuB019545@svn.freebsd.org> From: Warner Losh Date: Thu, 12 Mar 2009 06:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189727 - head/sys/dev/mmc 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 Mar 2009 06:36:45 -0000 Author: imp Date: Thu Mar 12 06:36:44 2009 New Revision: 189727 URL: http://svn.freebsd.org/changeset/base/189727 Log: read_ivar takes a uintptr_t * not a u_char *. Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Thu Mar 12 06:35:00 2009 (r189726) +++ head/sys/dev/mmc/mmc.c Thu Mar 12 06:36:44 2009 (r189727) @@ -1437,7 +1437,7 @@ mmc_scan(struct mmc_softc *sc) } static int -mmc_read_ivar(device_t bus, device_t child, int which, u_char *result) +mmc_read_ivar(device_t bus, device_t child, int which, uintptr_t *result) { struct mmc_ivars *ivar = device_get_ivars(child); From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 07:01:32 2009 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 E6427106567D; Thu, 12 Mar 2009 07:01:32 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 81BB28FC1E; Thu, 12 Mar 2009 07:01:32 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n2C6wUw7071012; Thu, 12 Mar 2009 00:58:31 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 12 Mar 2009 00:58:54 -0600 (MDT) Message-Id: <20090312.005854.-1827346875.imp@bsdimp.com> To: sgk@troutmask.apl.washington.edu From: "M. Warner Losh" In-Reply-To: <20090310021926.GA51405@troutmask.apl.washington.edu> References: <20090309222705.GA49870@troutmask.apl.washington.edu> <20090310013810.GC22633@lonesome.com> <20090310021926.GA51405@troutmask.apl.washington.edu> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, stas@FreeBSD.org, thompsa@FreeBSD.org, svn-src-head@FreeBSD.org, linimon@lonesome.com Subject: Re: svn commit: r189594 - 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: Thu, 12 Mar 2009 07:01:34 -0000 In message: <20090310021926.GA51405@troutmask.apl.washington.edu> Steve Kargl writes: : On Mon, Mar 09, 2009 at 08:38:10PM -0500, Mark Linimon wrote: : > : > As mlaier has pointed out, -current has sharp edges. It's one of : > 3 choices open to you, the other two being -stable (which will still : > have ports regressions from time to time -- see xorg -- and sometimes : > even src regressions), and a release, which is the best we can do with : > respect to QA. If you can't deal with having your system out of : > commission on occasion, then -current isn't for you. : > : : Oh Please! : : I've run -current since it was called 386bsd+patchkit. I've : lived through the gcc 2.6.3 to gcc 3.x transition, the replacement : of devfs by phk with a new improved devfs, the problems with : libm and the changes to stdio.h among many others. The facts : remain that the USB2 transistion was poorly executed. Contrast USB2 : with Ed's new TTY layer. Ed gave a month or more headsup that a : new TTY layer was coming. He enumerated the drivers that were broken : and actively solicited people with the affected hardware for help. : He furthermore helped those people fix as many driver as possible : before committing the new TTY layer. As part of portmngr, you : know Ed also actively fixed many ports broken by the new TTY layer : and/or helped others fix the ports before the new layer became : standard. The fact that USB2 broke such a fundamentally important : port as Xorg suggests a lack of testing and planning by those who : rushed the USB2 transition. : : If you and others take off your rose colored glasses, you'll see : that the USB2 transition could have been handled better. Hopefully, : you're willing to learn from your mistakes. I don't think anybody thinks the usb2 transition was a paragon of virtue. However, it was handled better than many others. The usb2 stuff has been in transition into the tree for much longer than the tty later, and was, frankly, a much bigger change. I think that it was handled well enough, all things considered. The biggest problem with the usb2 transition is that nobody had the time to drive it into the tree. There was no one person that volunteered to do all the steps. We had several different volunteers do good work to make it happen, but there wasn't a single point of contact for it. Rather than complain about it, you should view future transitions as an opportunity to help out more... Warner From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 07:04:29 2009 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 5C1051065688; Thu, 12 Mar 2009 07:04:29 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 01B428FC14; Thu, 12 Mar 2009 07:04:28 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n2C733Vv071072; Thu, 12 Mar 2009 01:03:04 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 12 Mar 2009 01:03:28 -0600 (MDT) Message-Id: <20090312.010328.-1666181653.imp@bsdimp.com> To: jhb@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <200903100904.38679.jhb@freebsd.org> References: <200903101210.n2ACApQ0061838@svn.freebsd.org> <200903100904.38679.jhb@freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189619 - head/sys/dev/cardbus 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 Mar 2009 07:04:29 -0000 In message: <200903100904.38679.jhb@freebsd.org> John Baldwin writes: : It might be best to do this before releasing the resources rather than : afterwards. It certainly does no harm to move them, and I will do so. However, what problems do you see with doing it in the current order? I can't think of anything bad that could happen, but my imagination has been a bit poor lately... Warner From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 07:18:28 2009 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 4BD3B1065670; Thu, 12 Mar 2009 07:18:28 +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 04B758FC1F; Thu, 12 Mar 2009 07:18:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C7IRac020382; Thu, 12 Mar 2009 07:18:27 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C7IRsR020381; Thu, 12 Mar 2009 07:18:27 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903120718.n2C7IRsR020381@svn.freebsd.org> From: Warner Losh Date: Thu, 12 Mar 2009 07:18: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: r189728 - head/sys/dev/fe 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 Mar 2009 07:18:28 -0000 Author: imp Date: Thu Mar 12 07:18:27 2009 New Revision: 189728 URL: http://svn.freebsd.org/changeset/base/189728 Log: Fix the whitespace in this file to be consistent with itself and with the rest of the project's files. s/sn_/fe_/ in a routine name that I copied from sn. Modified: head/sys/dev/fe/if_fe_pccard.c Modified: head/sys/dev/fe/if_fe_pccard.c ============================================================================== --- head/sys/dev/fe/if_fe_pccard.c Thu Mar 12 06:36:44 2009 (r189727) +++ head/sys/dev/fe/if_fe_pccard.c Thu Mar 12 07:18:27 2009 (r189728) @@ -60,7 +60,7 @@ static int fe_pccard_attach(device_t); static int fe_pccard_detach(device_t); static const struct fe_pccard_product { - struct pccard_product mpp_product; + struct pccard_product mpp_product; int mpp_flags; #define MPP_MBH10302 1 #define MPP_ANYFUNC 2 @@ -72,19 +72,19 @@ static const struct fe_pccard_product { { PCMCIA_CARD(FUJITSU2, FMV_J182A), 0 }, { PCMCIA_CARD(FUJITSU2, ITCFJ182A), 0 }, /* These need to be second */ - { PCMCIA_CARD(TDK, LAK_CD021BX), 0 }, - { PCMCIA_CARD(TDK, LAK_CF010), 0 }, + { PCMCIA_CARD(TDK, LAK_CD021BX), 0 }, + { PCMCIA_CARD(TDK, LAK_CF010), 0 }, #if 0 /* XXX 86960-based? */ - { PCMCIA_CARD(TDK, LAK_DFL9610), 0 }, + { PCMCIA_CARD(TDK, LAK_DFL9610), 0 }, #endif - { PCMCIA_CARD(CONTEC, CNETPC), 0 }, + { PCMCIA_CARD(CONTEC, CNETPC), 0 }, { PCMCIA_CARD(FUJITSU, LA501), 0 }, { PCMCIA_CARD(FUJITSU, LA10S), 0 }, { PCMCIA_CARD(FUJITSU, NE200T), MPP_MBH10302 },/* Sold by Eagle */ { PCMCIA_CARD(HITACHI, HT_4840), MPP_MBH10302 | MPP_SKIP_TO_CFE_10}, { PCMCIA_CARD(RATOC, REX_R280), 0 }, { PCMCIA_CARD(XIRCOM, CE), MPP_ANYFUNC }, - { { NULL } } + { { NULL } } }; static int @@ -92,12 +92,12 @@ fe_pccard_probe(device_t dev) { int error; uint32_t fcn = PCCARD_FUNCTION_UNSPEC; - const struct fe_pccard_product *pp; + const struct fe_pccard_product *pp; int i; - if ((pp = (const struct fe_pccard_product *)pccard_product_lookup(dev, - (const struct pccard_product *)fe_pccard_products, - sizeof(fe_pccard_products[0]), NULL)) != NULL) { + if ((pp = (const struct fe_pccard_product *)pccard_product_lookup(dev, + (const struct pccard_product *)fe_pccard_products, + sizeof(fe_pccard_products[0]), NULL)) != NULL) { if (pp->mpp_product.pp_name != NULL) device_set_desc(dev, pp->mpp_product.pp_name); if (pp->mpp_flags & MPP_ANYFUNC) @@ -119,15 +119,15 @@ fe_pccard_probe(device_t dev) } good:; return (0); - } - return (ENXIO); + } + return (ENXIO); } static device_method_t fe_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, fe_pccard_probe), - DEVMETHOD(device_attach, fe_pccard_attach), - DEVMETHOD(device_detach, fe_pccard_detach), + /* Device interface */ + DEVMETHOD(device_probe, fe_pccard_probe), + DEVMETHOD(device_attach, fe_pccard_attach), + DEVMETHOD(device_detach, fe_pccard_detach), { 0, 0 } }; @@ -143,23 +143,21 @@ MODULE_DEPEND(fe, pccard, 1, 1, 1); static int fe_probe_mbh(device_t, const struct fe_pccard_product *); static int fe_probe_tdk(device_t, const struct fe_pccard_product *); -/* - * Initialize the device - called from Slot manager. - */ + static int fe_pccard_attach(device_t dev) { struct fe_softc *sc; - const struct fe_pccard_product *pp; + const struct fe_pccard_product *pp; int error; /* Prepare for the device probe process. */ sc = device_get_softc(dev); sc->sc_unit = device_get_unit(dev); - pp = (const struct fe_pccard_product *) pccard_product_lookup(dev, + pp = (const struct fe_pccard_product *) pccard_product_lookup(dev, (const struct pccard_product *)fe_pccard_products, - sizeof(fe_pccard_products[0]), NULL); + sizeof(fe_pccard_products[0]), NULL); if (pp == NULL) return (ENXIO); @@ -269,7 +267,7 @@ fe_probe_mbh(device_t dev, const struct } static int -sn_pccard_xircom_mac(const struct pccard_tuple *tuple, void *argp) +fe_pccard_xircom_mac(const struct pccard_tuple *tuple, void *argp) { uint8_t *enaddr = argp; int i; @@ -317,41 +315,41 @@ fe_probe_tdk (device_t dev, const struct { struct fe_softc *sc = device_get_softc(dev); - static struct fe_simple_probe_struct probe_table [] = { - { FE_DLCR2, 0x10, 0x00 }, - { FE_DLCR4, 0x08, 0x00 }, - /* { FE_DLCR5, 0x80, 0x00 }, Does not work well. */ - { 0 } - }; + static struct fe_simple_probe_struct probe_table [] = { + { FE_DLCR2, 0x10, 0x00 }, + { FE_DLCR4, 0x08, 0x00 }, +/* { FE_DLCR5, 0x80, 0x00 }, Does not work well. */ + { 0 } + }; - /* C-NET(PC)C occupies 16 I/O addresses. */ + /* C-NET(PC)C occupies 16 I/O addresses. */ if (fe_alloc_port(dev, 16)) return ENXIO; /* Fill the softc struct with default values. */ fe_softc_defaults(sc); - /* - * See if C-NET(PC)C is on its address. - */ - if (!fe_simple_probe(sc, probe_table)) + /* + * See if C-NET(PC)C is on its address. + */ + if (!fe_simple_probe(sc, probe_table)) return ENXIO; - /* Determine the card type. */ + /* Determine the card type. */ sc->type = FE_TYPE_TDK; - sc->typestr = "Generic MB8696x/78Q837x Ethernet (PCMCIA)"; + sc->typestr = "Generic MB8696x/78Q837x Ethernet (PCMCIA)"; pccard_get_ether(dev, sc->enaddr); - /* Make sure we got a valid station address. */ - if (!fe_valid_Ether_p(sc->enaddr, 0)) { - pccard_cis_scan(dev, sn_pccard_xircom_mac, sc->enaddr); + /* Make sure we got a valid station address. */ + if (!fe_valid_Ether_p(sc->enaddr, 0)) { + pccard_cis_scan(dev, fe_pccard_xircom_mac, sc->enaddr); } - /* Make sure we got a valid station address. */ - if (!fe_valid_Ether_p(sc->enaddr, 0)) + /* Make sure we got a valid station address. */ + if (!fe_valid_Ether_p(sc->enaddr, 0)) return ENXIO; - return 0; + return 0; } From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 08:42:28 2009 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 8B4FB1065707; Thu, 12 Mar 2009 08:42:28 +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 798638FC0A; Thu, 12 Mar 2009 08:42:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C8gSrN023729; Thu, 12 Mar 2009 08:42:28 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C8gSsn023728; Thu, 12 Mar 2009 08:42:28 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903120842.n2C8gSsn023728@svn.freebsd.org> From: Warner Losh Date: Thu, 12 Mar 2009 08:42: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: r189731 - head/sys/dev/cardbus 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 Mar 2009 08:42:30 -0000 Author: imp Date: Thu Mar 12 08:42:27 2009 New Revision: 189731 URL: http://svn.freebsd.org/changeset/base/189731 Log: Move the deactivation of the device's BAR to before the loop where we turn deactivate the resources. While this likely doesn't matter, it is likely to be safer. Modified: head/sys/dev/cardbus/cardbus.c Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Thu Mar 12 08:27:54 2009 (r189730) +++ head/sys/dev/cardbus/cardbus.c Thu Mar 12 08:42:27 2009 (r189731) @@ -289,6 +289,11 @@ cardbus_release_all_resources(device_t c struct resource_list_entry *rle; device_t dev; + /* Turn off access to resources we're about to free */ + dev = dinfo->pci.cfg.dev; + pci_write_config(dev, PCIR_COMMAND, + pci_read_config(dev, PCIR_COMMAND, 2) & + ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2); /* Free all allocated resources */ STAILQ_FOREACH(rle, &dinfo->pci.resources, link) { if (rle->res) { @@ -298,11 +303,6 @@ cardbus_release_all_resources(device_t c } } resource_list_free(&dinfo->pci.resources); - /* turn off the card's decoding now that the resources are done */ - dev = dinfo->pci.cfg.dev; - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & - ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2); } /************************************************************************/ From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 08:47:32 2009 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 18153106564A; Thu, 12 Mar 2009 08:47:32 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.230]) by mx1.freebsd.org (Postfix) with ESMTP id C15678FC08; Thu, 12 Mar 2009 08:47:31 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by rv-out-0506.google.com with SMTP id g9so3875936rvb.3 for ; Thu, 12 Mar 2009 01:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=xHhGwwA0GAZHYH1UHfOzn121Ud84gaWP/7vHN4H/JUM=; b=szTHlXt1BQAToiS7NiABkcF0wBARU8y1OyRolZrSGEwilo0WXaTC3yBYry4D0sT+4I Quw0G1gHkY6rRxEVK7nT16GLPfxVaTMX2I+Cx2cVS2CS68lWRlNdIHuCkfpHmyz6AsvW E/ZgG52dLe+eT+lOF9hpTHT5ZNnZ0L/VIzOkg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=EbegibGpjqur+2hs14E+XJYk/MUKCLInjXHqcN9UFoCuwJXmja7piS3CqtHxqtjlR5 Jp381DHIV3yqFVFC2SuJQ+l3k6ibyIAATuv3Pi8N0Fpqr1m0zTAboEMIdA9J29cctQt7 O+lHQHgEUg9Y57dW5UfMvOuDCvrIMa1B5Agkc= Received: by 10.141.142.1 with SMTP id u1mr4904520rvn.93.1236847651342; Thu, 12 Mar 2009 01:47:31 -0700 (PDT) Received: from michelle.cdnetworks.co.kr ([114.111.62.249]) by mx.google.com with ESMTPS id k37sm18167627rvb.1.2009.03.12.01.47.28 (version=SSLv3 cipher=RC4-MD5); Thu, 12 Mar 2009 01:47:30 -0700 (PDT) Received: by michelle.cdnetworks.co.kr (sSMTP sendmail emulation); Thu, 12 Mar 2009 17:46:20 +0900 From: Pyun YongHyeon Date: Thu, 12 Mar 2009 17:46:20 +0900 To: Remko Lodder Message-ID: <20090312084620.GE13527@michelle.cdnetworks.co.kr> References: <200903120114.n2C1Elfx012323@svn.freebsd.org> <6342e028ecd95fd18f4269ff27fc401d.squirrel@galain.elvandar.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6342e028ecd95fd18f4269ff27fc401d.squirrel@galain.elvandar.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pyun YongHyeon Subject: Re: svn commit: r189714 - head/sys/dev/txp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com 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 Mar 2009 08:47:32 -0000 On Thu, Mar 12, 2009 at 09:36:20AM +0100, Remko Lodder wrote: > > On Thu, March 12, 2009 2:14 am, Pyun YongHyeon wrote: > > Author: yongari > > Date: Thu Mar 12 01:14:47 2009 > > New Revision: 189714 > > URL: http://svn.freebsd.org/changeset/base/189714 > > > > Log: > > bus_dma(9) conversion and make txp(4) work on all architectures. > > Hey Pyun, > > This is great work! Thanks a lot for that! > No problem. It's my pleasure to see one more driver that can run on sparc64. From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 09:00:05 2009 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 31C411065672; Thu, 12 Mar 2009 09:00:05 +0000 (UTC) (envelope-from remko@elvandar.org) Received: from websrv01.jr-hosting.nl (websrv01.jr-hosting.nl [78.47.69.233]) by mx1.freebsd.org (Postfix) with ESMTP id DA10B8FC20; Thu, 12 Mar 2009 09:00:04 +0000 (UTC) (envelope-from remko@elvandar.org) Received: from localhost ([127.0.0.1] helo=galain.elvandar.org) by websrv01.jr-hosting.nl with esmtpa (Exim 4.69 (FreeBSD)) (envelope-from ) id 1LhgOq-000BAf-4J; Thu, 12 Mar 2009 09:36:20 +0100 Received: from 145.7.91.133 (SquirrelMail authenticated user remko) by galain.elvandar.org with HTTP; Thu, 12 Mar 2009 09:36:20 +0100 (CET) Message-ID: <6342e028ecd95fd18f4269ff27fc401d.squirrel@galain.elvandar.org> In-Reply-To: <200903120114.n2C1Elfx012323@svn.freebsd.org> References: <200903120114.n2C1Elfx012323@svn.freebsd.org> Date: Thu, 12 Mar 2009 09:36:20 +0100 (CET) From: "Remko Lodder" To: "Pyun YongHyeon" User-Agent: SquirrelMail/1.4.17 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189714 - head/sys/dev/txp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: remko@elvandar.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 Mar 2009 09:00:05 -0000 On Thu, March 12, 2009 2:14 am, Pyun YongHyeon wrote: > Author: yongari > Date: Thu Mar 12 01:14:47 2009 > New Revision: 189714 > URL: http://svn.freebsd.org/changeset/base/189714 > > Log: > bus_dma(9) conversion and make txp(4) work on all architectures. Hey Pyun, This is great work! Thanks a lot for that! -- /"\ Best regards, | remko@FreeBSD.org \ / Remko Lodder | remko@EFnet X http://www.evilcoder.org/ | / \ ASCII Ribbon Campaign | Against HTML Mail and News From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 09:52:43 2009 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 51E4E106566B; Thu, 12 Mar 2009 09:52:43 +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 403C78FC15; Thu, 12 Mar 2009 09:52:43 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2C9qhao025182; Thu, 12 Mar 2009 09:52:43 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2C9qhvX025181; Thu, 12 Mar 2009 09:52:43 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200903120952.n2C9qhvX025181@svn.freebsd.org> From: Christian Brueffer Date: Thu, 12 Mar 2009 09:52: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: r189732 - head/release/doc/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: Thu, 12 Mar 2009 09:52:44 -0000 Author: brueffer Date: Thu Mar 12 09:52:42 2009 New Revision: 189732 URL: http://svn.freebsd.org/changeset/base/189732 Log: txp(4) should work on all architectures now. Modified: head/release/doc/share/misc/dev.archlist.txt Modified: head/release/doc/share/misc/dev.archlist.txt ============================================================================== --- head/release/doc/share/misc/dev.archlist.txt Thu Mar 12 08:42:27 2009 (r189731) +++ head/release/doc/share/misc/dev.archlist.txt Thu Mar 12 09:52:42 2009 (r189732) @@ -149,7 +149,6 @@ tl i386,pc98,amd64 trm i386,amd64 twa i386,amd64 twe i386,amd64 -txp i386,pc98,ia64,amd64 ubsa i386,pc98,amd64 ubsec i386,pc98,amd64 ubser i386,pc98,amd64 From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 10:34:17 2009 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 319F4106564A; Thu, 12 Mar 2009 10:34:17 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2018E8FC0A; Thu, 12 Mar 2009 10:34:17 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CAYH0L028117; Thu, 12 Mar 2009 10:34:17 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CAYHSK028116; Thu, 12 Mar 2009 10:34:17 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903121034.n2CAYHSK028116@svn.freebsd.org> From: Bruce M Simpson Date: Thu, 12 Mar 2009 10:34: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: r189735 - 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: Thu, 12 Mar 2009 10:34:17 -0000 Author: bms Date: Thu Mar 12 10:34:16 2009 New Revision: 189735 URL: http://svn.freebsd.org/changeset/base/189735 Log: Make semaphore debugging output more useful. PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545 MFC after: 5 days Submitted by: Philip Semanchuk Modified: head/sys/kern/uipc_sem.c Modified: head/sys/kern/uipc_sem.c ============================================================================== --- head/sys/kern/uipc_sem.c Thu Mar 12 09:56:15 2009 (r189734) +++ head/sys/kern/uipc_sem.c Thu Mar 12 10:34:16 2009 (r189735) @@ -548,6 +548,8 @@ int ksem_open(struct thread *td, struct ksem_open_args *uap) { + DP((">>> ksem_open start, pid=%d\n", (int)td->td_proc->p_pid)); + if ((uap->oflag & ~(O_CREAT | O_EXCL)) != 0) return (EINVAL); return (ksem_create(td, uap->name, uap->idp, uap->mode, uap->value, @@ -708,12 +710,14 @@ kern_sem_wait(struct thread *td, semid_t struct ksem *ks; int error; - DP((">>> kern_sem_wait entered!\n")); + DP((">>> kern_sem_wait entered! pid=%d\n", (int)td->td_proc->p_pid)); error = ksem_get(td, id, &fp); if (error) return (error); ks = fp->f_data; mtx_lock(&sem_lock); + DP((">>> kern_sem_wait critical section entered! pid=%d\n", + (int)td->td_proc->p_pid)); #ifdef MAC error = mac_posixsem_check_wait(td->td_ucred, fp->f_cred, ks); if (error) { @@ -750,11 +754,13 @@ kern_sem_wait(struct thread *td, semid_t goto err; } ks->ks_value--; + DP(("kern_sem_wait value post-decrement = %d\n", ks->ks_value)); error = 0; err: mtx_unlock(&sem_lock); fdrop(fp, td); - DP(("<<< kern_sem_wait leaving, error = %d\n", error)); + DP(("<<< kern_sem_wait leaving, pid=%d, error = %d\n", + (int)td->td_proc->p_pid, error)); return (error); } From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 10:36:39 2009 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 C7489106566B; Thu, 12 Mar 2009 10:36:39 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B56628FC12; Thu, 12 Mar 2009 10:36:39 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CAadjs028199; Thu, 12 Mar 2009 10:36:39 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CAadQA028198; Thu, 12 Mar 2009 10:36:39 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903121036.n2CAadQA028198@svn.freebsd.org> From: Bruce M Simpson Date: Thu, 12 Mar 2009 10:36: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: r189736 - 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: Thu, 12 Mar 2009 10:36:40 -0000 Author: bms Date: Thu Mar 12 10:36:39 2009 New Revision: 189736 URL: http://svn.freebsd.org/changeset/base/189736 Log: Ensure that the semaphore value is re-checked after sem_lock is re-acquired, after the condition variable is signalled. PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545 MFC after: 5 days Reviewed by: attilio Modified: head/sys/kern/uipc_sem.c Modified: head/sys/kern/uipc_sem.c ============================================================================== --- head/sys/kern/uipc_sem.c Thu Mar 12 10:34:16 2009 (r189735) +++ head/sys/kern/uipc_sem.c Thu Mar 12 10:36:39 2009 (r189736) @@ -727,7 +727,7 @@ kern_sem_wait(struct thread *td, semid_t #endif DP(("kern_sem_wait value = %d, tryflag %d\n", ks->ks_value, tryflag)); vfs_timestamp(&ks->ks_atime); - if (ks->ks_value == 0) { + while (ks->ks_value == 0) { ks->ks_waiters++; if (tryflag != 0) error = EAGAIN; From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 12:43:57 2009 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 7787A106566B; Thu, 12 Mar 2009 12:43:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F3E28FC1A; Thu, 12 Mar 2009 12:43:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CChu0W030519; Thu, 12 Mar 2009 12:43:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CChuuI030516; Thu, 12 Mar 2009 12:43:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903121243.n2CChuuI030516@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 12 Mar 2009 12:43: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: r189737 - in head/sys/ufs: ffs 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: Thu, 12 Mar 2009 12:43:57 -0000 Author: kib Date: Thu Mar 12 12:43:56 2009 New Revision: 189737 URL: http://svn.freebsd.org/changeset/base/189737 Log: The non-modifying EA VOPs are executed with only shared vnode lock taken. Provide a custom lock around initializing and tearing down EA area, to prevent both memory leaks and double-free of it. Count the number of EA area accessors. Lock protocol requires either holding exclusive vnode lock to modify i_ea_area, or shared vnode lock and owning IN_EA_LOCKED flag in i_flag. Noted by: YAMAMOTO, Taku Tested by: pho (previous version) MFC after: 2 weeks Modified: head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ufs/inode.h Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Thu Mar 12 10:36:39 2009 (r189736) +++ head/sys/ufs/ffs/ffs_vfsops.c Thu Mar 12 12:43:56 2009 (r189737) @@ -1451,6 +1451,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags ip->i_fs = fs; ip->i_dev = dev; ip->i_number = ino; + ip->i_ea_refs = 0; #ifdef QUOTA { int i; Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Thu Mar 12 10:36:39 2009 (r189736) +++ head/sys/ufs/ffs/ffs_vnops.c Thu Mar 12 12:43:56 2009 (r189737) @@ -1225,6 +1225,35 @@ ffs_rdextattr(u_char **p, struct vnode * return (0); } +static void +ffs_lock_ea(struct vnode *vp) +{ + struct inode *ip; + + ip = VTOI(vp); + VI_LOCK(vp); + while (ip->i_flag & IN_EA_LOCKED) { + ip->i_flag |= IN_EA_LOCKWAIT; + msleep(&ip->i_ea_refs, &vp->v_interlock, PINOD + 2, "ufs_ea", + 0); + } + ip->i_flag |= IN_EA_LOCKED; + VI_UNLOCK(vp); +} + +static void +ffs_unlock_ea(struct vnode *vp) +{ + struct inode *ip; + + ip = VTOI(vp); + VI_LOCK(vp); + if (ip->i_flag & IN_EA_LOCKWAIT) + wakeup(&ip->i_ea_refs); + ip->i_flag &= ~(IN_EA_LOCKED | IN_EA_LOCKWAIT); + VI_UNLOCK(vp); +} + static int ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td) { @@ -1234,14 +1263,22 @@ ffs_open_ea(struct vnode *vp, struct ucr ip = VTOI(vp); - if (ip->i_ea_area != NULL) - return (EBUSY); + ffs_lock_ea(vp); + if (ip->i_ea_area != NULL) { + ip->i_ea_refs++; + ffs_unlock_ea(vp); + return (0); + } dp = ip->i_din2; error = ffs_rdextattr(&ip->i_ea_area, vp, td, 0); - if (error) + if (error) { + ffs_unlock_ea(vp); return (error); + } ip->i_ea_len = dp->di_extsize; ip->i_ea_error = 0; + ip->i_ea_refs++; + ffs_unlock_ea(vp); return (0); } @@ -1258,11 +1295,16 @@ ffs_close_ea(struct vnode *vp, int commi struct ufs2_dinode *dp; ip = VTOI(vp); - if (ip->i_ea_area == NULL) + + ffs_lock_ea(vp); + if (ip->i_ea_area == NULL) { + ffs_unlock_ea(vp); return (EINVAL); + } dp = ip->i_din2; error = ip->i_ea_error; if (commit && error == 0) { + ASSERT_VOP_ELOCKED(vp, "ffs_close_ea commit"); if (cred == NOCRED) cred = vp->v_mount->mnt_cred; liovec.iov_base = ip->i_ea_area; @@ -1279,10 +1321,13 @@ ffs_close_ea(struct vnode *vp, int commi error = ffs_truncate(vp, 0, IO_EXT, cred, td); error = ffs_extwrite(vp, &luio, IO_EXT | IO_SYNC, cred); } - free(ip->i_ea_area, M_TEMP); - ip->i_ea_area = NULL; - ip->i_ea_len = 0; - ip->i_ea_error = 0; + if (--ip->i_ea_refs == 0) { + free(ip->i_ea_area, M_TEMP); + ip->i_ea_area = NULL; + ip->i_ea_len = 0; + ip->i_ea_error = 0; + } + ffs_unlock_ea(vp); return (error); } @@ -1392,7 +1437,6 @@ vop_deleteextattr { uint32_t ealength, ul; int ealen, olen, eapad1, eapad2, error, i, easize; u_char *eae, *p; - int stand_alone; ip = VTOI(ap->a_vp); fs = ip->i_fs; @@ -1409,19 +1453,19 @@ vop_deleteextattr { error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, ap->a_td, VWRITE); if (error) { + + /* + * ffs_lock_ea is not needed there, because the vnode + * must be exlusively locked. + */ if (ip->i_ea_area != NULL && ip->i_ea_error == 0) ip->i_ea_error = error; return (error); } - if (ip->i_ea_area == NULL) { - error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td); - if (error) - return (error); - stand_alone = 1; - } else { - stand_alone = 0; - } + error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td); + if (error) + return (error); ealength = eapad1 = ealen = eapad2 = 0; @@ -1434,8 +1478,7 @@ vop_deleteextattr { if (olen == -1) { /* delete but nonexistent */ free(eae, M_TEMP); - if (stand_alone) - ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); + ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); return(ENOATTR); } bcopy(p, &ul, sizeof ul); @@ -1446,9 +1489,8 @@ vop_deleteextattr { } if (easize > NXADDR * fs->fs_bsize) { free(eae, M_TEMP); - if (stand_alone) - ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); - else if (ip->i_ea_error == 0) + ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); + if (ip->i_ea_area != NULL && ip->i_ea_error == 0) ip->i_ea_error = ENOSPC; return(ENOSPC); } @@ -1456,8 +1498,7 @@ vop_deleteextattr { ip->i_ea_area = eae; ip->i_ea_len = easize; free(p, M_TEMP); - if (stand_alone) - error = ffs_close_ea(ap->a_vp, 1, ap->a_cred, ap->a_td); + error = ffs_close_ea(ap->a_vp, 1, ap->a_cred, ap->a_td); return(error); } @@ -1482,7 +1523,7 @@ vop_getextattr { struct fs *fs; u_char *eae, *p; unsigned easize; - int error, ealen, stand_alone; + int error, ealen; ip = VTOI(ap->a_vp); fs = ip->i_fs; @@ -1495,14 +1536,10 @@ vop_getextattr { if (error) return (error); - if (ip->i_ea_area == NULL) { - error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td); - if (error) - return (error); - stand_alone = 1; - } else { - stand_alone = 0; - } + error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td); + if (error) + return (error); + eae = ip->i_ea_area; easize = ip->i_ea_len; @@ -1516,8 +1553,8 @@ vop_getextattr { error = uiomove(p, ealen, ap->a_uio); } else error = ENOATTR; - if (stand_alone) - ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); + + ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); return(error); } @@ -1542,7 +1579,7 @@ vop_listextattr { u_char *eae, *p, *pe, *pn; unsigned easize; uint32_t ul; - int error, ealen, stand_alone; + int error, ealen; ip = VTOI(ap->a_vp); fs = ip->i_fs; @@ -1555,14 +1592,9 @@ vop_listextattr { if (error) return (error); - if (ip->i_ea_area == NULL) { - error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td); - if (error) - return (error); - stand_alone = 1; - } else { - stand_alone = 0; - } + error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td); + if (error) + return (error); eae = ip->i_ea_area; easize = ip->i_ea_len; @@ -1586,8 +1618,7 @@ vop_listextattr { error = uiomove(p, ealen + 1, ap->a_uio); } } - if (stand_alone) - ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); + ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); return(error); } @@ -1612,7 +1643,6 @@ vop_setextattr { uint32_t ealength, ul; int ealen, olen, eapad1, eapad2, error, i, easize; u_char *eae, *p; - int stand_alone; ip = VTOI(ap->a_vp); fs = ip->i_fs; @@ -1633,19 +1663,19 @@ vop_setextattr { error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, ap->a_td, VWRITE); if (error) { + + /* + * ffs_lock_ea is not needed there, because the vnode + * must be exlusively locked. + */ if (ip->i_ea_area != NULL && ip->i_ea_error == 0) ip->i_ea_error = error; return (error); } - if (ip->i_ea_area == NULL) { - error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td); - if (error) - return (error); - stand_alone = 1; - } else { - stand_alone = 0; - } + error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td); + if (error) + return (error); ealen = ap->a_uio->uio_resid; ealength = sizeof(uint32_t) + 3 + strlen(ap->a_name); @@ -1677,9 +1707,8 @@ vop_setextattr { } if (easize > NXADDR * fs->fs_bsize) { free(eae, M_TEMP); - if (stand_alone) - ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); - else if (ip->i_ea_error == 0) + ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); + if (ip->i_ea_area != NULL && ip->i_ea_error == 0) ip->i_ea_error = ENOSPC; return(ENOSPC); } @@ -1695,9 +1724,8 @@ vop_setextattr { error = uiomove(p, ealen, ap->a_uio); if (error) { free(eae, M_TEMP); - if (stand_alone) - ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); - else if (ip->i_ea_error == 0) + ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td); + if (ip->i_ea_area != NULL && ip->i_ea_error == 0) ip->i_ea_error = error; return(error); } @@ -1708,8 +1736,7 @@ vop_setextattr { ip->i_ea_area = eae; ip->i_ea_len = easize; free(p, M_TEMP); - if (stand_alone) - error = ffs_close_ea(ap->a_vp, 1, ap->a_cred, ap->a_td); + error = ffs_close_ea(ap->a_vp, 1, ap->a_cred, ap->a_td); return(error); } Modified: head/sys/ufs/ufs/inode.h ============================================================================== --- head/sys/ufs/ufs/inode.h Thu Mar 12 10:36:39 2009 (r189736) +++ head/sys/ufs/ufs/inode.h Thu Mar 12 12:43:56 2009 (r189737) @@ -94,6 +94,7 @@ struct inode { u_char *i_ea_area; /* Pointer to malloced copy of EA area */ unsigned i_ea_len; /* Length of i_ea_area */ int i_ea_error; /* First errno in transaction */ + int i_ea_refs; /* Number of users of EA area */ /* * Copies from the on-disk dinode itself. @@ -125,6 +126,8 @@ struct inode { #define IN_SPACECOUNTED 0x0080 /* Blocks to be freed in free count. */ #define IN_LAZYACCESS 0x0100 /* Process IN_ACCESS after the suspension finished */ +#define IN_EA_LOCKED 0x0200 +#define IN_EA_LOCKWAIT 0x0400 #define i_devvp i_ump->um_devvp #define i_umbufobj i_ump->um_bo From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 13:03:33 2009 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 C74361065678; Thu, 12 Mar 2009 13:03:33 +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 B42B58FC1E; Thu, 12 Mar 2009 13:03:33 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CD3XrM031028; Thu, 12 Mar 2009 13:03:33 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CD3XAP031027; Thu, 12 Mar 2009 13:03:33 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200903121303.n2CD3XAP031027@svn.freebsd.org> From: Maxim Konovalov Date: Thu, 12 Mar 2009 13:03: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: r189738 - head/usr.sbin/gstat 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 Mar 2009 13:03:34 -0000 Author: maxim Date: Thu Mar 12 13:03:33 2009 New Revision: 189738 URL: http://svn.freebsd.org/changeset/base/189738 Log: o Sync synopsis with reality. Remove BUG section -- there is a batch mode in gpart(8) now. Modified: head/usr.sbin/gstat/gstat.8 Modified: head/usr.sbin/gstat/gstat.8 ============================================================================== --- head/usr.sbin/gstat/gstat.8 Thu Mar 12 12:43:56 2009 (r189737) +++ head/usr.sbin/gstat/gstat.8 Thu Mar 12 13:03:33 2009 (r189738) @@ -32,7 +32,7 @@ .Nd print statistics about GEOM disks .Sh SYNOPSIS .Nm -.Op Fl acd +.Op Fl abcd .Op Fl f Ar filter .Op Fl I Ar interval .Sh DESCRIPTION @@ -92,15 +92,3 @@ A .Nm utility appeared in .Fx 5.0 . -.Sh BUGS -The -.Nm -utility only works interactively. -It should probably detect when it is run non-interactively and produce -simple -.Tn ASCII -text output. -Otherwise, this utility should probably be folded into -.Xr systat 1 -which only works interactively and is the obvious utility to run for -various other forms of system statistics. From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 13:17:46 2009 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 9E260106564A; Thu, 12 Mar 2009 13:17:46 +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 8C7BF8FC12; Thu, 12 Mar 2009 13:17:46 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CDHktP031336; Thu, 12 Mar 2009 13:17:46 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CDHk22031334; Thu, 12 Mar 2009 13:17:46 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200903121317.n2CDHk22031334@svn.freebsd.org> From: Maxim Konovalov Date: Thu, 12 Mar 2009 13:17: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: r189739 - head/usr.sbin/gstat 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 Mar 2009 13:17:47 -0000 Author: maxim Date: Thu Mar 12 13:17:46 2009 New Revision: 189739 URL: http://svn.freebsd.org/changeset/base/189739 Log: o Turn the batch mode on if stdout is not tty. Submitted by: vsevolod MFC after: 1 week Modified: head/usr.sbin/gstat/gstat.8 head/usr.sbin/gstat/gstat.c Modified: head/usr.sbin/gstat/gstat.8 ============================================================================== --- head/usr.sbin/gstat/gstat.8 Thu Mar 12 13:03:33 2009 (r189738) +++ head/usr.sbin/gstat/gstat.8 Thu Mar 12 13:17:46 2009 (r189739) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2006 +.Dd March 12, 2009 .Dt GSTAT 8 .Os .Sh NAME @@ -47,7 +47,9 @@ The options are as follows: .It Fl a Only display providers that are at least 0.1% busy. .It Fl b -Batch mode. Collect numbers, print and exit. +Batch mode. +Collect numbers, print and exit. +Default if stdout is not a tty. .It Fl c Enable display of .Xr geom 4 Modified: head/usr.sbin/gstat/gstat.c ============================================================================== --- head/usr.sbin/gstat/gstat.c Thu Mar 12 13:03:33 2009 (r189738) +++ head/usr.sbin/gstat/gstat.c Thu Mar 12 13:17:46 2009 (r189739) @@ -99,6 +99,10 @@ main(int argc, char **argv) maxx = -1; curx = -1; loop = 1; + /* Turn on batch mode if output is not tty. */ + if (!isatty(fileno(stdout))) + flag_b = 1; + f_s[0] = '\0'; while ((i = getopt(argc, argv, "adcf:I:b")) != -1) { switch (i) { @@ -318,9 +322,11 @@ main(int argc, char **argv) if (!flag_b) attron(COLOR_PAIR(i)); PRINTMSG(" %6.1lf", (double)ld[7]); - if (!flag_b) + if (!flag_b) { attroff(COLOR_PAIR(i)); - PRINTMSG("|"); + PRINTMSG("|"); + } else + PRINTMSG(" "); if (gid == NULL) { PRINTMSG(" ??"); } else if (gid->lg_what == ISPROVIDER) { From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 13:59:04 2009 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 717701065773; Thu, 12 Mar 2009 13:59:04 +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 3E8A78FC15; Thu, 12 Mar 2009 13:59:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id D8C1D46B03; Thu, 12 Mar 2009 09:59:03 -0400 (EDT) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n2CDwVOJ046493; Thu, 12 Mar 2009 09:58:58 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: "M. Warner Losh" Date: Thu, 12 Mar 2009 08:51:35 -0400 User-Agent: KMail/1.9.7 References: <200903101210.n2ACApQ0061838@svn.freebsd.org> <200903100904.38679.jhb@freebsd.org> <20090312.010328.-1666181653.imp@bsdimp.com> In-Reply-To: <20090312.010328.-1666181653.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903120851.36103.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 12 Mar 2009 09:58:58 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9100/Thu Mar 12 05:07:56 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189619 - head/sys/dev/cardbus 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 Mar 2009 13:59:06 -0000 On Thursday 12 March 2009 3:03:28 am M. Warner Losh wrote: > In message: <200903100904.38679.jhb@freebsd.org> > John Baldwin writes: > : It might be best to do this before releasing the resources rather than > : afterwards. > > It certainly does no harm to move them, and I will do so. > > However, what problems do you see with doing it in the current order? > I can't think of anything bad that could happen, but my imagination > has been a bit poor lately... The only thing that could theoretically happen is that the resources could be given to another device while the cardbus card is still decoding them. In practice this can't really happen right now since new-bus is still single-threaded and I believe most cardbus busses are subtractive-decode. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 16:55:16 2009 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 B3BDB106566B; Thu, 12 Mar 2009 16:55:16 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A17038FC15; Thu, 12 Mar 2009 16:55:16 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CGtGrk035712; Thu, 12 Mar 2009 16:55:16 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CGtG8o035711; Thu, 12 Mar 2009 16:55:16 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200903121655.n2CGtG8o035711@svn.freebsd.org> From: Roman Divacky Date: Thu, 12 Mar 2009 16:55: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: r189743 - head/usr.bin/calendar/calendars 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 Mar 2009 16:55:17 -0000 Author: rdivacky Date: Thu Mar 12 16:55:16 2009 New Revision: 189743 URL: http://svn.freebsd.org/changeset/base/189743 Log: Add myself. Approved by: ed (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Mar 12 14:36:34 2009 (r189742) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Mar 12 16:55:16 2009 (r189743) @@ -144,6 +144,7 @@ 05/23 Munechika Sumikawa born in Osaka, Osaka, Japan, 1972 05/24 Duncan McLennan Barclay born in London, Middlesex, United Kingdom, 1970 05/24 Oliver Lehmann born in Karlsburg, Germany, 1981 +05/25 Roman Divacky born in Brno, Czech Republic, 1983 05/25 Tom Rhodes born in Ellwood City, Pennsylvania, United States, 1981 05/26 Jim Pirzyk born in Chicago, Illinois, United States, 1968 05/27 Ollivier Robert born in Paris, France, 1967 From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 17:21:59 2009 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 35D80106566B; Thu, 12 Mar 2009 17:21:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22BF58FC1E; Thu, 12 Mar 2009 17:21:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CHLx91036203; Thu, 12 Mar 2009 17:21:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CHLx0x036202; Thu, 12 Mar 2009 17:21:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903121721.n2CHLx0x036202@svn.freebsd.org> From: John Baldwin Date: Thu, 12 Mar 2009 17:21: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: r189744 - 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: Thu, 12 Mar 2009 17:22:00 -0000 Author: jhb Date: Thu Mar 12 17:21:58 2009 New Revision: 189744 URL: http://svn.freebsd.org/changeset/base/189744 Log: Export the current values of nbuf, ncallout, and nswbuf via read-only sysctls that match the tunable names. MFC after: 3 days Modified: head/sys/kern/subr_param.c Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Thu Mar 12 16:55:16 2009 (r189743) +++ head/sys/kern/subr_param.c Thu Mar 12 17:21:58 2009 (r189744) @@ -101,6 +101,12 @@ u_long maxssiz; /* max stack size */ u_long sgrowsiz; /* amount to grow stack */ SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN, &hz, 0, "ticks/second"); +SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0, + "Number of pre-allocated timer events"); +SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN, &nbuf, 0, + "Number of buffer-cache I/O buffers"); +SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0, + "Number of swap buffers"); SYSCTL_INT(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0, "max swmeta KVA storage"); SYSCTL_INT(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0, From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 17:23:02 2009 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 BC9221065673; Thu, 12 Mar 2009 17:23:02 +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 AACD38FC22; Thu, 12 Mar 2009 17:23:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CHN26E036275; Thu, 12 Mar 2009 17:23:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CHN2v2036274; Thu, 12 Mar 2009 17:23:02 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903121723.n2CHN2v2036274@svn.freebsd.org> From: John Baldwin Date: Thu, 12 Mar 2009 17:23: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: r189745 - 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: Thu, 12 Mar 2009 17:23:03 -0000 Author: jhb Date: Thu Mar 12 17:23:02 2009 New Revision: 189745 URL: http://svn.freebsd.org/changeset/base/189745 Log: Change the sysctls for maxbcache and maxswzone from int to long. I missed this earlier since these sysctls don't exist in 7.x yet. Modified: head/sys/kern/subr_param.c Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Thu Mar 12 17:21:58 2009 (r189744) +++ head/sys/kern/subr_param.c Thu Mar 12 17:23:02 2009 (r189745) @@ -107,9 +107,9 @@ SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLA "Number of buffer-cache I/O buffers"); SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0, "Number of swap buffers"); -SYSCTL_INT(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0, +SYSCTL_LONG(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0, "max swmeta KVA storage"); -SYSCTL_INT(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0, +SYSCTL_LONG(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0, "max buffer cache KVA storage"); SYSCTL_ULONG(_kern, OID_AUTO, maxtsiz, CTLFLAG_RDTUN, &maxtsiz, 0, "max text size"); From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 18:18:28 2009 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 CA0F21065673; Thu, 12 Mar 2009 18:18:28 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2B9C8FC14; Thu, 12 Mar 2009 18:18:28 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CIISqr037389; Thu, 12 Mar 2009 18:18:28 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CIISdh037384; Thu, 12 Mar 2009 18:18:28 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903121818.n2CIISdh037384@svn.freebsd.org> From: Sam Leffler Date: Thu, 12 Mar 2009 18:18: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: r189747 - in head/sys: conf dev/ath/ath_hal/ar5416 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 Mar 2009 18:18:31 -0000 Author: sam Date: Thu Mar 12 18:18:28 2009 New Revision: 189747 URL: http://svn.freebsd.org/changeset/base/189747 Log: preliminary ar9280 support: o add 9280 attach that sets up ini, cal, etc. o new rf backend for 9280 and later parts o split ini setup and spur mitigation support out to methods and provide 9280-specific support o minor fixups to shared code to handle 9280-specific work Obtained from: Atheros (ini values and some code) Added: head/sys/dev/ath/ath_hal/ar5416/ar9280.c (contents, props changed) head/sys/dev/ath/ath_hal/ar5416/ar9280.h (contents, props changed) head/sys/dev/ath/ath_hal/ar5416/ar9280_attach.c (contents, props changed) head/sys/dev/ath/ath_hal/ar5416/ar9280v1.ini (contents, props changed) head/sys/dev/ath/ath_hal/ar5416/ar9280v2.ini (contents, props changed) Modified: head/sys/conf/files head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Mar 12 17:32:04 2009 (r189746) +++ head/sys/conf/files Thu Mar 12 18:18:28 2009 (r189747) @@ -515,16 +515,19 @@ dev/ath/if_ath_pci.c optional ath pci \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ah_osdep.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" +# dev/ath/ath_hal/ah.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_eeprom_v1.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_eeprom_v3.c optional ath_hal | ath_ar5211 | ath_ar5212 \ compile-with "${NORMAL_C} -I$S/dev/ath" -dev/ath/ath_hal/ah_eeprom_v14.c optional ath_hal | ath_ar5416 | ath_ar9160 \ +dev/ath/ath_hal/ah_eeprom_v14.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_regdomain.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" +# ar5210 dev/ath/ath_hal/ar5210/ar5210_attach.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_beacon.c optional ath_hal | ath_ar5210 \ @@ -545,6 +548,7 @@ dev/ath/ath_hal/ar5210/ar5210_reset.c o compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_xmit.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +# ar5211 dev/ath/ath_hal/ar5211/ar5211_attach.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_beacon.c optional ath_hal | ath_ar5211 \ @@ -565,123 +569,134 @@ dev/ath/ath_hal/ar5211/ar5211_reset.c o compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_xmit.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +# ar5212 dev/ath/ath_hal/ar5212/ar5212_ani.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_attach.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_beacon.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_eeprom.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_gpio.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_interrupts.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_keycache.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_misc.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_phy.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_power.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_recv.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_reset.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_rfgain.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_xmit.c \ - optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ - compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" -dev/ath/ath_hal/ar5212/ar2316.c optional ath_rf2316 \ - compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" -dev/ath/ath_hal/ar5212/ar2317.c optional ath_rf2317 \ - compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" -dev/ath/ath_hal/ar5212/ar2413.c optional ath_hal | ath_rf2413 \ - compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" -dev/ath/ath_hal/ar5212/ar2425.c optional ath_hal | ath_rf2425 | ath_rf2417 \ - compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" -dev/ath/ath_hal/ar5212/ar5111.c optional ath_hal | ath_rf5111 \ - compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" -dev/ath/ath_hal/ar5212/ar5112.c optional ath_hal | ath_rf5112 \ - compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" -dev/ath/ath_hal/ar5212/ar5413.c optional ath_hal | ath_rf5413 \ - compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" -dev/ath/ath_hal/ar5416/ar2133.c optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +# ar5416 (depends on ar5212) dev/ath/ath_hal/ar5416/ar5416_ani.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_attach.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_beacon.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_cal.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_cal_iq.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_eeprom.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_gpio.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_interrupts.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_keycache.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_misc.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_phy.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_power.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_recv.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_reset.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_xmit.c \ - optional ath_hal | ath_ar5416 | ath_ar9160 \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +# ar9160 (depends on ar5416) dev/ath/ath_hal/ar5416/ar9160_attach.c optional ath_hal | ath_ar9160 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +# ar9280 (depends on ar5416) +dev/ath/ath_hal/ar5416/ar9280_attach.c optional ath_hal | ath_ar9280 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +# rf backends +dev/ath/ath_hal/ar5212/ar2316.c optional ath_rf2316 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar2317.c optional ath_rf2317 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar2413.c optional ath_hal | ath_rf2413 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar2425.c optional ath_hal | ath_rf2425 | ath_rf2417 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5111.c optional ath_hal | ath_rf5111 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5112.c optional ath_hal | ath_rf5112 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5413.c optional ath_hal | ath_rf5413 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar2133.c optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar9280.c optional ath_hal | ath_ar9280 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +# ath rate control algorithms dev/ath/ath_rate/amrr/amrr.c optional ath_rate_amrr \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_rate/onoe/onoe.c optional ath_rate_onoe \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_rate/sample/sample.c optional ath_rate_sample \ compile-with "${NORMAL_C} -I$S/dev/ath" +# dev/bce/if_bce.c optional bce dev/bfe/if_bfe.c optional bfe dev/bge/if_bge.c optional bge Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Thu Mar 12 17:32:04 2009 (r189746) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Thu Mar 12 18:18:28 2009 (r189747) @@ -45,6 +45,8 @@ typedef struct { #define AR5416_CCA_MAX_HIGH_VALUE -62 #define AR5416_CCA_MIN_BAD_VALUE -140 +#define AR5416_SPUR_RSSI_THRESH 40 + struct ath_hal_5416 { struct ath_hal_5212 ah_5212; @@ -59,6 +61,11 @@ struct ath_hal_5416 { HAL_INI_ARRAY ah_ini_addac; HAL_INI_ARRAY ah_ini_pcieserdes; + void (*ah_writeIni)(struct ath_hal *, + const struct ieee80211_channel *); + void (*ah_spurMitigate)(struct ath_hal *, + const struct ieee80211_channel *); + u_int ah_globaltxtimeout; /* global tx timeout */ u_int ah_gpioMask; int ah_hangs; /* h/w hangs state */ Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Mar 12 17:32:04 2009 (r189746) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Mar 12 18:18:28 2009 (r189747) @@ -22,6 +22,8 @@ #include "ah_internal.h" #include "ah_devid.h" +#include "ah_eeprom_v14.h" + #include "ar5416/ar5416.h" #include "ar5416/ar5416reg.h" #include "ar5416/ar5416phy.h" @@ -29,6 +31,10 @@ #include "ar5416/ar5416.ini" static void ar5416ConfigPCIE(struct ath_hal *ah, HAL_BOOL restore); +static void ar5416WriteIni(struct ath_hal *ah, + const struct ieee80211_channel *chan); +static void ar5416SpurMitigate(struct ath_hal *ah, + const struct ieee80211_channel *chan); static void ar5416AniSetup(struct ath_hal *ah) @@ -152,6 +158,8 @@ ar5416InitState(struct ath_hal_5416 *ahp #endif ahp->ah_priv.ah_getChipPowerLimits = ar5416GetChipPowerLimits; + AH5416(ah)->ah_writeIni = ar5416WriteIni; + AH5416(ah)->ah_spurMitigate = ar5416SpurMitigate; /* * Start by setting all Owl devices to 2x2 */ @@ -393,6 +401,301 @@ ar5416ConfigPCIE(struct ath_hal *ah, HAL } } +static void +ar5416WriteIni(struct ath_hal *ah, const struct ieee80211_channel *chan) +{ + u_int modesIndex, freqIndex; + int regWrites = 0; + + /* Setup the indices for the next set of register array writes */ + /* XXX Ignore 11n dynamic mode on the AR5416 for the moment */ + if (IEEE80211_IS_CHAN_2GHZ(chan)) { + freqIndex = 2; + if (IEEE80211_IS_CHAN_HT40(chan)) + modesIndex = 3; + else if (IEEE80211_IS_CHAN_108G(chan)) + modesIndex = 5; + else + modesIndex = 4; + } else { + freqIndex = 1; + if (IEEE80211_IS_CHAN_HT40(chan) || + IEEE80211_IS_CHAN_TURBO(chan)) + modesIndex = 2; + else + modesIndex = 1; + } + + /* Set correct Baseband to analog shift setting to access analog chips. */ + OS_REG_WRITE(ah, AR_PHY(0), 0x00000007); + + /* + * Write addac shifts + */ + OS_REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_EXTERNAL_RADIO); +#if 0 + /* NB: only required for Sowl */ + ar5416EepromSetAddac(ah, chan); +#endif + regWrites = ath_hal_ini_write(ah, &AH5416(ah)->ah_ini_addac, 1, + regWrites); + OS_REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_INTERNAL_ADDAC); + + regWrites = ath_hal_ini_write(ah, &AH5212(ah)->ah_ini_modes, + modesIndex, regWrites); + regWrites = ath_hal_ini_write(ah, &AH5212(ah)->ah_ini_common, + 1, regWrites); + + /* XXX updated regWrites? */ + AH5212(ah)->ah_rfHal->writeRegs(ah, modesIndex, freqIndex, regWrites); +} + +/* + * Convert to baseband spur frequency given input channel frequency + * and compute register settings below. + */ + +static void +ar5416SpurMitigate(struct ath_hal *ah, const struct ieee80211_channel *chan) +{ + uint16_t freq = ath_hal_gethwchannel(ah, chan); + static const int pilot_mask_reg[4] = { AR_PHY_TIMING7, AR_PHY_TIMING8, + AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60 }; + static const int chan_mask_reg[4] = { AR_PHY_TIMING9, AR_PHY_TIMING10, + AR_PHY_CHANNEL_MASK_01_30, AR_PHY_CHANNEL_MASK_31_60 }; + static const int inc[4] = { 0, 100, 0, 0 }; + + int bb_spur = AR_NO_SPUR; + int bin, cur_bin; + int spur_freq_sd; + int spur_delta_phase; + int denominator; + int upper, lower, cur_vit_mask; + int tmp, new; + int i; + + int8_t mask_m[123]; + int8_t mask_p[123]; + int8_t mask_amt; + int tmp_mask; + int cur_bb_spur; + HAL_BOOL is2GHz = IEEE80211_IS_CHAN_2GHZ(chan); + + OS_MEMZERO(mask_m, sizeof(mask_m)); + OS_MEMZERO(mask_p, sizeof(mask_p)); + + /* + * Need to verify range +/- 9.5 for static ht20, otherwise spur + * is out-of-band and can be ignored. + */ + /* XXX ath9k changes */ + for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) { + cur_bb_spur = ath_hal_getSpurChan(ah, i, is2GHz); + if (AR_NO_SPUR == cur_bb_spur) + break; + cur_bb_spur = cur_bb_spur - (freq * 10); + if ((cur_bb_spur > -95) && (cur_bb_spur < 95)) { + bb_spur = cur_bb_spur; + break; + } + } + if (AR_NO_SPUR == bb_spur) + return; + + bin = bb_spur * 32; + + tmp = OS_REG_READ(ah, AR_PHY_TIMING_CTRL4_CHAIN(0)); + new = tmp | (AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI | + AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER | + AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK | + AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK); + + OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4_CHAIN(0), new); + + new = (AR_PHY_SPUR_REG_MASK_RATE_CNTL | + AR_PHY_SPUR_REG_ENABLE_MASK_PPM | + AR_PHY_SPUR_REG_MASK_RATE_SELECT | + AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI | + SM(AR5416_SPUR_RSSI_THRESH, AR_PHY_SPUR_REG_SPUR_RSSI_THRESH)); + OS_REG_WRITE(ah, AR_PHY_SPUR_REG, new); + /* + * Should offset bb_spur by +/- 10 MHz for dynamic 2040 MHz + * config, no offset for HT20. + * spur_delta_phase = bb_spur/40 * 2**21 for static ht20, + * /80 for dyn2040. + */ + spur_delta_phase = ((bb_spur * 524288) / 100) & + AR_PHY_TIMING11_SPUR_DELTA_PHASE; + /* + * in 11A mode the denominator of spur_freq_sd should be 40 and + * it should be 44 in 11G + */ + denominator = IEEE80211_IS_CHAN_2GHZ(chan) ? 440 : 400; + spur_freq_sd = ((bb_spur * 2048) / denominator) & 0x3ff; + + new = (AR_PHY_TIMING11_USE_SPUR_IN_AGC | + SM(spur_freq_sd, AR_PHY_TIMING11_SPUR_FREQ_SD) | + SM(spur_delta_phase, AR_PHY_TIMING11_SPUR_DELTA_PHASE)); + OS_REG_WRITE(ah, AR_PHY_TIMING11, new); + + + /* + * ============================================ + * pilot mask 1 [31:0] = +6..-26, no 0 bin + * pilot mask 2 [19:0] = +26..+7 + * + * channel mask 1 [31:0] = +6..-26, no 0 bin + * channel mask 2 [19:0] = +26..+7 + */ + //cur_bin = -26; + cur_bin = -6000; + upper = bin + 100; + lower = bin - 100; + + for (i = 0; i < 4; i++) { + int pilot_mask = 0; + int chan_mask = 0; + int bp = 0; + for (bp = 0; bp < 30; bp++) { + if ((cur_bin > lower) && (cur_bin < upper)) { + pilot_mask = pilot_mask | 0x1 << bp; + chan_mask = chan_mask | 0x1 << bp; + } + cur_bin += 100; + } + cur_bin += inc[i]; + OS_REG_WRITE(ah, pilot_mask_reg[i], pilot_mask); + OS_REG_WRITE(ah, chan_mask_reg[i], chan_mask); + } + + /* ================================================= + * viterbi mask 1 based on channel magnitude + * four levels 0-3 + * - mask (-27 to 27) (reg 64,0x9900 to 67,0x990c) + * [1 2 2 1] for -9.6 or [1 2 1] for +16 + * - enable_mask_ppm, all bins move with freq + * + * - mask_select, 8 bits for rates (reg 67,0x990c) + * - mask_rate_cntl, 8 bits for rates (reg 67,0x990c) + * choose which mask to use mask or mask2 + */ + + /* + * viterbi mask 2 2nd set for per data rate puncturing + * four levels 0-3 + * - mask_select, 8 bits for rates (reg 67) + * - mask (-27 to 27) (reg 98,0x9988 to 101,0x9994) + * [1 2 2 1] for -9.6 or [1 2 1] for +16 + */ + cur_vit_mask = 6100; + upper = bin + 120; + lower = bin - 120; + + for (i = 0; i < 123; i++) { + if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) { + if ((abs(cur_vit_mask - bin)) < 75) { + mask_amt = 1; + } else { + mask_amt = 0; + } + if (cur_vit_mask < 0) { + mask_m[abs(cur_vit_mask / 100)] = mask_amt; + } else { + mask_p[cur_vit_mask / 100] = mask_amt; + } + } + cur_vit_mask -= 100; + } + + tmp_mask = (mask_m[46] << 30) | (mask_m[47] << 28) + | (mask_m[48] << 26) | (mask_m[49] << 24) + | (mask_m[50] << 22) | (mask_m[51] << 20) + | (mask_m[52] << 18) | (mask_m[53] << 16) + | (mask_m[54] << 14) | (mask_m[55] << 12) + | (mask_m[56] << 10) | (mask_m[57] << 8) + | (mask_m[58] << 6) | (mask_m[59] << 4) + | (mask_m[60] << 2) | (mask_m[61] << 0); + OS_REG_WRITE(ah, AR_PHY_BIN_MASK_1, tmp_mask); + OS_REG_WRITE(ah, AR_PHY_VIT_MASK2_M_46_61, tmp_mask); + + tmp_mask = (mask_m[31] << 28) + | (mask_m[32] << 26) | (mask_m[33] << 24) + | (mask_m[34] << 22) | (mask_m[35] << 20) + | (mask_m[36] << 18) | (mask_m[37] << 16) + | (mask_m[48] << 14) | (mask_m[39] << 12) + | (mask_m[40] << 10) | (mask_m[41] << 8) + | (mask_m[42] << 6) | (mask_m[43] << 4) + | (mask_m[44] << 2) | (mask_m[45] << 0); + OS_REG_WRITE(ah, AR_PHY_BIN_MASK_2, tmp_mask); + OS_REG_WRITE(ah, AR_PHY_MASK2_M_31_45, tmp_mask); + + tmp_mask = (mask_m[16] << 30) | (mask_m[16] << 28) + | (mask_m[18] << 26) | (mask_m[18] << 24) + | (mask_m[20] << 22) | (mask_m[20] << 20) + | (mask_m[22] << 18) | (mask_m[22] << 16) + | (mask_m[24] << 14) | (mask_m[24] << 12) + | (mask_m[25] << 10) | (mask_m[26] << 8) + | (mask_m[27] << 6) | (mask_m[28] << 4) + | (mask_m[29] << 2) | (mask_m[30] << 0); + OS_REG_WRITE(ah, AR_PHY_BIN_MASK_3, tmp_mask); + OS_REG_WRITE(ah, AR_PHY_MASK2_M_16_30, tmp_mask); + + tmp_mask = (mask_m[ 0] << 30) | (mask_m[ 1] << 28) + | (mask_m[ 2] << 26) | (mask_m[ 3] << 24) + | (mask_m[ 4] << 22) | (mask_m[ 5] << 20) + | (mask_m[ 6] << 18) | (mask_m[ 7] << 16) + | (mask_m[ 8] << 14) | (mask_m[ 9] << 12) + | (mask_m[10] << 10) | (mask_m[11] << 8) + | (mask_m[12] << 6) | (mask_m[13] << 4) + | (mask_m[14] << 2) | (mask_m[15] << 0); + OS_REG_WRITE(ah, AR_PHY_MASK_CTL, tmp_mask); + OS_REG_WRITE(ah, AR_PHY_MASK2_M_00_15, tmp_mask); + + tmp_mask = (mask_p[15] << 28) + | (mask_p[14] << 26) | (mask_p[13] << 24) + | (mask_p[12] << 22) | (mask_p[11] << 20) + | (mask_p[10] << 18) | (mask_p[ 9] << 16) + | (mask_p[ 8] << 14) | (mask_p[ 7] << 12) + | (mask_p[ 6] << 10) | (mask_p[ 5] << 8) + | (mask_p[ 4] << 6) | (mask_p[ 3] << 4) + | (mask_p[ 2] << 2) | (mask_p[ 1] << 0); + OS_REG_WRITE(ah, AR_PHY_BIN_MASK2_1, tmp_mask); + OS_REG_WRITE(ah, AR_PHY_MASK2_P_15_01, tmp_mask); + + tmp_mask = (mask_p[30] << 28) + | (mask_p[29] << 26) | (mask_p[28] << 24) + | (mask_p[27] << 22) | (mask_p[26] << 20) + | (mask_p[25] << 18) | (mask_p[24] << 16) + | (mask_p[23] << 14) | (mask_p[22] << 12) + | (mask_p[21] << 10) | (mask_p[20] << 8) + | (mask_p[19] << 6) | (mask_p[18] << 4) + | (mask_p[17] << 2) | (mask_p[16] << 0); + OS_REG_WRITE(ah, AR_PHY_BIN_MASK2_2, tmp_mask); + OS_REG_WRITE(ah, AR_PHY_MASK2_P_30_16, tmp_mask); + + tmp_mask = (mask_p[45] << 28) + | (mask_p[44] << 26) | (mask_p[43] << 24) + | (mask_p[42] << 22) | (mask_p[41] << 20) + | (mask_p[40] << 18) | (mask_p[39] << 16) + | (mask_p[38] << 14) | (mask_p[37] << 12) + | (mask_p[36] << 10) | (mask_p[35] << 8) + | (mask_p[34] << 6) | (mask_p[33] << 4) + | (mask_p[32] << 2) | (mask_p[31] << 0); + OS_REG_WRITE(ah, AR_PHY_BIN_MASK2_3, tmp_mask); + OS_REG_WRITE(ah, AR_PHY_MASK2_P_45_31, tmp_mask); + + tmp_mask = (mask_p[61] << 30) | (mask_p[60] << 28) + | (mask_p[59] << 26) | (mask_p[58] << 24) + | (mask_p[57] << 22) | (mask_p[56] << 20) + | (mask_p[55] << 18) | (mask_p[54] << 16) + | (mask_p[53] << 14) | (mask_p[52] << 12) + | (mask_p[51] << 10) | (mask_p[50] << 8) + | (mask_p[49] << 6) | (mask_p[48] << 4) + | (mask_p[47] << 2) | (mask_p[46] << 0); + OS_REG_WRITE(ah, AR_PHY_BIN_MASK2_4, tmp_mask); + OS_REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask); +} + /* * Fill all software cached or static hardware state information. * Return failure if capabilities are to come from EEPROM and Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Thu Mar 12 17:32:04 2009 (r189746) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Thu Mar 12 18:18:28 2009 (r189747) @@ -27,9 +27,6 @@ #include "ar5416/ar5416.h" #include "ar5416/ar5416reg.h" #include "ar5416/ar5416phy.h" -#ifdef AH_SUPPORT_AR9280 -#include "ar5416/ar9280.h" -#endif /* Eeprom versioning macros. Returns true if the version is equal or newer than the ver specified */ #define EEP_MINOR(_ah) \ @@ -55,10 +52,6 @@ static HAL_BOOL ar5416SetTransmitPower(s static HAL_BOOL ar5416ChannelChange(struct ath_hal *, const struct ieee80211_channel *); #endif static void ar5416SetDeltaSlope(struct ath_hal *, const struct ieee80211_channel *); -static void ar5416SpurMitigate(struct ath_hal *ah, const struct ieee80211_channel *chan); -#ifdef AH_SUPPORT_AR9280 -static void ar9280SpurMitigate(struct ath_hal *ah, const struct ieee80211_channel *chan); -#endif static HAL_BOOL ar5416SetResetPowerOn(struct ath_hal *ah); static HAL_BOOL ar5416SetReset(struct ath_hal *ah, int type); @@ -120,11 +113,10 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO uint32_t saveDefAntenna, saveLedState; uint32_t macStaId1; uint16_t rfXpdGain[2]; - u_int modesIndex, freqIndex; HAL_STATUS ecode; - int i, regWrites = 0; uint32_t powerVal, rssiThrReg; uint32_t ackTpcPow, ctsTpcPow, chirpTpcPow; + int i; OS_MARK(ah, AH_MARK_RESET, bChannelChange); @@ -181,12 +173,6 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO (AR_MAC_LED_ASSOC | AR_MAC_LED_MODE | AR_MAC_LED_BLINK_THRESH_SEL | AR_MAC_LED_BLINK_SLOW); - /* - * Adjust gain parameters before reset if - * there's an outstanding gain updated. - */ - (void) ar5416GetRfgain(ah); - if (!ar5416ChipReset(ah, chan)) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__); FAIL(HAL_EIO); @@ -195,67 +181,12 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO /* Restore bmiss rssi & count thresholds */ OS_REG_WRITE(ah, AR_RSSI_THR, rssiThrReg); - /* Setup the indices for the next set of register array writes */ - /* XXX Ignore 11n dynamic mode on the AR5416 for the moment */ - if (IEEE80211_IS_CHAN_2GHZ(chan)) { - freqIndex = 2; - if (IEEE80211_IS_CHAN_HT40(chan)) - modesIndex = 3; - else if (IEEE80211_IS_CHAN_108G(chan)) - modesIndex = 5; - else - modesIndex = 4; - } else { - freqIndex = 1; - if (IEEE80211_IS_CHAN_HT40(chan) || - IEEE80211_IS_CHAN_TURBO(chan)) - modesIndex = 2; - else - modesIndex = 1; - } - OS_MARK(ah, AH_MARK_RESET_LINE, __LINE__); - /* Set correct Baseband to analog shift setting to access analog chips. */ - OS_REG_WRITE(ah, AR_PHY(0), 0x00000007); + AH5416(ah)->ah_writeIni(ah, chan); - /* - * Write addac shifts - */ - OS_REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_EXTERNAL_RADIO); -#if 0 - /* NB: only required for Sowl */ - ar5416EepromSetAddac(ah, chan); -#endif - regWrites = ath_hal_ini_write(ah, &AH5416(ah)->ah_ini_addac, 1, - regWrites); - OS_REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_INTERNAL_ADDAC); - - /* XXX Merlin ini fixups */ - /* XXX Merlin 100us delay for shift registers */ - regWrites = ath_hal_ini_write(ah, &ahp->ah_ini_modes, modesIndex, - regWrites); -#ifdef AH_SUPPORT_AR9280 - if (AR_SREV_MERLIN_20_OR_LATER(ah)) { - regWrites = ath_hal_ini_write(ah, &AH9280(ah)->ah_ini_rxgain, - modesIndex, regWrites); - regWrites = ath_hal_ini_write(ah, &AH9280(ah)->ah_ini_txgain, - modesIndex, regWrites); - } -#endif - /* XXX Merlin 100us delay for shift registers */ - regWrites = ath_hal_ini_write(ah, &ahp->ah_ini_common, 1, regWrites); /* Setup 11n MAC/Phy mode registers */ ar5416Set11nRegs(ah, chan); - /* XXX updated regWrites? */ - ahp->ah_rfHal->writeRegs(ah, modesIndex, freqIndex, regWrites); -#ifdef AH_SUPPORT_AR9280 - if (AR_SREV_MERLIN_20(ah) && IS_5GHZ_FAST_CLOCK_EN(ah, chan)) { - /* 5GHz channels w/ Fast Clock use different modal values */ - regWrites = ath_hal_ini_write(ah, &AH9280(ah)->ah_ini_xmodes, - modesIndex, regWrites); - } -#endif OS_MARK(ah, AH_MARK_RESET_LINE, __LINE__); @@ -300,7 +231,8 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO } /* Write the analog registers */ - if (!ahp->ah_rfHal->setRfRegs(ah, chan, freqIndex, rfXpdGain)) { + if (!ahp->ah_rfHal->setRfRegs(ah, chan, + IEEE80211_IS_CHAN_2GHZ(chan) ? 2: 1, rfXpdGain)) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: ar5212SetRfRegs failed\n", __func__); FAIL(HAL_EIO); @@ -310,12 +242,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO if (IEEE80211_IS_CHAN_OFDM(chan)|| IEEE80211_IS_CHAN_HT(chan)) ar5416SetDeltaSlope(ah, chan); -#ifdef AH_SUPPORT_AR9280 - if (AR_SREV_MERLIN_10_OR_LATER(ah)) - ar9280SpurMitigate(ah, chan); - else -#endif - ar5416SpurMitigate(ah, chan); + AH5416(ah)->ah_spurMitigate(ah, chan); /* Setup board specific options for EEPROM version 3 */ if (!ar5416SetBoardValues(ah, chan)) { @@ -677,8 +604,6 @@ ar5416InitUserSettings(struct ath_hal *a HAL_BOOL ar5416ChipReset(struct ath_hal *ah, const struct ieee80211_channel *chan) { - uint32_t rfMode = 0; - OS_MARK(ah, AH_MARK_CHIPRESET, chan ? chan->ic_freq : 0); /* * Warm reset is optimistic. @@ -705,9 +630,11 @@ ar5416ChipReset(struct ath_hal *ah, cons * radio device. */ if (chan != AH_NULL) { + uint32_t rfMode; + /* treat channel B as channel G , no B mode suport in owl */ - rfMode |= IEEE80211_IS_CHAN_CCK(chan) ? - AR_PHY_MODE_DYNAMIC : AR_PHY_MODE_OFDM; + rfMode = IEEE80211_IS_CHAN_CCK(chan) ? + AR_PHY_MODE_DYNAMIC : AR_PHY_MODE_OFDM; if (AR_SREV_MERLIN_20(ah) && IS_5GHZ_FAST_CLOCK_EN(ah, chan)) { /* phy mode bits for 5GHz channels require Fast Clock */ rfMode |= AR_PHY_MODE_DYNAMIC @@ -804,558 +731,6 @@ ar5416SetDeltaSlope(struct ath_hal *ah, } /* - * Convert to baseband spur frequency given input channel frequency - * and compute register settings below. - */ -#define SPUR_RSSI_THRESH 40 - -static void -ar5416SpurMitigate(struct ath_hal *ah, const struct ieee80211_channel *chan) -{ - uint16_t freq = ath_hal_gethwchannel(ah, chan); - static const int pilot_mask_reg[4] = { AR_PHY_TIMING7, AR_PHY_TIMING8, - AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60 }; - static const int chan_mask_reg[4] = { AR_PHY_TIMING9, AR_PHY_TIMING10, - AR_PHY_CHANNEL_MASK_01_30, AR_PHY_CHANNEL_MASK_31_60 }; - static const int inc[4] = { 0, 100, 0, 0 }; - - int bb_spur = AR_NO_SPUR; - int bin, cur_bin; - int spur_freq_sd; - int spur_delta_phase; - int denominator; - int upper, lower, cur_vit_mask; - int tmp, new; - int i; - - int8_t mask_m[123]; - int8_t mask_p[123]; - int8_t mask_amt; - int tmp_mask; - int cur_bb_spur; - HAL_BOOL is2GHz = IEEE80211_IS_CHAN_2GHZ(chan); - - OS_MEMZERO(mask_m, sizeof(mask_m)); - OS_MEMZERO(mask_p, sizeof(mask_p)); - - /* - * Need to verify range +/- 9.5 for static ht20, otherwise spur - * is out-of-band and can be ignored. - */ - /* XXX ath9k changes */ - for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) { - cur_bb_spur = ath_hal_getSpurChan(ah, i, is2GHz); - if (AR_NO_SPUR == cur_bb_spur) - break; - cur_bb_spur = cur_bb_spur - (freq * 10); - if ((cur_bb_spur > -95) && (cur_bb_spur < 95)) { - bb_spur = cur_bb_spur; - break; - } - } - if (AR_NO_SPUR == bb_spur) - return; - - bin = bb_spur * 32; - - tmp = OS_REG_READ(ah, AR_PHY_TIMING_CTRL4_CHAIN(0)); - new = tmp | (AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI | - AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER | - AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK | - AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK); - - OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4_CHAIN(0), new); - - new = (AR_PHY_SPUR_REG_MASK_RATE_CNTL | - AR_PHY_SPUR_REG_ENABLE_MASK_PPM | - AR_PHY_SPUR_REG_MASK_RATE_SELECT | - AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI | - SM(SPUR_RSSI_THRESH, AR_PHY_SPUR_REG_SPUR_RSSI_THRESH)); - OS_REG_WRITE(ah, AR_PHY_SPUR_REG, new); - /* - * Should offset bb_spur by +/- 10 MHz for dynamic 2040 MHz - * config, no offset for HT20. - * spur_delta_phase = bb_spur/40 * 2**21 for static ht20, - * /80 for dyn2040. - */ - spur_delta_phase = ((bb_spur * 524288) / 100) & - AR_PHY_TIMING11_SPUR_DELTA_PHASE; - /* - * in 11A mode the denominator of spur_freq_sd should be 40 and - * it should be 44 in 11G - */ - denominator = IEEE80211_IS_CHAN_2GHZ(chan) ? 440 : 400; - spur_freq_sd = ((bb_spur * 2048) / denominator) & 0x3ff; - - new = (AR_PHY_TIMING11_USE_SPUR_IN_AGC | - SM(spur_freq_sd, AR_PHY_TIMING11_SPUR_FREQ_SD) | - SM(spur_delta_phase, AR_PHY_TIMING11_SPUR_DELTA_PHASE)); - OS_REG_WRITE(ah, AR_PHY_TIMING11, new); - - - /* - * ============================================ - * pilot mask 1 [31:0] = +6..-26, no 0 bin - * pilot mask 2 [19:0] = +26..+7 - * - * channel mask 1 [31:0] = +6..-26, no 0 bin - * channel mask 2 [19:0] = +26..+7 - */ - //cur_bin = -26; - cur_bin = -6000; - upper = bin + 100; - lower = bin - 100; - - for (i = 0; i < 4; i++) { - int pilot_mask = 0; - int chan_mask = 0; - int bp = 0; - for (bp = 0; bp < 30; bp++) { - if ((cur_bin > lower) && (cur_bin < upper)) { - pilot_mask = pilot_mask | 0x1 << bp; - chan_mask = chan_mask | 0x1 << bp; - } - cur_bin += 100; - } - cur_bin += inc[i]; - OS_REG_WRITE(ah, pilot_mask_reg[i], pilot_mask); - OS_REG_WRITE(ah, chan_mask_reg[i], chan_mask); - } - - /* ================================================= - * viterbi mask 1 based on channel magnitude - * four levels 0-3 - * - mask (-27 to 27) (reg 64,0x9900 to 67,0x990c) - * [1 2 2 1] for -9.6 or [1 2 1] for +16 - * - enable_mask_ppm, all bins move with freq - * - * - mask_select, 8 bits for rates (reg 67,0x990c) - * - mask_rate_cntl, 8 bits for rates (reg 67,0x990c) - * choose which mask to use mask or mask2 - */ - - /* - * viterbi mask 2 2nd set for per data rate puncturing - * four levels 0-3 - * - mask_select, 8 bits for rates (reg 67) - * - mask (-27 to 27) (reg 98,0x9988 to 101,0x9994) - * [1 2 2 1] for -9.6 or [1 2 1] for +16 - */ - cur_vit_mask = 6100; - upper = bin + 120; - lower = bin - 120; - - for (i = 0; i < 123; i++) { - if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) { - if ((abs(cur_vit_mask - bin)) < 75) { - mask_amt = 1; - } else { - mask_amt = 0; - } - if (cur_vit_mask < 0) { - mask_m[abs(cur_vit_mask / 100)] = mask_amt; - } else { - mask_p[cur_vit_mask / 100] = mask_amt; - } - } - cur_vit_mask -= 100; - } - - tmp_mask = (mask_m[46] << 30) | (mask_m[47] << 28) - | (mask_m[48] << 26) | (mask_m[49] << 24) - | (mask_m[50] << 22) | (mask_m[51] << 20) - | (mask_m[52] << 18) | (mask_m[53] << 16) - | (mask_m[54] << 14) | (mask_m[55] << 12) - | (mask_m[56] << 10) | (mask_m[57] << 8) - | (mask_m[58] << 6) | (mask_m[59] << 4) - | (mask_m[60] << 2) | (mask_m[61] << 0); - OS_REG_WRITE(ah, AR_PHY_BIN_MASK_1, tmp_mask); - OS_REG_WRITE(ah, AR_PHY_VIT_MASK2_M_46_61, tmp_mask); - - tmp_mask = (mask_m[31] << 28) - | (mask_m[32] << 26) | (mask_m[33] << 24) - | (mask_m[34] << 22) | (mask_m[35] << 20) - | (mask_m[36] << 18) | (mask_m[37] << 16) - | (mask_m[48] << 14) | (mask_m[39] << 12) - | (mask_m[40] << 10) | (mask_m[41] << 8) - | (mask_m[42] << 6) | (mask_m[43] << 4) - | (mask_m[44] << 2) | (mask_m[45] << 0); - OS_REG_WRITE(ah, AR_PHY_BIN_MASK_2, tmp_mask); - OS_REG_WRITE(ah, AR_PHY_MASK2_M_31_45, tmp_mask); - - tmp_mask = (mask_m[16] << 30) | (mask_m[16] << 28) - | (mask_m[18] << 26) | (mask_m[18] << 24) - | (mask_m[20] << 22) | (mask_m[20] << 20) - | (mask_m[22] << 18) | (mask_m[22] << 16) - | (mask_m[24] << 14) | (mask_m[24] << 12) - | (mask_m[25] << 10) | (mask_m[26] << 8) - | (mask_m[27] << 6) | (mask_m[28] << 4) - | (mask_m[29] << 2) | (mask_m[30] << 0); - OS_REG_WRITE(ah, AR_PHY_BIN_MASK_3, tmp_mask); - OS_REG_WRITE(ah, AR_PHY_MASK2_M_16_30, tmp_mask); - - tmp_mask = (mask_m[ 0] << 30) | (mask_m[ 1] << 28) - | (mask_m[ 2] << 26) | (mask_m[ 3] << 24) - | (mask_m[ 4] << 22) | (mask_m[ 5] << 20) - | (mask_m[ 6] << 18) | (mask_m[ 7] << 16) - | (mask_m[ 8] << 14) | (mask_m[ 9] << 12) - | (mask_m[10] << 10) | (mask_m[11] << 8) - | (mask_m[12] << 6) | (mask_m[13] << 4) - | (mask_m[14] << 2) | (mask_m[15] << 0); - OS_REG_WRITE(ah, AR_PHY_MASK_CTL, tmp_mask); - OS_REG_WRITE(ah, AR_PHY_MASK2_M_00_15, tmp_mask); - - tmp_mask = (mask_p[15] << 28) - | (mask_p[14] << 26) | (mask_p[13] << 24) - | (mask_p[12] << 22) | (mask_p[11] << 20) - | (mask_p[10] << 18) | (mask_p[ 9] << 16) - | (mask_p[ 8] << 14) | (mask_p[ 7] << 12) - | (mask_p[ 6] << 10) | (mask_p[ 5] << 8) - | (mask_p[ 4] << 6) | (mask_p[ 3] << 4) - | (mask_p[ 2] << 2) | (mask_p[ 1] << 0); - OS_REG_WRITE(ah, AR_PHY_BIN_MASK2_1, tmp_mask); - OS_REG_WRITE(ah, AR_PHY_MASK2_P_15_01, tmp_mask); - - tmp_mask = (mask_p[30] << 28) - | (mask_p[29] << 26) | (mask_p[28] << 24) - | (mask_p[27] << 22) | (mask_p[26] << 20) - | (mask_p[25] << 18) | (mask_p[24] << 16) - | (mask_p[23] << 14) | (mask_p[22] << 12) - | (mask_p[21] << 10) | (mask_p[20] << 8) - | (mask_p[19] << 6) | (mask_p[18] << 4) - | (mask_p[17] << 2) | (mask_p[16] << 0); - OS_REG_WRITE(ah, AR_PHY_BIN_MASK2_2, tmp_mask); - OS_REG_WRITE(ah, AR_PHY_MASK2_P_30_16, tmp_mask); - - tmp_mask = (mask_p[45] << 28) - | (mask_p[44] << 26) | (mask_p[43] << 24) - | (mask_p[42] << 22) | (mask_p[41] << 20) - | (mask_p[40] << 18) | (mask_p[39] << 16) - | (mask_p[38] << 14) | (mask_p[37] << 12) - | (mask_p[36] << 10) | (mask_p[35] << 8) - | (mask_p[34] << 6) | (mask_p[33] << 4) - | (mask_p[32] << 2) | (mask_p[31] << 0); - OS_REG_WRITE(ah, AR_PHY_BIN_MASK2_3, tmp_mask); - OS_REG_WRITE(ah, AR_PHY_MASK2_P_45_31, tmp_mask); - - tmp_mask = (mask_p[61] << 30) | (mask_p[60] << 28) - | (mask_p[59] << 26) | (mask_p[58] << 24) - | (mask_p[57] << 22) | (mask_p[56] << 20) - | (mask_p[55] << 18) | (mask_p[54] << 16) - | (mask_p[53] << 14) | (mask_p[52] << 12) - | (mask_p[51] << 10) | (mask_p[50] << 8) - | (mask_p[49] << 6) | (mask_p[48] << 4) - | (mask_p[47] << 2) | (mask_p[46] << 0); - OS_REG_WRITE(ah, AR_PHY_BIN_MASK2_4, tmp_mask); - OS_REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask); -} - -#ifdef AH_SUPPORT_AR9280 -#define AR_BASE_FREQ_2GHZ 2300 -#define AR_BASE_FREQ_5GHZ 4900 -#define AR_SPUR_FEEQ_BOUND_HT40 19 -#define AR_SPUR_FEEQ_BOUND_HT20 10 - -static void -ar9280SpurMitigate(struct ath_hal *ah, const struct ieee80211_channel *chan) -{ - static const int pilot_mask_reg[4] = { AR_PHY_TIMING7, AR_PHY_TIMING8, - AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60 }; - static const int chan_mask_reg[4] = { AR_PHY_TIMING9, AR_PHY_TIMING10, - AR_PHY_CHANNEL_MASK_01_30, AR_PHY_CHANNEL_MASK_31_60 }; - static int inc[4] = { 0, 100, 0, 0 }; - - int bb_spur = AR_NO_SPUR; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 18:26:54 2009 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 14E451065670; Thu, 12 Mar 2009 18:26:54 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id DEB0D8FC0C; Thu, 12 Mar 2009 18:26:53 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n2CIQrtu043764 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 Mar 2009 11:26:53 -0700 (PDT) (envelope-from sam@freebsd.org) Message-ID: <49B953ED.9080104@freebsd.org> Date: Thu, 12 Mar 2009 11:26:53 -0700 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.18 (X11/20081209) MIME-Version: 1.0 To: src-committers@freebsd.org References: <200903121818.n2CIISdh037384@svn.freebsd.org> In-Reply-To: <200903121818.n2CIISdh037384@svn.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC--Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r189747 - in head/sys: conf dev/ath/ath_hal/ar5416 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 Mar 2009 18:26:54 -0000 Sam Leffler wrote: > Author: sam > Date: Thu Mar 12 18:18:28 2009 > New Revision: 189747 > URL: http://svn.freebsd.org/changeset/base/189747 > > Log: > preliminary ar9280 support: > Several things to note: 1. This is legacy only (no 11n) 2. This is VERY preliminary code; tested only in sta+monitor mode and I see complaints about BB hangs (also see them w/ 9160) that likely indicate a bug 3. Tested only w/ a v2 merlin card 4. There is no support for things like open loop power control Folks can help by comparing code to the linux ath9k driver. It is unlikely I'll be touching this stuff as I have only 1 card and it's sitting in an extender so rarely used. If someone can scrounge me a 9285 part it would be good to get it supported too. Thanks to ixSystems for sending me this card. Sam From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 18:59:40 2009 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 3075C106564A; Thu, 12 Mar 2009 18:59:40 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 124138FC1C; Thu, 12 Mar 2009 18:59:40 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CIxdXY038299; Thu, 12 Mar 2009 18:59:39 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CIxdJM038298; Thu, 12 Mar 2009 18:59:39 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200903121859.n2CIxdJM038298@svn.freebsd.org> From: Rui Paulo Date: Thu, 12 Mar 2009 18:59: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: r189748 - head/sys/dev/k8temp 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 Mar 2009 18:59:41 -0000 Author: rpaulo Date: Thu Mar 12 18:59:39 2009 New Revision: 189748 URL: http://svn.freebsd.org/changeset/base/189748 Log: Add support for 10h and 11h family of processors. Also, make the sysctl look like a temperature. This driver will most likely be renamed to something more meaningful in the near future. Submitted by: nork MFC after: 2 weeks Modified: head/sys/dev/k8temp/k8temp.c Modified: head/sys/dev/k8temp/k8temp.c ============================================================================== --- head/sys/dev/k8temp/k8temp.c Thu Mar 12 18:18:28 2009 (r189747) +++ head/sys/dev/k8temp/k8temp.c Thu Mar 12 18:59:39 2009 (r189748) @@ -48,6 +48,15 @@ __FBSDID("$FreeBSD$"); #include #include +typedef enum { + SENSOR0_CORE0, + SENSOR0_CORE1, + SENSOR1_CORE0, + SENSOR1_CORE1, + CORE0, + CORE1 +} k8sensor_t; + struct k8temp_softc { device_t sc_dev; int sc_temps[4]; @@ -55,36 +64,38 @@ struct k8temp_softc { struct sysctl_oid *sc_oid; struct sysctl_oid *sc_sysctl_cpu[2]; struct intr_config_hook sc_ich; + int32_t (*sc_gettemp)(device_t, k8sensor_t); }; #define VENDORID_AMD 0x1022 -#define DEVICEID_AMD_MISC 0x1103 +#define DEVICEID_AMD_MISC0F 0x1103 +#define DEVICEID_AMD_MISC10 0x1203 +#define DEVICEID_AMD_MISC11 0x1303 static struct k8temp_product { uint16_t k8temp_vendorid; uint16_t k8temp_deviceid; } k8temp_products[] = { - { VENDORID_AMD, DEVICEID_AMD_MISC }, + { VENDORID_AMD, DEVICEID_AMD_MISC0F }, + { VENDORID_AMD, DEVICEID_AMD_MISC10 }, + { VENDORID_AMD, DEVICEID_AMD_MISC11 }, { 0, 0 } }; /* * Register control */ -#define K8TEMP_REG 0xe4 +#define K8TEMP_REG0F 0xe4 #define K8TEMP_REG_SELSENSOR 0x40 #define K8TEMP_REG_SELCORE 0x04 -#define K8TEMP_MINTEMP 49 /* -49 C is the mininum temperature */ +#define K8TEMP_REG 0xa4 -typedef enum { - SENSOR0_CORE0, - SENSOR0_CORE1, - SENSOR1_CORE0, - SENSOR1_CORE1, - CORE0, - CORE1 -} k8sensor_t; +#define TZ_ZEROC 2732 + + /* -49 C is the mininum temperature */ +#define K8TEMP_OFFSET0F (TZ_ZEROC-490) +#define K8TEMP_OFFSET (TZ_ZEROC) /* * Device methods. @@ -95,6 +106,7 @@ static int k8temp_attach(device_t dev); static void k8temp_intrhook(void *arg); static int k8temp_detach(device_t dev); static int k8temp_match(device_t dev); +static int32_t k8temp_gettemp0f(device_t dev, k8sensor_t sensor); static int32_t k8temp_gettemp(device_t dev, k8sensor_t sensor); static int k8temp_sysctl(SYSCTL_HANDLER_ARGS); @@ -193,6 +205,13 @@ k8temp_attach(device_t dev) return (ENXIO); } + if (pci_get_device(dev) == DEVICEID_AMD_MISC0F) + sc->sc_gettemp = k8temp_gettemp0f; + else { + sc->sc_gettemp = k8temp_gettemp; + return (0); + } + /* * dev.k8temp.N tree. */ @@ -204,13 +223,13 @@ k8temp_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR0_CORE0, k8temp_sysctl, "I", + dev, SENSOR0_CORE0, k8temp_sysctl, "IK", "Sensor 0 / Core 0 temperature"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR0_CORE1, k8temp_sysctl, "I", + dev, SENSOR0_CORE1, k8temp_sysctl, "IK", "Sensor 0 / Core 1 temperature"); sysctlnode = SYSCTL_ADD_NODE(sysctlctx, @@ -220,13 +239,13 @@ k8temp_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR1_CORE0, k8temp_sysctl, "I", + dev, SENSOR1_CORE0, k8temp_sysctl, "IK", "Sensor 1 / Core 0 temperature"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR1_CORE1, k8temp_sysctl, "I", + dev, SENSOR1_CORE1, k8temp_sysctl, "IK", "Sensor 1 / Core 1 temperature"); return (0); @@ -258,7 +277,7 @@ k8temp_intrhook(void *arg) sc->sc_sysctl_cpu[i] = SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(device_get_sysctl_tree(cpu)), OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, - dev, CORE0, k8temp_sysctl, "I", + dev, CORE0, k8temp_sysctl, "IK", "Max of sensor 0 / 1"); } } @@ -285,22 +304,23 @@ static int k8temp_sysctl(SYSCTL_HANDLER_ARGS) { device_t dev = (device_t) arg1; + struct k8temp_softc *sc = device_get_softc(dev); int error; int32_t temp, auxtemp[2]; switch (arg2) { case CORE0: - auxtemp[0] = k8temp_gettemp(dev, SENSOR0_CORE0); - auxtemp[1] = k8temp_gettemp(dev, SENSOR1_CORE0); + auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE0); + auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE0); temp = imax(auxtemp[0], auxtemp[1]); break; case CORE1: - auxtemp[0] = k8temp_gettemp(dev, SENSOR0_CORE1); - auxtemp[1] = k8temp_gettemp(dev, SENSOR1_CORE1); + auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE1); + auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE1); temp = imax(auxtemp[0], auxtemp[1]); break; default: - temp = k8temp_gettemp(dev, arg2); + temp = sc->sc_gettemp(dev, arg2); break; } error = sysctl_handle_int(oidp, &temp, 0, req); @@ -309,12 +329,12 @@ k8temp_sysctl(SYSCTL_HANDLER_ARGS) } static int32_t -k8temp_gettemp(device_t dev, k8sensor_t sensor) +k8temp_gettemp0f(device_t dev, k8sensor_t sensor) { uint8_t cfg; uint32_t temp; - cfg = pci_read_config(dev, K8TEMP_REG, 1); + cfg = pci_read_config(dev, K8TEMP_REG0F, 1); switch (sensor) { case SENSOR0_CORE0: cfg &= ~(K8TEMP_REG_SELSENSOR | K8TEMP_REG_SELCORE); @@ -334,9 +354,20 @@ k8temp_gettemp(device_t dev, k8sensor_t cfg = 0; break; } - pci_write_config(dev, K8TEMP_REG, cfg, 1); - temp = pci_read_config(dev, K8TEMP_REG, 4); - temp = ((temp >> 16) & 0xff) - K8TEMP_MINTEMP; + pci_write_config(dev, K8TEMP_REG0F, cfg, 1); + temp = pci_read_config(dev, K8TEMP_REG0F, 4); + temp = ((temp >> 16) & 0xff) * 10 + K8TEMP_OFFSET0F; return (temp); } + +static int32_t +k8temp_gettemp(device_t dev, k8sensor_t sensor) +{ + uint32_t temp; + + temp = pci_read_config(dev, K8TEMP_REG, 4); + temp = ((temp >> 21) & 0x3ff) * 10 / 8 + K8TEMP_OFFSET; + + return (temp); +} From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 19:54:50 2009 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 DC7501065670; Thu, 12 Mar 2009 19:54:50 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id A7DB98FC19; Thu, 12 Mar 2009 19:54:50 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 4E8862C2A8E; Thu, 12 Mar 2009 14:29:01 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id JqjAvPqwkwc6; Thu, 12 Mar 2009 14:28:53 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 17EA32C2ACE; Thu, 12 Mar 2009 14:28:53 -0500 (CDT) Message-ID: <49B96273.90008@cs.rice.edu> Date: Thu, 12 Mar 2009 14:28:51 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.19 (X11/20090124) MIME-Version: 1.0 To: John Baldwin References: <200903091935.n29JZL3d035574@svn.freebsd.org> <200903091555.53181.jhb@freebsd.org> In-Reply-To: <200903091555.53181.jhb@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: r189595 - in head/sys: kern sys ufs/ffs 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: Thu, 12 Mar 2009 19:54:51 -0000 John Baldwin wrote: > On Monday 09 March 2009 3:35:20 pm John Baldwin wrote: > >> Author: jhb >> Date: Mon Mar 9 19:35:20 2009 >> New Revision: 189595 >> URL: http://svn.freebsd.org/changeset/base/189595 >> >> Log: >> Adjust some variables (mostly related to the buffer cache) that hold >> address space sizes to be longs instead of ints. Specifically, the follow >> values are now longs: runningbufspace, bufspace, maxbufspace, >> bufmallocspace, maxbufmallocspace, lobufspace, hibufspace, lorunningspace, >> hirunningspace, maxswzone, maxbcache, and maxpipekva. Previously, a >> relatively small number (~ 44000) of buffers set in kern.nbuf would result >> in integer overflows resulting either in hangs or bogus values of >> hidirtybuffers and lodirtybuffers. Now one has to overflow a long to see >> such problems. There was a check for a nbuf setting that would cause >> overflows in the auto-tuning of nbuf. I've changed it to always check and >> cap nbuf but warn if a user-supplied tunable would cause overflow. >> >> Note that this changes the ABI of several sysctls that are used by things >> like top(1), etc., so any MFC would probably require a some gross shims >> to allow for that. >> >> MFC after: 1 month >> > > I was able to boot with kern.nbuf=132000 with a buffer cache a little over 2GB > with this change on amd64 (thanks to Alan's changes to bump the kernel_map to > 6GB). It gave this layout for kernel_map: > > (kgdb) kvm > fffffffe40000000 - fffffffe40012000 kmem_alloc() / contigmalloc() > fffffffe40012000 - fffffffe4003c000 AP stacks > fffffffe4003c000 - fffffffe400f5000 kmem_alloc_nofault() (kstack/mapdev) > fffffffe400f5000 - fffffffe40200000 kmem_alloc() / contigmalloc() > fffffffe40200000 - fffffffee5565000 kmem_map > fffffffee5565000 - fffffffee56e20a0 callouts > fffffffee56e20a0 - fffffffee57078a0 swbuf > fffffffee57078a0 - fffffffeea290000 buf > fffffffeea290000 - ffffffff6d110000 buffer_map + pager_map > ffffffff6d110000 - ffffffff6d540000 exec_map > ffffffff6d540000 - ffffffff7596b000 pipe_map > ffffffff7596b000 - ffffffff7777d000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7777d000 - ffffffff7aab7000 kmem_alloc() / contigmalloc() > ffffffff7aab7000 - ffffffff7aada000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7aada000 - ffffffff7b6da000 kmem_alloc() / contigmalloc() > ffffffff7b6da000 - ffffffff7b6fd000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7b6fd000 - ffffffff7b883000 kmem_alloc() / contigmalloc() > ffffffff7b883000 - ffffffff7b888000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7b888000 - ffffffff7ba0e000 kmem_alloc() / contigmalloc() > ffffffff7ba0e000 - ffffffff7ba13000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7ba13000 - ffffffff7bb99000 kmem_alloc() / contigmalloc() > ffffffff7bb99000 - ffffffff7bb9e000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7bb9e000 - ffffffff7bd24000 kmem_alloc() / contigmalloc() > ffffffff7bd24000 - ffffffff7bd29000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7bd29000 - ffffffff7bf13000 kmem_alloc() / contigmalloc() > ffffffff7bf13000 - ffffffff7bf22000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7bf22000 - ffffffff7bf2c000 kmem_alloc() / contigmalloc() > ffffffff7bf2c000 - ffffffff7bf9d000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7bf9d000 - ffffffff7bfc5000 kmem_alloc() / contigmalloc() > ffffffff7bfc5000 - ffffffff7c146000 kmem_alloc_nofault() (kstack/mapdev) > ffffffff7c146000 - ffffffff80000000 ---- > ffffffff80000000 - ffffffff80dd2c88 text/data/bss > ffffffff80dd2c88 - ffffffff8639a000 bootstrap data > ffffffff8639a000 - ffffffff86400000 ---- > > As far as an ABI fixup, I imagine that will involve having a hack where there > is a new flag that sysctl_handle_long() checks and will truncate a value if > the flag is set (CTLFLAG_INTABI or some such) and req->oldlen is sizeof(int) > < sizeof(long) rather than failing. > > We should try to segregate the kmem_alloc() allocations from the others. Mingling them with the others, makes it less likely that superpages are used. Alan From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 20:25:18 2009 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 8BDD51065675; Thu, 12 Mar 2009 20:25:18 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206045082.chello.pl [87.206.45.82]) by mx1.freebsd.org (Postfix) with ESMTP id 196D08FC16; Thu, 12 Mar 2009 20:25:18 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 7E51B45685; Thu, 12 Mar 2009 21:03:53 +0100 (CET) Received: from localhost (chello087206045082.chello.pl [87.206.45.82]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id BCFC145683; Thu, 12 Mar 2009 21:03:47 +0100 (CET) Date: Thu, 12 Mar 2009 21:04:26 +0100 From: Pawel Jakub Dawidek To: Guido van Rooij Message-ID: <20090312200425.GB1786@garage.freebsd.pl> References: <200903101519.n2AFJovP065743@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EuxKj2iCbKjpUGkD" Content-Disposition: inline In-Reply-To: <200903101519.n2AFJovP065743@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189624 - 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: Thu, 12 Mar 2009 20:25:19 -0000 --EuxKj2iCbKjpUGkD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 10, 2009 at 03:19:50PM +0000, Guido van Rooij wrote: > Author: guido > Date: Tue Mar 10 15:19:49 2009 > New Revision: 189624 > URL: http://svn.freebsd.org/changeset/base/189624 >=20 > Log: > When swap resides on a mirror and it is not stopped, the mirror > is degraded upon the next reboot and will have to be rebuild. > Thus call swapoff when rebooting (read: when stopping swap1) Others already explained the problem with this commit. I'll only add that gmirror providers used only for swap should be created with -F flag, which tells gmirror that there is no need to rebuild those. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --EuxKj2iCbKjpUGkD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFJuWrJForvXbEpPzQRAiUhAKC2lEnlqgfV2wI5O9fPOGa8nirNoQCeKX87 eJ0EE5FATsaWMtn6nvFMhgM= =jALn -----END PGP SIGNATURE----- --EuxKj2iCbKjpUGkD-- From owner-svn-src-head@FreeBSD.ORG Thu Mar 12 20:41:53 2009 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 09A73106564A; Thu, 12 Mar 2009 20:41:53 +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 EB2A68FC1F; Thu, 12 Mar 2009 20:41:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2CKfqPS040185; Thu, 12 Mar 2009 20:41:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2CKfq2S040183; Thu, 12 Mar 2009 20:41:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903122041.n2CKfq2S040183@svn.freebsd.org> From: John Baldwin Date: Thu, 12 Mar 2009 20:41: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: r189749 - head/sys/boot/i386/libi386 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 Mar 2009 20:41:53 -0000 Author: jhb Date: Thu Mar 12 20:41:52 2009 New Revision: 189749 URL: http://svn.freebsd.org/changeset/base/189749 Log: The recent change to use memory > 1MB for the heap by default broke CD booting because the CD driver did not use bounce buffers to ensure request buffers sent to the BIOS were always in the first 1MB. Copy over the bounce buffer logic from the BIOS disk driver (minus the 64k boundary code for floppies) to fix this. Reported by: kensmith Modified: head/sys/boot/i386/libi386/bioscd.c head/sys/boot/i386/libi386/biosdisk.c head/sys/boot/i386/libi386/libi386.h Modified: head/sys/boot/i386/libi386/bioscd.c ============================================================================== --- head/sys/boot/i386/libi386/bioscd.c Thu Mar 12 18:59:39 2009 (r189748) +++ head/sys/boot/i386/libi386/bioscd.c Thu Mar 12 20:41:52 2009 (r189749) @@ -173,9 +173,9 @@ bc_add(int biosdev) static void bc_print(int verbose) { - int i; char line[80]; - + int i; + for (i = 0; i < nbcinfo; i++) { sprintf(line, " cd%d: Device 0x%x\n", i, bcinfo[i].bc_sp.sp_devicespec); @@ -235,7 +235,7 @@ bc_strategy(void *devdata, int rw, daddr if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0) return (EINVAL); dblk /= (BIOSCD_SECSIZE / DEV_BSIZE); - DEBUG("read %d from %d to %p", blks, dblk, buf); + DEBUG("read %d from %lld to %p", blks, dblk, buf); if (rsize) *rsize = 0; @@ -244,9 +244,9 @@ bc_strategy(void *devdata, int rw, daddr return (EIO); } #ifdef BD_SUPPORT_FRAGS - DEBUG("bc_strategy: frag read %d from %d+%d to %p", + DEBUG("frag read %d from %lld+%d to %p", fragsize, dblk, blks, buf + (blks * BIOSCD_SECSIZE)); - if (fragsize && bc_read(unit, dblk + blks, 1, fragsize)) { + if (fragsize && bc_read(unit, dblk + blks, 1, fragbuf)) { DEBUG("frag read error"); return(EIO); } @@ -257,11 +257,15 @@ bc_strategy(void *devdata, int rw, daddr return (0); } +/* Max number of sectors to bounce-buffer at a time. */ +#define CD_BOUNCEBUF 8 + static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest) { - u_int result, retry; - static unsigned short packet[8]; + u_int maxfer, resid, result, retry, x; + caddr_t bbuf, p, xp; + static struct edd_packet packet; int biosdev; #ifdef DISK_DEBUG int error; @@ -275,47 +279,77 @@ bc_read(int unit, daddr_t dblk, int blks if (blks == 0) return (0); + /* Decide whether we have to bounce */ + if (VTOP(dest) >> 20 != 0) { + /* + * The destination buffer is above first 1MB of + * physical memory so we have to arrange a suitable + * bounce buffer. + */ + x = min(CD_BOUNCEBUF, (unsigned)blks); + bbuf = alloca(x * BIOSCD_SECSIZE); + maxfer = x; + } else { + bbuf = NULL; + maxfer = 0; + } + biosdev = bc_unit2bios(unit); - /* - * Loop retrying the operation a couple of times. The BIOS - * may also retry. - */ - for (retry = 0; retry < 3; retry++) { - /* If retrying, reset the drive */ - if (retry > 0) { + resid = blks; + p = dest; + + while (resid > 0) { + if (bbuf) + xp = bbuf; + else + xp = p; + x = resid; + if (maxfer > 0) + x = min(x, maxfer); + + /* + * Loop retrying the operation a couple of times. The BIOS + * may also retry. + */ + for (retry = 0; retry < 3; retry++) { + /* If retrying, reset the drive */ + if (retry > 0) { + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0; + v86.edx = biosdev; + v86int(); + } + + packet.len = 0x10; + packet.count = x; + packet.offset = VTOPOFF(xp); + packet.seg = VTOPSEG(xp); + packet.lba = dblk; v86.ctl = V86_FLAGS; v86.addr = 0x13; - v86.eax = 0; + v86.eax = 0x4200; v86.edx = biosdev; + v86.ds = VTOPSEG(&packet); + v86.esi = VTOPOFF(&packet); v86int(); + result = (v86.efl & PSL_C); + if (result == 0) + break; } - - packet[0] = 0x10; - packet[1] = blks; - packet[2] = VTOPOFF(dest); - packet[3] = VTOPSEG(dest); - packet[4] = dblk & 0xffff; - packet[5] = dblk >> 16; - packet[6] = 0; - packet[7] = 0; - v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x4200; - v86.edx = biosdev; - v86.ds = VTOPSEG(packet); - v86.esi = VTOPOFF(packet); - v86int(); - result = (v86.efl & PSL_C); - if (result == 0) - break; - } #ifdef DISK_DEBUG - error = (v86.eax >> 8) & 0xff; + error = (v86.eax >> 8) & 0xff; #endif - DEBUG("%d sectors from %ld to %p (0x%x) %s", blks, dblk, dest, - VTOP(dest), result ? "failed" : "ok"); - DEBUG("unit %d status 0x%x", unit, error); + DEBUG("%d sectors from %lld to %p (0x%x) %s", x, dblk, p, + VTOP(p), result ? "failed" : "ok"); + DEBUG("unit %d status 0x%x", unit, error); + if (bbuf != NULL) + bcopy(bbuf, p, x * BIOSCD_SECSIZE); + p += (x * BIOSCD_SECSIZE); + dblk += x; + resid -= x; + } /* hexdump(dest, (blks * BIOSCD_SECSIZE)); */ return(0); Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Thu Mar 12 18:59:39 2009 (r189748) +++ head/sys/boot/i386/libi386/biosdisk.c Thu Mar 12 20:41:52 2009 (r189749) @@ -1125,14 +1125,6 @@ bd_realstrategy(void *devdata, int rw, d /* Max number of sectors to bounce-buffer if the request crosses a 64k boundary */ #define FLOPPY_BOUNCEBUF 18 -struct edd_packet { - uint16_t len; - uint16_t count; - uint16_t offset; - uint16_t seg; - uint64_t lba; -}; - static int bd_edd_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write) { Modified: head/sys/boot/i386/libi386/libi386.h ============================================================================== --- head/sys/boot/i386/libi386/libi386.h Thu Mar 12 18:59:39 2009 (r189748) +++ head/sys/boot/i386/libi386/libi386.h Thu Mar 12 20:41:52 2009 (r189749) @@ -52,6 +52,14 @@ struct i386_devdesc } d_kind; }; +struct edd_packet { + uint16_t len; + uint16_t count; + uint16_t offset; + uint16_t seg; + uint64_t lba; +}; + int i386_getdev(void **vdev, const char *devspec, const char **path); char *i386_fmtdev(void *vdev); int i386_setcurrdev(struct env_var *ev, int flags, const void *value); From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 02:15:50 2009 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 02ED6106566B; Fri, 13 Mar 2009 02:15:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E689B8FC1A; Fri, 13 Mar 2009 02:15:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D2Fnwd047129; Fri, 13 Mar 2009 02:15:49 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D2FnSB047128; Fri, 13 Mar 2009 02:15:49 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903130215.n2D2FnSB047128@svn.freebsd.org> From: Warner Losh Date: Fri, 13 Mar 2009 02:15:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189752 - head/sys/dev/dcons 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 Mar 2009 02:15:50 -0000 Author: imp Date: Fri Mar 13 02:15:49 2009 New Revision: 189752 URL: http://svn.freebsd.org/changeset/base/189752 Log: We need to initialize the console for dcons to work. Submitted by: nork@ Modified: head/sys/dev/dcons/dcons_os.c Modified: head/sys/dev/dcons/dcons_os.c ============================================================================== --- head/sys/dev/dcons/dcons_os.c Fri Mar 13 01:28:10 2009 (r189751) +++ head/sys/dev/dcons/dcons_os.c Fri Mar 13 02:15:49 2009 (r189752) @@ -360,6 +360,7 @@ dcons_attach_port(int port, char *name, tp = tty_alloc(&dcons_ttydevsw, dc, NULL); dc->flags = flags; dc->tty = tp; + tty_init_console(tp, 0); tty_makedev(tp, NULL, "%s", name); return(0); } From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 03:51:42 2009 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 37A57106564A; Fri, 13 Mar 2009 03:51:42 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24C478FC14; Fri, 13 Mar 2009 03:51:42 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D3pg0V051384; Fri, 13 Mar 2009 03:51:42 GMT (envelope-from grog@svn.freebsd.org) Received: (from grog@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D3pfOV051378; Fri, 13 Mar 2009 03:51:41 GMT (envelope-from grog@svn.freebsd.org) Message-Id: <200903130351.n2D3pfOV051378@svn.freebsd.org> From: Greg Lehey Date: Fri, 13 Mar 2009 03:51: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: r189754 - head/usr.sbin/sysinstall 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 Mar 2009 03:51:42 -0000 Author: grog Date: Fri Mar 13 03:51:41 2009 New Revision: 189754 URL: http://svn.freebsd.org/changeset/base/189754 Log: Add menus to read install.cfg from any disk device sysinstall can see (eg USB key, CD) rather than just floppy. Handle \r\n line termination in a cfg file. Add keeprcconf variable. Submitted by: Daniel O'Connor Modified: head/usr.sbin/sysinstall/config.c head/usr.sbin/sysinstall/dispatch.c head/usr.sbin/sysinstall/menus.c head/usr.sbin/sysinstall/modules.c head/usr.sbin/sysinstall/sysinstall.8 head/usr.sbin/sysinstall/sysinstall.h Modified: head/usr.sbin/sysinstall/config.c ============================================================================== --- head/usr.sbin/sysinstall/config.c Fri Mar 13 03:00:38 2009 (r189753) +++ head/usr.sbin/sysinstall/config.c Fri Mar 13 03:51:41 2009 (r189754) @@ -428,8 +428,12 @@ configRC_conf(void) while(fgets(line, sizeof(line), rcOld)) { if(line[0] == '#' || variable_check2(line) != 0) fprintf(rcSite, "%s", line); - else - fprintf(rcSite, "#REMOVED: %s", line); + else { + if (variable_get(VAR_KEEPRCCONF) != NULL) + fprintf(rcSite, "%s", line); + else + fprintf(rcSite, "#REMOVED: %s", line); + } } fclose(rcOld); } else if (write_header) { Modified: head/usr.sbin/sysinstall/dispatch.c ============================================================================== --- head/usr.sbin/sysinstall/dispatch.c Fri Mar 13 03:00:38 2009 (r189753) +++ head/usr.sbin/sysinstall/dispatch.c Fri Mar 13 03:51:41 2009 (r189754) @@ -47,6 +47,7 @@ static int dispatch_systemExecute(dialog static int dispatch_msgConfirm(dialogMenuItem *unused); static int dispatch_mediaOpen(dialogMenuItem *unused); static int dispatch_mediaClose(dialogMenuItem *unused); +static int cfgModuleFire(dialogMenuItem *self); static struct _word { char *name; @@ -90,6 +91,7 @@ static struct _word { { "installVarDefaults", installVarDefaults }, { "loadConfig", dispatch_load_file }, { "loadFloppyConfig", dispatch_load_floppy }, + { "loadCDROMConfig", dispatch_load_cdrom }, { "mediaOpen", dispatch_mediaOpen }, { "mediaClose", dispatch_mediaClose }, { "mediaSetCDROM", mediaSetCDROM }, @@ -242,8 +244,9 @@ dispatchCommand(char *str) msgConfirm("Null or zero-length string passed to dispatchCommand"); return DITEM_FAILURE; } - /* If it's got a newline, trim it */ - if ((cp = index(str, '\n')) != NULL) + + /* Fixup DOS abuse */ + if ((cp = index(str, '\r')) != NULL) *cp = '\0'; /* If it's got a `=' sign in there, assume it's a variable setting */ @@ -294,9 +297,12 @@ dispatch_load_fp(FILE *fp) INITQUE(*head); while (fgets(buf, sizeof buf, fp)) { - - if ((cp = strchr(buf, '\n')) != NULL) + /* Fix up DOS abuse */ + if ((cp = index(buf, '\r')) != NULL) *cp = '\0'; + /* If it's got a new line, trim it */ + if ((cp = index(buf, '\n')) != NULL) + *cp = '\0'; if (*buf == '\0' || *buf == '#') continue; @@ -326,7 +332,7 @@ dispatch_execute(qelement *head) while (!EMPTYQUE(*head)) { item = (command_buffer *) head->q_forw; - + if (DITEM_STATUS(dispatchCommand(item->string)) != DITEM_SUCCESS) { msgConfirm("Command `%s' failed - rest of script aborted.\n", item->string); @@ -401,8 +407,7 @@ dispatch_load_floppy(dialogMenuItem *sel mediaClose(); cp = variable_get_value(VAR_INSTALL_CFG, - "Specify the name of a configuration file\n" - "residing on a MSDOS or UFS floppy.", 0); + "Specify the name of a configuration file", 0); if (!cp || !*cp) { variable_unset(VAR_INSTALL_CFG); what |= DITEM_FAILURE; @@ -443,3 +448,189 @@ dispatch_load_floppy(dialogMenuItem *sel return what; } +int +dispatch_load_cdrom(dialogMenuItem *self) +{ + int what = DITEM_SUCCESS; + extern char *distWanted; + char *cp; + FILE *fp; + qelement *list; + + mediaClose(); + cp = variable_get_value(VAR_INSTALL_CFG, + "Specify the name of a configuration file\n" + "residing on the CDROM.", 0); + if (!cp || !*cp) { + variable_unset(VAR_INSTALL_CFG); + what |= DITEM_FAILURE; + return what; + } + + distWanted = cp; + /* Try to open the floppy drive */ + if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_FAILURE) { + msgConfirm("Unable to set media device to CDROM."); + what |= DITEM_FAILURE; + mediaClose(); + return what; + } + + if (!DEVICE_INIT(mediaDevice)) { + msgConfirm("Unable to CDROM filesystem."); + what |= DITEM_FAILURE; + mediaClose(); + return what; + } + + fp = DEVICE_GET(mediaDevice, cp, TRUE); + if (fp) { + list = dispatch_load_fp(fp); + fclose(fp); + mediaClose(); + + what |= dispatch_execute(list); + } + else { + if (!variable_get(VAR_NO_ERROR)) + msgConfirm("Configuration file '%s' not found.", cp); + variable_unset(VAR_INSTALL_CFG); + what |= DITEM_FAILURE; + mediaClose(); + } + return what; +} + +/* + * Create a menu based on available disk devices + */ +int +dispatch_load_menu(dialogMenuItem *self) +{ + DMenu *menu; + Device **devlist; + char *err; + int what, i, j, msize, count; + DeviceType dtypes[] = {DEVICE_TYPE_FLOPPY, DEVICE_TYPE_CDROM, DEVICE_TYPE_DOS, DEVICE_TYPE_UFS}; + + fprintf(stderr, "dispatch_load_menu called\n"); + + msize = sizeof(DMenu) + (sizeof(dialogMenuItem) * 2); + count = 0; + err = NULL; + what = DITEM_SUCCESS; + + if ((menu = malloc(msize)) == NULL) { + err = "Failed to allocate memory for menu"; + goto errout; + } + + bcopy(&MenuConfig, menu, sizeof(DMenu)); + + bzero(&menu->items[count], sizeof(menu->items[0])); + menu->items[count].prompt = strdup("X Exit"); + menu->items[count].title = strdup("Exit this menu (returning to previous)"); + menu->items[count].fire = dmenuExit; + count++; + + for (i = 0; i < sizeof(dtypes) / sizeof(dtypes[0]); i++) { + if ((devlist = deviceFind(NULL, dtypes[i])) == NULL) { + fprintf(stderr, "No devices found for type %d\n", dtypes[i]); + continue; + } + + for (j = 0; devlist[j] != NULL; j++) { + fprintf(stderr, "device type %d device name %s\n", dtypes[i], devlist[j]->name); + msize += sizeof(dialogMenuItem); + if ((menu = realloc(menu, msize)) == NULL) { + err = "Failed to allocate memory for menu item"; + goto errout; + } + + bzero(&menu->items[count], sizeof(menu->items[0])); + menu->items[count].fire = cfgModuleFire; + + menu->items[count].prompt = strdup(devlist[j]->name); + menu->items[count].title = strdup(devlist[j]->description); + /* XXX: dialog(3) sucks */ + menu->items[count].aux = (long)devlist[j]; + count++; + } + } + + menu->items[count].prompt = NULL; + menu->items[count].title = NULL; + + dmenuOpenSimple(menu, FALSE); + + errout: + for (i = 0; i < count; i++) { + free(menu->items[i].prompt); + free(menu->items[i].title); + } + + free(menu); + + if (err != NULL) { + what |= DITEM_FAILURE; + if (!variable_get(VAR_NO_ERROR)) + msgConfirm(err); + } + + return (what); + +} + +static int +cfgModuleFire(dialogMenuItem *self) { + Device *d; + FILE *fp; + int what = DITEM_SUCCESS; + extern char *distWanted; + qelement *list; + char *cp; + + d = (Device *)self->aux; + + msgDebug("cfgModuleFire: User selected %s (%s)\n", self->prompt, d->devname); + + mediaClose(); + + cp = variable_get_value(VAR_INSTALL_CFG, + "Specify the name of a configuration file", 0); + if (!cp || !*cp) { + variable_unset(VAR_INSTALL_CFG); + what |= DITEM_FAILURE; + return what; + } + + distWanted = cp; + + mediaDevice = d; + if (!DEVICE_INIT(mediaDevice)) { + msgConfirm("Unable to mount filesystem."); + what |= DITEM_FAILURE; + mediaClose(); + return what; + } + msgDebug("getting fp for %s\n", cp); + + fp = DEVICE_GET(mediaDevice, cp, TRUE); + if (fp) { + msgDebug("opened OK, processing..\n"); + + list = dispatch_load_fp(fp); + fclose(fp); + mediaClose(); + + what |= dispatch_execute(list); + } else { + if (!variable_get(VAR_NO_ERROR)) + msgConfirm("Configuration file '%s' not found.", cp); + variable_unset(VAR_INSTALL_CFG); + what |= DITEM_FAILURE; + mediaClose(); + } + + return(what); + } Modified: head/usr.sbin/sysinstall/menus.c ============================================================================== --- head/usr.sbin/sysinstall/menus.c Fri Mar 13 03:00:38 2009 (r189753) +++ head/usr.sbin/sysinstall/menus.c Fri Mar 13 03:51:41 2009 (r189754) @@ -152,7 +152,9 @@ DMenu MenuIndex = { { " Console settings", "Customize system console behavior.", NULL, dmenuSubmenu, NULL, &MenuSyscons }, #endif { " Configure", "The system configuration menu.", NULL, dmenuSubmenu, NULL, &MenuConfigure }, - { " Defaults, Load", "Load default settings.", NULL, dispatch_load_floppy }, + { " Defaults, Load (FDD)","Load default settings from floppy.", NULL, dispatch_load_floppy }, + { " Defaults, Load (CD)", "Load default settings from CDROM.", NULL, dispatch_load_cdrom }, + { " Defaults, Load", "Load default settings (all devices).", NULL, dispatch_load_menu }, #ifdef WITH_MICE { " Device, Mouse", "The mouse configuration menu.", NULL, dmenuSubmenu, NULL, &MenuMouse }, #endif @@ -256,7 +258,7 @@ DMenu MenuInitial = { { "Options", "View/Set various installation options", NULL, optionsEditor }, { "Fixit", "Repair mode with CDROM/DVD/floppy or start shell", NULL, dmenuSubmenu, NULL, &MenuFixit }, { "Upgrade", "Upgrade an existing system", NULL, installUpgrade }, - { "Load Config","Load default install configuration", NULL, dispatch_load_floppy }, + { "Load Config..","Load default install configuration", NULL, dispatch_load_menu }, { "Index", "Glossary of functions", NULL, dmenuSubmenu, NULL, &MenuIndex }, { NULL } }, }; @@ -818,6 +820,17 @@ DMenu MenuKLD = { { { NULL } }, }; +/* Prototype config file load menu */ +DMenu MenuConfig = { + DMENU_NORMAL_TYPE, + "Config Menu", + "Please select the device to load your configuration file from.\n" + "Note that a USB key will show up as daNs1.", + NULL, + NULL, + { { NULL } }, +}; + /* The media selection menu */ DMenu MenuMedia = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, Modified: head/usr.sbin/sysinstall/modules.c ============================================================================== --- head/usr.sbin/sysinstall/modules.c Fri Mar 13 03:00:38 2009 (r189753) +++ head/usr.sbin/sysinstall/modules.c Fri Mar 13 03:51:41 2009 (r189754) @@ -132,17 +132,13 @@ kldBrowser(dialogMenuItem *self) err = NULL; if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE) { - msgConfirm("Unable to set media device to floppy."); - what |= DITEM_FAILURE; - mediaClose(); - return what; + err = "Unable to set media device to floppy."; + goto errout; } if (!DEVICE_INIT(mediaDevice)) { - msgConfirm("Unable to mount floppy filesystem."); - what |= DITEM_FAILURE; - mediaClose(); - return what; + err = "Unable to mount floppy filesystem."; + goto errout; } msize = sizeof(DMenu) + (sizeof(dialogMenuItem) * 2); @@ -191,11 +187,10 @@ kldBrowser(dialogMenuItem *self) dmenuOpenSimple(menu, FALSE); - mediaClose(); - deviceRescan(); errout: + mediaClose(); for (i = 0; i < count; i++) free(menu->items[i].prompt); Modified: head/usr.sbin/sysinstall/sysinstall.8 ============================================================================== --- head/usr.sbin/sysinstall/sysinstall.8 Fri Mar 13 03:00:38 2009 (r189753) +++ head/usr.sbin/sysinstall/sysinstall.8 Fri Mar 13 03:51:41 2009 (r189754) @@ -534,7 +534,16 @@ functions. .Pp .Sy Variables : None -.It installExpress +.It installConfigure +Commit any rc.conf changes to disk. +.Pp +.Sy Variables : +.Bl -tag -width indent +.It keeprcconf +Preserve existing rc.conf parameters. +This is useful if you have a post-install script which modifies rc.conf. +.El + .It installExpress Start an "express" installation, asking few questions of the user. .Pp @@ -894,3 +903,6 @@ for these tasks. .Pp This utility is a prototype which lasted several years past its expiration date and is greatly in need of death. +.Pp +There are a (great) number of undocumented variables. +UTSL. Modified: head/usr.sbin/sysinstall/sysinstall.h ============================================================================== --- head/usr.sbin/sysinstall/sysinstall.h Fri Mar 13 03:00:38 2009 (r189753) +++ head/usr.sbin/sysinstall/sysinstall.h Fri Mar 13 03:51:41 2009 (r189754) @@ -191,6 +191,7 @@ #define VAR_HOME_SIZE "homeSize" #define VAR_TERM "TERM" #define VAR_CONSTERM "_consterm" +#define VAR_KEEPRCCONF "keeprcconf" #ifdef PC98 #define DEFAULT_COUNTRY "jp" @@ -433,6 +434,7 @@ extern DMenu MenuIndex; /* Index menu extern DMenu MenuOptions; /* Installation options */ extern DMenu MenuOptionsLanguage; /* Language options menu */ extern DMenu MenuKLD; /* Prototype KLD menu */ +extern DMenu MenuConfig; /* Prototype config menu */ extern DMenu MenuMedia; /* Media type menu */ #ifdef WITH_MICE extern DMenu MenuMouse; /* Mouse type menu */ @@ -577,8 +579,10 @@ extern int diskGetSelectCount(Device *** /* dispatch.c */ extern int dispatchCommand(char *command); extern int dispatch_load_floppy(dialogMenuItem *self); +extern int dispatch_load_cdrom(dialogMenuItem *self); extern int dispatch_load_file_int(int); extern int dispatch_load_file(dialogMenuItem *self); +extern int dispatch_load_menu(dialogMenuItem *self); /* dist.c */ From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 05:31:28 2009 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 2A0AA1065670; Fri, 13 Mar 2009 05:31:28 +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 F1E498FC18; Fri, 13 Mar 2009 05:31:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D5VRuU053308; Fri, 13 Mar 2009 05:31:27 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D5VRMb053307; Fri, 13 Mar 2009 05:31:27 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903130531.n2D5VRMb053307@svn.freebsd.org> From: Warner Losh Date: Fri, 13 Mar 2009 05:31: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: r189755 - head/sys/dev/cardbus 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 Mar 2009 05:31:28 -0000 Author: imp Date: Fri Mar 13 05:31:27 2009 New Revision: 189755 URL: http://svn.freebsd.org/changeset/base/189755 Log: Minorly improved debugging. Use the DEVPRINTF macro and report the offset for memory when mapping in the CIS. Modified: head/sys/dev/cardbus/cardbus_cis.c Modified: head/sys/dev/cardbus/cardbus_cis.c ============================================================================== --- head/sys/dev/cardbus/cardbus_cis.c Fri Mar 13 03:51:41 2009 (r189754) +++ head/sys/dev/cardbus/cardbus_cis.c Fri Mar 13 05:31:27 2009 (r189755) @@ -451,8 +451,7 @@ cardbus_read_tuple_init(device_t cbdev, space = *start & PCIM_CIS_ASI_MASK; switch (space) { case PCIM_CIS_ASI_CONFIG: - if (cardbus_cis_debug) - device_printf(cbdev, "CIS in PCI config space\n"); + DEVPRINTF((cbdev, "CIS in PCI config space\n")); /* CIS in PCI config space need no initialization */ return (CIS_CONFIG_SPACE); case PCIM_CIS_ASI_BAR0: @@ -462,13 +461,11 @@ cardbus_read_tuple_init(device_t cbdev, case PCIM_CIS_ASI_BAR4: case PCIM_CIS_ASI_BAR5: *rid = PCIR_BAR(space - PCIM_CIS_ASI_BAR0); - if (cardbus_cis_debug) - device_printf(cbdev, "CIS in BAR %#x\n", *rid); + DEVPRINTF((cbdev, "CIS in BAR %#x\n", *rid)); break; case PCIM_CIS_ASI_ROM: *rid = PCIR_BIOS; - if (cardbus_cis_debug) - device_printf(cbdev, "CIS in option rom\n"); + DEVPRINTF((cbdev, "CIS in option rom\n")); break; default: device_printf(cbdev, "Unable to read CIS: Unknown space: %d\n", @@ -484,6 +481,7 @@ cardbus_read_tuple_init(device_t cbdev, "to read CIS.\n"); return (NULL); } + DEVPRINTF((cbdev, "CIS Mapped to %#lx\n", rman_get_start(res))); if (*rid == PCIR_BIOS) pci_write_config(child, *rid, rman_get_start(res) | PCIM_BIOS_ENABLE, 4); @@ -558,8 +556,7 @@ cardbus_read_tuple_init(device_t cbdev, } else { *start = *start & PCIM_CIS_ADDR_MASK; } - if (cardbus_cis_debug) - device_printf(cbdev, "CIS offset is %#x\n", *start); + DEVPRINTF((cbdev, "CIS offset is %#x\n", *start)); return (res); } @@ -598,13 +595,10 @@ cardbus_parse_cis(device_t cbdev, device bzero(tupledata, MAXTUPLESIZE); expect_linktarget = TRUE; if ((start = pci_read_config(child, PCIR_CIS, 4)) == 0) { - if (cardbus_cis_debug) - device_printf(cbdev, - "Warning: CIS pointer 0 (no CIS present)\n"); + DEVPRINTF((cbdev, "Warning: CIS pointer is 0: (no CIS)\n")); return (ENXIO); } - if (cardbus_cis_debug) - device_printf(cbdev, "CIS pointer is %#x\n", start); + DEVPRINTF((cbdev, "CIS pointer is %#x\n", start)); off = 0; res = cardbus_read_tuple_init(cbdev, child, &start, &rid); if (res == NULL) { From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 06:06:21 2009 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 E77211065691; Fri, 13 Mar 2009 06:06:21 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D170F8FC17; Fri, 13 Mar 2009 06:06:21 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D66LT2053968; Fri, 13 Mar 2009 06:06:21 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D66LEC053967; Fri, 13 Mar 2009 06:06:21 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <200903130606.n2D66LEC053967@svn.freebsd.org> From: David Xu Date: Fri, 13 Mar 2009 06:06: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: r189756 - 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: Fri, 13 Mar 2009 06:06:25 -0000 Author: davidxu Date: Fri Mar 13 06:06:20 2009 New Revision: 189756 URL: http://svn.freebsd.org/changeset/base/189756 Log: 1) Check NULL pointer before calling umtx_pi_adjust_locked(), this avoids a PANIC. 2) Rework locking for POSIX priority-mutex, this fixes a race where a thread may wait there forever even if the mutex is unlocked. Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Fri Mar 13 05:31:27 2009 (r189755) +++ head/sys/kern/kern_umtx.c Fri Mar 13 06:06:20 2009 (r189756) @@ -166,6 +166,7 @@ struct umtxq_chain { }; #define UMTXQ_LOCKED_ASSERT(uc) mtx_assert(&(uc)->uc_lock, MA_OWNED) +#define UMTXQ_BUSY_ASSERT(uc) KASSERT(&(uc)->uc_busy, ("umtx chain is not busy")) /* * Don't propagate time-sharing priority, there is a security reason, @@ -1392,7 +1393,8 @@ umtx_unpropagate_priority(struct umtx_pi oldpri = pi->pi_owner->td_user_pri; sched_unlend_user_prio(pi->pi_owner, pri); thread_unlock(pi->pi_owner); - umtx_pi_adjust_locked(pi->pi_owner, oldpri); + if (uq_owner->uq_pi_blocked != NULL) + umtx_pi_adjust_locked(pi->pi_owner, oldpri); pi = uq_owner->uq_pi_blocked; } } @@ -1513,7 +1515,9 @@ umtxq_sleep_pi(struct umtx_q *uq, struct KASSERT(td == curthread, ("inconsistent uq_thread")); uc = umtxq_getchain(&uq->uq_key); UMTXQ_LOCKED_ASSERT(uc); + UMTXQ_BUSY_ASSERT(uc); umtxq_insert(uq); + mtx_lock_spin(&umtx_lock); if (pi->pi_owner == NULL) { /* XXX * Current, We only support process private PI-mutex, @@ -1524,6 +1528,7 @@ umtxq_sleep_pi(struct umtx_q *uq, struct * For process private PI-mutex, we can find owner * thread and boost its priority safely. */ + mtx_unlock_spin(&umtx_lock); PROC_LOCK(curproc); td1 = thread_find(curproc, owner); mtx_lock_spin(&umtx_lock); @@ -1532,8 +1537,6 @@ umtxq_sleep_pi(struct umtx_q *uq, struct umtx_pi_setowner(pi, td1); } PROC_UNLOCK(curproc); - } else { - mtx_lock_spin(&umtx_lock); } TAILQ_FOREACH(uq1, &pi->pi_blocked, uq_lockq) { @@ -1551,26 +1554,18 @@ umtxq_sleep_pi(struct umtx_q *uq, struct thread_lock(td); td->td_flags |= TDF_UPIBLOCKED; thread_unlock(td); - mtx_unlock_spin(&umtx_lock); - umtxq_unlock(&uq->uq_key); - - mtx_lock_spin(&umtx_lock); umtx_propagate_priority(td); mtx_unlock_spin(&umtx_lock); + umtxq_unbusy(&uq->uq_key); - umtxq_lock(&uq->uq_key); if (uq->uq_flags & UQF_UMTXQ) { error = msleep(uq, &uc->uc_lock, PCATCH, wmesg, timo); if (error == EWOULDBLOCK) error = ETIMEDOUT; if (uq->uq_flags & UQF_UMTXQ) { - umtxq_busy(&uq->uq_key); umtxq_remove(uq); - umtxq_unbusy(&uq->uq_key); } } - umtxq_unlock(&uq->uq_key); - mtx_lock_spin(&umtx_lock); uq->uq_pi_blocked = NULL; thread_lock(td); @@ -1579,8 +1574,7 @@ umtxq_sleep_pi(struct umtx_q *uq, struct TAILQ_REMOVE(&pi->pi_blocked, uq, uq_lockq); umtx_unpropagate_priority(pi); mtx_unlock_spin(&umtx_lock); - - umtxq_lock(&uq->uq_key); + umtxq_unlock(&uq->uq_key); return (error); } @@ -1606,7 +1600,6 @@ static void umtx_pi_unref(struct umtx_pi *pi) { struct umtxq_chain *uc; - int free = 0; uc = umtxq_getchain(&pi->pi_key); UMTXQ_LOCKED_ASSERT(uc); @@ -1622,10 +1615,8 @@ umtx_pi_unref(struct umtx_pi *pi) ("blocked queue not empty")); mtx_unlock_spin(&umtx_lock); TAILQ_REMOVE(&uc->uc_pi_list, pi, pi_hashlink); - free = 1; - } - if (free) umtx_pi_free(pi); + } } /* @@ -1686,7 +1677,6 @@ _do_lock_pi(struct thread *td, struct um if (new_pi == NULL) { umtxq_unlock(&uq->uq_key); new_pi = umtx_pi_alloc(M_WAITOK); - new_pi->pi_key = uq->uq_key; umtxq_lock(&uq->uq_key); pi = umtx_pi_lookup(&uq->uq_key); if (pi != NULL) { @@ -1732,7 +1722,9 @@ _do_lock_pi(struct thread *td, struct um if (owner == UMUTEX_CONTESTED) { umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); error = umtx_pi_claim(pi, td); + umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); break; } @@ -1787,7 +1779,6 @@ _do_lock_pi(struct thread *td, struct um } umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); /* * We set the contested bit, sleep. Otherwise the lock changed * and we need to retry or we lost a race to the thread @@ -1796,7 +1787,10 @@ _do_lock_pi(struct thread *td, struct um if (old == owner) error = umtxq_sleep_pi(uq, pi, owner & ~UMUTEX_CONTESTED, "umtxpi", timo); - umtxq_unlock(&uq->uq_key); + else { + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + } } umtxq_lock(&uq->uq_key); @@ -1851,18 +1845,26 @@ do_unlock_pi(struct thread *td, struct u umtxq_busy(&key); count = umtxq_count_pi(&key, &uq_first); if (uq_first != NULL) { + mtx_lock_spin(&umtx_lock); pi = uq_first->uq_pi_blocked; + KASSERT(pi != NULL, ("pi == NULL?")); if (pi->pi_owner != curthread) { + mtx_unlock_spin(&umtx_lock); umtxq_unbusy(&key); umtxq_unlock(&key); + umtx_key_release(&key); /* userland messed the mutex */ return (EPERM); } uq_me = curthread->td_umtxq; - mtx_lock_spin(&umtx_lock); pi->pi_owner = NULL; TAILQ_REMOVE(&uq_me->uq_pi_contested, pi, pi_link); + /* get highest priority thread which is still sleeping. */ uq_first = TAILQ_FIRST(&pi->pi_blocked); + while (uq_first != NULL && + (uq_first->uq_flags & UQF_UMTXQ) == 0) { + uq_first = TAILQ_NEXT(uq_first, uq_lockq); + } pri = PRI_MAX; TAILQ_FOREACH(pi2, &uq_me->uq_pi_contested, pi_link) { uq_first2 = TAILQ_FIRST(&pi2->pi_blocked); @@ -1875,6 +1877,8 @@ do_unlock_pi(struct thread *td, struct u sched_unlend_user_prio(curthread, pri); thread_unlock(curthread); mtx_unlock_spin(&umtx_lock); + if (uq_first) + umtxq_signal_thread(uq_first); } umtxq_unlock(&key); @@ -1887,8 +1891,6 @@ do_unlock_pi(struct thread *td, struct u count <= 1 ? UMUTEX_UNOWNED : UMUTEX_CONTESTED); umtxq_lock(&key); - if (uq_first != NULL) - umtxq_signal_thread(uq_first); umtxq_unbusy(&key); umtxq_unlock(&key); umtx_key_release(&key); From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 06:28:20 2009 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 B6445106566C; Fri, 13 Mar 2009 06:28:20 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3C1F8FC0A; Fri, 13 Mar 2009 06:28:20 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D6SKjr054418; Fri, 13 Mar 2009 06:28:20 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D6SK7s054414; Fri, 13 Mar 2009 06:28:20 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200903130628.n2D6SK7s054414@svn.freebsd.org> From: Rafal Jaworowski Date: Fri, 13 Mar 2009 06:28: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: r189757 - in head/sys/powerpc: include mpc85xx 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 Mar 2009 06:28:21 -0000 Author: raj Date: Fri Mar 13 06:28:20 2009 New Revision: 189757 URL: http://svn.freebsd.org/changeset/base/189757 Log: Make MPC85xx LAW handling and reset routines aware of the MPC8548 variant. Inspired by discussion with Alexey V Fedorov on freebsd-powerpc@. Modified: head/sys/powerpc/include/spr.h head/sys/powerpc/mpc85xx/mpc85xx.c head/sys/powerpc/mpc85xx/mpc85xx.h head/sys/powerpc/mpc85xx/ocpbus.c Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Fri Mar 13 06:06:20 2009 (r189756) +++ head/sys/powerpc/include/spr.h Fri Mar 13 06:28:20 2009 (r189757) @@ -564,6 +564,8 @@ #define SVR_MPC8533E 0x8034 #define SVR_MPC8541 0x8072 #define SVR_MPC8541E 0x807a +#define SVR_MPC8548 0x8031 +#define SVR_MPC8548E 0x8039 #define SVR_MPC8555 0x8071 #define SVR_MPC8555E 0x8079 #define SVR_MPC8572 0x80e0 Modified: head/sys/powerpc/mpc85xx/mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx.c Fri Mar 13 06:06:20 2009 (r189756) +++ head/sys/powerpc/mpc85xx/mpc85xx.c Fri Mar 13 06:28:20 2009 (r189757) @@ -61,7 +61,7 @@ ccsr_write4(uintptr_t addr, uint32_t val __asm __volatile("eieio; sync"); } -static __inline int +int law_getmax(void) { uint32_t ver; @@ -69,6 +69,8 @@ law_getmax(void) ver = SVR_VER(mfspr(SPR_SVR)); if (ver == SVR_MPC8572E || ver == SVR_MPC8572) return (12); + else if (ver == SVR_MPC8548E || ver == SVR_MPC8548) + return (10); else return (8); } @@ -132,7 +134,8 @@ cpu_reset(void) { uint32_t ver = SVR_VER(mfspr(SPR_SVR)); - if (ver == SVR_MPC8572E || ver == SVR_MPC8572) + if (ver == SVR_MPC8572E || ver == SVR_MPC8572 || + ver == SVR_MPC8548E || ver == SVR_MPC8548) /* Systems with dedicated reset register */ ccsr_write4(OCP85XX_RSTCR, 2); else { Modified: head/sys/powerpc/mpc85xx/mpc85xx.h ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx.h Fri Mar 13 06:06:20 2009 (r189756) +++ head/sys/powerpc/mpc85xx/mpc85xx.h Fri Mar 13 06:28:20 2009 (r189757) @@ -33,5 +33,6 @@ uint32_t ccsr_read4(uintptr_t addr); void ccsr_write4(uintptr_t addr, uint32_t val); int law_enable(int trgt, u_long addr, u_long size); int law_disable(int trgt, u_long addr, u_long size); +int law_getmax(void); #endif /* _MPC85XX_H_ */ Modified: head/sys/powerpc/mpc85xx/ocpbus.c ============================================================================== --- head/sys/powerpc/mpc85xx/ocpbus.c Fri Mar 13 06:06:20 2009 (r189756) +++ head/sys/powerpc/mpc85xx/ocpbus.c Fri Mar 13 06:28:20 2009 (r189757) @@ -114,8 +114,6 @@ devclass_t ocpbus_devclass; DRIVER_MODULE(ocpbus, nexus, ocpbus_driver, ocpbus_devclass, 0, 0); -static int law_max = 0; - static device_t ocpbus_mk_child(device_t dev, int type, int unit) { @@ -189,16 +187,6 @@ ocpbus_write_law(int trgt, int type, u_l static int ocpbus_probe(device_t dev) { - struct ocpbus_softc *sc; - uint32_t ver; - - sc = device_get_softc(dev); - - ver = SVR_VER(mfspr(SPR_SVR)); - if (ver == SVR_MPC8572E || ver == SVR_MPC8572) - law_max = 12; - else - law_max = 8; device_set_desc(dev, "On-Chip Peripherals bus"); return (BUS_PROBE_DEFAULT); @@ -208,7 +196,7 @@ static int ocpbus_attach(device_t dev) { struct ocpbus_softc *sc; - int error, i, tgt; + int error, i, tgt, law_max; uint32_t sr; u_long start, end; @@ -261,6 +249,7 @@ ocpbus_attach(device_t dev) * Clear local access windows. Skip DRAM entries, so we don't shoot * ourselves in the foot. */ + law_max = law_getmax(); for (i = 0; i < law_max; i++) { sr = ccsr_read4(OCP85XX_LAWSR(i)); if ((sr & 0x80000000) == 0) From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 07:09:20 2009 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 D0BC4106566B; Fri, 13 Mar 2009 07:09:20 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDDA48FC16; Fri, 13 Mar 2009 07:09:20 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D79Kbp055295; Fri, 13 Mar 2009 07:09:20 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D79KBD055294; Fri, 13 Mar 2009 07:09:20 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200903130709.n2D79KBD055294@svn.freebsd.org> From: Attilio Rao Date: Fri, 13 Mar 2009 07:09: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: r189758 - head/sys/fs/nullfs 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 Mar 2009 07:09:21 -0000 Author: attilio Date: Fri Mar 13 07:09:20 2009 New Revision: 189758 URL: http://svn.freebsd.org/changeset/base/189758 Log: Remove the null_islocked() overloaded vop because the standard one does the same. Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Fri Mar 13 06:28:20 2009 (r189757) +++ head/sys/fs/nullfs/null_vnops.c Fri Mar 13 07:09:20 2009 (r189758) @@ -614,14 +614,6 @@ null_unlock(struct vop_unlock_args *ap) return (error); } -static int -null_islocked(struct vop_islocked_args *ap) -{ - struct vnode *vp = ap->a_vp; - - return (lockstatus(vp->v_vnlock)); -} - /* * There is no way to tell that someone issued remove/rmdir operation * on the underlying filesystem. For now we just have to release lowervp @@ -732,7 +724,6 @@ struct vop_vector null_vnodeops = { .vop_getattr = null_getattr, .vop_getwritemount = null_getwritemount, .vop_inactive = null_inactive, - .vop_islocked = null_islocked, .vop_lock1 = null_lock, .vop_lookup = null_lookup, .vop_open = null_open, From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 07:12:25 2009 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 B2B731065670; Fri, 13 Mar 2009 07:12:25 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 856AB8FC0C; Fri, 13 Mar 2009 07:12:25 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D7CP8H055412; Fri, 13 Mar 2009 07:12:25 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D7CP1g055409; Fri, 13 Mar 2009 07:12:25 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <200903130712.n2D7CP1g055409@svn.freebsd.org> From: Brooks Davis Date: Fri, 13 Mar 2009 07:12: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: r189759 - in head: etc etc/defaults 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 Mar 2009 07:12:26 -0000 Author: brooks Date: Fri Mar 13 07:12:25 2009 New Revision: 189759 URL: http://svn.freebsd.org/changeset/base/189759 Log: Add support for setting the debug flags on wlan interfaces after the are created using wlandebug_ variables. Modified: head/etc/defaults/rc.conf head/etc/network.subr head/share/man/man5/rc.conf.5 Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Fri Mar 13 07:09:20 2009 (r189758) +++ head/etc/defaults/rc.conf Fri Mar 13 07:12:25 2009 (r189759) @@ -197,6 +197,7 @@ ifconfig_lo0="inet 127.0.0.1" # default #ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry. #ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0. #wlans_ath0="wlan0" # wlan(4) interfaces for ath0 device +#wlandebug_wlan0="scan+auth+assoc" # Set debug flags with wlanddebug(8) #ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. # #autobridge_interfaces="bridge0" # List of bridges to check Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Fri Mar 13 07:09:20 2009 (r189758) +++ head/etc/network.subr Fri Mar 13 07:12:25 2009 (r189759) @@ -499,7 +499,7 @@ clone_down() # childif_create() { - local cfg child child_wlans create_args ifn i + local cfg child child_wlans create_args debug_flags ifn i cfg=1 ifn=$1 @@ -509,10 +509,18 @@ childif_create() for child in ${child_wlans}; do create_args="wlandev $ifn `get_if_var $child create_args_IF`" + debug_flags="`get_if_var $child wlandebug_IF`" + if expr $child : 'wlan[0-9][0-9]*$' >/dev/null 2>&1; then ifconfig $child create ${create_args} && cfg=0 + if [ -n "${debug_flags}" ]; then + wlandebug -i $child ${debug_flags} + fi else i=`ifconfig wlan create ${create_args}` + if [ -n "${debug_flags}" ]; then + wlandebug -i $i ${debug_flags} + fi ifconfig $i name $child && cfg=0 fi if autoif $child; then Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Fri Mar 13 07:09:20 2009 (r189758) +++ head/share/man/man5/rc.conf.5 Fri Mar 13 07:12:25 2009 (r189759) @@ -1169,6 +1169,15 @@ One or more .Xr wlan 4 devices must be created for each wireless devices as of .Fx 8.0 . +Debugging flags for +.Xr wlan 4 +devices as set by +.Xr wlandebug 8 +may be specified with an +.Va wlandebug_ Ns Aq Ar interface +variable. +The contents of this variable will be passed directly to +.Xr wlandebug 8 . .Pp If the .Va ifconfig_ Ns Aq Ar interface @@ -4065,6 +4074,7 @@ Default .Xr sysctl 8 , .Xr syslogd 8 , .Xr timed 8 , +.Xr wlandebug 8 , .Xr yp 8 , .Xr ypbind 8 , .Xr ypserv 8 , From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 07:23:58 2009 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 9666C1065675; Fri, 13 Mar 2009 07:23:58 +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 83CF68FC12; Fri, 13 Mar 2009 07:23:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D7NwMh055642; Fri, 13 Mar 2009 07:23:58 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D7NwlG055640; Fri, 13 Mar 2009 07:23:58 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903130723.n2D7NwlG055640@svn.freebsd.org> From: Warner Losh Date: Fri, 13 Mar 2009 07:23: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: r189760 - 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: Fri, 13 Mar 2009 07:23:59 -0000 Author: imp Date: Fri Mar 13 07:23:58 2009 New Revision: 189760 URL: http://svn.freebsd.org/changeset/base/189760 Log: Implement the xdev target. When you define XDEV=arch XDEV_ARCH=arch, you can build the cross development tools and install them as $XDEV-freebsd-xxx for each tool. This allows one to use autoconf to find the tools for cross building scenarios. Modified: head/Makefile head/Makefile.inc1 Modified: head/Makefile ============================================================================== --- head/Makefile Fri Mar 13 07:12:25 2009 (r189759) +++ head/Makefile Fri Mar 13 07:23:58 2009 (r189760) @@ -88,7 +88,7 @@ TGTS= all all-man buildenv buildenvvars obj objlink regress rerelease showconfig tags toolchain update \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _cross-tools _includes _libraries _depend \ - build32 distribute32 install32 + build32 distribute32 install32 xdev xdev-build xdev-install TGTS+= ${SUBDIR_TARGETS} BITGTS= files includes Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Mar 13 07:12:25 2009 (r189759) +++ head/Makefile.inc1 Fri Mar 13 07:23:58 2009 (r189760) @@ -1328,3 +1328,89 @@ check-old: check-old-files check-old-lib # showconfig: @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort + + +############### + +.if defined(XDEV) && defined(XDEV_ARCH) + +NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ + -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \ + -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS + +XDDIR=${XDEV}-freebsd +XDTP=/usr/${XDDIR} +CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ + TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} +CDENV= ${CDBENV} \ + _SHLIBDIRPREFIX=${XDTP} \ + TOOLS_PREFIX=${XDTP} +CD2ENV=${CDENV} \ + MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} + +CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp +CDMAKE=${CDENV} ${MAKE} ${NOFUN} +CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} +XDDESTDIR=${DESTDIR}${XDTP} + +.ORDER: xdev-build xdev-install +xdev: xdev-build xdev-install + +.ORDER: _xb-build-tools _xb-cross-tools +xdev-build: _xb-build-tools _xb-cross-tools + +_xb-build-tools: + ${_+_}cd ${.CURDIR}; \ + ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools + +_xb-cross-tools: +.for _tool in \ + gnu/usr.bin/binutils \ + gnu/usr.bin/cc + ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ + cd ${.CURDIR}/${_tool}; \ + ${CDMAKE} DIRPRFX=${_tool}/ obj; \ + ${CDMAKE} DIRPRFX=${_tool}/ depend; \ + ${CDMAKE} DIRPRFX=${_tool}/ all +.endfor + +_xi-mtree: + ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" + mkdir -p ${XDDESTDIR} + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ + -p ${XDDESTDIR} >/dev/null + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ + -p ${XDDESTDIR}/usr >/dev/null + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ + -p ${XDDESTDIR}/usr/include >/dev/null + +.ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links +xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links + +_xi-cross-tools: + @echo "_xi-cross-tools" +.for _tool in \ + gnu/usr.bin/binutils \ + gnu/usr.bin/cc + ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ + cd ${.CURDIR}/${_tool}; \ + ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} +.endfor + +_xi-includes: + ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ + DESTDIR=${XDDESTDIR} + +_xi-libraries: + ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ + DESTDIR=${XDDESTDIR} + +_xi-links: + ${_+_}cd ${XDDESTDIR}/usr/bin; \ + for i in *; do \ + ln -sf ../../${XDTP}/usr/bin/$$i \ + ../../../../usr/bin/${XDDIR}-$$i; \ + ln -sf ../../${XDTP}/usr/bin/$$i \ + ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ + done +.endif From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 07:34:05 2009 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 74A45106566C; Fri, 13 Mar 2009 07:34:05 +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 61E798FC18; Fri, 13 Mar 2009 07:34:05 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D7Y5Vf055844; Fri, 13 Mar 2009 07:34:05 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D7Y5Xc055843; Fri, 13 Mar 2009 07:34:05 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200903130734.n2D7Y5Xc055843@svn.freebsd.org> From: Doug Barton Date: Fri, 13 Mar 2009 07:34: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: r189761 - head/usr.sbin/mergemaster 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 Mar 2009 07:34:05 -0000 Author: dougb Date: Fri Mar 13 07:34:05 2009 New Revision: 189761 URL: http://svn.freebsd.org/changeset/base/189761 Log: When using the -D option: 1. The new mtree file should be created in the "host" system /tmp 2. The existing mtree file in the "host" system should not be deleted Submitted by: scf Modified: head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Fri Mar 13 07:23:58 2009 (r189760) +++ head/usr.sbin/mergemaster/mergemaster.sh Fri Mar 13 07:34:05 2009 (r189761) @@ -671,7 +671,7 @@ find ${TEMPROOT} -type f -size 0 -delete # Build the mtree database in a temporary location. MTREENEW=`mktemp -t mergemaster.mtree` case "${PRE_WORLD}" in -'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${DESTDIR}${MTREENEW} 2>/dev/null +'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null ;; *) # We don't want to mess with the mtree database on a pre-world run. ;; @@ -1037,10 +1037,10 @@ done # This is for the do way up there a echo '' echo "*** Comparison complete" -if [ -f "${DESTDIR}${MTREENEW}" ]; then +if [ -f "${MTREENEW}" ]; then echo "*** Saving mtree database for future upgrades" - test -e "${MTREEFILE}" && unlink ${MTREEFILE} - mv ${DESTDIR}${MTREENEW} ${DESTDIR}${MTREEFILE} + test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} + mv ${MTREENEW} ${DESTDIR}${MTREEFILE} fi echo '' From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 08:13:52 2009 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 3E86E1065673; Fri, 13 Mar 2009 08:13:52 +0000 (UTC) (envelope-from guido@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A1248FC22; Fri, 13 Mar 2009 08:13:52 +0000 (UTC) (envelope-from guido@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D8DqwJ056564; Fri, 13 Mar 2009 08:13:52 GMT (envelope-from guido@svn.freebsd.org) Received: (from guido@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D8DqUK056563; Fri, 13 Mar 2009 08:13:52 GMT (envelope-from guido@svn.freebsd.org) Message-Id: <200903130813.n2D8DqUK056563@svn.freebsd.org> From: Guido van Rooij Date: Fri, 13 Mar 2009 08:13: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: r189762 - head/sys/geom/eli 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 Mar 2009 08:13:54 -0000 Author: guido Date: Fri Mar 13 08:13:51 2009 New Revision: 189762 URL: http://svn.freebsd.org/changeset/base/189762 Log: Backout this commit whil a better solution is developed Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Fri Mar 13 07:34:05 2009 (r189761) +++ head/sys/geom/eli/g_eli.c Fri Mar 13 08:13:51 2009 (r189762) @@ -996,7 +996,6 @@ g_eli_taste(struct g_class *mp, struct g /* * We have correct key, let's attach provider. */ - md.md_flags |= G_ELI_FLAG_WO_DETACH; gp = g_eli_create(NULL, mp, pp, &md, mkey, nkey); bzero(mkey, sizeof(mkey)); bzero(&md, sizeof(md)); From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 08:48:34 2009 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 6AC381065673; Fri, 13 Mar 2009 08:48:34 +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 3E2FC8FC13; Fri, 13 Mar 2009 08:48:34 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2D8mYHa057309; Fri, 13 Mar 2009 08:48:34 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2D8mYwp057308; Fri, 13 Mar 2009 08:48:34 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200903130848.n2D8mYwp057308@svn.freebsd.org> From: Doug Barton Date: Fri, 13 Mar 2009 08:48: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: r189763 - head/usr.sbin/mergemaster 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 Mar 2009 08:48:34 -0000 Author: dougb Date: Fri Mar 13 08:48:33 2009 New Revision: 189763 URL: http://svn.freebsd.org/changeset/base/189763 Log: 1. Clean up usage() output a bit by grouping options that take an argument 2. Fix a comment to refer to the right loop Modified: head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Fri Mar 13 08:13:51 2009 (r189762) +++ head/usr.sbin/mergemaster/mergemaster.sh Fri Mar 13 08:48:33 2009 (r189763) @@ -15,8 +15,8 @@ PATH=/bin:/usr/bin:/usr/sbin display_usage () { VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` echo "mergemaster version ${VERSION_NUMBER}" - echo 'Usage: mergemaster [-scrvahipCP] [-m /path]' - echo ' [-t /path] [-d] [-u N] [-w N] [-D /path]' + echo 'Usage: mergemaster [-scrvahipCPU]' + echo ' [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]' echo "Options:" echo " -s Strict comparison (diff every pair of files)" echo " -c Use context diff instead of unified diff" @@ -28,6 +28,8 @@ display_usage () { echo ' -p Pre-buildworld mode, only compares crucial files' echo ' -C Compare local rc.conf variables to the defaults' echo ' -P Preserve files that are overwritten' + echo " -U Attempt to auto upgrade files that have not been user modified" + echo '' echo " -m /path/directory Specify location of source to do the make in" echo " -t /path/directory Specify temp root directory" echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)" @@ -35,7 +37,6 @@ display_usage () { echo " -w N Specify a screen width in columns to sdiff" echo " -A architecture Alternative architecture name to pass to make" echo ' -D /path/directory Specify the destination directory to install files to' - echo " -U Attempt to auto upgrade files that have not been user modified." echo '' } @@ -1032,7 +1033,7 @@ for COMPFILE in `find . -type f -size +0 esac # Auto run test fi # Yes, the files are different fi # Yes, the file still remains to be checked -done # This is for the do way up there at the beginning of the comparison +done # This is for the for way up there at the beginning of the comparison echo '' echo "*** Comparison complete" From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 10:09:08 2009 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 E5E74106566C; Fri, 13 Mar 2009 10:09:08 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D481E8FC08; Fri, 13 Mar 2009 10:09:08 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DA98U5060346; Fri, 13 Mar 2009 10:09:08 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DA98Fr060345; Fri, 13 Mar 2009 10:09:08 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <200903131009.n2DA98Fr060345@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 13 Mar 2009 10: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: r189764 - 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: Fri, 13 Mar 2009 10:09:09 -0000 Author: ru Date: Fri Mar 13 10:09:08 2009 New Revision: 189764 URL: http://svn.freebsd.org/changeset/base/189764 Log: Don't put "install-info" to the list of install-tools if we're installing with -DWITHOUT_INFO, otherwise one can experience a failure trying to installworld on a system that is built with -DWITHOUT_INFO (i.e., without /usr/bin/install-info). Reported by: bland MFC after: 3 days Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Mar 13 08:48:33 2009 (r189763) +++ head/Makefile.inc1 Fri Mar 13 10:09:08 2009 (r189764) @@ -612,8 +612,12 @@ installcheck_UGID: # # Required install tools to be saved in a scratch dir for safety. # +.if ${MK_INFO} != "no" +_install-info= install-info +.endif + ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ - date echo egrep find grep install-info \ + date echo egrep find grep ${_install-info} \ ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ test true uname wc zic From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 10:40:38 2009 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 A33D71065673; Fri, 13 Mar 2009 10:40:38 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 901048FC1B; Fri, 13 Mar 2009 10:40:38 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DAec40061139; Fri, 13 Mar 2009 10:40:38 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DAecSO061131; Fri, 13 Mar 2009 10:40:38 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200903131040.n2DAecSO061131@svn.freebsd.org> From: Gabor Kovesdan Date: Fri, 13 Mar 2009 10:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 10:40:39 -0000 Author: gabor (doc,ports committer) Date: Fri Mar 13 10:40:38 2009 New Revision: 189765 URL: http://svn.freebsd.org/changeset/base/189765 Log: - Reenable Native Language Support in libc. This feature was disabled due to possible breakages in the catalog handling code. Since then, that code has been replaced by the secure code from NetBSD but NLS in libc remained turned off. Tests have shown that the feature is stable and working so we can now turn it on again. - Add several new catalog files: - ca_ES.ISO8859-1 - de_DE.ISO8859-1 - el_GR.ISO8859-7 (by manolis@ and keramida@) - es_ES.ISO8859-1 (kern/123179, by carvay@) - fi_FI.ISO8859-1 - fr_FR.ISO8859-1 (kern/78756, by thierry@) - hu_HU.ISO8859-2 (by gabor@) - it_IT.ISO8859-15 - nl_NL.ISO8859-1 (corrections by rene@) - no_NO.ISO8859-1 - mn_MN.UTF-8 (by ganbold@) - sk_SK.ISO8859-2 - sv_SE.ISO8859-1 (The catalogs without explicit source has been obtained from NetBSD.) Approved by: attilio Added: head/lib/libc/nls/ca_ES.ISO8859-1.msg (contents, props changed) head/lib/libc/nls/de_DE.ISO8859-1.msg (contents, props changed) head/lib/libc/nls/el_GR.ISO8859-7.msg (contents, props changed) head/lib/libc/nls/es_ES.ISO8859-1.msg (contents, props changed) head/lib/libc/nls/fi_FI.ISO8859-1.msg (contents, props changed) head/lib/libc/nls/fr_FR.ISO8859-1.msg (contents, props changed) head/lib/libc/nls/hu_HU.ISO8859-2.msg (contents, props changed) head/lib/libc/nls/it_IT.ISO8859-15.msg (contents, props changed) head/lib/libc/nls/mn_MN.UTF-8.msg (contents, props changed) head/lib/libc/nls/nl_NL.ISO8859-1.msg (contents, props changed) head/lib/libc/nls/no_NO.ISO8859-1.msg (contents, props changed) head/lib/libc/nls/sk_SK.ISO8859-2.msg (contents, props changed) head/lib/libc/nls/sv_SE.ISO8859-1.msg (contents, props changed) Modified: head/Makefile.inc1 head/lib/libc/Makefile head/lib/libc/nls/Makefile.inc Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Mar 13 10:09:08 2009 (r189764) +++ head/Makefile.inc1 Fri Mar 13 10:40:38 2009 (r189765) @@ -232,7 +232,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ - -DWITHOUT_NLS -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ + -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF # build-tools stage @@ -291,7 +291,7 @@ LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTRE SHLIBDIR=/usr/lib32 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ - -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \ + -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \ -DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP} LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS .endif @@ -429,7 +429,7 @@ _libraries: @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; \ ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ - -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE libraries + -DWITHOUT_MAN -DWITHOUT_PROFILE libraries _depend: @echo @echo "--------------------------------------------------------------" Modified: head/lib/libc/Makefile ============================================================================== --- head/lib/libc/Makefile Fri Mar 13 10:09:08 2009 (r189764) +++ head/lib/libc/Makefile Fri Mar 13 10:40:38 2009 (r189765) @@ -16,6 +16,7 @@ SHLIB_MAJOR= 7 WARNS?= 2 CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include CFLAGS+=-I${.CURDIR}/${MACHINE_ARCH} +CFLAGS+=-DNLS CLEANFILES+=tags INSTALL_PIC_ARCHIVE= PRECIOUSLIB= Modified: head/lib/libc/nls/Makefile.inc ============================================================================== --- head/lib/libc/nls/Makefile.inc Fri Mar 13 10:09:08 2009 (r189764) +++ head/lib/libc/nls/Makefile.inc Fri Mar 13 10:40:38 2009 (r189765) @@ -8,3 +8,31 @@ SRCS+= msgcat.c SYM_MAPS+=${.CURDIR}/nls/Symbol.map MAN+= catclose.3 catgets.3 catopen.3 + +# NOTE: C.msg should not be processed here, it's used as a template +# for translators. + +NLSNAME= libc +NLS+= ca_ES.ISO8859-1 +NLS+= de_DE.ISO8859-1 +NLS+= el_GR.ISO8859-7 +NLS+= es_ES.ISO8859-1 +NLS+= fi_FI.ISO8859-1 +NLS+= fr_FR.ISO8859-1 +NLS+= hu_HU.ISO8859-2 +NLS+= it_IT.ISO8859-15 +NLS+= ko_KR.UTF-8 +NLS+= ko_KR.eucKR +NLS+= mn_MN.UTF-8 +NLS+= nl_NL.ISO8859-1 +NLS+= no_NO.ISO8859-1 +NLS+= pl_PL.ISO8859-2 +NLS+= ru_RU.KOI8-R +NLS+= sk_SK.ISO8859-2 +NLS+= sv_SE.ISO8859-1 + +beforeinstall: +.for c in ${NLS} + mkdir -p ${CANONICALOBJDIR}/../../lib32/usr/share/nls/${c} + mkdir -p ${CANONICALOBJDIR}/../../tmp/usr/share/nls/${c} +.endfor Added: head/lib/libc/nls/ca_ES.ISO8859-1.msg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/nls/ca_ES.ISO8859-1.msg Fri Mar 13 10:40:38 2009 (r189765) @@ -0,0 +1,267 @@ +$ $FreeBSD$ +$ +$ Message catalog for ca_ES.ISO8859-1 locale +$ +$ strerror() support catalog +$ +$set 1 +$ EPERM +1 Operació no permesa +$ ENOENT +2 Arxiu o directori inexistent +$ ESRCH +3 Procés inexistent +$ EINTR +4 Crida del sistema interrompuda +$ EIO +5 Error d'entrada/sortida +$ ENXIO +6 Dispositiu no configurat +$ E2BIG +7 Llista de parŕmetres massa llarga +$ ENOEXEC +8 Error en el format de l'executable +$ EBADF +9 Descriptor d'arxiu incorrecte +$ ECHILD +10 No hi ha processos fills +$ EDEADLK +11 S'ha evitat el bloqueig del recurs +$ ENOMEM +12 No es pot assignar la memňria demanada +$ EACCES +13 Permís denegat +$ EFAULT +14 Adreça incorrecta +$ ENOTBLK +15 Es necessita un dispositiu de blocs +$ EBUSY +16 Dispositiu ocupat +$ EEXIST +17 L'arxiu ja existeix +$ EXDEV +18 Enllaç entre dispositius +$ ENODEV +19 Operació no suportada pel dispositiu +$ ENOTDIR +20 No és un directori +$ EISDIR +21 És un directori +$ EINVAL +22 Parŕmetre incorrecte +$ ENFILE +23 Hi ha massa arxius oberts al sistema +$ EMFILE +24 Hi ha massa arxius oberts +$ ENOTTY +25 L'ioctl no és adecuat per al dispositiu +$ ETXTBSY +26 Arxiu de text ocupat +$ EFBIG +27 Arxiu massa gran +$ ENOSPC +28 No queda espai lliure en el dispositiu +$ ESPIPE +29 Cerca ilˇlegal +$ EROFS +30 Sistema d'arxius de només lectura +$ EMLINK +31 Massa enllaços +$ EPIPE +32 Canal (pipe) trencat +$ EDOM +33 El resultat surt fora de rang +$ ERANGE +34 Resultat massa gran +$ EAGAIN, EWOULDBLOCK +35 El recurs no estŕ disponible temporalment +$ EINPROGRESS +36 L'operació es troba en progrés actualment +$ EALREADY +37 L'operació ja es troba en progrés +$ ENOTSOCK +38 Operació de tipus socket en quelcom que no ho és +$ EDESTADDRREQ +39 Es requereix l'adreça de destí +$ EMSGSIZE +40 Missatge massa llarg +$ EPROTOTYPE +41 Tipus de protocol incorrecte per al socket +$ ENOPROTOOPT +42 Protocol no disponible +$ EPROTONOSUPPORT +43 Protocol no suportat +$ ESOCKTNOSUPPORT +44 Tipus de socket no suportat +$ EOPNOTSUPP +45 Operació no suportada +$ EPFNOSUPPORT +46 Família de protocols no suportada +$ EAFNOSUPPORT +47 Família d'adreces no suportada per la família de protocols +$ EADDRINUSE +48 L'adreça ja es troba en ús +$ EADDRNOTAVAIL +49 No es pot assignar l'adreça demanada +$ ENETDOWN +50 La xarxa no es troba disponible +$ ENETUNREACH +51 No es pot accedir a la xarxa +$ ENETRESET +52 La connexió a la xarxa s'ha perdut durant la reinicialització +$ ECONNABORTED +53 El programari ha causat l'avort de la connexió +$ ECONNRESET +54 L'interlocutor ha reinicialitzat la comunicació +$ ENOBUFS +55 No hi ha prou espai per a la memoria intermčdia (buffer) +$ EISCONN +56 El socket ja es troba connectat +$ ENOTCONN +57 El socket no es troba connectat +$ ESHUTDOWN +58 No es pot enviar desprčs de la desconnexió del socket +$ ETOOMANYREFS +59 Hi ha massa referčncies: no es poden unir +$ ETIMEDOUT +60 El temps de connexió s'ha esgotat +$ ECONNREFUSED +61 Connexió rebutjada +$ ELOOP +62 Hi ha massa nivells d'enllaços simbňlics +$ ENAMETOOLONG +63 Nom d'arxiu massa llarg +$ EHOSTDOWN +64 La mŕquina no es troba disponible +$ EHOSTUNREACH +65 No hi ha cap camí fins a la mŕquina +$ ENOTEMPTY +66 El directori no estŕ buit +$ EPROCLIM +67 Hi ha massa processos +$ EUSERS +68 Hi ha massa usuaris +$ EDQUOT +69 Quota de disc sobrepassada +$ ESTALE +70 Descriptor d'arxiu NFS incorrecte +$ EREMOTE +71 Massa nivells en el camí de destí +$ EBADRPC +72 L'estructura RPC es incorrecta +$ ERPCMISMATCH +73 La versió del RPC es incorrecta +$ EPROGUNAVAIL +74 El programa RPC no es troba disponible +$ EPROGMISMATCH +75 Versió incorrecta del programa +$ EPROCUNAVAIL +76 Procediment erroni per al programa +$ ENOLCK +77 No hi ha bloquejos disponibles +$ ENOSYS +78 Funció no implementada +$ EFTYPE +79 Tipus d'arxiu o de format inadequat +$ EAUTH +80 Error d'autenticació +$ ENEEDAUTH +81 Es necessita un autenticador +$ EIDRM +82 Identificador eliminat +$ ENOMSG +83 No hi ha missatges del tipus desitjat +$ EOVERFLOW +84 Valor massa gran per a ésser emmagatzemat en el tipus de dades +$ EILSEQ +85 Seqüčncia de bytes ilˇlegal +$ ENOTSUP +86 No suportat +$ ECANCELED +87 Operació cancelˇlada +$ EBADMSG +88 Missatje incorrecte o corrupte +$ ENODATA +89 No hi ha missatges disponibles +$ ENOSR +90 No hi ha recursos de tipus STREAM +$ ENOSTR +91 No és un STREAM +$ ETIME +92 Temps d'espera esgotat en el ioctl STREAM +$ ENOATTR +93 Atribut inexistent +$ EMULTIHOP +94 S'ha intentat un multisalt +$ ENOLINK +95 L'enllaç s'ha servit +$ EPROTO +96 Error de protocol +$ +$ strsignal() support catalog +$ +$set 2 +$ SIGHUP +1 Fí de línia (hangup) +$ SIGINT +2 Interrupció +$ SIGQUIT +3 Finalització +$ SIGILL +4 Instrucció ilˇlegal +$ SIGTRAP +5 Depuració (Trace/BPT) +$ SIGABRT +6 Crida d'avort +$ SIGEMT +7 Captura d'EMT +$ SIGFPE +8 Excepció de coma flotant +$ SIGKILL +9 Matat +$ SIGBUS +10 Error del bus +$ SIGSEGV +11 Error de segmentació +$ SIGSYS +12 Crida al sistema incorrecta +$ SIGPIPE +13 Canal (pipe) trencat +$ SIGALRM +14 Alarma de rellotge +$ SIGTERM +15 Finalitzat +$ SIGURG +16 Condició urgent d'E/S +$ SIGSTOP +17 Parat (per senyal) +$ SIGTSTP +18 Parat +$ SIGCONT +19 Continuant +$ SIGCHLD +20 El fill ha acabat +$ SIGTTIN +21 Parat (entrada de tty) +$ SIGTTOU +22 Parat (sortida de tty) +$ SIGIO +23 I/O permesa +$ SIGXCPU +24 S'ha sobrepassat el límit de temps de la CPU +$ SIGXFSZ +25 S'ha sobrepassat el límit de la longitud de l'arxiu +$ SIGVTALRM +26 El temporitzador virtual ha expirat +$ SIGPROF +27 El temporitzador del perfilador ha expirat +$ SIGWINCH +28 Canvis en la mida de la finestra +$ SIGINFO +29 Demanda d'informació +$ SIGUSR1 +30 Senyal 1 definida per l'usuari +$ SIGUSR2 +31 Senyal 2 definida per l'usuari +$ SIGPWR +32 Fallada/reinicialització de l'alimentació Added: head/lib/libc/nls/de_DE.ISO8859-1.msg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/nls/de_DE.ISO8859-1.msg Fri Mar 13 10:40:38 2009 (r189765) @@ -0,0 +1,267 @@ +$ $FreeBSD$ +$ +$ Message catalog for de_DE.ISO8859-1 locale +$ +$ strerror() support catalog +$ +$set 1 +$ EPERM +1 Operation nicht erlaubt +$ ENOENT +2 Datei oder Verzeichnis nicht gefunden +$ ESRCH +3 Prozess nicht gefunden +$ EINTR +4 Interrupt innerhalb eines Systemaufrufs +$ EIO +5 Ein/Ausgabefehler +$ ENXIO +6 Gerät ist nicht konfiguriert +$ E2BIG +7 Argumentliste ist zu lang +$ ENOEXEC +8 Die Datei hat kein bekanntes ausführbares Format +$ EBADF +9 Ungültiger Dateideskriptor +$ ECHILD +10 Kein Kindprozess +$ EDEADLK +11 Ein Deadlock wurde vermieden +$ ENOMEM +12 Kann nicht genug Speicher belegen +$ EACCES +13 Zugriff verboten +$ EFAULT +14 Ungültige Adresse +$ ENOTBLK +15 Es wird ein Blockgerät benötigt +$ EBUSY +16 Das Gerät ist belegt +$ EEXIST +17 Datei existiert bereits +$ EXDEV +18 Link zwischen verschiedenen Geräten +$ ENODEV +19 Die Operation wird von diesem Gerät nicht unterstützt +$ ENOTDIR +20 Kein Verzeichnis +$ EISDIR +21 Ist ein Verzeichnis +$ EINVAL +22 Ungültiges Argument +$ ENFILE +23 Zu viele offene Dateien im gesamten System +$ EMFILE +24 Zu viele offene Dateien +$ ENOTTY +25 Ungültiger Ioctl für dieses Gerät +$ ETXTBSY +26 Ausführbare Datei wird benutzt +$ EFBIG +27 Datei zu groß +$ ENOSPC +28 Kein Platz mehr auf dem Gerät +$ ESPIPE +29 Ungültige Positionierung +$ EROFS +30 Dateisystem ist schreibgeschützt +$ EMLINK +31 Zu viele Links +$ EPIPE +32 Unterbrochene Pipe +$ EDOM +33 Numerisches Argument ausserhalb des Wertebereichs +$ ERANGE +34 Ergebnis zu groß oder zu klein +$ EAGAIN, EWOULDBLOCK +35 Ressource vorübergehend nicht verfügbar +$ EINPROGRESS +36 Operation wird jetzt fortgesetzt +$ EALREADY +37 Operation wird bereits ausgeführt +$ ENOTSOCK +38 Deskriptor ist kein Socket +$ EDESTADDRREQ +39 Zieladresse benötigt +$ EMSGSIZE +40 Nachricht zu lang +$ EPROTOTYPE +41 Ungültiger Protokolltyp für diesen Socket +$ ENOPROTOOPT +42 Protokoll nicht verfügbar +$ EPROTONOSUPPORT +43 Protokoll nicht unterstützt +$ ESOCKTNOSUPPORT +44 Sockettyp nicht unterstützt +$ EOPNOTSUPP +45 Operation nicht unterstützt +$ EPFNOSUPPORT +46 Protokollfamilie nicht unterstützt +$ EAFNOSUPPORT +47 Addressart wird von der Protokollfamilie nicht unterstützt +$ EADDRINUSE +48 Adresse wird bereits benutzt +$ EADDRNOTAVAIL +49 Kann angeforderte Adresse nicht belegen +$ ENETDOWN +50 Netzwerk nicht verfügbar +$ ENETUNREACH +51 Netzwerk nicht erreichbar +$ ENETRESET +52 Netzwerk hat Verbindung mit Reset abgebrochen +$ ECONNABORTED +53 Software verursachte einen Verbindungsabbruch +$ ECONNRESET +54 Verbindung wurde von der Gegenstelle geschlossen +$ ENOBUFS +55 Keine Buffer verfügbar +$ EISCONN +56 Socket ist schon verbunden +$ ENOTCONN +57 Socket ist nicht verbunden +$ ESHUTDOWN +58 Kann nach einem Socket-Shutdown nicht mehr senden +$ ETOOMANYREFS +59 Zu viele Referenzen, kann nicht verbinden +$ ETIMEDOUT +60 Verbindungsabbruch durch Zeitüberschreitung +$ ECONNREFUSED +61 Verbindung wurde abgelehnt +$ ELOOP +62 Zu viele symbolische Links (zirkulär?) +$ ENAMETOOLONG +63 Dateiname zu lang +$ EHOSTDOWN +64 Host nicht verfügbar +$ EHOSTUNREACH +65 Keine Route zum Host +$ ENOTEMPTY +66 Verzeichnis ist nicht leer +$ EPROCLIM +67 Zu viele Prozesse +$ EUSERS +68 Zu viele Benutzer +$ EDQUOT +69 Plattenplatzlimit erschöpft +$ ESTALE +70 Verwaister NFS-Dateideskriptor +$ EREMOTE +71 Zu viele Fernverweise in diesem Zugriff +$ EBADRPC +72 RPC-Struktur ist ungültig +$ ERPCMISMATCH +73 RPC-Version stimmt nicht +$ EPROGUNAVAIL +74 RPC-Programm nicht verfügbar +$ EPROGMISMATCH +75 Falsche Programmversion +$ EPROCUNAVAIL +76 Falsche Prozedur für dieses Programm +$ ENOLCK +77 Keine Dateisperren verfügbar +$ ENOSYS +78 Funktion nicht implementiert +$ EFTYPE +79 Ungültiger Dateityp oder Dateiformat +$ EAUTH +80 Authentikationsfehler +$ ENEEDAUTH +81 Authentikator benötigt +$ EIDRM +82 Identifizierung entfernt +$ ENOMSG +83 Keine Nachricht vom gewünschten Typ +$ EOVERFLOW +84 Wert zu groß, um in Datentyp zu speichern +$ EILSEQ +85 Illegale Byte-Sequenz +$ ENOTSUP +86 Operation nicht unterstützt +$ ECANCELED +87 Operation abgebrochen +$ EBADMSG +88 Ungültige Nachricht +$ ENODATA +89 Keine Nachricht verfügbar +$ ENOSR +90 Keine STREAM-Ressourcen verfügbar +$ ENOSTR +91 Kein STREAM +$ ETIME +92 Zeitüberschreitung bei STREAM Ioctl +$ ENOATTR +93 Attribut nicht gefunden +$ EMULTIHOP +94 Multihopversuch +$ ENOLINK +95 Verbindung wurde getrennt +$ EPROTO +96 Protokollfehler +$ +$ strsignal() support catalog +$ +$set 2 +$ SIGHUP +1 Verbindungsende +$ SIGINT +2 Unterbrechung +$ SIGQUIT +3 Programmende +$ SIGILL +4 Ungültiger Maschinenbefehl +$ SIGTRAP +5 Trace/BPT trap +$ SIGABRT +6 Abort trap +$ SIGEMT +7 EMT trap +$ SIGFPE +8 Fließkommafehler +$ SIGKILL +9 Unbedingter Programmabbruch +$ SIGBUS +10 Bus-Zugriffsfehler +$ SIGSEGV +11 Illegaler Speicherzugriff +$ SIGSYS +12 Ungültiger Systemaufruf +$ SIGPIPE +13 Unterbrochene Pipe +$ SIGALRM +14 Wecker +$ SIGTERM +15 Beendet +$ SIGURG +16 Dringende Ein/Ausgabeanforderung +$ SIGSTOP +17 Gestoppt (Signal) +$ SIGTSTP +18 Gestoppt +$ SIGCONT +19 Fortgesetzt +$ SIGCHLD +20 Kindprozess beendet +$ SIGTTIN +21 Gestoppt (Eingabe) +$ SIGTTOU +22 Gestoppt (Ausgabe) +$ SIGIO +23 Ein/Ausgabe ist möglich +$ SIGXCPU +24 CPU-Zeitlimit erschöpft +$ SIGXFSZ +25 Dateigröße hat das Limit erreicht +$ SIGVTALRM +26 Virtueller Wecker abgelaufen +$ SIGPROF +27 Profil-Wecker abgelaufen +$ SIGWINCH +28 Fenstergröße hat sich geändert +$ SIGINFO +29 Informationsanforderung +$ SIGUSR1 +30 Benutzerdefiniertes Signal 1 +$ SIGUSR2 +31 Benutzerdefiniertes Signal 2 +$ SIGPWR +32 Statusänderung der Energieversorgung Added: head/lib/libc/nls/el_GR.ISO8859-7.msg ============================================================================== Binary file. No diff available. Added: head/lib/libc/nls/es_ES.ISO8859-1.msg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/nls/es_ES.ISO8859-1.msg Fri Mar 13 10:40:38 2009 (r189765) @@ -0,0 +1,249 @@ +$ $FreeBSD$ +$ +$ Message catalog for es_ES.ISO8859-1 locale +$ +$ strerror() support catalog +$ +$set 1 +$ EPERM +1 Operación no permitida +$ ENOENT +2 Fichero o directorio inexistente +$ ESRCH +3 Proceso inexistente +$ EINTR +4 Llamada del sistema interrumpida +$ EIO +5 Error de Entrada/Salida +$ ENXIO +6 Dispositivo no configurado +$ E2BIG +7 La lista de argumentos es demasiado larga +$ ENOEXEC +8 Error en el formato del ejecutable +$ EBADF +9 Descriptor incorrecto de fichero +$ ECHILD +10 No hay procesos hijo +$ EDEADLK +11 Se ha evitado el bloqueo del recurso +$ ENOMEM +12 No se pudo asignar memoria +$ EACCES +13 Permiso denegado +$ EFAULT +14 Dirección incorrecta +$ ENOTBLK +15 Se necesita un dispositivo de bloques +$ EBUSY +16 Dispositivo ocupado +$ EEXIST +17 El fichero ya existe +$ EXDEV +18 Enlace entre dispositivos +$ ENODEV +19 Operación inadecuada para este dispositivo +$ ENOTDIR +20 No es un directorio +$ EISDIR +21 Es un directorio +$ EINVAL +22 Argumento inadecuado +$ ENFILE +23 Hay demasiados ficheros abiertos en el sistema +$ EMFILE +24 Hay demasiados ficheros abiertos +$ ENOTTY +25 ioctl inapropiado para el dispositivo +$ ETXTBSY +26 Fichero de texto ocupado +$ EFBIG +27 Fichero demasiado grande +$ ENOSPC +28 No queda espacio libre en el dispositivo +$ ESPIPE +29 Illegal seek +$ EROFS +30 Sistema de ficheros de solo lectura +$ EMLINK +31 Demasiados enlaces +$ EPIPE +32 Canal (pipe) roto +$ EDOM +33 Argumento numérico fuera de rango +$ ERANGE +34 El resultado es demasiado grande +$ EAGAIN, EWOULDBLOCK +35 el recurso no está disponible temporalmente +$ EINPROGRESS +36 Operación en proceso +$ EALREADY +37 La operación ya se está ejecutando +$ ENOTSOCK +38 Operación de socket inaceptable para el dispositivo +$ EDESTADDRREQ +39 Se necesita una dirección de destino +$ EMSGSIZE +40 Mensaje demasiado largo +$ EPROTOTYPE +41 Tipo erróneo de protocolo para el socket +$ ENOPROTOOPT +42 protocolo no disponible +$ EPROTONOSUPPORT +43 Protocolo no contemplado +$ ESOCKTNOSUPPORT +44 Tipo de socket no contemplado +$ EOPNOTSUPP +45 Operación no contemplada +$ EPFNOSUPPORT +46 Familia de protocolos no contemplada +$ EAFNOSUPPORT +47 Familia de direcciones no contemplada por la familia de protocolos +$ EADDRINUSE +48 La dirección ya está siendo usada +$ EADDRNOTAVAIL +49 No se pudo asignar la dirección requerida +$ ENETDOWN +50 La red no funciona +$ ENETUNREACH +51 No se ha podido acceder a la red +$ ENETRESET +52 La conexión de red se ha interrumpido al reinicializar +$ ECONNABORTED +53 Conexión perdida por problemas en el software +$ ECONNRESET +54 El interlocutor ha reinicializado la conexión +$ ENOBUFS +55 No queda espacio en el búfer +$ EISCONN +56 El socket ya estaba conectado +$ ENOTCONN +57 El socket no está conectado +$ ESHUTDOWN +58 No se puede enviar tras la desconexión del socket +$ ETOOMANYREFS +59 Demasiadas referencias: no se pueden unir +$ ETIMEDOUT +60 El tiempo de conexión ha expirado +$ ECONNREFUSED +61 Conexión rehusada +$ ELOOP +62 Demasiados niveles de enlaces simbólicos +$ ENAMETOOLONG +63 Nombre de fichero demasiado largo +$ EHOSTDOWN +64 La máquina está fuera de servicio +$ EHOSTUNREACH +65 No hay ruta hasta la máquina +$ ENOTEMPTY +66 Directorio no vacío +$ EPROCLIM +67 Demasiados procesos +$ EUSERS +68 Demasiados usuarios +$ EDQUOT +69 Cuota de disco sobrepasada +$ ESTALE +70 Descriptor de fichero NFS inválido +$ EREMOTE +71 Ruta con demasiados niveles +$ EBADRPC +72 La estructura de la RPC es errónea +$ ERPCMISMATCH +73 La versón de la RPC es errónea +$ EPROGUNAVAIL +74 La RPC no está accesible +$ EPROGMISMATCH +75 Versión errónea del programa +$ EPROCUNAVAIL +76 Procedimiento erróneo para el programa +$ ENOLCK +77 No hay bloqueos disponibles +$ ENOSYS +78 Función no realizada +$ EFTYPE +79 Tipo de fichero o formato inapropiado +$ EAUTH +80 Error de autentificación +$ ENEEDAUTH +81 Se necesita un autenticador +$ EIDRM +82 Identificador eliminado +$ ENOMSG +83 No hay mensajes del tipo deseado +$ EOVERFLOW +84 Valor demasiado grande para almacenarse en el tipo deseado +$ ECANCELED +85 Operación cancelada +$ EILSEQ +86 Illegal byte sequence +$ ENOATTR +87 Atributo no encontrado +$ EDOOFUS +88 Error de programación +$ +$ strsignal() support catalog +$ +$set 2 +$ SIGHUP +1 Fín de línea (Hangup) +$ SIGINT +2 Interrumpido +$ SIGQUIT +3 Terminado +$ SIGILL +4 Illegal instruction +$ SIGTRAP +5 Trace/BPT trap +$ SIGABRT +6 Abort trap +$ SIGEMT +7 EMT trap +$ SIGFPE +8 Excepción de coma flotante +$ SIGKILL +9 Matado +$ SIGBUS +10 Error en el bus +$ SIGSEGV +11 Fallo de segmentación +$ SIGSYS +12 Llamada al sistema errónea +$ SIGPIPE +13 Canal (pipe) roto +$ SIGALRM +14 Alarma del reloj +$ SIGTERM +15 Terminado +$ SIGURG +16 Condición urgente de E/S +$ SIGSTOP +17 Detenido (seńal) +$ SIGTSTP +18 Detenido +$ SIGCONT +19 Continuando +$ SIGCHLD +20 Proceso hijo terminado +$ SIGTTIN +21 Detenido (entrada tty) +$ SIGTTOU +22 Detenido (salida tty) +$ SIGIO +23 E/S posible +$ SIGXCPU +24 Se ha sobrepasado el tiempo límite de la CPU +$ SIGXFSZ +25 Se ha sobrepasado el límite de tamańo de fichero +$ SIGVTALRM +26 Temporizador virtual expirado +$ SIGPROF +27 Temporizador de perfilación expirado +$ SIGWINCH +28 Cambios en el tamańo de ventana +$ SIGINFO +29 Petición de información +$ SIGUSR1 +30 Seńal definida por el usuario n1 +$ SIGUSR2 +31 Seńal definida por el usuario n2 Added: head/lib/libc/nls/fi_FI.ISO8859-1.msg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/nls/fi_FI.ISO8859-1.msg Fri Mar 13 10:40:38 2009 (r189765) @@ -0,0 +1,233 @@ +$ $FreeBSD$ +$ +$ Message catalog for fi_FI.ISO8859-1 locale +$ +$ strerror() support catalog +$ +$set 1 +$ EPERM +1 Toimintoa ei sallita +$ ENOENT +2 Tiedostoa tai hakemistoa ei löydy +$ ESRCH +3 Prosessia ei löydy +$ EINTR +4 Systeemikutsu keskeytyi +$ EIO +5 Syöttö/tulostusvirhe +$ ENXIO +6 Laitetta ei määritelty +$ E2BIG +7 Liikaa argumentteja +$ ENOEXEC +8 Tuntematon ohjelmatyyppi +$ EBADF +9 Virheellinen tiedosto-osoitin +$ ECHILD +10 Ei lapsiprosesseja +$ EDEADLK +11 Resurssin ristiinlukitus vältetty +$ ENOMEM +12 Muistinvaraus epäonnistui +$ EACCES +13 Lupa kielletty +$ EFAULT +14 Virheellinen osoite +$ ENOTBLK +15 Tarvitaan lohko-osoitettava laite +$ EBUSY +16 Laite käytössä +$ EEXIST +17 Tiedosto on jo olemassa +$ EXDEV +18 Laitteiden välinen linkki +$ ENODEV +19 Laite ei tue toimintoa +$ ENOTDIR +20 Kohde ei ole hakemisto +$ EISDIR +21 Kohde on hakemisto +$ EINVAL +22 Virheellinen argumentti +$ ENFILE +23 Järjestelmässä on liian monta avointa tiedostoa +$ EMFILE +24 Liian monta avointa tiedostoa +$ ENOTTY +25 Virheellinen ohjaustoiminto laitteelle +$ ETXTBSY +26 Tiedosto on käytössä +$ EFBIG +27 Tiedosto liian suuri +$ ENOSPC +28 Laitteella ei ole tilaa +$ ESPIPE +29 Virheellinen haku +$ EROFS +30 Vain luettava tiedostojärjestelmä +$ EMLINK +31 Liian monta linkkiä +$ EPIPE +32 Katkennut putki +$ EDOM +33 Numeerinen syöte virheellinen +$ ERANGE +34 Tulos liian suuri +$ EAGAIN, EWOULDBLOCK +35 Resurssi ei ole tilapäisesti saatavilla +$ EINPROGRESS +36 Toiminta on käynnissä +$ EALREADY +37 Toiminta oli jo käynnissä +$ ENOTSOCK +38 Socket-operaatio muulla kuin socketilla +$ EDESTADDRREQ +39 Tarvitaan kohdeosoite +$ EMSGSIZE +40 Sanoma liian pitkä +$ EPROTOTYPE +41 Väärä protokolla socketille +$ ENOPROTOOPT +42 Protokolla ei ole käytettävissä +$ EPROTONOSUPPORT +43 Protokollaa ei tueta +$ ESOCKTNOSUPPORT +44 Socket-tyyppiä ei tueta +$ EOPNOTSUPP +45 Toimintoa ei tueta +$ EPFNOSUPPORT +46 Protokollaperhettä ei tueta +$ EAFNOSUPPORT +47 Protokollaperhe ei tue osoiteperhettä +$ EADDRINUSE +48 Osoite on jo käytössä +$ EADDRNOTAVAIL +49 Ei pysty antamaan pyydettyä osoitetta +$ ENETDOWN +50 Verkko ei ole käytettävissä +$ ENETUNREACH +51 Verkkoon ei ole yhteyttä +$ ENETRESET +52 Verkko sulki yhteyden +$ ECONNABORTED +53 Ohjelmiston aiheuttama yhteyden keskeytyminen +$ ECONNRESET +54 Isäntä nollasi yhteyden +$ ENOBUFS +55 Puskuritila on lopussa +$ EISCONN +56 Yhteys on jo olemassa +$ ENOTCONN +57 Yhteyttä ei ole olemassa +$ ESHUTDOWN +58 Lähettäminen ei ole mahdollista yhteyden katkaisun jälkeen +$ ETOOMANYREFS +59 Liikaa viittauksia: ei voi yhdistää +$ ETIMEDOUT +60 Yhteyden aikavalvontakatkaisu +$ ECONNREFUSED +61 Yhteys hylätty +$ ELOOP +62 Liian monta peräkkäistä symbolista linkkiä +$ ENAMETOOLONG *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 13:13:53 2009 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 52633106564A; Fri, 13 Mar 2009 13:13:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E1D8C8FC13; Fri, 13 Mar 2009 13:13:52 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 7761346B55; Fri, 13 Mar 2009 09:13:52 -0400 (EDT) Date: Fri, 13 Mar 2009 13:13:52 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Gabor Kovesdan In-Reply-To: <200903131040.n2DAecSO061131@svn.freebsd.org> Message-ID: References: <200903131040.n2DAecSO061131@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 13:13:53 -0000 On Fri, 13 Mar 2009, Gabor Kovesdan wrote: > - Reenable Native Language Support in libc. This feature was disabled due > to possible breakages in the catalog handling code. Since then, that > code has been replaced by the secure code from NetBSD but NLS in libc > remained turned off. Tests have shown that the feature is stable and > working so we can now turn it on again. Do we have a nice tutorialish document somewhere on what people writing new command line tools or libraries should do in order to address localization requirements, or at least, make it easier for other people to do so? I'm afraid I, at least, live in a world without catalogues, but a quick and practical guide to what The Right Thing Is for FreeBSD would make it much easier for me to do something a bit more mature. Thanks, Robert N M Watson Computer Laboratory University of Cambridge > > - Add several new catalog files: > - ca_ES.ISO8859-1 > - de_DE.ISO8859-1 > - el_GR.ISO8859-7 (by manolis@ and keramida@) > - es_ES.ISO8859-1 (kern/123179, by carvay@) > - fi_FI.ISO8859-1 > - fr_FR.ISO8859-1 (kern/78756, by thierry@) > - hu_HU.ISO8859-2 (by gabor@) > - it_IT.ISO8859-15 > - nl_NL.ISO8859-1 (corrections by rene@) > - no_NO.ISO8859-1 > - mn_MN.UTF-8 (by ganbold@) > - sk_SK.ISO8859-2 > - sv_SE.ISO8859-1 > (The catalogs without explicit source has been obtained from NetBSD.) > > Approved by: attilio > > Added: > head/lib/libc/nls/ca_ES.ISO8859-1.msg (contents, props changed) > head/lib/libc/nls/de_DE.ISO8859-1.msg (contents, props changed) > head/lib/libc/nls/el_GR.ISO8859-7.msg (contents, props changed) > head/lib/libc/nls/es_ES.ISO8859-1.msg (contents, props changed) > head/lib/libc/nls/fi_FI.ISO8859-1.msg (contents, props changed) > head/lib/libc/nls/fr_FR.ISO8859-1.msg (contents, props changed) > head/lib/libc/nls/hu_HU.ISO8859-2.msg (contents, props changed) > head/lib/libc/nls/it_IT.ISO8859-15.msg (contents, props changed) > head/lib/libc/nls/mn_MN.UTF-8.msg (contents, props changed) > head/lib/libc/nls/nl_NL.ISO8859-1.msg (contents, props changed) > head/lib/libc/nls/no_NO.ISO8859-1.msg (contents, props changed) > head/lib/libc/nls/sk_SK.ISO8859-2.msg (contents, props changed) > head/lib/libc/nls/sv_SE.ISO8859-1.msg (contents, props changed) > Modified: > head/Makefile.inc1 > head/lib/libc/Makefile > head/lib/libc/nls/Makefile.inc > > Modified: head/Makefile.inc1 > ============================================================================== > --- head/Makefile.inc1 Fri Mar 13 10:09:08 2009 (r189764) > +++ head/Makefile.inc1 Fri Mar 13 10:40:38 2009 (r189765) > @@ -232,7 +232,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ > BOOTSTRAPPING=${OSRELDATE} \ > SSP_CFLAGS= \ > -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ > - -DWITHOUT_NLS -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ > + -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ > -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF > > # build-tools stage > @@ -291,7 +291,7 @@ LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTRE > SHLIBDIR=/usr/lib32 > > LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ > - -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \ > + -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \ > -DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP} > LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS > .endif > @@ -429,7 +429,7 @@ _libraries: > @echo "--------------------------------------------------------------" > ${_+_}cd ${.CURDIR}; \ > ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ > - -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE libraries > + -DWITHOUT_MAN -DWITHOUT_PROFILE libraries > _depend: > @echo > @echo "--------------------------------------------------------------" > > Modified: head/lib/libc/Makefile > ============================================================================== > --- head/lib/libc/Makefile Fri Mar 13 10:09:08 2009 (r189764) > +++ head/lib/libc/Makefile Fri Mar 13 10:40:38 2009 (r189765) > @@ -16,6 +16,7 @@ SHLIB_MAJOR= 7 > WARNS?= 2 > CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include > CFLAGS+=-I${.CURDIR}/${MACHINE_ARCH} > +CFLAGS+=-DNLS > CLEANFILES+=tags > INSTALL_PIC_ARCHIVE= > PRECIOUSLIB= > > Modified: head/lib/libc/nls/Makefile.inc > ============================================================================== > --- head/lib/libc/nls/Makefile.inc Fri Mar 13 10:09:08 2009 (r189764) > +++ head/lib/libc/nls/Makefile.inc Fri Mar 13 10:40:38 2009 (r189765) > @@ -8,3 +8,31 @@ SRCS+= msgcat.c > SYM_MAPS+=${.CURDIR}/nls/Symbol.map > > MAN+= catclose.3 catgets.3 catopen.3 > + > +# NOTE: C.msg should not be processed here, it's used as a template > +# for translators. > + > +NLSNAME= libc > +NLS+= ca_ES.ISO8859-1 > +NLS+= de_DE.ISO8859-1 > +NLS+= el_GR.ISO8859-7 > +NLS+= es_ES.ISO8859-1 > +NLS+= fi_FI.ISO8859-1 > +NLS+= fr_FR.ISO8859-1 > +NLS+= hu_HU.ISO8859-2 > +NLS+= it_IT.ISO8859-15 > +NLS+= ko_KR.UTF-8 > +NLS+= ko_KR.eucKR > +NLS+= mn_MN.UTF-8 > +NLS+= nl_NL.ISO8859-1 > +NLS+= no_NO.ISO8859-1 > +NLS+= pl_PL.ISO8859-2 > +NLS+= ru_RU.KOI8-R > +NLS+= sk_SK.ISO8859-2 > +NLS+= sv_SE.ISO8859-1 > + > +beforeinstall: > +.for c in ${NLS} > + mkdir -p ${CANONICALOBJDIR}/../../lib32/usr/share/nls/${c} > + mkdir -p ${CANONICALOBJDIR}/../../tmp/usr/share/nls/${c} > +.endfor > > Added: head/lib/libc/nls/ca_ES.ISO8859-1.msg > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libc/nls/ca_ES.ISO8859-1.msg Fri Mar 13 10:40:38 2009 (r189765) > @@ -0,0 +1,267 @@ > +$ $FreeBSD$ > +$ > +$ Message catalog for ca_ES.ISO8859-1 locale > +$ > +$ strerror() support catalog > +$ > +$set 1 > +$ EPERM > +1 Operaci??no permesa > +$ ENOENT > +2 Arxiu o directori inexistent > +$ ESRCH > +3 Proc?? inexistent > +$ EINTR > +4 Crida del sistema interrompuda > +$ EIO > +5 Error d'entrada/sortida > +$ ENXIO > +6 Dispositiu no configurat > +$ E2BIG > +7 Llista de par??etres massa llarga > +$ ENOEXEC > +8 Error en el format de l'executable > +$ EBADF > +9 Descriptor d'arxiu incorrecte > +$ ECHILD > +10 No hi ha processos fills > +$ EDEADLK > +11 S'ha evitat el bloqueig del recurs > +$ ENOMEM > +12 No es pot assignar la mem??ia demanada > +$ EACCES > +13 Perm?? denegat > +$ EFAULT > +14 Adre?? incorrecta > +$ ENOTBLK > +15 Es necessita un dispositiu de blocs > +$ EBUSY > +16 Dispositiu ocupat > +$ EEXIST > +17 L'arxiu ja existeix > +$ EXDEV > +18 Enlla??entre dispositius > +$ ENODEV > +19 Operaci??no suportada pel dispositiu > +$ ENOTDIR > +20 No ?? un directori > +$ EISDIR > +21 ?? un directori > +$ EINVAL > +22 Par??etre incorrecte > +$ ENFILE > +23 Hi ha massa arxius oberts al sistema > +$ EMFILE > +24 Hi ha massa arxius oberts > +$ ENOTTY > +25 L'ioctl no ?? adecuat per al dispositiu > +$ ETXTBSY > +26 Arxiu de text ocupat > +$ EFBIG > +27 Arxiu massa gran > +$ ENOSPC > +28 No queda espai lliure en el dispositiu > +$ ESPIPE > +29 Cerca il?legal > +$ EROFS > +30 Sistema d'arxius de nom?? lectura > +$ EMLINK > +31 Massa enlla??s > +$ EPIPE > +32 Canal (pipe) trencat > +$ EDOM > +33 El resultat surt fora de rang > +$ ERANGE > +34 Resultat massa gran > +$ EAGAIN, EWOULDBLOCK > +35 El recurs no est??disponible temporalment > +$ EINPROGRESS > +36 L'operaci??es troba en progr?? actualment > +$ EALREADY > +37 L'operaci??ja es troba en progr?? > +$ ENOTSOCK > +38 Operaci??de tipus socket en quelcom que no ho ?? > +$ EDESTADDRREQ > +39 Es requereix l'adre?? de dest ?? +$ EMSGSIZE > +40 Missatge massa llarg > +$ EPROTOTYPE > +41 Tipus de protocol incorrecte per al socket > +$ ENOPROTOOPT > +42 Protocol no disponible > +$ EPROTONOSUPPORT > +43 Protocol no suportat > +$ ESOCKTNOSUPPORT > +44 Tipus de socket no suportat > +$ EOPNOTSUPP > +45 Operaci??no suportada > +$ EPFNOSUPPORT > +46 Fam??ia de protocols no suportada > +$ EAFNOSUPPORT > +47 Fam??ia d'adreces no suportada per la fam??ia de protocols > +$ EADDRINUSE > +48 L'adre?? ja es troba en ?? > +$ EADDRNOTAVAIL > +49 No es pot assignar l'adre?? demanada > +$ ENETDOWN > +50 La xarxa no es troba disponible > +$ ENETUNREACH > +51 No es pot accedir a la xarxa > +$ ENETRESET > +52 La connexi??a la xarxa s'ha perdut durant la reinicialitzaci ?? +$ ECONNABORTED > +53 El programari ha causat l'avort de la connexi ?? +$ ECONNRESET > +54 L'interlocutor ha reinicialitzat la comunicaci ?? +$ ENOBUFS > +55 No hi ha prou espai per a la memoria interm??ia (buffer) > +$ EISCONN > +56 El socket ja es troba connectat > +$ ENOTCONN > +57 El socket no es troba connectat > +$ ESHUTDOWN > +58 No es pot enviar despr?? de la desconnexi??del socket > +$ ETOOMANYREFS > +59 Hi ha massa refer??cies: no es poden unir > +$ ETIMEDOUT > +60 El temps de connexi??s'ha esgotat > +$ ECONNREFUSED > +61 Connexi??rebutjada > +$ ELOOP > +62 Hi ha massa nivells d'enlla??s simb??ics > +$ ENAMETOOLONG > +63 Nom d'arxiu massa llarg > +$ EHOSTDOWN > +64 La m??uina no es troba disponible > +$ EHOSTUNREACH > +65 No hi ha cap cam??fins a la m??uina > +$ ENOTEMPTY > +66 El directori no est??buit > +$ EPROCLIM > +67 Hi ha massa processos > +$ EUSERS > +68 Hi ha massa usuaris > +$ EDQUOT > +69 Quota de disc sobrepassada > +$ ESTALE > +70 Descriptor d'arxiu NFS incorrecte > +$ EREMOTE > +71 Massa nivells en el cam??de dest ?? +$ EBADRPC > +72 L'estructura RPC es incorrecta > +$ ERPCMISMATCH > +73 La versi??del RPC es incorrecta > +$ EPROGUNAVAIL > +74 El programa RPC no es troba disponible > +$ EPROGMISMATCH > +75 Versi??incorrecta del programa > +$ EPROCUNAVAIL > +76 Procediment erroni per al programa > +$ ENOLCK > +77 No hi ha bloquejos disponibles > +$ ENOSYS > +78 Funci??no implementada > +$ EFTYPE > +79 Tipus d'arxiu o de format inadequat > +$ EAUTH > +80 Error d'autenticaci ?? +$ ENEEDAUTH > +81 Es necessita un autenticador > +$ EIDRM > +82 Identificador eliminat > +$ ENOMSG > +83 No hi ha missatges del tipus desitjat > +$ EOVERFLOW > +84 Valor massa gran per a ??ser emmagatzemat en el tipus de dades > +$ EILSEQ > +85 Seq??ncia de bytes il?legal > +$ ENOTSUP > +86 No suportat > +$ ECANCELED > +87 Operaci??cancel?lada > +$ EBADMSG > +88 Missatje incorrecte o corrupte > +$ ENODATA > +89 No hi ha missatges disponibles > +$ ENOSR > +90 No hi ha recursos de tipus STREAM > +$ ENOSTR > +91 No ?? un STREAM > +$ ETIME > +92 Temps d'espera esgotat en el ioctl STREAM > +$ ENOATTR > +93 Atribut inexistent > +$ EMULTIHOP > +94 S'ha intentat un multisalt > +$ ENOLINK > +95 L'enlla??s'ha servit > +$ EPROTO > +96 Error de protocol > +$ > +$ strsignal() support catalog > +$ > +$set 2 > +$ SIGHUP > +1 F??de l??ia (hangup) > +$ SIGINT > +2 Interrupci ?? +$ SIGQUIT > +3 Finalitzaci ?? +$ SIGILL > +4 Instrucci??il?legal > +$ SIGTRAP > +5 Depuraci??(Trace/BPT) > +$ SIGABRT > +6 Crida d'avort > +$ SIGEMT > +7 Captura d'EMT > +$ SIGFPE > +8 Excepci??de coma flotant > +$ SIGKILL > +9 Matat > +$ SIGBUS > +10 Error del bus > +$ SIGSEGV > +11 Error de segmentaci ?? +$ SIGSYS > +12 Crida al sistema incorrecta > +$ SIGPIPE > +13 Canal (pipe) trencat > +$ SIGALRM > +14 Alarma de rellotge > +$ SIGTERM > +15 Finalitzat > +$ SIGURG > +16 Condici??urgent d'E/S > +$ SIGSTOP > +17 Parat (per senyal) > +$ SIGTSTP > +18 Parat > +$ SIGCONT > +19 Continuant > +$ SIGCHLD > +20 El fill ha acabat > +$ SIGTTIN > +21 Parat (entrada de tty) > +$ SIGTTOU > +22 Parat (sortida de tty) > +$ SIGIO > +23 I/O permesa > +$ SIGXCPU > +24 S'ha sobrepassat el l??it de temps de la CPU > +$ SIGXFSZ > +25 S'ha sobrepassat el l??it de la longitud de l'arxiu > +$ SIGVTALRM > +26 El temporitzador virtual ha expirat > +$ SIGPROF > +27 El temporitzador del perfilador ha expirat > +$ SIGWINCH > +28 Canvis en la mida de la finestra > +$ SIGINFO > +29 Demanda d'informaci ?? +$ SIGUSR1 > +30 Senyal 1 definida per l'usuari > +$ SIGUSR2 > +31 Senyal 2 definida per l'usuari > +$ SIGPWR > +32 Fallada/reinicialitzaci??de l'alimentaci ?? > Added: head/lib/libc/nls/de_DE.ISO8859-1.msg > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libc/nls/de_DE.ISO8859-1.msg Fri Mar 13 10:40:38 2009 (r189765) > @@ -0,0 +1,267 @@ > +$ $FreeBSD$ > +$ > +$ Message catalog for de_DE.ISO8859-1 locale > +$ > +$ strerror() support catalog > +$ > +$set 1 > +$ EPERM > +1 Operation nicht erlaubt > +$ ENOENT > +2 Datei oder Verzeichnis nicht gefunden > +$ ESRCH > +3 Prozess nicht gefunden > +$ EINTR > +4 Interrupt innerhalb eines Systemaufrufs > +$ EIO > +5 Ein/Ausgabefehler > +$ ENXIO > +6 Ger?? ist nicht konfiguriert > +$ E2BIG > +7 Argumentliste ist zu lang > +$ ENOEXEC > +8 Die Datei hat kein bekanntes ausf??rbares Format > +$ EBADF > +9 Ung??tiger Dateideskriptor > +$ ECHILD > +10 Kein Kindprozess > +$ EDEADLK > +11 Ein Deadlock wurde vermieden > +$ ENOMEM > +12 Kann nicht genug Speicher belegen > +$ EACCES > +13 Zugriff verboten > +$ EFAULT > +14 Ung??tige Adresse > +$ ENOTBLK > +15 Es wird ein Blockger?? ben??igt > +$ EBUSY > +16 Das Ger?? ist belegt > +$ EEXIST > +17 Datei existiert bereits > +$ EXDEV > +18 Link zwischen verschiedenen Ger??en > +$ ENODEV > +19 Die Operation wird von diesem Ger?? nicht unterst??zt > +$ ENOTDIR > +20 Kein Verzeichnis > +$ EISDIR > +21 Ist ein Verzeichnis > +$ EINVAL > +22 Ung??tiges Argument > +$ ENFILE > +23 Zu viele offene Dateien im gesamten System > +$ EMFILE > +24 Zu viele offene Dateien > +$ ENOTTY > +25 Ung??tiger Ioctl f?? dieses Ger?? > +$ ETXTBSY > +26 Ausf??rbare Datei wird benutzt > +$ EFBIG > +27 Datei zu gro ?? +$ ENOSPC > +28 Kein Platz mehr auf dem Ger?? > +$ ESPIPE > +29 Ung??tige Positionierung > +$ EROFS > +30 Dateisystem ist schreibgesch??zt > +$ EMLINK > +31 Zu viele Links > +$ EPIPE > +32 Unterbrochene Pipe > +$ EDOM > +33 Numerisches Argument ausserhalb des Wertebereichs > +$ ERANGE > +34 Ergebnis zu gro??oder zu klein > +$ EAGAIN, EWOULDBLOCK > +35 Ressource vor??ergehend nicht verf??bar > +$ EINPROGRESS > +36 Operation wird jetzt fortgesetzt > +$ EALREADY > +37 Operation wird bereits ausgef??rt > +$ ENOTSOCK > +38 Deskriptor ist kein Socket > +$ EDESTADDRREQ > +39 Zieladresse ben??igt > +$ EMSGSIZE > +40 Nachricht zu lang > +$ EPROTOTYPE > +41 Ung??tiger Protokolltyp f?? diesen Socket > +$ ENOPROTOOPT > +42 Protokoll nicht verf??bar > +$ EPROTONOSUPPORT > +43 Protokoll nicht unterst??zt > +$ ESOCKTNOSUPPORT > +44 Sockettyp nicht unterst??zt > +$ EOPNOTSUPP > +45 Operation nicht unterst??zt > +$ EPFNOSUPPORT > +46 Protokollfamilie nicht unterst??zt > +$ EAFNOSUPPORT > +47 Addressart wird von der Protokollfamilie nicht unterst??zt > +$ EADDRINUSE > +48 Adresse wird bereits benutzt > +$ EADDRNOTAVAIL > +49 Kann angeforderte Adresse nicht belegen > +$ ENETDOWN > +50 Netzwerk nicht verf??bar > +$ ENETUNREACH > +51 Netzwerk nicht erreichbar > +$ ENETRESET > +52 Netzwerk hat Verbindung mit Reset abgebrochen > +$ ECONNABORTED > +53 Software verursachte einen Verbindungsabbruch > +$ ECONNRESET > +54 Verbindung wurde von der Gegenstelle geschlossen > +$ ENOBUFS > +55 Keine Buffer verf??bar > +$ EISCONN > +56 Socket ist schon verbunden > +$ ENOTCONN > +57 Socket ist nicht verbunden > +$ ESHUTDOWN > +58 Kann nach einem Socket-Shutdown nicht mehr senden > +$ ETOOMANYREFS > +59 Zu viele Referenzen, kann nicht verbinden > +$ ETIMEDOUT > +60 Verbindungsabbruch durch Zeit??erschreitung > +$ ECONNREFUSED > +61 Verbindung wurde abgelehnt > +$ ELOOP > +62 Zu viele symbolische Links (zirkul???) > +$ ENAMETOOLONG > +63 Dateiname zu lang > +$ EHOSTDOWN > +64 Host nicht verf??bar > +$ EHOSTUNREACH > +65 Keine Route zum Host > +$ ENOTEMPTY > +66 Verzeichnis ist nicht leer > +$ EPROCLIM > +67 Zu viele Prozesse > +$ EUSERS > +68 Zu viele Benutzer > +$ EDQUOT > +69 Plattenplatzlimit ersch??ft > +$ ESTALE > +70 Verwaister NFS-Dateideskriptor > +$ EREMOTE > +71 Zu viele Fernverweise in diesem Zugriff > +$ EBADRPC > +72 RPC-Struktur ist ung??tig > +$ ERPCMISMATCH > +73 RPC-Version stimmt nicht > +$ EPROGUNAVAIL > +74 RPC-Programm nicht verf??bar > +$ EPROGMISMATCH > +75 Falsche Programmversion > +$ EPROCUNAVAIL > +76 Falsche Prozedur f?? dieses Programm > +$ ENOLCK > +77 Keine Dateisperren verf??bar > +$ ENOSYS > +78 Funktion nicht implementiert > +$ EFTYPE > +79 Ung??tiger Dateityp oder Dateiformat > +$ EAUTH > +80 Authentikationsfehler > +$ ENEEDAUTH > +81 Authentikator ben??igt > +$ EIDRM > +82 Identifizierung entfernt > +$ ENOMSG > +83 Keine Nachricht vom gew??schten Typ > +$ EOVERFLOW > +84 Wert zu gro?? um in Datentyp zu speichern > +$ EILSEQ > +85 Illegale Byte-Sequenz > +$ ENOTSUP > +86 Operation nicht unterst??zt > +$ ECANCELED > +87 Operation abgebrochen > +$ EBADMSG > +88 Ung??tige Nachricht > +$ ENODATA > +89 Keine Nachricht verf??bar > +$ ENOSR > +90 Keine STREAM-Ressourcen verf??bar > +$ ENOSTR > +91 Kein STREAM > +$ ETIME > +92 Zeit??erschreitung bei STREAM Ioctl > +$ ENOATTR > +93 Attribut nicht gefunden > +$ EMULTIHOP > +94 Multihopversuch > +$ ENOLINK > +95 Verbindung wurde getrennt > +$ EPROTO > +96 Protokollfehler > +$ > +$ strsignal() support catalog > +$ > +$set 2 > +$ SIGHUP > +1 Verbindungsende > +$ SIGINT > +2 Unterbrechung > +$ SIGQUIT > +3 Programmende > +$ SIGILL > +4 Ung??tiger Maschinenbefehl > +$ SIGTRAP > +5 Trace/BPT trap > +$ SIGABRT > +6 Abort trap > +$ SIGEMT > +7 EMT trap > +$ SIGFPE > +8 Flie??ommafehler > +$ SIGKILL > +9 Unbedingter Programmabbruch > +$ SIGBUS > +10 Bus-Zugriffsfehler > +$ SIGSEGV > +11 Illegaler Speicherzugriff > +$ SIGSYS > +12 Ung??tiger Systemaufruf > +$ SIGPIPE > +13 Unterbrochene Pipe > +$ SIGALRM > +14 Wecker > +$ SIGTERM > +15 Beendet > +$ SIGURG > +16 Dringende Ein/Ausgabeanforderung > +$ SIGSTOP > +17 Gestoppt (Signal) > +$ SIGTSTP > +18 Gestoppt > +$ SIGCONT > +19 Fortgesetzt > +$ SIGCHLD > +20 Kindprozess beendet > +$ SIGTTIN > +21 Gestoppt (Eingabe) > +$ SIGTTOU > +22 Gestoppt (Ausgabe) > +$ SIGIO > +23 Ein/Ausgabe ist m??lich > +$ SIGXCPU > +24 CPU-Zeitlimit ersch??ft > +$ SIGXFSZ > +25 Dateigr??e hat das Limit erreicht > +$ SIGVTALRM > +26 Virtueller Wecker abgelaufen > +$ SIGPROF > +27 Profil-Wecker abgelaufen > +$ SIGWINCH > +28 Fenstergr??e hat sich ge??dert > +$ SIGINFO > +29 Informationsanforderung > +$ SIGUSR1 > +30 Benutzerdefiniertes Signal 1 > +$ SIGUSR2 > +31 Benutzerdefiniertes Signal 2 > +$ SIGPWR > +32 Status??derung der Energieversorgung > > Added: head/lib/libc/nls/el_GR.ISO8859-7.msg > ============================================================================== > Binary file. No diff available. > > Added: head/lib/libc/nls/es_ES.ISO8859-1.msg > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libc/nls/es_ES.ISO8859-1.msg Fri Mar 13 10:40:38 2009 (r189765) > @@ -0,0 +1,249 @@ > +$ $FreeBSD$ > +$ > +$ Message catalog for es_ES.ISO8859-1 locale > +$ > +$ strerror() support catalog > +$ > +$set 1 > +$ EPERM > +1 Operaci?? no permitida > +$ ENOENT > +2 Fichero o directorio inexistente > +$ ESRCH > +3 Proceso inexistente > +$ EINTR > +4 Llamada del sistema interrumpida > +$ EIO > +5 Error de Entrada/Salida > +$ ENXIO > +6 Dispositivo no configurado > +$ E2BIG > +7 La lista de argumentos es demasiado larga > +$ ENOEXEC > +8 Error en el formato del ejecutable > +$ EBADF > +9 Descriptor incorrecto de fichero > +$ ECHILD > +10 No hay procesos hijo > +$ EDEADLK > +11 Se ha evitado el bloqueo del recurso > +$ ENOMEM > +12 No se pudo asignar memoria > +$ EACCES > +13 Permiso denegado > +$ EFAULT > +14 Direcci?? incorrecta > +$ ENOTBLK > +15 Se necesita un dispositivo de bloques > +$ EBUSY > +16 Dispositivo ocupado > +$ EEXIST > +17 El fichero ya existe > +$ EXDEV > +18 Enlace entre dispositivos > +$ ENODEV > +19 Operaci?? inadecuada para este dispositivo > +$ ENOTDIR > +20 No es un directorio > +$ EISDIR > +21 Es un directorio > +$ EINVAL > +22 Argumento inadecuado > +$ ENFILE > +23 Hay demasiados ficheros abiertos en el sistema > +$ EMFILE > +24 Hay demasiados ficheros abiertos > +$ ENOTTY > +25 ioctl inapropiado para el dispositivo > +$ ETXTBSY > +26 Fichero de texto ocupado > +$ EFBIG > +27 Fichero demasiado grande > +$ ENOSPC > +28 No queda espacio libre en el dispositivo > +$ ESPIPE > +29 Illegal seek > +$ EROFS > +30 Sistema de ficheros de solo lectura > +$ EMLINK > +31 Demasiados enlaces > +$ EPIPE > +32 Canal (pipe) roto > +$ EDOM > +33 Argumento num??ico fuera de rango > +$ ERANGE > +34 El resultado es demasiado grande > +$ EAGAIN, EWOULDBLOCK > +35 el recurso no est??disponible temporalmente > +$ EINPROGRESS > +36 Operaci?? en proceso > +$ EALREADY > +37 La operaci?? ya se est??ejecutando > +$ ENOTSOCK > +38 Operaci?? de socket inaceptable para el dispositivo > +$ EDESTADDRREQ > +39 Se necesita una direcci?? de destino > +$ EMSGSIZE > +40 Mensaje demasiado largo > +$ EPROTOTYPE > +41 Tipo err??eo de protocolo para el socket > +$ ENOPROTOOPT > +42 protocolo no disponible > +$ EPROTONOSUPPORT > +43 Protocolo no contemplado > +$ ESOCKTNOSUPPORT > +44 Tipo de socket no contemplado > +$ EOPNOTSUPP > +45 Operaci?? no contemplada > +$ EPFNOSUPPORT > +46 Familia de protocolos no contemplada > +$ EAFNOSUPPORT > +47 Familia de direcciones no contemplada por la familia de protocolos > +$ EADDRINUSE > +48 La direcci?? ya est??siendo usada > +$ EADDRNOTAVAIL > +49 No se pudo asignar la direcci?? requerida > +$ ENETDOWN > +50 La red no funciona > +$ ENETUNREACH > +51 No se ha podido acceder a la red > +$ ENETRESET > +52 La conexi?? de red se ha interrumpido al reinicializar > +$ ECONNABORTED > +53 Conexi?? perdida por problemas en el software > +$ ECONNRESET > +54 El interlocutor ha reinicializado la conexi?? > +$ ENOBUFS > +55 No queda espacio en el b??er > +$ EISCONN > +56 El socket ya estaba conectado > +$ ENOTCONN > +57 El socket no est??conectado > +$ ESHUTDOWN > +58 No se puede enviar tras la desconexi?? del socket > +$ ETOOMANYREFS > +59 Demasiadas referencias: no se pueden unir > +$ ETIMEDOUT > +60 El tiempo de conexi?? ha expirado > +$ ECONNREFUSED > +61 Conexi?? rehusada > +$ ELOOP > +62 Demasiados niveles de enlaces simb??icos > +$ ENAMETOOLONG > +63 Nombre de fichero demasiado largo > +$ EHOSTDOWN > +64 La m??uina est??fuera de servicio > +$ EHOSTUNREACH > +65 No hay ruta hasta la m??uina > +$ ENOTEMPTY > +66 Directorio no vac?? > +$ EPROCLIM > +67 Demasiados procesos > +$ EUSERS > +68 Demasiados usuarios > +$ EDQUOT > +69 Cuota de disco sobrepasada > +$ ESTALE > +70 Descriptor de fichero NFS inv??ido > +$ EREMOTE > +71 Ruta con demasiados niveles > +$ EBADRPC > +72 La estructura de la RPC es err??ea > +$ ERPCMISMATCH > +73 La vers?? de la RPC es err??ea > +$ EPROGUNAVAIL > +74 La RPC no est??accesible > +$ EPROGMISMATCH > +75 Versi?? err??ea del programa > +$ EPROCUNAVAIL > +76 Procedimiento err??eo para el programa > +$ ENOLCK > +77 No hay bloqueos disponibles > +$ ENOSYS > +78 Funci?? no realizada > +$ EFTYPE > +79 Tipo de fichero o formato inapropiado > +$ EAUTH > +80 Error de autentificaci?? > +$ ENEEDAUTH > +81 Se necesita un autenticador > +$ EIDRM > +82 Identificador eliminado > +$ ENOMSG > +83 No hay mensajes del tipo deseado > +$ EOVERFLOW > +84 Valor demasiado grande para almacenarse en el tipo deseado > +$ ECANCELED > +85 Operaci?? cancelada > +$ EILSEQ > +86 Illegal byte sequence > +$ ENOATTR > +87 Atributo no encontrado > +$ EDOOFUS > +88 Error de programaci?? > +$ > +$ strsignal() support catalog > +$ > +$set 2 > +$ SIGHUP > +1 F?? de l??ea (Hangup) > +$ SIGINT > +2 Interrumpido > +$ SIGQUIT > +3 Terminado > +$ SIGILL > +4 Illegal instruction > +$ SIGTRAP > +5 Trace/BPT trap > +$ SIGABRT > +6 Abort trap > +$ SIGEMT > +7 EMT trap > +$ SIGFPE > +8 Excepci?? de coma flotante > +$ SIGKILL > +9 Matado > +$ SIGBUS > +10 Error en el bus > +$ SIGSEGV > +11 Fallo de segmentaci?? > +$ SIGSYS > +12 Llamada al sistema err??ea > +$ SIGPIPE > +13 Canal (pipe) roto > +$ SIGALRM > +14 Alarma del reloj > +$ SIGTERM > +15 Terminado > +$ SIGURG > +16 Condici?? urgente de E/S > +$ SIGSTOP > +17 Detenido (se??l) > +$ SIGTSTP > +18 Detenido > +$ SIGCONT > +19 Continuando > +$ SIGCHLD > +20 Proceso hijo terminado > +$ SIGTTIN > +21 Detenido (entrada tty) > +$ SIGTTOU > +22 Detenido (salida tty) > +$ SIGIO > +23 E/S posible > +$ SIGXCPU > +24 Se ha sobrepasado el tiempo l??ite de la CPU > +$ SIGXFSZ > +25 Se ha sobrepasado el l??ite de tama?? de fichero > +$ SIGVTALRM > +26 Temporizador virtual expirado > +$ SIGPROF > +27 Temporizador de perfilaci?? expirado > +$ SIGWINCH > +28 Cambios en el tama?? de ventana > +$ SIGINFO > +29 Petici?? de informaci?? > +$ SIGUSR1 > +30 Se??l definida por el usuario n1 > +$ SIGUSR2 > +31 Se??l definida por el usuario n2 > > Added: head/lib/libc/nls/fi_FI.ISO8859-1.msg > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libc/nls/fi_FI.ISO8859-1.msg Fri Mar 13 10:40:38 2009 (r189765) > @@ -0,0 +1,233 @@ > +$ $FreeBSD$ > +$ > +$ Message catalog for fi_FI.ISO8859-1 locale > +$ > +$ strerror() support catalog > +$ > +$set 1 > +$ EPERM > +1 Toimintoa ei sallita > +$ ENOENT > +2 Tiedostoa tai hakemistoa ei l??dy > +$ ESRCH > +3 Prosessia ei l??dy > +$ EINTR > +4 Systeemikutsu keskeytyi > +$ EIO > +5 Sy??t??tulostusvirhe > +$ ENXIO > +6 Laitetta ei m??ritelty > +$ E2BIG > +7 Liikaa argumentteja > +$ ENOEXEC > +8 Tuntematon ohjelmatyyppi > +$ EBADF > +9 Virheellinen tiedosto-osoitin > +$ ECHILD > +10 Ei lapsiprosesseja > +$ EDEADLK > +11 Resurssin ristiinlukitus v??tetty > +$ ENOMEM > +12 Muistinvaraus ep??nnistui > +$ EACCES > +13 Lupa kielletty > +$ EFAULT > +14 Virheellinen osoite > +$ ENOTBLK > +15 Tarvitaan lohko-osoitettava laite > +$ EBUSY > +16 Laite k??t??s ?? +$ EEXIST > +17 Tiedosto on jo olemassa > +$ EXDEV > +18 Laitteiden v??inen linkki > +$ ENODEV > +19 Laite ei tue toimintoa > +$ ENOTDIR > +20 Kohde ei ole hakemisto > +$ EISDIR > +21 Kohde on hakemisto > +$ EINVAL > +22 Virheellinen argumentti > +$ ENFILE > +23 J??jestelm??s??on liian monta avointa tiedostoa > +$ EMFILE > +24 Liian monta avointa tiedostoa > +$ ENOTTY > +25 Virheellinen ohjaustoiminto laitteelle > +$ ETXTBSY > +26 Tiedosto on k??t??s ?? +$ EFBIG > +27 Tiedosto liian suuri > +$ ENOSPC > +28 Laitteella ei ole tilaa > +$ ESPIPE > +29 Virheellinen haku > +$ EROFS > +30 Vain luettava tiedostoj??jestelm ?? +$ EMLINK > +31 Liian monta linkki ?? +$ EPIPE > +32 Katkennut putki > +$ EDOM > +33 Numeerinen sy??e virheellinen > +$ ERANGE > +34 Tulos liian suuri > +$ EAGAIN, EWOULDBLOCK > +35 Resurssi ei ole tilap??sesti saatavilla > +$ EINPROGRESS > +36 Toiminta on k??nniss ?? +$ EALREADY > +37 Toiminta oli jo k??nniss ?? +$ ENOTSOCK > +38 Socket-operaatio muulla kuin socketilla > +$ EDESTADDRREQ > +39 Tarvitaan kohdeosoite > +$ EMSGSIZE > +40 Sanoma liian pitk ?? +$ EPROTOTYPE > +41 V??r??protokolla socketille > +$ ENOPROTOOPT > +42 Protokolla ei ole k??tett??iss ?? +$ EPROTONOSUPPORT > +43 Protokollaa ei tueta > +$ ESOCKTNOSUPPORT > +44 Socket-tyyppi??ei tueta > +$ EOPNOTSUPP > +45 Toimintoa ei tueta > +$ EPFNOSUPPORT > +46 Protokollaperhett??ei tueta > +$ EAFNOSUPPORT > +47 Protokollaperhe ei tue osoiteperhett ?? +$ EADDRINUSE > +48 Osoite on jo k??t??s ?? +$ EADDRNOTAVAIL > +49 Ei pysty antamaan pyydetty??osoitetta > +$ ENETDOWN > +50 Verkko ei ole k??tett??iss ?? +$ ENETUNREACH > +51 Verkkoon ei ole yhteytt ?? +$ ENETRESET > +52 Verkko sulki yhteyden > +$ ECONNABORTED > +53 Ohjelmiston aiheuttama yhteyden keskeytyminen > +$ ECONNRESET > +54 Is??t??nollasi yhteyden > +$ ENOBUFS > +55 Puskuritila on lopussa > +$ EISCONN > +56 Yhteys on jo olemassa > +$ ENOTCONN > +57 Yhteytt??ei ole olemassa > +$ ESHUTDOWN > +58 L??ett??inen ei ole mahdollista yhteyden katkaisun j??keen > +$ ETOOMANYREFS > +59 Liikaa viittauksia: ei voi yhdist?? > +$ ETIMEDOUT > +60 Yhteyden aikavalvontakatkaisu > +$ ECONNREFUSED > +61 Yhteys hyl??ty > +$ ELOOP > +62 Liian monta per??k??st??symbolista linkki ?? +$ ENAMETOOLONG > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 14:09:36 2009 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 5948A106564A; Fri, 13 Mar 2009 14:09:36 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 23ADB8FC0C; Fri, 13 Mar 2009 14:09:36 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id n2DE9SBj023127; Fri, 13 Mar 2009 09:09:28 -0500 (CDT) (envelope-from scf@FreeBSD.org) Date: Fri, 13 Mar 2009 09:09:28 -0500 (CDT) From: "Sean C. Farley" To: Doug Barton In-Reply-To: <200903130734.n2D7Y5Xc055843@svn.freebsd.org> Message-ID: References: <200903130734.n2D7Y5Xc055843@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189761 - head/usr.sbin/mergemaster 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 Mar 2009 14:09:36 -0000 On Fri, 13 Mar 2009, Doug Barton wrote: > Author: dougb > Date: Fri Mar 13 07:34:05 2009 > New Revision: 189761 > URL: http://svn.freebsd.org/changeset/base/189761 > > Log: > When using the -D option: > 1. The new mtree file should be created in the "host" system /tmp > 2. The existing mtree file in the "host" system should not be deleted > > Submitted by: scf Thank you! Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 14:35:58 2009 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 781671065677; Fri, 13 Mar 2009 14:35:58 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65B3D8FC24; Fri, 13 Mar 2009 14:35:58 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DEZwPU065476; Fri, 13 Mar 2009 14:35:58 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DEZwek065475; Fri, 13 Mar 2009 14:35:58 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <200903131435.n2DEZwek065475@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 13 Mar 2009 14:35: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: r189767 - 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 Mar 2009 14:36:00 -0000 Author: ru Date: Fri Mar 13 14:35:58 2009 New Revision: 189767 URL: http://svn.freebsd.org/changeset/base/189767 Log: Switch to using official English short country names. Modified: head/share/misc/iso3166 Modified: head/share/misc/iso3166 ============================================================================== --- head/share/misc/iso3166 Fri Mar 13 10:52:22 2009 (r189766) +++ head/share/misc/iso3166 Fri Mar 13 14:35:58 2009 (r189767) @@ -13,7 +13,7 @@ # been deleted unless necessary to distinguish two countries. # # The ISO3166 Maintenance Agency can be found at: -# http://www.iso.ch/iso/en/prods-services/iso3166ma/index.html +# http://www.iso.org/iso/country_codes.htm # # two three number name AF AFG 004 Afghanistan @@ -43,7 +43,7 @@ BJ BEN 204 Benin BM BMU 060 Bermuda BT BTN 064 Bhutan BO BOL 068 Bolivia -BA BIH 070 Bosnia and Herzegowina +BA BIH 070 Bosnia and Herzegovina BW BWA 072 Botswana BV BVT 074 Bouvet Island BR BRA 076 Brazil @@ -65,8 +65,8 @@ CX CXR 162 Christmas Island CC CCK 166 Cocos (Keeling) Islands CO COL 170 Colombia KM COM 174 Comoros -CG COG 178 Congo (Rep.) -CD COD 180 Congo (Dem. Rep.) +CG COG 178 Congo +CD COD 180 Congo, the Democratic Republic of the CK COK 184 Cook Islands CR CRI 188 Costa Rica CI CIV 384 Cote d'Ivoire @@ -86,7 +86,7 @@ GQ GNQ 226 Equatorial Guinea ER ERI 232 Eritrea EE EST 233 Estonia ET ETH 231 Ethiopia -FK FLK 238 Falkland Islands +FK FLK 238 Falkland Islands (Malvinas) FO FRO 234 Faroe Islands FJ FJI 242 Fiji FI FIN 246 Finland @@ -111,14 +111,14 @@ GN GIN 324 Guinea GW GNB 624 Guinea-Bissau GY GUY 328 Guyana HT HTI 332 Haiti -HM HMD 334 Heard and McDonald Islands +HM HMD 334 Heard Island and McDonald Islands HN HND 340 Honduras HK HKG 344 Hong Kong HU HUN 348 Hungary IS ISL 352 Iceland IN IND 356 India ID IDN 360 Indonesia -IR IRN 364 Iran +IR IRN 364 Iran, Islamic Republic of IQ IRQ 368 Iraq IE IRL 372 Ireland IM IMN 833 Isle of Man @@ -131,8 +131,8 @@ JO JOR 400 Jordan KZ KAZ 398 Kazakhstan KE KEN 404 Kenya KI KIR 296 Kiribati -KP PRK 408 Korea (Democratic People's Republic of) -KR KOR 410 Korea (Republic of) +KP PRK 408 Korea, Democratic People's Republic of +KR KOR 410 Korea, Republic of KW KWT 414 Kuwait KG KGZ 417 Kyrgyzstan LA LAO 418 Lao People's Democratic Republic @@ -145,7 +145,7 @@ LI LIE 438 Liechtenstein LT LTU 440 Lithuania LU LUX 442 Luxembourg MO MAC 446 Macao -MK MKD 807 Macedonia (The Former Yugoslav Republic of) +MK MKD 807 Macedonia, the Former Yugoslav Republic of MG MDG 450 Madagascar MW MWI 454 Malawi MY MYS 458 Malaysia @@ -158,8 +158,8 @@ MR MRT 478 Mauritania MU MUS 480 Mauritius YT MYT 175 Mayotte MX MEX 484 Mexico -FM FSM 583 Micronesia (Federated States of) -MD MDA 498 Moldova +FM FSM 583 Micronesia, Federated States of +MD MDA 498 Moldova, Republic of MC MCO 492 Monaco MN MNG 496 Mongolia ME MNE 499 Montenegro @@ -184,9 +184,9 @@ NO NOR 578 Norway OM OMN 512 Oman PK PAK 586 Pakistan PW PLW 585 Palau -PS PSE 275 Occupied Palestinian Territory +PS PSE 275 Palestinian Territory, Occupied PA PAN 591 Panama -PG PNG 598 Papua-New Guinea +PG PNG 598 Papua New Guinea PY PRY 600 Paraguay PE PER 604 Peru PH PHL 608 Philippines @@ -202,7 +202,7 @@ RW RWA 646 Rwanda BL BLM 652 Saint Barthelemy KN KNA 659 Saint Kitts and Nevis LC LCA 662 Saint Lucia -MF MAF 663 Saint Martin (French part) +MF MAF 663 Saint Martin VC VCT 670 Saint Vincent and the Grenadines WS WSM 882 Samoa SM SMR 674 San Marino @@ -221,18 +221,18 @@ ZA ZAF 710 South Africa GS SGS 239 South Georgia and the South Sandwich Islands ES ESP 724 Spain LK LKA 144 Sri Lanka -SH SHN 654 St. Helena -PM SPM 666 St. Pierre and Miquelon +SH SHN 654 Saint Helena +PM SPM 666 Saint Pierre and Miquelon SD SDN 736 Sudan SR SUR 740 Suriname -SJ SJM 744 Svalbard and Jan Mayen Islands +SJ SJM 744 Svalbard and Jan Mayen SZ SWZ 748 Swaziland SE SWE 752 Sweden CH CHE 756 Switzerland SY SYR 760 Syrian Arab Republic -TW TWN 158 Taiwan +TW TWN 158 Taiwan, Province of China TJ TJK 762 Tajikistan -TZ TZA 834 Tanzania +TZ TZA 834 Tanzania, United Republic of TH THA 764 Thailand TG TGO 768 Togo TK TKL 772 Tokelau @@ -252,12 +252,12 @@ UM UMI 581 United States Minor Outlying UY URY 858 Uruguay UZ UZB 860 Uzbekistan VU VUT 548 Vanuatu -VA VAT 336 Vatican City State +VA VAT 336 Holy See (Vatican City State) VE VEN 862 Venezuela VN VNM 704 Viet Nam -VG VGB 092 Virgin Islands (British) -VI VIR 850 Virgin Islands (U.S.) -WF WLF 876 Wallis and Futuna Islands +VG VGB 092 Virgin Islands, British +VI VIR 850 Virgin Islands, U.S. +WF WLF 876 Wallis and Futuna EH ESH 732 Western Sahara YE YEM 887 Yemen ZM ZMB 894 Zambia From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 14:36:57 2009 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 9B17510656FF; Fri, 13 Mar 2009 14:36:56 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 445A18FC18; Fri, 13 Mar 2009 14:36:56 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id n2DEam8u023632; Fri, 13 Mar 2009 09:36:48 -0500 (CDT) (envelope-from scf@FreeBSD.org) Date: Fri, 13 Mar 2009 09:36:48 -0500 (CDT) From: "Sean C. Farley" To: Gabor Kovesdan In-Reply-To: <200903131040.n2DAecSO061131@svn.freebsd.org> Message-ID: References: <200903131040.n2DAecSO061131@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 14:36:59 -0000 On Fri, 13 Mar 2009, Gabor Kovesdan wrote: > Author: gabor (doc,ports committer) > Date: Fri Mar 13 10:40:38 2009 > New Revision: 189765 > URL: http://svn.freebsd.org/changeset/base/189765 > > Log: > - Reenable Native Language Support in libc. This feature was disabled due > to possible breakages in the catalog handling code. Since then, that > code has been replaced by the secure code from NetBSD but NLS in libc > remained turned off. Tests have shown that the feature is stable and > working so we can now turn it on again. > > - Add several new catalog files: > - ca_ES.ISO8859-1 > - de_DE.ISO8859-1 > - el_GR.ISO8859-7 (by manolis@ and keramida@) > - es_ES.ISO8859-1 (kern/123179, by carvay@) > - fi_FI.ISO8859-1 > - fr_FR.ISO8859-1 (kern/78756, by thierry@) > - hu_HU.ISO8859-2 (by gabor@) > - it_IT.ISO8859-15 > - nl_NL.ISO8859-1 (corrections by rene@) > - no_NO.ISO8859-1 > - mn_MN.UTF-8 (by ganbold@) > - sk_SK.ISO8859-2 > - sv_SE.ISO8859-1 > (The catalogs without explicit source has been obtained from NetBSD.) Nice! I need to find some time to learn how to use NLS. Now, you only need to revive the BSD-licensed libiconv[1]. :) I am kidding; I do not want to start adding more stuff to your plate. Thank you for strengthening FreeBSD's i18n support. Out of curiosity, how does enabling NLS in libc interact with the devel/gettext port? Sean 1. http://people.freebsd.org/~bland/iconv-2.1.tar.gz -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 15:36:45 2009 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 26D4B106566C; Fri, 13 Mar 2009 15:36:45 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id D0A3C8FC15; Fri, 13 Mar 2009 15:36:44 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 106D114D87AB; Fri, 13 Mar 2009 16:20:42 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AWZJv+ednsbm; Fri, 13 Mar 2009 16:20:37 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id C8FE214D87AD; Fri, 13 Mar 2009 16:20:36 +0100 (CET) Message-ID: <49BA79C2.4030800@FreeBSD.org> Date: Fri, 13 Mar 2009 16:20:34 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Robert Watson References: <200903131040.n2DAecSO061131@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 15:36:45 -0000 Robert Watson escribió: > > On Fri, 13 Mar 2009, Gabor Kovesdan wrote: > >> - Reenable Native Language Support in libc. This feature was >> disabled due >> to possible breakages in the catalog handling code. Since then, that >> code has been replaced by the secure code from NetBSD but NLS in libc >> remained turned off. Tests have shown that the feature is stable and >> working so we can now turn it on again. > > Do we have a nice tutorialish document somewhere on what people > writing new command line tools or libraries should do in order to > address localization requirements, or at least, make it easier for > other people to do so? I'm afraid I, at least, live in a world > without catalogues, but a quick and practical guide to what The Right > Thing Is for FreeBSD would make it much easier for me to do something > a bit more mature. I don't know about any documentation, but I can add some snippets to developers-handbook if I can find some time. I added catalog support to BSD grep (my SoC 2008 project), so I found out how to deal with catalogs. For the meantime, BSD grep can be used as a quick reference, the code snippets in grep.c are quite clear. Oh, and the best thing is that if you use err(), which reads errno to exit with an error message, you have localized messages out of the box. E.g., for BSD grep there are 10 more messages, but the rest is done via err(). -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 15:38:48 2009 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 AC7FD106566B; Fri, 13 Mar 2009 15:38:48 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 55BDA8FC17; Fri, 13 Mar 2009 15:38:48 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 7734B14D87AB; Fri, 13 Mar 2009 16:38:47 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UZ2yobFEaJGC; Fri, 13 Mar 2009 16:38:42 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 8FE0814D86CB; Fri, 13 Mar 2009 16:38:42 +0100 (CET) Message-ID: <49BA7E01.50000@FreeBSD.org> Date: Fri, 13 Mar 2009 16:38:41 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: "Sean C. Farley" References: <200903131040.n2DAecSO061131@svn.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 Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 15:38:49 -0000 > Nice! I need to find some time to learn how to use NLS. > > Now, you only need to revive the BSD-licensed libiconv[1]. :) I am > kidding; I do not want to start adding more stuff to your plate. > Thank you for strengthening FreeBSD's i18n support. > > Out of curiosity, how does enabling NLS in libc interact with the > devel/gettext port? Well, it's not a bad idea, actually I'm thinking of generating some more catalogs automatically but the problem is that we don't have iconv in the base system. For example, we could easily make a hu_HU.UTF-8 catalog from hu_HU.ISO8859-2 by just converting the encoding of the catalog file. And the same applies to a bunch of locales... I don't really know gettext so I don't know how they can interact. Afaik, gettext is based on some text replacement, while in POSIX.1 NLS, you arrange strings into sets and you identify them with a number inside the sets. Some people think gettext is easier to use but I suspect that it uses a more complex process of building the application itself to process its catalogs. POSIX.1 NLS only needs some additional lines. Here are some code snippets from BSD grep, which uses a single set with 10 messages: grep.h: ================ #ifdef WITHOUT_NLS #define getstr(n) errstr[n] #else #include extern nl_catd catalog; #define getstr(n) catgets(catalog, 1, n, errstr[n]) #endif extern char *errstr[]; grep.c: ================ #ifndef WITHOUT_NLS #include nl_catd catalog; #endif /* * Default messags to use when NLS is disabled or no catalogue * is found. */ char *errstr[] = { "", /* 1*/ "(standard input)", /* 2*/ "cannot read bzip2 compressed file", /* 3*/ "unknown --color option", /* 4*/ "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n", /* 5*/ "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n", /* 6*/ "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n", /* 7*/ "\t[--null] [pattern] [file ...]\n", /* 8*/ "unknown --binary-files option", /* 9*/ "Binary file %s matches\n" /*10*/ "%s (BSD grep) %s\n", }; And then you can simply use getstr(n), where n is the number of the string you want to use. It will work with catalogs and with NLS disables, as well. -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 16:08:09 2009 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 3CA85106566C; Fri, 13 Mar 2009 16:08:09 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28B848FC12; Fri, 13 Mar 2009 16:08:09 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DG89LT067231; Fri, 13 Mar 2009 16:08:09 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DG88Fa067228; Fri, 13 Mar 2009 16:08:09 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200903131608.n2DG88Fa067228@svn.freebsd.org> From: Rui Paulo Date: Fri, 13 Mar 2009 16:08: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: r189768 - in head/sys: conf dev/amdtemp dev/k8temp modules modules/amdtemp modules/k8temp 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 Mar 2009 16:08:09 -0000 Author: rpaulo Date: Fri Mar 13 16:08:08 2009 New Revision: 189768 URL: http://svn.freebsd.org/changeset/base/189768 Log: Rename the k8temp driver to amdtemp. MFC after: 2 weeks Added: head/sys/dev/amdtemp/ - copied from r189489, head/sys/dev/k8temp/ head/sys/dev/amdtemp/amdtemp.c - copied unchanged from r189489, head/sys/dev/k8temp/k8temp.c head/sys/modules/amdtemp/ - copied from r189489, head/sys/modules/k8temp/ Deleted: head/sys/dev/amdtemp/k8temp.c head/sys/dev/k8temp/ head/sys/modules/k8temp/ Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/Makefile head/sys/modules/amdtemp/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Fri Mar 13 14:35:58 2009 (r189767) +++ head/sys/conf/files.amd64 Fri Mar 13 16:08:08 2009 (r189768) @@ -136,6 +136,7 @@ dev/agp/agp_amd64.c optional agp dev/agp/agp_i810.c optional agp dev/agp/agp_intel.c optional agp dev/agp/agp_via.c optional agp +dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/asmc/asmc.c optional asmc isa dev/atkbdc/atkbd.c optional atkbd atkbdc @@ -187,7 +188,6 @@ dev/hwpmc/hwpmc_core.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/k8temp/k8temp.c optional k8temp dev/kbd/kbd.c optional atkbd | sc | ukbd | usb2_input_kbd dev/mem/memutil.c optional mem dev/nfe/if_nfe.c optional nfe pci Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Mar 13 14:35:58 2009 (r189767) +++ head/sys/conf/files.i386 Fri Mar 13 16:08:08 2009 (r189768) @@ -128,6 +128,7 @@ dev/agp/agp_nvidia.c optional agp dev/agp/agp_sis.c optional agp dev/agp/agp_via.c optional agp dev/aic/aic_isa.c optional aic isa +dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/ar/if_ar.c optional ar dev/ar/if_ar_isa.c optional ar isa @@ -198,7 +199,6 @@ dev/ipmi/ipmi_smbus.c optional ipmi smb dev/ipmi/ipmi_smbios.c optional ipmi dev/ipmi/ipmi_ssif.c optional ipmi smbus dev/ipmi/ipmi_pci.c optional ipmi pci -dev/k8temp/k8temp.c optional k8temp dev/kbd/kbd.c optional atkbd | sc | ukbd | usb2_input_kbd dev/le/if_le_isa.c optional le isa dev/mem/memutil.c optional mem Copied: head/sys/dev/amdtemp/amdtemp.c (from r189489, head/sys/dev/k8temp/k8temp.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/amdtemp/amdtemp.c Fri Mar 13 16:08:08 2009 (r189768, copy of r189489, head/sys/dev/k8temp/k8temp.c) @@ -0,0 +1,342 @@ +/*- + * Copyright (c) 2008 Rui Paulo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Driver for the AMD K8 thermal sensors. Based on a Linux driver by the + * same name. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +struct k8temp_softc { + device_t sc_dev; + int sc_temps[4]; + int sc_ntemps; + struct sysctl_oid *sc_oid; + struct sysctl_oid *sc_sysctl_cpu[2]; + struct intr_config_hook sc_ich; +}; + +#define VENDORID_AMD 0x1022 +#define DEVICEID_AMD_MISC 0x1103 + +static struct k8temp_product { + uint16_t k8temp_vendorid; + uint16_t k8temp_deviceid; +} k8temp_products[] = { + { VENDORID_AMD, DEVICEID_AMD_MISC }, + { 0, 0 } +}; + +/* + * Register control + */ +#define K8TEMP_REG 0xe4 +#define K8TEMP_REG_SELSENSOR 0x40 +#define K8TEMP_REG_SELCORE 0x04 + +#define K8TEMP_MINTEMP 49 /* -49 C is the mininum temperature */ + +typedef enum { + SENSOR0_CORE0, + SENSOR0_CORE1, + SENSOR1_CORE0, + SENSOR1_CORE1, + CORE0, + CORE1 +} k8sensor_t; + +/* + * Device methods. + */ +static void k8temp_identify(driver_t *driver, device_t parent); +static int k8temp_probe(device_t dev); +static int k8temp_attach(device_t dev); +static void k8temp_intrhook(void *arg); +static int k8temp_detach(device_t dev); +static int k8temp_match(device_t dev); +static int32_t k8temp_gettemp(device_t dev, k8sensor_t sensor); +static int k8temp_sysctl(SYSCTL_HANDLER_ARGS); + +static device_method_t k8temp_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, k8temp_identify), + DEVMETHOD(device_probe, k8temp_probe), + DEVMETHOD(device_attach, k8temp_attach), + DEVMETHOD(device_detach, k8temp_detach), + + {0, 0} +}; + +static driver_t k8temp_driver = { + "k8temp", + k8temp_methods, + sizeof(struct k8temp_softc), +}; + +static devclass_t k8temp_devclass; +DRIVER_MODULE(k8temp, hostb, k8temp_driver, k8temp_devclass, NULL, NULL); + +static int +k8temp_match(device_t dev) +{ + int i; + uint16_t vendor, devid; + + vendor = pci_get_vendor(dev); + devid = pci_get_device(dev); + + for (i = 0; k8temp_products[i].k8temp_vendorid != 0; i++) { + if (vendor == k8temp_products[i].k8temp_vendorid && + devid == k8temp_products[i].k8temp_deviceid) + return (1); + } + + return (0); +} + +static void +k8temp_identify(driver_t *driver, device_t parent) +{ + device_t child; + + /* Make sure we're not being doubly invoked. */ + if (device_find_child(parent, "k8temp", -1) != NULL) + return; + + if (k8temp_match(parent)) { + child = device_add_child(parent, "k8temp", -1); + if (child == NULL) + device_printf(parent, "add k8temp child failed\n"); + } + +} + +static int +k8temp_probe(device_t dev) +{ + uint32_t regs[4]; + + if (resource_disabled("k8temp", 0)) + return (ENXIO); + + do_cpuid(1, regs); + switch (regs[0]) { + case 0xf40: + case 0xf50: + case 0xf51: + return (ENXIO); + } + device_set_desc(dev, "AMD K8 Thermal Sensors"); + + return (BUS_PROBE_GENERIC); +} + +static int +k8temp_attach(device_t dev) +{ + struct k8temp_softc *sc = device_get_softc(dev); + struct sysctl_ctx_list *sysctlctx; + struct sysctl_oid *sysctlnode; + + + /* + * Setup intrhook function to create dev.cpu sysctl entries. This is + * needed because the cpu driver may be loaded late on boot, after + * us. + */ + sc->sc_ich.ich_func = k8temp_intrhook; + sc->sc_ich.ich_arg = dev; + if (config_intrhook_establish(&sc->sc_ich) != 0) { + device_printf(dev, "config_intrhook_establish " + "failed!\n"); + return (ENXIO); + } + + /* + * dev.k8temp.N tree. + */ + sysctlctx = device_get_sysctl_ctx(dev); + sysctlnode = SYSCTL_ADD_NODE(sysctlctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensor0", + CTLFLAG_RD, 0, "Sensor 0"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR0_CORE0, k8temp_sysctl, "I", + "Sensor 0 / Core 0 temperature"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR0_CORE1, k8temp_sysctl, "I", + "Sensor 0 / Core 1 temperature"); + + sysctlnode = SYSCTL_ADD_NODE(sysctlctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensor1", + CTLFLAG_RD, 0, "Sensor 1"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR1_CORE0, k8temp_sysctl, "I", + "Sensor 1 / Core 0 temperature"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR1_CORE1, k8temp_sysctl, "I", + "Sensor 1 / Core 1 temperature"); + + return (0); +} + +void +k8temp_intrhook(void *arg) +{ + int i; + device_t nexus, acpi, cpu; + device_t dev = (device_t) arg; + struct k8temp_softc *sc; + struct sysctl_ctx_list *sysctlctx; + + sc = device_get_softc(dev); + + /* + * dev.cpu.N.temperature. + */ + nexus = device_find_child(root_bus, "nexus", 0); + acpi = device_find_child(nexus, "acpi", 0); + + for (i = 0; i < 2; i++) { + cpu = device_find_child(acpi, "cpu", + device_get_unit(dev) * 2 + i); + if (cpu) { + sysctlctx = device_get_sysctl_ctx(cpu); + + sc->sc_sysctl_cpu[i] = SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(cpu)), + OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, + dev, CORE0, k8temp_sysctl, "I", + "Max of sensor 0 / 1"); + } + } + config_intrhook_disestablish(&sc->sc_ich); +} + +int +k8temp_detach(device_t dev) +{ + int i; + struct k8temp_softc *sc = device_get_softc(dev); + + for (i = 0; i < 2; i++) { + if (sc->sc_sysctl_cpu[i]) + sysctl_remove_oid(sc->sc_sysctl_cpu[i], 1, 0); + } + + /* NewBus removes the dev.k8temp.N tree by itself. */ + + return (0); +} + +static int +k8temp_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t dev = (device_t) arg1; + int error; + int32_t temp, auxtemp[2]; + + switch (arg2) { + case CORE0: + auxtemp[0] = k8temp_gettemp(dev, SENSOR0_CORE0); + auxtemp[1] = k8temp_gettemp(dev, SENSOR1_CORE0); + temp = imax(auxtemp[0], auxtemp[1]); + break; + case CORE1: + auxtemp[0] = k8temp_gettemp(dev, SENSOR0_CORE1); + auxtemp[1] = k8temp_gettemp(dev, SENSOR1_CORE1); + temp = imax(auxtemp[0], auxtemp[1]); + break; + default: + temp = k8temp_gettemp(dev, arg2); + break; + } + error = sysctl_handle_int(oidp, &temp, 0, req); + + return (error); +} + +static int32_t +k8temp_gettemp(device_t dev, k8sensor_t sensor) +{ + uint8_t cfg; + uint32_t temp; + + cfg = pci_read_config(dev, K8TEMP_REG, 1); + switch (sensor) { + case SENSOR0_CORE0: + cfg &= ~(K8TEMP_REG_SELSENSOR | K8TEMP_REG_SELCORE); + break; + case SENSOR0_CORE1: + cfg &= ~K8TEMP_REG_SELSENSOR; + cfg |= K8TEMP_REG_SELCORE; + break; + case SENSOR1_CORE0: + cfg &= ~K8TEMP_REG_SELCORE; + cfg |= K8TEMP_REG_SELSENSOR; + break; + case SENSOR1_CORE1: + cfg |= (K8TEMP_REG_SELSENSOR | K8TEMP_REG_SELCORE); + break; + default: + cfg = 0; + break; + } + pci_write_config(dev, K8TEMP_REG, cfg, 1); + temp = pci_read_config(dev, K8TEMP_REG, 4); + temp = ((temp >> 16) & 0xff) - K8TEMP_MINTEMP; + + return (temp); +} Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Fri Mar 13 14:35:58 2009 (r189767) +++ head/sys/modules/Makefile Fri Mar 13 16:08:08 2009 (r189768) @@ -18,6 +18,7 @@ SUBDIR= ${_3dfx} \ aic7xxx \ aio \ ${_amd} \ + ${_amdtemp} \ ale \ amr \ ${_an} \ @@ -137,7 +138,6 @@ SUBDIR= ${_3dfx} \ ${_ixgb} \ jme \ joy \ - ${_k8temp} \ kbdmux \ krpc \ le \ @@ -409,6 +409,7 @@ _zfs= zfs _aac= aac _acpi= acpi _ahb= ahb +_amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc _asr= asr @@ -435,7 +436,6 @@ _iwifw= iwifw _iwn= iwn _iwnfw= iwnfw _ixgb= ixgb -_k8temp= k8temp _mly= mly _nfe= nfe _nve= nve @@ -464,6 +464,7 @@ _aac= aac _acpi= acpi _agp= agp _an= an +_amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc _cardbus= cardbus @@ -502,7 +503,6 @@ _ipwfw= ipwfw _iwn= iwn _iwnfw= iwnfw _ixgb= ixgb -_k8temp= k8temp _linprocfs= linprocfs _linsysfs= linsysfs _linux= linux Modified: head/sys/modules/amdtemp/Makefile ============================================================================== --- head/sys/modules/k8temp/Makefile Sat Mar 7 10:21:37 2009 (r189489) +++ head/sys/modules/amdtemp/Makefile Fri Mar 13 16:08:08 2009 (r189768) @@ -1,8 +1,8 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../dev/k8temp +.PATH: ${.CURDIR}/../../dev/amdtemp -KMOD= k8temp -SRCS= k8temp.c bus_if.h device_if.h pci_if.h +KMOD= amdtemp +SRCS= amdtemp.c bus_if.h device_if.h pci_if.h .include From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 16:28:26 2009 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 1F7821065796; Fri, 13 Mar 2009 16:28:26 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CA618FC14; Fri, 13 Mar 2009 16:28:26 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DGSPCX067681; Fri, 13 Mar 2009 16:28:25 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DGSPcx067680; Fri, 13 Mar 2009 16:28:25 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200903131628.n2DGSPcx067680@svn.freebsd.org> From: Rui Paulo Date: Fri, 13 Mar 2009 16:28: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: r189769 - head/sys/dev/amdtemp 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 Mar 2009 16:28:26 -0000 Author: rpaulo Date: Fri Mar 13 16:28:25 2009 New Revision: 189769 URL: http://svn.freebsd.org/changeset/base/189769 Log: Rename all the variables/function names/structs/etc. to reflect the driver name change. While there, update copyright. MFC after: 2 weeks Modified: head/sys/dev/amdtemp/amdtemp.c Modified: head/sys/dev/amdtemp/amdtemp.c ============================================================================== --- head/sys/dev/amdtemp/amdtemp.c Fri Mar 13 16:08:08 2009 (r189768) +++ head/sys/dev/amdtemp/amdtemp.c Fri Mar 13 16:28:25 2009 (r189769) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2008 Rui Paulo + * Copyright (c) 2008, 2009 Rui Paulo + * Copyright (c) 2009 Norikatsu Shigemura * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,8 +26,8 @@ */ /* - * Driver for the AMD K8 thermal sensors. Based on a Linux driver by the - * same name. + * Driver for the AMD K8/K10/K11 thermal sensors. Initially based on the + * amdtemp Linux driver. */ #include @@ -48,77 +49,92 @@ __FBSDID("$FreeBSD$"); #include #include -struct k8temp_softc { +typedef enum { + SENSOR0_CORE0, + SENSOR0_CORE1, + SENSOR1_CORE0, + SENSOR1_CORE1, + CORE0, + CORE1 +} amdsensor_t; + +struct amdtemp_softc { device_t sc_dev; int sc_temps[4]; int sc_ntemps; struct sysctl_oid *sc_oid; struct sysctl_oid *sc_sysctl_cpu[2]; struct intr_config_hook sc_ich; + int32_t (*sc_gettemp)(device_t, amdsensor_t); }; #define VENDORID_AMD 0x1022 -#define DEVICEID_AMD_MISC 0x1103 - -static struct k8temp_product { - uint16_t k8temp_vendorid; - uint16_t k8temp_deviceid; -} k8temp_products[] = { - { VENDORID_AMD, DEVICEID_AMD_MISC }, +#define DEVICEID_AMD_MISC0F 0x1103 +#define DEVICEID_AMD_MISC10 0x1203 +#define DEVICEID_AMD_MISC11 0x1303 + +static struct amdtemp_product { + uint16_t amdtemp_vendorid; + uint16_t amdtemp_deviceid; +} amdtemp_products[] = { + { VENDORID_AMD, DEVICEID_AMD_MISC0F }, + { VENDORID_AMD, DEVICEID_AMD_MISC10 }, + { VENDORID_AMD, DEVICEID_AMD_MISC11 }, { 0, 0 } }; /* - * Register control + * Register control (K8 family) */ -#define K8TEMP_REG 0xe4 -#define K8TEMP_REG_SELSENSOR 0x40 -#define K8TEMP_REG_SELCORE 0x04 +#define AMDTEMP_REG0F 0xe4 +#define AMDTEMP_REG_SELSENSOR 0x40 +#define AMDTEMP_REG_SELCORE 0x04 -#define K8TEMP_MINTEMP 49 /* -49 C is the mininum temperature */ +/* + * Register control (K10 & K11) family + */ +#define AMDTEMP_REG 0xa4 -typedef enum { - SENSOR0_CORE0, - SENSOR0_CORE1, - SENSOR1_CORE0, - SENSOR1_CORE1, - CORE0, - CORE1 -} k8sensor_t; +#define TZ_ZEROC 2732 + + /* -49 C is the mininum temperature */ +#define AMDTEMP_OFFSET0F (TZ_ZEROC-490) +#define AMDTEMP_OFFSET (TZ_ZEROC) /* * Device methods. */ -static void k8temp_identify(driver_t *driver, device_t parent); -static int k8temp_probe(device_t dev); -static int k8temp_attach(device_t dev); -static void k8temp_intrhook(void *arg); -static int k8temp_detach(device_t dev); -static int k8temp_match(device_t dev); -static int32_t k8temp_gettemp(device_t dev, k8sensor_t sensor); -static int k8temp_sysctl(SYSCTL_HANDLER_ARGS); +static void amdtemp_identify(driver_t *driver, device_t parent); +static int amdtemp_probe(device_t dev); +static int amdtemp_attach(device_t dev); +static void amdtemp_intrhook(void *arg); +static int amdtemp_detach(device_t dev); +static int amdtemp_match(device_t dev); +static int32_t amdtemp_gettemp0f(device_t dev, amdsensor_t sensor); +static int32_t amdtemp_gettemp(device_t dev, amdsensor_t sensor); +static int amdtemp_sysctl(SYSCTL_HANDLER_ARGS); -static device_method_t k8temp_methods[] = { +static device_method_t amdtemp_methods[] = { /* Device interface */ - DEVMETHOD(device_identify, k8temp_identify), - DEVMETHOD(device_probe, k8temp_probe), - DEVMETHOD(device_attach, k8temp_attach), - DEVMETHOD(device_detach, k8temp_detach), + DEVMETHOD(device_identify, amdtemp_identify), + DEVMETHOD(device_probe, amdtemp_probe), + DEVMETHOD(device_attach, amdtemp_attach), + DEVMETHOD(device_detach, amdtemp_detach), {0, 0} }; -static driver_t k8temp_driver = { - "k8temp", - k8temp_methods, - sizeof(struct k8temp_softc), +static driver_t amdtemp_driver = { + "amdtemp", + amdtemp_methods, + sizeof(struct amdtemp_softc), }; -static devclass_t k8temp_devclass; -DRIVER_MODULE(k8temp, hostb, k8temp_driver, k8temp_devclass, NULL, NULL); +static devclass_t amdtemp_devclass; +DRIVER_MODULE(amdtemp, hostb, amdtemp_driver, amdtemp_devclass, NULL, NULL); static int -k8temp_match(device_t dev) +amdtemp_match(device_t dev) { int i; uint16_t vendor, devid; @@ -126,9 +142,9 @@ k8temp_match(device_t dev) vendor = pci_get_vendor(dev); devid = pci_get_device(dev); - for (i = 0; k8temp_products[i].k8temp_vendorid != 0; i++) { - if (vendor == k8temp_products[i].k8temp_vendorid && - devid == k8temp_products[i].k8temp_deviceid) + for (i = 0; amdtemp_products[i].amdtemp_vendorid != 0; i++) { + if (vendor == amdtemp_products[i].amdtemp_vendorid && + devid == amdtemp_products[i].amdtemp_deviceid) return (1); } @@ -136,28 +152,28 @@ k8temp_match(device_t dev) } static void -k8temp_identify(driver_t *driver, device_t parent) +amdtemp_identify(driver_t *driver, device_t parent) { device_t child; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "k8temp", -1) != NULL) + if (device_find_child(parent, "amdtemp", -1) != NULL) return; - if (k8temp_match(parent)) { - child = device_add_child(parent, "k8temp", -1); + if (amdtemp_match(parent)) { + child = device_add_child(parent, "amdtemp", -1); if (child == NULL) - device_printf(parent, "add k8temp child failed\n"); + device_printf(parent, "add amdtemp child failed\n"); } } static int -k8temp_probe(device_t dev) +amdtemp_probe(device_t dev) { uint32_t regs[4]; - if (resource_disabled("k8temp", 0)) + if (resource_disabled("amdtemp", 0)) return (ENXIO); do_cpuid(1, regs); @@ -173,9 +189,9 @@ k8temp_probe(device_t dev) } static int -k8temp_attach(device_t dev) +amdtemp_attach(device_t dev) { - struct k8temp_softc *sc = device_get_softc(dev); + struct amdtemp_softc *sc = device_get_softc(dev); struct sysctl_ctx_list *sysctlctx; struct sysctl_oid *sysctlnode; @@ -185,7 +201,7 @@ k8temp_attach(device_t dev) * needed because the cpu driver may be loaded late on boot, after * us. */ - sc->sc_ich.ich_func = k8temp_intrhook; + sc->sc_ich.ich_func = amdtemp_intrhook; sc->sc_ich.ich_arg = dev; if (config_intrhook_establish(&sc->sc_ich) != 0) { device_printf(dev, "config_intrhook_establish " @@ -193,8 +209,15 @@ k8temp_attach(device_t dev) return (ENXIO); } + if (pci_get_device(dev) == DEVICEID_AMD_MISC0F) + sc->sc_gettemp = amdtemp_gettemp0f; + else { + sc->sc_gettemp = amdtemp_gettemp; + return (0); + } + /* - * dev.k8temp.N tree. + * dev.amdtemp.N tree. */ sysctlctx = device_get_sysctl_ctx(dev); sysctlnode = SYSCTL_ADD_NODE(sysctlctx, @@ -204,13 +227,13 @@ k8temp_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR0_CORE0, k8temp_sysctl, "I", + dev, SENSOR0_CORE0, amdtemp_sysctl, "IK", "Sensor 0 / Core 0 temperature"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR0_CORE1, k8temp_sysctl, "I", + dev, SENSOR0_CORE1, amdtemp_sysctl, "IK", "Sensor 0 / Core 1 temperature"); sysctlnode = SYSCTL_ADD_NODE(sysctlctx, @@ -220,25 +243,25 @@ k8temp_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR1_CORE0, k8temp_sysctl, "I", + dev, SENSOR1_CORE0, amdtemp_sysctl, "IK", "Sensor 1 / Core 0 temperature"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR1_CORE1, k8temp_sysctl, "I", + dev, SENSOR1_CORE1, amdtemp_sysctl, "IK", "Sensor 1 / Core 1 temperature"); return (0); } void -k8temp_intrhook(void *arg) +amdtemp_intrhook(void *arg) { int i; device_t nexus, acpi, cpu; device_t dev = (device_t) arg; - struct k8temp_softc *sc; + struct amdtemp_softc *sc; struct sysctl_ctx_list *sysctlctx; sc = device_get_softc(dev); @@ -258,7 +281,7 @@ k8temp_intrhook(void *arg) sc->sc_sysctl_cpu[i] = SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(device_get_sysctl_tree(cpu)), OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, - dev, CORE0, k8temp_sysctl, "I", + dev, CORE0, amdtemp_sysctl, "IK", "Max of sensor 0 / 1"); } } @@ -266,41 +289,42 @@ k8temp_intrhook(void *arg) } int -k8temp_detach(device_t dev) +amdtemp_detach(device_t dev) { int i; - struct k8temp_softc *sc = device_get_softc(dev); + struct amdtemp_softc *sc = device_get_softc(dev); for (i = 0; i < 2; i++) { if (sc->sc_sysctl_cpu[i]) sysctl_remove_oid(sc->sc_sysctl_cpu[i], 1, 0); } - /* NewBus removes the dev.k8temp.N tree by itself. */ + /* NewBus removes the dev.amdtemp.N tree by itself. */ return (0); } static int -k8temp_sysctl(SYSCTL_HANDLER_ARGS) +amdtemp_sysctl(SYSCTL_HANDLER_ARGS) { device_t dev = (device_t) arg1; + struct amdtemp_softc *sc = device_get_softc(dev); int error; int32_t temp, auxtemp[2]; switch (arg2) { case CORE0: - auxtemp[0] = k8temp_gettemp(dev, SENSOR0_CORE0); - auxtemp[1] = k8temp_gettemp(dev, SENSOR1_CORE0); + auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE0); + auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE0); temp = imax(auxtemp[0], auxtemp[1]); break; case CORE1: - auxtemp[0] = k8temp_gettemp(dev, SENSOR0_CORE1); - auxtemp[1] = k8temp_gettemp(dev, SENSOR1_CORE1); + auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE1); + auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE1); temp = imax(auxtemp[0], auxtemp[1]); break; default: - temp = k8temp_gettemp(dev, arg2); + temp = sc->sc_gettemp(dev, arg2); break; } error = sysctl_handle_int(oidp, &temp, 0, req); @@ -309,34 +333,45 @@ k8temp_sysctl(SYSCTL_HANDLER_ARGS) } static int32_t -k8temp_gettemp(device_t dev, k8sensor_t sensor) +amdtemp_gettemp0f(device_t dev, amdsensor_t sensor) { uint8_t cfg; uint32_t temp; - cfg = pci_read_config(dev, K8TEMP_REG, 1); + cfg = pci_read_config(dev, AMDTEMP_REG0F, 1); switch (sensor) { case SENSOR0_CORE0: - cfg &= ~(K8TEMP_REG_SELSENSOR | K8TEMP_REG_SELCORE); + cfg &= ~(AMDTEMP_REG_SELSENSOR | AMDTEMP_REG_SELCORE); break; case SENSOR0_CORE1: - cfg &= ~K8TEMP_REG_SELSENSOR; - cfg |= K8TEMP_REG_SELCORE; + cfg &= ~AMDTEMP_REG_SELSENSOR; + cfg |= AMDTEMP_REG_SELCORE; break; case SENSOR1_CORE0: - cfg &= ~K8TEMP_REG_SELCORE; - cfg |= K8TEMP_REG_SELSENSOR; + cfg &= ~AMDTEMP_REG_SELCORE; + cfg |= AMDTEMP_REG_SELSENSOR; break; case SENSOR1_CORE1: - cfg |= (K8TEMP_REG_SELSENSOR | K8TEMP_REG_SELCORE); + cfg |= (AMDTEMP_REG_SELSENSOR | AMDTEMP_REG_SELCORE); break; default: cfg = 0; break; } - pci_write_config(dev, K8TEMP_REG, cfg, 1); - temp = pci_read_config(dev, K8TEMP_REG, 4); - temp = ((temp >> 16) & 0xff) - K8TEMP_MINTEMP; + pci_write_config(dev, AMDTEMP_REG0F, cfg, 1); + temp = pci_read_config(dev, AMDTEMP_REG0F, 4); + temp = ((temp >> 16) & 0xff) * 10 + AMDTEMP_OFFSET0F; return (temp); } + +static int32_t +amdtemp_gettemp(device_t dev, amdsensor_t sensor) +{ + uint32_t temp; + + temp = pci_read_config(dev, AMDTEMP_REG, 4); + temp = ((temp >> 21) & 0x3ff) * 10 / 8 + AMDTEMP_OFFSET; + + return (temp); +} From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 16:30:33 2009 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 E706F10657CC; Fri, 13 Mar 2009 16:30:33 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D36798FC1B; Fri, 13 Mar 2009 16:30:33 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DGUXGq067778; Fri, 13 Mar 2009 16:30:33 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DGUXGx067777; Fri, 13 Mar 2009 16:30:33 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200903131630.n2DGUXGx067777@svn.freebsd.org> From: Rui Paulo Date: Fri, 13 Mar 2009 16:30: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: r189770 - 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: Fri, 13 Mar 2009 16:30:36 -0000 Author: rpaulo Date: Fri Mar 13 16:30:33 2009 New Revision: 189770 URL: http://svn.freebsd.org/changeset/base/189770 Log: Mention k8temp -> amdtemp rename. MFC after: 2 weeks Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Mar 13 16:28:25 2009 (r189769) +++ head/UPDATING Fri Mar 13 16:30:33 2009 (r189770) @@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090313: + The k8temp(4) driver has been renamed to amdtemp(4) since + support for K10 and K11 CPU families was added. + 20090309: IGMPv3 and Source-Specific Multicast (SSM) have been merged to the IPv4 stack. VIMAGE hooks are in but not yet used. From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 16:40:51 2009 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 E981C106564A; Fri, 13 Mar 2009 16:40:51 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D453C8FC16; Fri, 13 Mar 2009 16:40:51 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DGep17068015; Fri, 13 Mar 2009 16:40:51 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DGep8f068001; Fri, 13 Mar 2009 16:40:51 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200903131640.n2DGep8f068001@svn.freebsd.org> From: Dmitry Chagin Date: Fri, 13 Mar 2009 16:40: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: r189771 - in head/sys: amd64/amd64 amd64/linux32 arm/arm compat/ia32 compat/svr4 i386/i386 i386/linux ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc64 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: Fri, 13 Mar 2009 16:40:52 -0000 Author: dchagin Date: Fri Mar 13 16:40:51 2009 New Revision: 189771 URL: http://svn.freebsd.org/changeset/base/189771 Log: Implement new way of branding ELF binaries by looking to a ".note.ABI-tag" section. The search order of a brand is changed, now first of all the ".note.ABI-tag" is looked through. Move code which fetch osreldate for ELF binary to check_note() handler. PR: 118473 Approved by: kib (mentor) Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/arm/elf_machdep.c head/sys/compat/ia32/ia32_sysvec.c head/sys/compat/svr4/svr4_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/i386/linux/linux_sysvec.c head/sys/ia64/ia64/elf_machdep.c head/sys/kern/imgact_elf.c head/sys/mips/mips/elf64_machdep.c head/sys/mips/mips/elf_machdep.c head/sys/powerpc/powerpc/elf_machdep.c head/sys/sparc64/sparc64/elf_machdep.c head/sys/sys/imgact_elf.h Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/amd64/amd64/elf_machdep.c Fri Mar 13 16:40:51 2009 (r189771) @@ -84,7 +84,8 @@ static Elf64_Brandinfo freebsd_brand_inf .interp_path = "/libexec/ld-elf.so.1", .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf64_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, @@ -99,7 +100,8 @@ static Elf64_Brandinfo freebsd_brand_oin .interp_path = "/usr/libexec/ld-elf.so.1", .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf64_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 13 16:40:51 2009 (r189771) @@ -1047,6 +1047,16 @@ struct sysentvec elf_linux_sysvec = { .sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_IA32 }; +static char GNULINUX_ABI_VENDOR[] = "GNU"; + +static Elf_Brandnote linux32_brandnote = { + .hdr.n_namesz = sizeof(GNULINUX_ABI_VENDOR), + .hdr.n_descsz = 16, + .hdr.n_type = 1, + .vendor = GNULINUX_ABI_VENDOR, + .flags = 0 +}; + static Elf32_Brandinfo linux_brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, @@ -1055,7 +1065,8 @@ static Elf32_Brandinfo linux_brand = { .interp_path = "/lib/ld-linux.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &linux32_brandnote, + .flags = BI_CAN_EXEC_DYN }; static Elf32_Brandinfo linux_glibc2brand = { @@ -1066,7 +1077,8 @@ static Elf32_Brandinfo linux_glibc2brand .interp_path = "/lib/ld-linux.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &linux32_brandnote, + .flags = BI_CAN_EXEC_DYN }; Elf32_Brandinfo *linux_brandlist[] = { Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/arm/arm/elf_machdep.c Fri Mar 13 16:40:51 2009 (r189771) @@ -84,7 +84,8 @@ static Elf32_Brandinfo freebsd_brand_inf .interp_path = "/libexec/ld-elf.so.1", .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf32_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -99,7 +100,8 @@ static Elf32_Brandinfo freebsd_brand_oin .interp_path = "/usr/libexec/ld-elf.so.1", .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf32_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- head/sys/compat/ia32/ia32_sysvec.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/compat/ia32/ia32_sysvec.c Fri Mar 13 16:40:51 2009 (r189771) @@ -148,6 +148,7 @@ static Elf32_Brandinfo ia32_brand_info = .interp_path = "/libexec/ld-elf.so.1", .sysvec = &ia32_freebsd_sysvec, .interp_newpath = "/libexec/ld-elf32.so.1", + .brand_note = &elf32_freebsd_brandnote, .flags = BI_CAN_EXEC_DYN }; @@ -163,7 +164,8 @@ static Elf32_Brandinfo ia32_brand_oinfo .interp_path = "/usr/libexec/ld-elf.so.1", .sysvec = &ia32_freebsd_sysvec, .interp_newpath = "/libexec/ld-elf32.so.1", - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf32_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/compat/svr4/svr4_sysvec.c ============================================================================== --- head/sys/compat/svr4/svr4_sysvec.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/compat/svr4/svr4_sysvec.c Fri Mar 13 16:40:51 2009 (r189771) @@ -204,6 +204,7 @@ Elf32_Brandinfo svr4_brand = { .interp_path = "/lib/libc.so.1", .sysvec = &svr4_sysvec, .interp_newpath = NULL, + .brand_note = NULL, .flags = 0 }; Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/i386/i386/elf_machdep.c Fri Mar 13 16:40:51 2009 (r189771) @@ -84,7 +84,8 @@ static Elf32_Brandinfo freebsd_brand_inf .interp_path = "/libexec/ld-elf.so.1", .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf32_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -99,7 +100,8 @@ static Elf32_Brandinfo freebsd_brand_oin .interp_path = "/usr/libexec/ld-elf.so.1", .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf32_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/i386/linux/linux_sysvec.c Fri Mar 13 16:40:51 2009 (r189771) @@ -1019,6 +1019,16 @@ struct sysentvec elf_linux_sysvec = { .sv_flags = SV_ABI_LINUX | SV_IA32 | SV_ILP32 }; +static char GNULINUX_ABI_VENDOR[] = "GNU"; + +static Elf_Brandnote linux_brandnote = { + .hdr.n_namesz = sizeof(GNULINUX_ABI_VENDOR), + .hdr.n_descsz = 16, + .hdr.n_type = 1, + .vendor = GNULINUX_ABI_VENDOR, + .flags = 0 +}; + static Elf32_Brandinfo linux_brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, @@ -1027,7 +1037,8 @@ static Elf32_Brandinfo linux_brand = { .interp_path = "/lib/ld-linux.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &linux_brandnote, + .flags = BI_CAN_EXEC_DYN }; static Elf32_Brandinfo linux_glibc2brand = { @@ -1038,7 +1049,8 @@ static Elf32_Brandinfo linux_glibc2brand .interp_path = "/lib/ld-linux.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &linux_brandnote, + .flags = BI_CAN_EXEC_DYN }; Elf32_Brandinfo *linux_brandlist[] = { Modified: head/sys/ia64/ia64/elf_machdep.c ============================================================================== --- head/sys/ia64/ia64/elf_machdep.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/ia64/ia64/elf_machdep.c Fri Mar 13 16:40:51 2009 (r189771) @@ -92,7 +92,8 @@ static Elf64_Brandinfo freebsd_brand_inf .interp_path = "/libexec/ld-elf.so.1", .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf64_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info); @@ -105,7 +106,8 @@ static Elf64_Brandinfo freebsd_brand_oin .interp_path = "/usr/libexec/ld-elf.so.1", .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf64_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_oinfo); Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/kern/imgact_elf.c Fri Mar 13 16:40:51 2009 (r189771) @@ -78,14 +78,16 @@ __FBSDID("$FreeBSD$"); #define OLD_EI_BRAND 8 static int __elfN(check_header)(const Elf_Ehdr *hdr); -static Elf_Brandinfo *__elfN(get_brandinfo)(const Elf_Ehdr *hdr, - const char *interp); +static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, + const char *interp, int32_t *osrel); static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, u_long *entry, size_t pagesize); static int __elfN(load_section)(struct vmspace *vmspace, vm_object_t object, vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot, size_t pagesize); static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp); +static boolean_t __elfN(check_note)(struct image_params *imgp, + Elf_Brandnote *checknote, int32_t *osrel); SYSCTL_NODE(_kern, OID_AUTO, __CONCAT(elf, __ELF_WORD_SIZE), CTLFLAG_RW, 0, ""); @@ -107,6 +109,16 @@ static Elf_Brandinfo *elf_brand_list[MAX #define round_page_ps(va, ps) (((va) + (ps - 1)) & ~(ps - 1)) #define aligned(a, t) (trunc_page_ps((u_long)(a), sizeof(t)) == (u_long)(a)) +static const char FREEBSD_ABI_VENDOR[] = "FreeBSD"; + +Elf_Brandnote __elfN(freebsd_brandnote) = { + .hdr.n_namesz = sizeof(FREEBSD_ABI_VENDOR), + .hdr.n_descsz = sizeof(int32_t), + .hdr.n_type = 1, + .vendor = FREEBSD_ABI_VENDOR, + .flags = BN_CAN_FETCH_OSREL +}; + int __elfN(insert_brand_entry)(Elf_Brandinfo *entry) { @@ -158,19 +170,32 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry } static Elf_Brandinfo * -__elfN(get_brandinfo)(const Elf_Ehdr *hdr, const char *interp) +__elfN(get_brandinfo)(struct image_params *imgp, const char *interp, + int32_t *osrel) { + const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; Elf_Brandinfo *bi; + boolean_t ret; int i; /* - * We support three types of branding -- (1) the ELF EI_OSABI field + * We support four types of branding -- (1) the ELF EI_OSABI field * that SCO added to the ELF spec, (2) FreeBSD 3.x's traditional string - * branding w/in the ELF header, and (3) path of the `interp_path' - * field. We should also look for an ".note.ABI-tag" ELF section now - * in all Linux ELF binaries, FreeBSD 4.1+, and some NetBSD ones. + * branding w/in the ELF header, (3) path of the `interp_path' + * field, and (4) the ".note.ABI-tag" ELF section. */ + /* Look for an ".note.ABI-tag" ELF section */ + for (i = 0; i < MAX_BRANDS; i++) { + bi = elf_brand_list[i]; + if (bi != NULL && hdr->e_machine == bi->machine && + bi->brand_note != NULL) { + ret = __elfN(check_note)(imgp, bi->brand_note, osrel); + if (ret) + return (bi); + } + } + /* If the executable has a brand, search for it in the brand list. */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; @@ -590,13 +615,11 @@ fail: return (error); } -static const char FREEBSD_ABI_VENDOR[] = "FreeBSD"; - static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) { const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; - const Elf_Phdr *phdr, *pnote = NULL; + const Elf_Phdr *phdr; Elf_Auxargs *elf_auxargs; struct vmspace *vmspace; vm_prot_t prot; @@ -604,12 +627,11 @@ __CONCAT(exec_, __elfN(imgact))(struct i u_long text_addr = 0, data_addr = 0; u_long seg_size, seg_addr; u_long addr, entry = 0, proghdr = 0; + int32_t osrel = 0; int error = 0, i; const char *interp = NULL, *newinterp = NULL; Elf_Brandinfo *brand_info; - const Elf_Note *note, *note_end; char *path; - const char *note_name; struct sysentvec *sv; /* @@ -646,7 +668,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i } } - brand_info = __elfN(get_brandinfo)(hdr, interp); + brand_info = __elfN(get_brandinfo)(imgp, interp, &osrel); if (brand_info == NULL) { uprintf("ELF binary type \"%u\" not known.\n", hdr->e_ident[EI_OSABI]); @@ -750,9 +772,6 @@ __CONCAT(exec_, __elfN(imgact))(struct i case PT_PHDR: /* Program header table info */ proghdr = phdr[i].p_vaddr; break; - case PT_NOTE: - pnote = &phdr[i]; - break; default: break; } @@ -840,41 +859,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i imgp->auxargs = elf_auxargs; imgp->interpreted = 0; - - /* - * Try to fetch the osreldate for FreeBSD binary from the ELF - * OSABI-note. Only the first page of the image is searched, - * the same as for headers. - */ - if (pnote != NULL && pnote->p_offset < PAGE_SIZE && - pnote->p_offset + pnote->p_filesz < PAGE_SIZE ) { - note = (const Elf_Note *)(imgp->image_header + pnote->p_offset); - if (!aligned(note, Elf32_Addr)) { - free(imgp->auxargs, M_TEMP); - imgp->auxargs = NULL; - return (ENOEXEC); - } - note_end = (const Elf_Note *)(imgp->image_header + pnote->p_offset + - pnote->p_filesz); - while (note < note_end) { - if (note->n_namesz == sizeof(FREEBSD_ABI_VENDOR) && - note->n_descsz == sizeof(int32_t) && - note->n_type == 1 /* ABI_NOTETYPE */) { - note_name = (const char *)(note + 1); - if (strncmp(FREEBSD_ABI_VENDOR, note_name, - sizeof(FREEBSD_ABI_VENDOR)) == 0) { - imgp->proc->p_osrel = *(const int32_t *) - (note_name + - round_page_ps(sizeof(FREEBSD_ABI_VENDOR), - sizeof(Elf32_Addr))); - break; - } - } - note = (const Elf_Note *)((const char *)(note + 1) + - round_page_ps(note->n_namesz, sizeof(Elf32_Addr)) + - round_page_ps(note->n_descsz, sizeof(Elf32_Addr))); - } - } + imgp->proc->p_osrel = osrel; return (error); } @@ -1336,6 +1321,71 @@ __elfN(putnote)(void *dst, size_t *off, } /* + * Try to find the appropriate ABI-note section for checknote, + * fetch the osreldate for binary from the ELF OSABI-note. Only the + * first page of the image is searched, the same as for headers. + */ +static boolean_t +__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *checknote, + int32_t *osrel) +{ + const Elf_Note *note, *note_end; + const Elf32_Phdr *phdr, *pnote; + const Elf32_Ehdr *hdr; + const char *note_name; + int i; + + pnote = NULL; + hdr = (const Elf32_Ehdr *)imgp->image_header; + phdr = (const Elf32_Phdr *)(imgp->image_header + hdr->e_phoff); + + for (i = 0; i < hdr->e_phnum; i++) { + if (phdr[i].p_type == PT_NOTE) { + pnote = &phdr[i]; + break; + } + } + + if (pnote == NULL || pnote->p_offset >= PAGE_SIZE || + pnote->p_offset + pnote->p_filesz >= PAGE_SIZE) + return (FALSE); + + note = (const Elf_Note *)(imgp->image_header + pnote->p_offset); + if (!aligned(note, Elf32_Addr)) + return (FALSE); + note_end = (const Elf_Note *)(imgp->image_header + + pnote->p_offset + pnote->p_filesz); + while (note < note_end) { + if (note->n_namesz != checknote->hdr.n_namesz || + note->n_descsz != checknote->hdr.n_descsz || + note->n_type != checknote->hdr.n_type) + goto nextnote; + note_name = (const char *)(note + 1); + if (strncmp(checknote->vendor, note_name, + checknote->hdr.n_namesz) != 0) + goto nextnote; + + /* + * Fetch the osreldate for binary + * from the ELF OSABI-note if necessary. + */ + if ((checknote->flags & BN_CAN_FETCH_OSREL) != 0 && + osrel != NULL) + *osrel = *(const int32_t *) (note_name + + roundup2(checknote->hdr.n_namesz, + sizeof(Elf32_Addr))); + return (TRUE); + +nextnote: + note = (const Elf_Note *)((const char *)(note + 1) + + roundup2(note->n_namesz, sizeof(Elf32_Addr)) + + roundup2(note->n_descsz, sizeof(Elf32_Addr))); + } + + return (FALSE); +} + +/* * Tell kern_execve.c about it, with a little help from the linker. */ static struct execsw __elfN(execsw) = { Modified: head/sys/mips/mips/elf64_machdep.c ============================================================================== --- head/sys/mips/mips/elf64_machdep.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/mips/mips/elf64_machdep.c Fri Mar 13 16:40:51 2009 (r189771) @@ -88,6 +88,7 @@ static Elf64_Brandinfo freebsd_brand_gnu .interp_path = "/libexec/ld-elf.so.1", .sysvec = &elf64_freebsd_sysvec, .interp_path = "/libexec/ld-elf.so.1", + .brand_note = &elf64_freebsd_brandnote, .flags = BI_CAN_EXEC_DYN }; @@ -103,6 +104,7 @@ static Elf64_Brandinfo freebsd_brand_inf .interp_path = "/libexec/ld-elf.so.1", .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, + .brand_note = &elf64_freebsd_brandnote, .flags = 0 }; Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/mips/mips/elf_machdep.c Fri Mar 13 16:40:51 2009 (r189771) @@ -86,6 +86,7 @@ static Elf32_Brandinfo freebsd_brand_inf .interp_path = "/libexec/ld-elf.so.1", .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, + .brand_note = &elf32_freebsd_brandnote, .flags = 0 }; Modified: head/sys/powerpc/powerpc/elf_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf_machdep.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/powerpc/powerpc/elf_machdep.c Fri Mar 13 16:40:51 2009 (r189771) @@ -87,7 +87,8 @@ static Elf32_Brandinfo freebsd_brand_inf .interp_path = "/libexec/ld-elf.so.1", .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf32_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -102,7 +103,8 @@ static Elf32_Brandinfo freebsd_brand_oin .interp_path = "/usr/libexec/ld-elf.so.1", .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf32_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/sparc64/sparc64/elf_machdep.c Fri Mar 13 16:40:51 2009 (r189771) @@ -99,7 +99,8 @@ static Elf64_Brandinfo freebsd_brand_inf .interp_path = "/libexec/ld-elf.so.1", .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf64_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, @@ -114,7 +115,8 @@ static Elf64_Brandinfo freebsd_brand_oin .interp_path = "/usr/libexec/ld-elf.so.1", .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, - .flags = BI_CAN_EXEC_DYN, + .brand_note = &elf64_freebsd_brandnote, + .flags = BI_CAN_EXEC_DYN }; SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/sys/imgact_elf.h ============================================================================== --- head/sys/sys/imgact_elf.h Fri Mar 13 16:30:33 2009 (r189770) +++ head/sys/sys/imgact_elf.h Fri Mar 13 16:40:51 2009 (r189771) @@ -55,6 +55,13 @@ typedef struct { } __ElfN(Auxargs); typedef struct { + Elf_Note hdr; + const char * vendor; + int flags; +#define BN_CAN_FETCH_OSREL 0x0001 +} Elf_Brandnote; + +typedef struct { int brand; int machine; const char *compat_3_brand; /* pre Binutils 2.10 method (FBSD 3) */ @@ -62,6 +69,7 @@ typedef struct { const char *interp_path; struct sysentvec *sysvec; const char *interp_newpath; + Elf_Brandnote *brand_note; int flags; #define BI_CAN_EXEC_DYN 0x0001 } __ElfN(Brandinfo); @@ -81,7 +89,7 @@ int __elfN(coredump)(struct thread *, st void __elfN(dump_thread)(struct thread *, void *, size_t *); extern int __elfN(fallback_brand); - +extern Elf_Brandnote __elfN(freebsd_brandnote); #endif /* _KERNEL */ #endif /* !_SYS_IMGACT_ELF_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 16:40:56 2009 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 E3F691065676; Fri, 13 Mar 2009 16:40:56 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2EAC8FC17; Fri, 13 Mar 2009 16:40:56 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DGeu7Q068050; Fri, 13 Mar 2009 16:40:56 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DGeuHk068049; Fri, 13 Mar 2009 16:40:56 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200903131640.n2DGeuHk068049@svn.freebsd.org> From: Gabor Kovesdan Date: Fri, 13 Mar 2009 16:40: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: r189772 - 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: Fri, 13 Mar 2009 16:40:57 -0000 Author: gabor (doc,ports committer) Date: Fri Mar 13 16:40:56 2009 New Revision: 189772 URL: http://svn.freebsd.org/changeset/base/189772 Log: - Add an entry about enabling libc NLS support Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Mar 13 16:40:51 2009 (r189771) +++ head/UPDATING Fri Mar 13 16:40:56 2009 (r189772) @@ -23,6 +23,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. ln -s aj /etc/malloc.conf.) 20090313: + POSIX.1 Native Language Support (NLS) has been enabled in libc and + a bunch of new language catalog files have also been added. + This means that some common libc messages are now localized and + they depend on the LC_MESSAGES environmental variable. + +20090313: The k8temp(4) driver has been renamed to amdtemp(4) since support for K10 and K11 CPU families was added. From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 16:42:25 2009 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 6A1D4106566B; Fri, 13 Mar 2009 16:42:25 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D5DC8FC15; Fri, 13 Mar 2009 16:42:25 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DGgP8w068110; Fri, 13 Mar 2009 16:42:25 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DGgP5M068108; Fri, 13 Mar 2009 16:42:25 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200903131642.n2DGgP5M068108@svn.freebsd.org> From: Rui Paulo Date: Fri, 13 Mar 2009 16:42: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: r189773 - 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: Fri, 13 Mar 2009 16:42:25 -0000 Author: rpaulo Date: Fri Mar 13 16:42:24 2009 New Revision: 189773 URL: http://svn.freebsd.org/changeset/base/189773 Log: Rename the k8temp(4) man page to amdtemp(4) and update its contents for the new families. MFC after: 2 weeks Added: head/share/man/man4/amdtemp.4 - copied, changed from r189768, head/share/man/man4/k8temp.4 Deleted: head/share/man/man4/k8temp.4 Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Fri Mar 13 16:40:56 2009 (r189772) +++ head/share/man/man4/Makefile Fri Mar 13 16:42:24 2009 (r189773) @@ -26,6 +26,7 @@ MAN= aac.4 \ ale.4 \ altq.4 \ amd.4 \ + ${_amdtemp.4} \ ${_amdsmb.4} \ amr.4 \ an.4 \ @@ -155,7 +156,6 @@ MAN= aac.4 \ ixgbe.4 \ jme.4 \ joy.4 \ - ${_k8temp.4} \ kbdmux.4 \ keyboard.4 \ kld.4 \ @@ -593,6 +593,7 @@ _acpi_panasonic.4=acpi_panasonic.4 _acpi_sony.4= acpi_sony.4 _acpi_toshiba.4=acpi_toshiba.4 _amdsmb.4= amdsmb.4 +_amdtemp.4= amdtemp.4 _asmc.4= asmc.4 _coretemp.4= coretemp.4 _cpuctl.4= cpuctl.4 @@ -610,7 +611,6 @@ _ipmi.4= ipmi.4 _io.4= io.4 _linux.4= linux.4 _ndis.4= ndis.4 -_k8temp.4= k8temp.4 _nfe.4= nfe.4 _nfsmb.4= nfsmb.4 _nve.4= nve.4 Copied and modified: head/share/man/man4/amdtemp.4 (from r189768, head/share/man/man4/k8temp.4) ============================================================================== --- head/share/man/man4/k8temp.4 Fri Mar 13 16:08:08 2009 (r189768, copy source) +++ head/share/man/man4/amdtemp.4 Fri Mar 13 16:42:24 2009 (r189773) @@ -26,39 +26,47 @@ .\" $FreeBSD$ .\" .Dd April 8, 2008 -.Dt K8TEMP 4 +.Dt AMDTEMP 4 .Os .Sh NAME -.Nm k8temp -.Nd device driver for AMD K8 on-die digital thermal sensor +.Nm amdtemp +.Nd device driver for AMD K8, K10 and K11 on-die digital thermal sensor .Sh SYNOPSIS To compile this driver into the kernel, place the following line in your kernel configuration file: .Bd -ragged -offset indent -.Cd "device k8temp" +.Cd "device amdtemp" .Ed .Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -k8temp_load="YES" +amdtemp_load="YES" .Ed .Sh DESCRIPTION The .Nm driver provides support for the on-die digital thermal sensor present -in AMD K8 processors. +in AMD K8, K10 and K11 processors. .Pp -The +For the K8 family, the .Nm driver reports each cores' temperature through a sysctl node in the corresponding CPU devices's sysctl tree, named -.Va dev.k8temp.%d.sensor{0,1}.core{0,1} . +.Va dev.amdtemp.%d.sensor{0,1}.core{0,1} . +The driver also creates .Va dev.cpu.%d.temperature -is also created and it displays the maximum temperature of the two sensors +displaying the maximum temperature of the two sensors located in each CPU core. +.Pp +For the K10 and K11 families, the driver creates +.Va dev.cpu.%d.temperature +with the temperature of each core. +.Sh BUGS +AMD K9 is not supported because temperature reporting has been replaced +by Maltese. .Sh SEE ALSO .Xr sysctl 8 .Sh HISTORY @@ -69,3 +77,4 @@ driver first appeared in .Sh AUTHORS .An .An Rui Paulo Aq rpaulo@FreeBSD.org +.An Norikatsu Shigemura Aq nork@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 16:43:31 2009 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 C00C610656C6; Fri, 13 Mar 2009 16:43:31 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE2B28FC25; Fri, 13 Mar 2009 16:43:31 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DGhVCK068163; Fri, 13 Mar 2009 16:43:31 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DGhVQa068162; Fri, 13 Mar 2009 16:43:31 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200903131643.n2DGhVQa068162@svn.freebsd.org> From: Rui Paulo Date: Fri, 13 Mar 2009 16:43: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: r189774 - head/sys/dev/amdtemp 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 Mar 2009 16:43:32 -0000 Author: rpaulo Date: Fri Mar 13 16:43:31 2009 New Revision: 189774 URL: http://svn.freebsd.org/changeset/base/189774 Log: Fix comment explaining where this driver came from. MFC after: 2 weeks Modified: head/sys/dev/amdtemp/amdtemp.c Modified: head/sys/dev/amdtemp/amdtemp.c ============================================================================== --- head/sys/dev/amdtemp/amdtemp.c Fri Mar 13 16:42:24 2009 (r189773) +++ head/sys/dev/amdtemp/amdtemp.c Fri Mar 13 16:43:31 2009 (r189774) @@ -27,7 +27,7 @@ /* * Driver for the AMD K8/K10/K11 thermal sensors. Initially based on the - * amdtemp Linux driver. + * k8temp Linux driver. */ #include From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 18:14:47 2009 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 5F2F4106564A; Fri, 13 Mar 2009 18:14:47 +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 2DF4C8FC29; Fri, 13 Mar 2009 18:14:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id CF9B946B0D; Fri, 13 Mar 2009 14:14:46 -0400 (EDT) Received: from new-host-2.baldwin.cx (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n2DIEfSI061161; Fri, 13 Mar 2009 14:14:41 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: <49BAA2C6.2000807@FreeBSD.org> Date: Fri, 13 Mar 2009 14:15:34 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: Konstantin Belousov References: <200812181158.mBIBwC50039690@svn.freebsd.org> In-Reply-To: <200812181158.mBIBwC50039690@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Fri, 13 Mar 2009 14:14:41 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9105/Fri Mar 13 07:58:59 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r186276 - 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: Fri, 13 Mar 2009 18:14:48 -0000 Konstantin Belousov wrote: > Author: kib > Date: Thu Dec 18 11:58:12 2008 > New Revision: 186276 > URL: http://svn.freebsd.org/changeset/base/186276 > > Log: > Do not return success and doomed vnode from lookup. LK_UPGRADE allows > the vnode to be reclaimed. > > Tested by: pho > MFC after: 1 month Would EBADF be more appropriate? That is what other places that check VI_DOOMED return for this type of check (e.g. in cache_lookup()). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 18:22:06 2009 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 BB1191065670; Fri, 13 Mar 2009 18:22:06 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 75E988FC14; Fri, 13 Mar 2009 18:22:06 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n2DIMGmY008948; Fri, 13 Mar 2009 14:22:16 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n2DIMGsB008947; Fri, 13 Mar 2009 14:22:16 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Fri, 13 Mar 2009 14:22:16 -0400 From: David Schultz To: "Sean C. Farley" Message-ID: <20090313182216.GA8844@zim.MIT.EDU> Mail-Followup-To: "Sean C. Farley" , Gabor Kovesdan , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200903131040.n2DAecSO061131@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Gabor Kovesdan Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 18:22:07 -0000 On Fri, Mar 13, 2009, Sean C. Farley wrote: > Now, you only need to revive the BSD-licensed libiconv[1]. :) [...] > 1. http://people.freebsd.org/~bland/iconv-2.1.tar.gz I asked a few weeks ago on standards@ why we weren't using Citrus iconv, which is what NetBSD uses, and seems to be in a somewhat better state than this. It also provides various wide character conversion routines that overlap with what tjr@ has already done in FreeBSD, so we'd have to sort that out. And we'd have to sort out a gazillion ports that want -liconv. From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 18:36:08 2009 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 ABDF3106566B; Fri, 13 Mar 2009 18:36:08 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 702748FC13; Fri, 13 Mar 2009 18:36:08 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id n2DIa71Q027608; Fri, 13 Mar 2009 13:36:07 -0500 (CDT) (envelope-from scf@FreeBSD.org) Date: Fri, 13 Mar 2009 13:36:07 -0500 (CDT) From: "Sean C. Farley" To: David Schultz In-Reply-To: <20090313182216.GA8844@zim.MIT.EDU> Message-ID: References: <200903131040.n2DAecSO061131@svn.freebsd.org> <20090313182216.GA8844@zim.MIT.EDU> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Gabor Kovesdan Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 18:36:09 -0000 On Fri, 13 Mar 2009, David Schultz wrote: > On Fri, Mar 13, 2009, Sean C. Farley wrote: >> Now, you only need to revive the BSD-licensed libiconv[1]. :) > [...] >> 1. http://people.freebsd.org/~bland/iconv-2.1.tar.gz > > I asked a few weeks ago on standards@ why we weren't using Citrus > iconv, which is what NetBSD uses, and seems to be in a somewhat > better state than this. It also provides various wide character > conversion routines that overlap with what tjr@ has already done > in FreeBSD, so we'd have to sort that out. And we'd have to sort > out a gazillion ports that want -liconv. I have not explored either. The Citrus version appears to have more functionality, however, the Citrus website is ambiguous about the license. Note to self: register with standards@; arch@ is not enough. :) Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 19:05:34 2009 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 E6745106564A; Fri, 13 Mar 2009 19:05:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C96868FC12; Fri, 13 Mar 2009 19:05:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DJ5YkC070986; Fri, 13 Mar 2009 19:05:34 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DJ5YoC070985; Fri, 13 Mar 2009 19:05:34 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903131905.n2DJ5YoC070985@svn.freebsd.org> From: Sam Leffler Date: Fri, 13 Mar 2009 19:05: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: r189775 - head/contrib/wpa/wpa_supplicant 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 Mar 2009 19:05:35 -0000 Author: sam Date: Fri Mar 13 19:05:34 2009 New Revision: 189775 URL: http://svn.freebsd.org/changeset/base/189775 Log: fix portability; linux does not have sa_len/sun_len Modified: head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c Modified: head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c ============================================================================== --- head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c Fri Mar 13 16:43:31 2009 (r189774) +++ head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c Fri Mar 13 19:05:34 2009 (r189775) @@ -16,6 +16,7 @@ #include #include #include +#include #include "common.h" #include "eloop.h" @@ -69,7 +70,8 @@ static int wpa_supplicant_ctrl_iface_att dst->next = priv->ctrl_dst; priv->ctrl_dst = dst; wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor attached", - (u8 *) from->sun_path, fromlen - sizeof(from->sun_family)); + (u8 *) from->sun_path, + fromlen - offsetof(struct sockaddr_un, sun_path)); return 0; } @@ -84,7 +86,7 @@ static int wpa_supplicant_ctrl_iface_det while (dst) { if (fromlen == dst->addrlen && os_memcmp(from->sun_path, dst->addr.sun_path, - fromlen - sizeof(from->sun_family)) == 0) { + fromlen - offsetof(struct sockaddr_un, sun_path)) == 0) { if (prev == NULL) priv->ctrl_dst = dst->next; else @@ -92,7 +94,7 @@ static int wpa_supplicant_ctrl_iface_det os_free(dst); wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor detached", (u8 *) from->sun_path, - fromlen - sizeof(from->sun_family)); + fromlen - offsetof(struct sockaddr_un, sun_path)); return 0; } prev = dst; @@ -115,10 +117,10 @@ static int wpa_supplicant_ctrl_iface_lev while (dst) { if (fromlen == dst->addrlen && os_memcmp(from->sun_path, dst->addr.sun_path, - fromlen - sizeof(from->sun_family)) == 0) { + fromlen - offsetof(struct sockaddr_un, sun_path)) == 0) { wpa_hexdump(MSG_DEBUG, "CTRL_IFACE changed monitor " "level", (u8 *) from->sun_path, - fromlen - sizeof(from->sun_family)); + fromlen - offsetof(struct sockaddr_un, sun_path)); dst->debug_level = atoi(level); return 0; } @@ -339,6 +341,8 @@ wpa_supplicant_ctrl_iface_init(struct wp } os_memset(&addr, 0, sizeof(addr)); + /* XXX #ifdef */ + addr.sun_len = sizeof(addr); addr.sun_family = AF_UNIX; fname = wpa_supplicant_ctrl_iface_path(wpa_s); if (fname == NULL) @@ -509,8 +513,8 @@ static void wpa_supplicant_ctrl_iface_se next = dst->next; if (level >= dst->debug_level) { wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor send", - (u8 *) dst->addr.sun_path, dst->addrlen - - sizeof(dst->addr.sun_family)); + (u8 *) dst->addr.sun_path, + dst->addrlen - offsetof(struct sockaddr_un, sun_path)); msg.msg_name = (void *) &dst->addr; msg.msg_namelen = dst->addrlen; if (sendmsg(priv->sock, &msg, 0) < 0) { @@ -637,6 +641,8 @@ wpa_supplicant_global_ctrl_iface_init(st } os_memset(&addr, 0, sizeof(addr)); + /* XXX #ifdef */ + addr.sun_len = sizeof(addr); addr.sun_family = AF_UNIX; os_strlcpy(addr.sun_path, global->params.ctrl_interface, sizeof(addr.sun_path)); From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 20:12:56 2009 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 BD4ED1065705; Fri, 13 Mar 2009 20:12:56 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-fx0-f158.google.com (mail-fx0-f158.google.com [209.85.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id 937028FC19; Fri, 13 Mar 2009 20:12:55 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by fxm2 with SMTP id 2so2653875fxm.43 for ; Fri, 13 Mar 2009 13:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=8jS54kiWI37nrKFMwgTW/I3pzvrPUDyLMQl82RRs/+g=; b=d7yhj8SqAP0n88uzcQ1S327dxREkbNUsAx2JCkbhjadBwjWlzii9UtAUOf3QODAbTc HMVWfIt17vzK/Kzkg/LI1Dhj9aJaOqp+o0LUhsVRub5klL4mgYktvJdFNdkvcyEl/qR2 FWfP5ckYigwXf4KK1Rn3CzByUp3WNNSN3W3DQ= DomainKey-Signature: a=rsa-sha1; c=nofws; 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; b=J8NGgQLpYQawa7yZgZbAPPDcxo50kAPntqeRMUXsPHwd7tlRbvd6KFiVpuobO81CGw 6zs8Z9ob+WWDw99uUHilCXcnFXKp5yGL5T3bXbQAG7JXZipu4YVZMOq3s6nrIJDseZYO ITDiZesBuC3Fkm1UVs6V6/kqs3KBi6JunZaNc= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.204.50.195 with SMTP id a3mr519346bkg.94.1236975174616; Fri, 13 Mar 2009 13:12:54 -0700 (PDT) In-Reply-To: <49BA7E01.50000@FreeBSD.org> References: <200903131040.n2DAecSO061131@svn.freebsd.org> <49BA7E01.50000@FreeBSD.org> Date: Fri, 13 Mar 2009 21:12:54 +0100 X-Google-Sender-Auth: 3c605fb8560f3491 Message-ID: <9bbcef730903131312s1ecf48a6uf80424bb0a4dbfba@mail.gmail.com> From: Ivan Voras To: =?UTF-8?B?R8OhYm9yIEvDtnZlc2TDoW4=?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Sean C. Farley" Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 20:12:58 -0000 2009/3/13 G=C3=A1bor K=C3=B6vesd=C3=A1n : > >> Nice! =C2=A0I need to find some time to learn how to use NLS. >> >> Now, you only need to revive the BSD-licensed libiconv[1]. =C2=A0:) =C2= =A0I am >> kidding; =C2=A0I do not want to start adding more stuff to your plate. = =C2=A0Thank you >> for strengthening FreeBSD's i18n support. >> >> Out of curiosity, how does enabling NLS in libc interact with the >> devel/gettext port? > > Well, it's not a bad idea, actually I'm thinking of generating some more > catalogs automatically but the problem is that we don't have iconv in the > base system. For example, we could easily make a hu_HU.UTF-8 catalog from > hu_HU.ISO8859-2 by just converting the encoding of the catalog file. And = the > same applies to a bunch of locales... This only glances the original topic, but Konrad (konrad@, konrad.jankowski@bluemedia.pl) was doing UTF-8 collation support and it appears that the project is very close to completion but for a few months now Konrad is busy with RL stuff and has postponed it. Maybe you could benefit from his work and also bring it in? From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 20:28:25 2009 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 ECA6810656C2; Fri, 13 Mar 2009 20:28:25 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 8AF2E8FC14; Fri, 13 Mar 2009 20:28:25 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 4176914D87B4; Fri, 13 Mar 2009 21:28:23 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id O0NvIRqYkPLR; Fri, 13 Mar 2009 21:28:22 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id B68BA14D87B2; Fri, 13 Mar 2009 21:28:21 +0100 (CET) Message-ID: <49BAC1E3.10203@FreeBSD.org> Date: Fri, 13 Mar 2009 21:28:19 +0100 From: =?UTF-8?B?R8OhYm9yIEvDtnZlc2TDoW4=?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Ivan Voras References: <200903131040.n2DAecSO061131@svn.freebsd.org> <49BA7E01.50000@FreeBSD.org> <9bbcef730903131312s1ecf48a6uf80424bb0a4dbfba@mail.gmail.com> In-Reply-To: <9bbcef730903131312s1ecf48a6uf80424bb0a4dbfba@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Sean C. Farley" Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 20:28:27 -0000 Ivan Voras escribiĂł: > 2009/3/13 GĂĄbor KĂśvesdĂĄn : > >>> Nice! I need to find some time to learn how to use NLS. >>> >>> Now, you only need to revive the BSD-licensed libiconv[1]. :) I am >>> kidding; I do not want to start adding more stuff to your plate. Thank you >>> for strengthening FreeBSD's i18n support. >>> >>> Out of curiosity, how does enabling NLS in libc interact with the >>> devel/gettext port? >>> >> Well, it's not a bad idea, actually I'm thinking of generating some more >> catalogs automatically but the problem is that we don't have iconv in the >> base system. For example, we could easily make a hu_HU.UTF-8 catalog from >> hu_HU.ISO8859-2 by just converting the encoding of the catalog file. And the >> same applies to a bunch of locales... >> > > This only glances the original topic, but Konrad (konrad@, > konrad.jankowski@bluemedia.pl) was doing UTF-8 collation support and > it appears that the project is very close to completion but for a few > months now Konrad is busy with RL stuff and has postponed it. Maybe > you could benefit from his work and also bring it in? > I can gladly review it but I'm not more competent in this area than Konrad, actually I'm not even a src committer, so my review won't be sufficient... -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 21:02:03 2009 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 7AF9A106564A; Fri, 13 Mar 2009 21:02:03 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from sakura.ninth-nine.com (unknown [IPv6:2001:2f0:104:80a0:230:48ff:fe41:2455]) by mx1.freebsd.org (Postfix) with ESMTP id 186418FC16; Fri, 13 Mar 2009 21:02:02 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from nadesico.ninth-nine.com (nadesico.ninth-nine.com [219.127.74.122]) by sakura.ninth-nine.com (8.14.1/8.14.1/NinthNine) with SMTP id n2DL21av022157; Sat, 14 Mar 2009 06:02:01 +0900 (JST) (envelope-from nork@FreeBSD.org) Date: Sat, 14 Mar 2009 06:01:59 +0900 From: Norikatsu Shigemura To: "Sean C. Farley" Message-Id: <20090314060159.c508619b.nork@FreeBSD.org> In-Reply-To: References: <200903131040.n2DAecSO061131@svn.freebsd.org> <20090313182216.GA8844@zim.MIT.EDU> X-Mailer: Sylpheed 2.6.0 (GTK+ 2.14.7; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (sakura.ninth-nine.com [219.127.74.121]); Sat, 14 Mar 2009 06:02:01 +0900 (JST) Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Norikatsu Shigemura , Gabor Kovesdan , svn-src-head@FreeBSD.org, David Schultz Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 21:02:04 -0000 Hi Sean! On Fri, 13 Mar 2009 13:36:07 -0500 (CDT) "Sean C. Farley" wrote: > functionality, however, the Citrus website is ambiguous about the > license. Really? > ambigous Citrus is licensed under BSD License or variant (like Perl or MIT). It can use with (L)GPL. WWW: http://citrus.bsdclub.org/ From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 21:12:02 2009 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 5024F106564A; Fri, 13 Mar 2009 21:12:02 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id EA48D8FC0C; Fri, 13 Mar 2009 21:12:01 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id n2DLC0YC030130; Fri, 13 Mar 2009 16:12:00 -0500 (CDT) (envelope-from scf@FreeBSD.org) Date: Fri, 13 Mar 2009 16:12:00 -0500 (CDT) From: "Sean C. Farley" To: Norikatsu Shigemura In-Reply-To: <20090314060159.c508619b.nork@FreeBSD.org> Message-ID: References: <200903131040.n2DAecSO061131@svn.freebsd.org> <20090313182216.GA8844@zim.MIT.EDU> <20090314060159.c508619b.nork@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, David Schultz , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Gabor Kovesdan Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 21:12:02 -0000 On Sat, 14 Mar 2009, Norikatsu Shigemura wrote: > Hi Sean! Hi Norikatsu, > On Fri, 13 Mar 2009 13:36:07 -0500 (CDT) > "Sean C. Farley" wrote: >> functionality, however, the Citrus website is ambiguous about the >> license. > > Really? > ambigous > Citrus is licensed under BSD License or variant (like > Perl or MIT). It can use with (L)GPL. > > WWW: http://citrus.bsdclub.org/ OK. Technically, the website is not ambiguous. It is the license that is ambiguous. :) At least, they claim it is: The license is still ambiguous at this point, but it will be either a BSD Style License or use perl's model. In addition, "the license must allow for BSD/MIT/(L)GPL uses of the code". This allows the possibility that it will be picked up by X or glib. However, it is only a "possibility". To be honest, so far there is not schedule to do port to glibc strictly. The X Consortium may be interested in iconv for its X-TT or Unicode support. A person offering code for this project must agree to it being distributed with this license condition. In addition, copyright of this project is added to the source code. Of course the original copyright is left in place as well. Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 21:22:34 2009 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 093511065674; Fri, 13 Mar 2009 21:22:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 9D4588FC1B; Fri, 13 Mar 2009 21:22:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LiEps-000E0Q-58; Fri, 13 Mar 2009 23:22:32 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n2DLMTig037377 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Mar 2009 23:22:29 +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.3/8.14.3) with ESMTP id n2DLMTN7014353; Fri, 13 Mar 2009 23:22:29 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n2DLMTHn014352; Fri, 13 Mar 2009 23:22:29 +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: Fri, 13 Mar 2009 23:22:29 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20090313212229.GW41617@deviant.kiev.zoral.com.ua> References: <200812181158.mBIBwC50039690@svn.freebsd.org> <49BAA2C6.2000807@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2UfnThGAjlIhdWh/" Content-Disposition: inline In-Reply-To: <49BAA2C6.2000807@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 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 X-Virus-Scanned: mail.terabit.net.ua 1LiEps-000E0Q-58 b8427aac06b2da6619ebe8da2d82be47 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r186276 - 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: Fri, 13 Mar 2009 21:22:35 -0000 --2UfnThGAjlIhdWh/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 13, 2009 at 02:15:34PM -0400, John Baldwin wrote: > Konstantin Belousov wrote: > >Author: kib > >Date: Thu Dec 18 11:58:12 2008 > >New Revision: 186276 > >URL: http://svn.freebsd.org/changeset/base/186276 > > > >Log: > > Do not return success and doomed vnode from lookup. LK_UPGRADE allows > > the vnode to be reclaimed. > > =20 > > Tested by: pho > > MFC after: 1 month >=20 > Would EBADF be more appropriate? That is what other places that check=20 > VI_DOOMED return for this type of check (e.g. in cache_lookup()). I do not think so. When we do namei lookup, there is actually no file descriptor to be invalid. The fact the we lost the race with forced unmount actually means that there is no more node with supplied name. --2UfnThGAjlIhdWh/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm6zpQACgkQC3+MBN1Mb4hx2ACgj4wTci0VmNugCYOeh1gBMCza M3IAoNDpUMKztX5lFK8cZm2g9Rv8MxnA =qyS1 -----END PGP SIGNATURE----- --2UfnThGAjlIhdWh/-- From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 21:59:12 2009 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 A9CA4106566B; Fri, 13 Mar 2009 21:59:12 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from sakura.ninth-nine.com (unknown [IPv6:2001:2f0:104:80a0:230:48ff:fe41:2455]) by mx1.freebsd.org (Postfix) with ESMTP id 434128FC19; Fri, 13 Mar 2009 21:59:12 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from nadesico.ninth-nine.com (nadesico.ninth-nine.com [219.127.74.122]) by sakura.ninth-nine.com (8.14.1/8.14.1/NinthNine) with SMTP id n2DLxBJE023540; Sat, 14 Mar 2009 06:59:11 +0900 (JST) (envelope-from nork@FreeBSD.org) Date: Sat, 14 Mar 2009 06:59:09 +0900 From: Norikatsu Shigemura To: "Sean C. Farley" Message-Id: <20090314065909.85bd441f.nork@FreeBSD.org> In-Reply-To: References: <200903131040.n2DAecSO061131@svn.freebsd.org> <20090313182216.GA8844@zim.MIT.EDU> <20090314060159.c508619b.nork@FreeBSD.org> X-Mailer: Sylpheed 2.6.0 (GTK+ 2.14.7; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (sakura.ninth-nine.com [219.127.74.121]); Sat, 14 Mar 2009 06:59:11 +0900 (JST) Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, nork@FreeBSD.org, Gabor Kovesdan , svn-src-head@FreeBSD.org, David Schultz Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 21:59:13 -0000 Hi Sean! On Fri, 13 Mar 2009 16:12:00 -0500 (CDT) "Sean C. Farley" wrote: > >> functionality, however, the Citrus website is ambiguous about the > >> license. > > Really? > ambigous > > Citrus is licensed under BSD License or variant (like > > Perl or MIT). It can use with (L)GPL. > > WWW: http://citrus.bsdclub.org/ > OK. Technically, the website is not ambiguous. It is the license that > is ambiguous. :) At least, they claim it is: Ah, OK. They, Citrus developers, consider that it is licensed under BSD License on *BSD, at least. In fact, on NetBSD/OpenBSD, it is licensed under BSD License, and we can use it under BSD License. But it may be used on other environment like X. So it is licensed under dual(multiple?) license. From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 22:15:38 2009 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 72F35106566B; Fri, 13 Mar 2009 22:15:38 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net [IPv6:2001:470:1f03:2c9::2]) by mx1.freebsd.org (Postfix) with ESMTP id 048B88FC0A; Fri, 13 Mar 2009 22:15:38 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.delphij.net (Postfix) with ESMTPS id 90C4E28448; Sat, 14 Mar 2009 06:15:36 +0800 (CST) Received: from localhost (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 178CAEC534D; Sat, 14 Mar 2009 06:15:36 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with ESMTP id Gq0MfW5KNmzS; Sat, 14 Mar 2009 06:15:30 +0800 (CST) Received: from charlie.delphij.net (adsl-76-237-33-62.dsl.pltn13.sbcglobal.net [76.237.33.62]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id C5DF9EC50A3; Sat, 14 Mar 2009 06:15:26 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=CT/1BwysXng7ZF650gPHU3EuoH4C7OnY9NWiSj39BXqkKq9WfHg1PQunMIHSZCI8E cUmFmvsTzgqDBmP+KYH8A== Message-ID: <49BADAFB.4070009@delphij.net> Date: Fri, 13 Mar 2009 15:15:23 -0700 From: Xin LI Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.19 (X11/20090217) MIME-Version: 1.0 To: "Sean C. Farley" References: <200903131040.n2DAecSO061131@svn.freebsd.org> <20090313182216.GA8844@zim.MIT.EDU> <20090314060159.c508619b.nork@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 0.95.7 OpenPGP: id=18EDEBA0; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, Norikatsu Shigemura , Gabor Kovesdan , svn-src-head@FreeBSD.ORG, David Schultz Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net 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 Mar 2009 22:15:39 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Sean C. Farley wrote: > On Sat, 14 Mar 2009, Norikatsu Shigemura wrote: > >> Hi Sean! > > Hi Norikatsu, > >> On Fri, 13 Mar 2009 13:36:07 -0500 (CDT) >> "Sean C. Farley" wrote: >>> functionality, however, the Citrus website is ambiguous about the >>> license. >> >> Really? > ambigous >> Citrus is licensed under BSD License or variant (like >> Perl or MIT). It can use with (L)GPL. >> >> WWW: http://citrus.bsdclub.org/ > > OK. Technically, the website is not ambiguous. It is the license that > is ambiguous. :) At least, they claim it is: > > The license is still ambiguous at this point, but it will be either > a BSD Style License or use perl's model. In addition, "the license > must allow for BSD/MIT/(L)GPL uses of the code". This allows the > possibility that it will be picked up by X or glib. However, it is > only a "possibility". To be honest, so far there is not schedule to > do port to glibc strictly. The X Consortium may be interested in > iconv for its X-TT or Unicode support. > > A person offering code for this project must agree to it being > distributed with this license condition. In addition, copyright of > this project is added to the source code. Of course the original > copyright is left in place as well. IANAL but the code already included in NetBSD says. for example: /*- * Copyright (c)2008 Citrus Project, * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ So my understanding is that, at least these code are released under a 2-clause BSD code and we are supposed to be able to use these code under such license? Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkm62voACgkQi+vbBBjt66C7uwCfdQoe2ZaTVN+pvrw6KfAJCfYg +9gAoJKkQgBvIoMf3TsPaL8+fzeq7hIc =sJKd -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 22:18:06 2009 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 BAB791065673 for ; Fri, 13 Mar 2009 22:18:06 +0000 (UTC) (envelope-from cokane@FreeBSD.org) Received: from mail-out2.fuse.net (mail-out2.fuse.net [216.68.8.171]) by mx1.freebsd.org (Postfix) with ESMTP id 5FC6B8FC19 for ; Fri, 13 Mar 2009 22:18:06 +0000 (UTC) (envelope-from cokane@FreeBSD.org) X-CNFS-Analysis: v=1.0 c=1 a=tWP6490OWosA:10 a=eKl7Qre8x-wA:10 a=6I5d2MoRAAAA:8 a=ugNII8IMAAAA:8 a=aR16PxjQAAAA:8 a=Ly_9pwcYby5loY-0g1wA:9 a=XO7M7BvHDVnMgIUEV9oA:7 a=TCvKZNr5yEohLm81yS-D0oHwX7kA:4 a=LY0hPdMaydYA:10 a=CiSHi91Bn78A:10 a=SV7veod9ZcQA:10 a=Ak_2QjFDng1v8fqXdFYA:9 a=eYYLwG3FvUKuhm8MB_Y9AeQNe30A:4 a=rPt6xJ-oxjAA:10 X-CM-Score: 0 X-Scanned-by: Cloudmark Authority Engine Authentication-Results: gwout2 smtp.mail=cokane@FreeBSD.org; spf=softfail Received-SPF: softfail (gwout2: transitional domain FreeBSD.org does not designate 74.215.227.9 as permitted sender) Received: from [74.215.227.9] ([74.215.227.9:50350] helo=discordia) by gwout2 (envelope-from ) (ecelerity 2.2.2.37 r(28805/28810M)) with ESMTP id 99/9F-25989-C9BDAB94; Fri, 13 Mar 2009 18:18:05 -0400 Received: by discordia (Postfix, from userid 103) id 010B235A7D8; Fri, 13 Mar 2009 18:18:04 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.1.8-gr1 (2007-02-13) on discordia X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.8-gr1 Received: from [172.31.1.6] (unknown [172.31.1.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by discordia (Postfix) with ESMTP id 5F92235A7D7; Fri, 13 Mar 2009 18:17:57 -0400 (EDT) From: Coleman Kane To: Norikatsu Shigemura In-Reply-To: <20090314065909.85bd441f.nork@FreeBSD.org> References: <200903131040.n2DAecSO061131@svn.freebsd.org> <20090313182216.GA8844@zim.MIT.EDU> <20090314060159.c508619b.nork@FreeBSD.org> <20090314065909.85bd441f.nork@FreeBSD.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-0p7teHYUeVi8jwudFyM0" Organization: FreeBSD Project Date: Fri, 13 Mar 2009 18:16:39 -0400 Message-Id: <1236982599.4575.31.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Gabor Kovesdan , svn-src-head@FreeBSD.org, David Schultz , "Sean C. Farley" Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 22:18:07 -0000 --=-0p7teHYUeVi8jwudFyM0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sat, 2009-03-14 at 06:59 +0900, Norikatsu Shigemura wrote: > Hi Sean! >=20 > On Fri, 13 Mar 2009 16:12:00 -0500 (CDT) > "Sean C. Farley" wrote: > > >> functionality, however, the Citrus website is ambiguous about the > > >> license. > > > Really? > ambigous > > > Citrus is licensed under BSD License or variant (like > > > Perl or MIT). It can use with (L)GPL. > > > WWW: http://citrus.bsdclub.org/ > > OK. Technically, the website is not ambiguous. It is the license that= =20 > > is ambiguous. :) At least, they claim it is: >=20 > Ah, OK. They, Citrus developers, consider that it is licensed > under BSD License on *BSD, at least. In fact, on NetBSD/OpenBSD, > it is licensed under BSD License, and we can use it under BSD > License. >=20 > But it may be used on other environment like X. So it is licensed > under dual(multiple?) license. >=20 I thought that X.org was MIT/X11 licensed (which was very very similar to BSD). --=20 Coleman Kane --=-0p7teHYUeVi8jwudFyM0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkm620MACgkQcMSxQcXat5cJBwCfUgg1TJTF4Fc1E9Bl8R4tJ4v2 PPkAn390C9rJvL/O0Fgm5lXk2CI0IkPy =uL1w -----END PGP SIGNATURE----- --=-0p7teHYUeVi8jwudFyM0-- From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 22:28:37 2009 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 AA5291065673; Fri, 13 Mar 2009 22:28:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 995918FC16; Fri, 13 Mar 2009 22:28:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DMSbSP074753; Fri, 13 Mar 2009 22:28:37 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DMSb8J074752; Fri, 13 Mar 2009 22:28:37 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903132228.n2DMSb8J074752@svn.freebsd.org> From: Andrew Thompson Date: Fri, 13 Mar 2009 22:28: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: r189776 - 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 Mar 2009 22:28:38 -0000 Author: thompsa Date: Fri Mar 13 22:28:37 2009 New Revision: 189776 URL: http://svn.freebsd.org/changeset/base/189776 Log: HID usage minimum can be equal to the maximum. Submitted by: Hans Petter Selasky Tested by: Andreas Tobler Modified: head/sys/dev/usb/usb_hid.c Modified: head/sys/dev/usb/usb_hid.c ============================================================================== --- head/sys/dev/usb/usb_hid.c Fri Mar 13 19:05:34 2009 (r189775) +++ head/sys/dev/usb/usb_hid.c Fri Mar 13 22:28:37 2009 (r189776) @@ -441,7 +441,7 @@ hid_get_item(struct hid_data *s, struct /* sanity check */ if ((s->nusage < MAXUSAGE) && - (c->usage_minimum < c->usage_maximum)) { + (c->usage_minimum <= c->usage_maximum)) { /* add usage range */ s->usages_min[s->nusage] = c->usage_minimum; From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 22:41:30 2009 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 AE6131065716; Fri, 13 Mar 2009 22:41:30 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D6A38FC20; Fri, 13 Mar 2009 22:41:30 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DMfUbm075095; Fri, 13 Mar 2009 22:41:30 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DMfUax075094; Fri, 13 Mar 2009 22:41:30 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200903132241.n2DMfUax075094@svn.freebsd.org> From: Gabor Kovesdan Date: Fri, 13 Mar 2009 22:41: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: r189777 - head/lib/libc/nls 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 Mar 2009 22:41:31 -0000 Author: gabor (doc,ports committer) Date: Fri Mar 13 22:41:30 2009 New Revision: 189777 URL: http://svn.freebsd.org/changeset/base/189777 Log: - Fix object directory creation when running threaded buildworld Modified: head/lib/libc/nls/Makefile.inc Modified: head/lib/libc/nls/Makefile.inc ============================================================================== --- head/lib/libc/nls/Makefile.inc Fri Mar 13 22:28:37 2009 (r189776) +++ head/lib/libc/nls/Makefile.inc Fri Mar 13 22:41:30 2009 (r189777) @@ -31,7 +31,7 @@ NLS+= ru_RU.KOI8-R NLS+= sk_SK.ISO8859-2 NLS+= sv_SE.ISO8859-1 -beforeinstall: +.BEGIN: .for c in ${NLS} mkdir -p ${CANONICALOBJDIR}/../../lib32/usr/share/nls/${c} mkdir -p ${CANONICALOBJDIR}/../../tmp/usr/share/nls/${c} From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 22:43:47 2009 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 0BDE21065737; Fri, 13 Mar 2009 22:43:47 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id A350F8FC14; Fri, 13 Mar 2009 22:43:46 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id n2DMhjZI031594; Fri, 13 Mar 2009 17:43:45 -0500 (CDT) (envelope-from scf@FreeBSD.org) Date: Fri, 13 Mar 2009 17:43:45 -0500 (CDT) From: "Sean C. Farley" To: d@delphij.net In-Reply-To: <49BADAFB.4070009@delphij.net> Message-ID: References: <200903131040.n2DAecSO061131@svn.freebsd.org> <20090313182216.GA8844@zim.MIT.EDU> <20090314060159.c508619b.nork@FreeBSD.org> <49BADAFB.4070009@delphij.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Norikatsu Shigemura , Gabor Kovesdan , svn-src-head@FreeBSD.org, David Schultz Subject: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls 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 Mar 2009 22:43:48 -0000 On Fri, 13 Mar 2009, Xin LI wrote: > Sean C. Farley wrote: >> On Sat, 14 Mar 2009, Norikatsu Shigemura wrote: >>> On Fri, 13 Mar 2009 13:36:07 -0500 (CDT) "Sean C. Farley" wrote: >>>> functionality, however, the Citrus website is ambiguous about the >>>> license. >>> >>> Really? > ambigous >>> Citrus is licensed under BSD License or variant (like >>> Perl or MIT). It can use with (L)GPL. >>> >>> WWW: http://citrus.bsdclub.org/ >> >> OK. Technically, the website is not ambiguous. It is the license >> that is ambiguous. :) At least, they claim it is: >> >> The license is still ambiguous at this point, but it will be either >> a BSD Style License or use perl's model. In addition, "the license >> must allow for BSD/MIT/(L)GPL uses of the code". This allows the >> possibility that it will be picked up by X or glib. However, it is >> only a "possibility". To be honest, so far there is not schedule to >> do port to glibc strictly. The X Consortium may be interested in >> iconv for its X-TT or Unicode support. >> >> A person offering code for this project must agree to it being >> distributed with this license condition. In addition, copyright of >> this project is added to the source code. Of course the original >> copyright is left in place as well. > > IANAL but the code already included in NetBSD says. for example: *snip BSD license* > So my understanding is that, at least these code are released under a > 2-clause BSD code and we are supposed to be able to use these code > under such license? If that is the case, then that is great. I was only going by what the website said about the source. Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Fri Mar 13 23:42:34 2009 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 ECF2A106566B; Fri, 13 Mar 2009 23:42:34 +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 DC3308FC17; Fri, 13 Mar 2009 23:42:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DNgYNi076215; Fri, 13 Mar 2009 23:42:34 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DNgYFZ076214; Fri, 13 Mar 2009 23:42:34 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903132342.n2DNgYFZ076214@svn.freebsd.org> From: Robert Watson Date: Fri, 13 Mar 2009 23:42: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: r189778 - 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: Fri, 13 Mar 2009 23:42:35 -0000 Author: rwatson Date: Fri Mar 13 23:42:34 2009 New Revision: 189778 URL: http://svn.freebsd.org/changeset/base/189778 Log: Don't suggest mounting procfs in diskless configurations. MFC after: 3 days Modified: head/share/man/man8/diskless.8 Modified: head/share/man/man8/diskless.8 ============================================================================== --- head/share/man/man8/diskless.8 Fri Mar 13 22:41:30 2009 (r189777) +++ head/share/man/man8/diskless.8 Fri Mar 13 23:42:34 2009 (r189778) @@ -376,7 +376,6 @@ As a minimum, you normally need to have .Bd -literal -offset indent : / nfs ro 0 0 :/usr /usr nfs ro 0 0 -proc /proc procfs rw 0 0 .Ed .Pp You also need to create a customized version of From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 01:52:52 2009 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 85768106570F; Sat, 14 Mar 2009 01:52:52 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 268798FC0A; Sat, 14 Mar 2009 01:52:52 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 5094B14D87B1; Sat, 14 Mar 2009 02:52:51 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2uffIx0cuDlQ; Sat, 14 Mar 2009 02:52:50 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 85F9214D877A; Sat, 14 Mar 2009 02:52:50 +0100 (CET) Message-ID: <49BB0DF0.3020907@FreeBSD.org> Date: Sat, 14 Mar 2009 02:52:48 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Robert Watson References: <200903131040.n2DAecSO061131@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: Gabor Pali , doc@FreeBSD.org, Tom Rhodes , Giorgos Keramidas , Manolis Kiagias , svn-src-head@freebsd.org, "Sean C. Farley" Subject: NLS additions to I18N chapter of developers-handbook [Was: Re: svn commit: r189765 - in head: . lib/libc lib/libc/nls] 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 Mar 2009 01:52:53 -0000 Robert Watson escribió: > > On Fri, 13 Mar 2009, Gabor Kovesdan wrote: > >> - Reenable Native Language Support in libc. This feature was >> disabled due >> to possible breakages in the catalog handling code. Since then, that >> code has been replaced by the secure code from NetBSD but NLS in libc >> remained turned off. Tests have shown that the feature is stable and >> working so we can now turn it on again. > > Do we have a nice tutorialish document somewhere on what people > writing new command line tools or libraries should do in order to > address localization requirements, or at least, make it easier for > other people to do so? I'm afraid I, at least, live in a world > without catalogues, but a quick and practical guide to what The Right > Thing Is for FreeBSD would make it much easier for me to do something > a bit more mature. > I've spent some time on writing a short section on this trying to do this from a practical viewpoint. Please take a look ant tell me what do you think: http://kovesdan.org/files/developers-handbook/posix-nls.html A patch can be found here: http://kovesdan.org/patches/nls-doc.diff (doc@ and some probable reviewers added to CC) -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 02:31:49 2009 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 3E664106566C; Sat, 14 Mar 2009 02:31:49 +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 2CF538FC18; Sat, 14 Mar 2009 02:31:49 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2E2VnWZ079336; Sat, 14 Mar 2009 02:31:49 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2E2VnPw079335; Sat, 14 Mar 2009 02:31:49 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903140231.n2E2VnPw079335@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 02:31:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189782 - 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: Sat, 14 Mar 2009 02:31:50 -0000 Author: das Date: Sat Mar 14 02:31:48 2009 New Revision: 189782 URL: http://svn.freebsd.org/changeset/base/189782 Log: r189349 removed mktemp() from the XSI namespace when __XOPEN_SOURCE >= 700, since mktemp() was withdrawn from the standard. However, __XSI_VISIBLE is set to 700 in the default BSD envrionment, where mktemp() should still exist; hence, check for this. Modified: head/include/stdlib.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Sat Mar 14 01:12:35 2009 (r189781) +++ head/include/stdlib.h Sat Mar 14 02:31:48 2009 (r189782) @@ -196,7 +196,7 @@ long jrand48(unsigned short[3]); char *l64a(long); void lcong48(unsigned short[7]); long lrand48(void); -#if !defined(_MKTEMP_DECLARED) && __XSI_VISIBLE <= 600 +#if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600) char *mktemp(char *); #define _MKTEMP_DECLARED #endif From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 02:34:26 2009 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 856AD106566B; Sat, 14 Mar 2009 02:34:26 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 2A46E8FC18; Sat, 14 Mar 2009 02:34:26 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n2E2Yetx036968; Fri, 13 Mar 2009 22:34:40 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n2E2YeiC036967; Fri, 13 Mar 2009 22:34:40 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Fri, 13 Mar 2009 22:34:40 -0400 From: David Schultz To: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20090314023440.GA36951@zim.MIT.EDU> Mail-Followup-To: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200903140231.n2E2VnPw079335@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200903140231.n2E2VnPw079335@svn.freebsd.org> Cc: Subject: Re: svn commit: r189782 - 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: Sat, 14 Mar 2009 02:34:27 -0000 On Sat, Mar 14, 2009, David Schultz wrote: > Author: das > Date: Sat Mar 14 02:31:48 2009 > New Revision: 189782 > URL: http://svn.freebsd.org/changeset/base/189782 > > Log: > r189349 removed mktemp() from the XSI namespace when > __XOPEN_SOURCE >= 700, since mktemp() was withdrawn > from the standard. However, __XSI_VISIBLE is set to > 700 in the default BSD envrionment, where mktemp() > should still exist; hence, check for this. Forgot to mention... Reported by: rdivacky From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 05:33:10 2009 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 02C36106564A; Sat, 14 Mar 2009 05:33:10 +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 E5F278FC21; Sat, 14 Mar 2009 05:33:09 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2E5X9fM083027; Sat, 14 Mar 2009 05:33:09 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2E5X9mK083026; Sat, 14 Mar 2009 05:33:09 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200903140533.n2E5X9mK083026@svn.freebsd.org> From: Alan Cox Date: Sat, 14 Mar 2009 05:33: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: r189783 - head/sys/amd64/amd64 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 Mar 2009 05:33:10 -0000 Author: alc Date: Sat Mar 14 05:33:09 2009 New Revision: 189783 URL: http://svn.freebsd.org/changeset/base/189783 Log: Correct accounting errors in _pmap_allocpte(). Specifically, the pmap's resident page count and the global wired page count were not correctly maintained when page table page allocation failed. MFC after: 6 weeks Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Mar 14 02:31:48 2009 (r189782) +++ head/sys/amd64/amd64/pmap.c Sat Mar 14 05:33:09 2009 (r189783) @@ -1442,8 +1442,6 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t * it isn't already there. */ - pmap->pm_stats.resident_count++; - if (ptepindex >= (NUPDE + NUPDPE)) { pml4_entry_t *pml4; vm_pindex_t pml4index; @@ -1469,7 +1467,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t if (_pmap_allocpte(pmap, NUPDE + NUPDPE + pml4index, flags) == NULL) { --m->wire_count; - vm_page_free(m); + atomic_subtract_int(&cnt.v_wire_count, 1); + vm_page_free_zero(m); return (NULL); } } else { @@ -1501,7 +1500,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t if (_pmap_allocpte(pmap, NUPDE + pdpindex, flags) == NULL) { --m->wire_count; - vm_page_free(m); + atomic_subtract_int(&cnt.v_wire_count, 1); + vm_page_free_zero(m); return (NULL); } pdp = (pdp_entry_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME); @@ -1514,7 +1514,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t if (_pmap_allocpte(pmap, NUPDE + pdpindex, flags) == NULL) { --m->wire_count; - vm_page_free(m); + atomic_subtract_int(&cnt.v_wire_count, + 1); + vm_page_free_zero(m); return (NULL); } } else { @@ -1530,6 +1532,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t *pd = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M; } + pmap->pm_stats.resident_count++; + return m; } From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 05:52:44 2009 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 106DF106564A; Sat, 14 Mar 2009 05:52:44 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id DBB748FC0A; Sat, 14 Mar 2009 05:52:43 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 581FD2C2A8E; Sat, 14 Mar 2009 00:52:43 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id OJ8W1mpUlHba; Sat, 14 Mar 2009 00:52:35 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 58A3E2C2A91; Sat, 14 Mar 2009 00:52:35 -0500 (CDT) Message-ID: <49BB4622.2010108@cs.rice.edu> Date: Sat, 14 Mar 2009 00:52:34 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.19 (X11/20090124) MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <200903140533.n2E5X9mK083026@svn.freebsd.org> In-Reply-To: <200903140533.n2E5X9mK083026@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Alan Cox Subject: Re: svn commit: r189783 - head/sys/amd64/amd64 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 Mar 2009 05:52:44 -0000 Alan Cox wrote: > Author: alc > Date: Sat Mar 14 05:33:09 2009 > New Revision: 189783 > URL: http://svn.freebsd.org/changeset/base/189783 > > Log: > Correct accounting errors in _pmap_allocpte(). Specifically, the pmap's > resident page count and the global wired page count were not correctly > maintained when page table page allocation failed. > > MFC after: 6 weeks > I should have also said: Reviewed by: kib Tested by: pho From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 05:58:38 2009 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 54FCC106566B; Sat, 14 Mar 2009 05:58:38 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id E556C8FC0C; Sat, 14 Mar 2009 05:58:37 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id D55921CE0D; Sat, 14 Mar 2009 06:58:36 +0100 (CET) Date: Sat, 14 Mar 2009 06:58:36 +0100 From: Ed Schouten To: Gabor Kovesdan Message-ID: <20090314055836.GV31961@hoeg.nl> References: <200903132241.n2DMfUax075094@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uNvczuo8OWfsyO2w" Content-Disposition: inline In-Reply-To: <200903132241.n2DMfUax075094@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 05:58:38 -0000 --uNvczuo8OWfsyO2w Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Gabor Kovesdan wrote: > - Fix object directory creation when running threaded buildworld Isn't this normally done by the mtrees? --=20 Ed Schouten WWW: http://80386.nl/ --uNvczuo8OWfsyO2w Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm7R4wACgkQ52SDGA2eCwX5oQCfRRJCuYkoBgGguSac/BMKt2AO SOoAni3wJUAxeKSw4OjNYI4EhNiEtzSk =hvXB -----END PGP SIGNATURE----- --uNvczuo8OWfsyO2w-- From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 08:28:03 2009 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 0F49E1065672; Sat, 14 Mar 2009 08:28:03 +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 F153B8FC0C; Sat, 14 Mar 2009 08:28:02 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2E8S2q2086228; Sat, 14 Mar 2009 08:28:02 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2E8S270086227; Sat, 14 Mar 2009 08:28:02 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200903140828.n2E8S270086227@svn.freebsd.org> From: Alan Cox Date: Sat, 14 Mar 2009 08:28: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: r189785 - head/sys/amd64/amd64 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 Mar 2009 08:28:03 -0000 Author: alc Date: Sat Mar 14 08:28:02 2009 New Revision: 189785 URL: http://svn.freebsd.org/changeset/base/189785 Log: Update the pmap's resident page count when a page table page is freed in pmap_remove_pde() and pmap_remove_pages(). MFC after: 6 weeks Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Mar 14 06:48:50 2009 (r189784) +++ head/sys/amd64/amd64/pmap.c Sat Mar 14 08:28:02 2009 (r189785) @@ -2342,6 +2342,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t mpte = pmap_lookup_pt_page(pmap, sva); if (mpte != NULL) { pmap_remove_pt_page(pmap, mpte); + pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pde: pte page wire count error")); mpte->wire_count = 0; @@ -3851,6 +3852,7 @@ pmap_remove_pages(pmap_t pmap) mpte = pmap_lookup_pt_page(pmap, pv->pv_va); if (mpte != NULL) { pmap_remove_pt_page(pmap, mpte); + pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pages: pte page wire count error")); mpte->wire_count = 0; From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 10:56:57 2009 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 DE0F71065677; Sat, 14 Mar 2009 10:56:57 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 73C798FC18; Sat, 14 Mar 2009 10:56:57 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 61E341CE0D; Sat, 14 Mar 2009 11:56:56 +0100 (CET) Date: Sat, 14 Mar 2009 11:56:56 +0100 From: Ed Schouten To: Gabor Kovesdan Message-ID: <20090314105656.GW31961@hoeg.nl> References: <200903132241.n2DMfUax075094@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HtRZva1Vzv8iP5ye" Content-Disposition: inline In-Reply-To: <200903132241.n2DMfUax075094@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 10:56:59 -0000 --HtRZva1Vzv8iP5ye Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Gabor, * Gabor Kovesdan wrote: > mkdir -p ${CANONICALOBJDIR}/../../lib32/usr/share/nls/${c} > mkdir -p ${CANONICALOBJDIR}/../../tmp/usr/share/nls/${c} This also seems to cause directories to be created in /usr/obj/lib32 when lib32 is explicitly disabled. --=20 Ed Schouten WWW: http://80386.nl/ --HtRZva1Vzv8iP5ye Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm7jXgACgkQ52SDGA2eCwWuugCfYgogKElAhIDumKwMGjTTwVcH 3uIAn2UL1kxyj+J4ckSPqPiC4/g3sZEG =ovjm -----END PGP SIGNATURE----- --HtRZva1Vzv8iP5ye-- From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 11:41:36 2009 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 A4EA0106566B; Sat, 14 Mar 2009 11:41:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 937908FC1A; Sat, 14 Mar 2009 11:41:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EBfaoL092221; Sat, 14 Mar 2009 11:41:36 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EBfaZX092220; Sat, 14 Mar 2009 11:41:36 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200903141141.n2EBfaZX092220@svn.freebsd.org> From: Jeff Roberson Date: Sat, 14 Mar 2009 11:41: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: r189787 - 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 Mar 2009 11:41:37 -0000 Author: jeff Date: Sat Mar 14 11:41:36 2009 New Revision: 189787 URL: http://svn.freebsd.org/changeset/base/189787 Log: - Fix an error that occurs when mp_ncpu is an odd number. steal_thresh is calculated as 0 which causes errors elsewhere. Submitted by: KOIE Hidetaka - When sched_affinity() is called with a thread that is not curthread we need to handle the ON_RUNQ() case by adding the thread to the correct run queue. Submitted by: Justin Teller MFC after: 1 Week Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Sat Mar 14 08:34:45 2009 (r189786) +++ head/sys/kern/sched_ule.c Sat Mar 14 11:41:36 2009 (r189787) @@ -1337,11 +1337,11 @@ sched_initticks(void *dummy) */ balance_interval = realstathz; /* - * Set steal thresh to log2(mp_ncpu) but no greater than 4. This - * prevents excess thrashing on large machines and excess idle on - * smaller machines. + * Set steal thresh to roughly log2(mp_ncpu) but no greater than 4. + * This prevents excess thrashing on large machines and excess idle + * on smaller machines. */ - steal_thresh = min(ffs(mp_ncpus) - 1, 3); + steal_thresh = min(fls(mp_ncpus) - 1, 3); affinity = SCHED_AFFINITY_DEFAULT; #endif } @@ -2417,6 +2417,11 @@ sched_affinity(struct thread *td) ts = td->td_sched; if (THREAD_CAN_SCHED(td, ts->ts_cpu)) return; + if (TD_ON_RUNQ(td)) { + sched_rem(td); + sched_add(td, SRQ_BORING); + return; + } if (!TD_IS_RUNNING(td)) return; td->td_flags |= TDF_NEEDRESCHED; From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 11:43:02 2009 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 BFE60106566B; Sat, 14 Mar 2009 11:43:02 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE33E8FC0C; Sat, 14 Mar 2009 11:43:02 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EBh2rP092282; Sat, 14 Mar 2009 11:43:02 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EBh29M092281; Sat, 14 Mar 2009 11:43:02 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200903141143.n2EBh29M092281@svn.freebsd.org> From: Jeff Roberson Date: Sat, 14 Mar 2009 11: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: r189788 - 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 Mar 2009 11:43:03 -0000 Author: jeff Date: Sat Mar 14 11:43:02 2009 New Revision: 189788 URL: http://svn.freebsd.org/changeset/base/189788 Log: - Call lock_profile_release when we're transitioning a lock to be owned by LK_KERNPROC. Discussed with: attilio Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Sat Mar 14 11:41:36 2009 (r189787) +++ head/sys/kern/kern_lock.c Sat Mar 14 11:43:02 2009 (r189788) @@ -686,7 +686,8 @@ __lockmgr_args(struct lock *lk, u_int fl lk->lk_recurse--; break; } - lock_profile_release_lock(&lk->lock_object); + if (tid != LK_KERNPROC) + lock_profile_release_lock(&lk->lock_object); if (atomic_cmpset_rel_ptr(&lk->lk_lock, tid, LK_UNLOCKED)) @@ -874,6 +875,7 @@ _lockmgr_disown(struct lock *lk, const c */ if (LK_HOLDER(lk->lk_lock) != tid) return; + lock_profile_release_lock(&lk->lock_object); LOCK_LOG_LOCK("XDISOWN", &lk->lock_object, 0, 0, file, line); WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line); TD_LOCKS_DEC(curthread); From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 11:43:39 2009 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 E6084106568F; Sat, 14 Mar 2009 11:43:38 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D01F58FC13; Sat, 14 Mar 2009 11:43:38 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EBhcSG092326; Sat, 14 Mar 2009 11:43:38 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EBhcfE092325; Sat, 14 Mar 2009 11:43:38 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200903141143.n2EBhcfE092325@svn.freebsd.org> From: Jeff Roberson Date: Sat, 14 Mar 2009 11:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189789 - 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 Mar 2009 11:43:50 -0000 Author: jeff Date: Sat Mar 14 11:43:38 2009 New Revision: 189789 URL: http://svn.freebsd.org/changeset/base/189789 Log: - When a mutex is destroyed while locked we need to inform lock profiling that it has been released. Modified: head/sys/kern/kern_mutex.c Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Sat Mar 14 11:43:02 2009 (r189788) +++ head/sys/kern/kern_mutex.c Sat Mar 14 11:43:38 2009 (r189789) @@ -765,6 +765,7 @@ mtx_destroy(struct mtx *m) else curthread->td_locks--; + lock_profile_release_lock(&m->lock_object); /* Tell witness this isn't locked to make it happy. */ WITNESS_UNLOCK(&m->lock_object, LOP_EXCLUSIVE, __FILE__, __LINE__); From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 11:44:43 2009 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 B06241065680; Sat, 14 Mar 2009 11:44:43 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 6860B8FC19; Sat, 14 Mar 2009 11:44:43 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 8D47C14D87BA; Sat, 14 Mar 2009 12:44:41 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 8V3Mi60axYvH; Sat, 14 Mar 2009 12:44:41 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id E8F7814D87B9; Sat, 14 Mar 2009 12:44:40 +0100 (CET) Message-ID: <49BB98A1.80403@FreeBSD.org> Date: Sat, 14 Mar 2009 12:44:33 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Ed Schouten References: <200903132241.n2DMfUax075094@svn.freebsd.org> <20090314055836.GV31961@hoeg.nl> In-Reply-To: <20090314055836.GV31961@hoeg.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 11:44:44 -0000 Ed Schouten escribió: > * Gabor Kovesdan wrote: > >> - Fix object directory creation when running threaded buildworld >> > > Isn't this normally done by the mtrees? > I haven't yet found a better solution for this. I also grepped for mtree in the source tree hoping that it will point me a good solution with mtrees but it didn't. Ruslan might suggest something if he has some time to take a look. > This also seems to cause directories to be created in /usr/obj/lib32 > when lib32 is explicitly disabled. That's not a real problem, because you need to clean up those directories yourself anyway, make clean in head/ doesn't remove them. -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 13:42:14 2009 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 AF1D8106567C; Sat, 14 Mar 2009 13:42:14 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AE488FC17; Sat, 14 Mar 2009 13:42:14 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EDgEKQ094663; Sat, 14 Mar 2009 13:42:14 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EDgESI094655; Sat, 14 Mar 2009 13:42:14 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <200903141342.n2EDgESI094655@svn.freebsd.org> From: Randall Stewart Date: Sat, 14 Mar 2009 13:42: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: r189790 - 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 Mar 2009 13:42:16 -0000 Author: rrs Date: Sat Mar 14 13:42:13 2009 New Revision: 189790 URL: http://svn.freebsd.org/changeset/base/189790 Log: Fixes several PR-SCTP releated bugs. - When sending large PR-SCTP messages over a lossy link we would incorrectly calculate the fwd-tsn - When receiving large multipart pr-sctp packets we would incorrectly send back a SACK that would renege improperly on already received packets thus causing unneeded retransmissions. Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_var.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Mar 14 11:43:38 2009 (r189789) +++ head/sys/netinet/sctp.h Sat Mar 14 13:42:13 2009 (r189790) @@ -544,7 +544,7 @@ struct sctp_error_unrecognized_chunk { #define SCTP_THRESHOLD_LOGGING 0x02000000 #define SCTP_LOG_AT_SEND_2_SCTP 0x04000000 #define SCTP_LOG_AT_SEND_2_OUTQ 0x08000000 - +#define SCTP_LOG_TRY_ADVANCE 0x10000000 #undef SCTP_PACKED Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Sat Mar 14 11:43:38 2009 (r189789) +++ head/sys/netinet/sctp_constants.h Sat Mar 14 13:42:13 2009 (r189790) @@ -229,8 +229,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_THRESHOLD_CLEAR 120 #define SCTP_THRESHOLD_INCR 121 #define SCTP_FLIGHT_LOG_DWN_WP_FWD 122 - -#define SCTP_LOG_MAX_TYPES 123 +#define SCTP_FWD_TSN_CHECK 123 +#define SCTP_LOG_MAX_TYPES 124 /* * To turn on various logging, you must first enable 'options KTR' and * you might want to bump the entires 'options KTR_ENTRIES=80000'. Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Mar 14 11:43:38 2009 (r189789) +++ head/sys/netinet/sctp_indata.c Sat Mar 14 13:42:13 2009 (r189790) @@ -3680,7 +3680,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t if (tp1->data != NULL) { (void)sctp_release_pr_sctp_chunk(stcb, tp1, (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), - &asoc->sent_queue, SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED); } tp1 = TAILQ_NEXT(tp1, sctp_next); continue; @@ -3693,7 +3693,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t if (tp1->data != NULL) { (void)sctp_release_pr_sctp_chunk(stcb, tp1, (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), - &asoc->sent_queue, SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED); } tp1 = TAILQ_NEXT(tp1, sctp_next); continue; @@ -4078,6 +4078,13 @@ sctp_try_advance_peer_ack_point(struct s /* no chance to advance, out of here */ break; } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { + if (tp1->sent == SCTP_FORWARD_TSN_SKIP) { + sctp_misc_ints(SCTP_FWD_TSN_CHECK, + asoc->advanced_peer_ack_point, + tp1->rec.data.TSN_seq, 0, 0); + } + } if (!PR_SCTP_ENABLED(tp1->flags)) { /* * We can't fwd-tsn past any that are reliable aka @@ -4107,7 +4114,7 @@ sctp_try_advance_peer_ack_point(struct s if (tp1->data) { (void)sctp_release_pr_sctp_chunk(stcb, tp1, (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), - &asoc->sent_queue, SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED); } } else { /* @@ -4124,8 +4131,16 @@ sctp_try_advance_peer_ack_point(struct s */ if (tp1->sent == SCTP_FORWARD_TSN_SKIP) { /* advance PeerAckPoint goes forward */ - asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq; - a_adv = tp1; + if (compare_with_wrap(tp1->rec.data.TSN_seq, + asoc->advanced_peer_ack_point, + MAX_TSN)) { + + asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq; + a_adv = tp1; + } else if (tp1->rec.data.TSN_seq == asoc->advanced_peer_ack_point) { + /* No update but we do save the chk */ + a_adv = tp1; + } } else { /* * If it is still in RESEND we can advance no @@ -4142,14 +4157,27 @@ sctp_try_advance_peer_ack_point(struct s return (a_adv); } -static void +static int sctp_fs_audit(struct sctp_association *asoc) { struct sctp_tmit_chunk *chk; int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0; + int entry_flight, entry_cnt, ret; + + entry_flight = asoc->total_flight; + entry_cnt = asoc->total_flight_count; + ret = 0; + + if (asoc->pr_sctp_cnt >= asoc->sent_queue_cnt) + return (0); TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { if (chk->sent < SCTP_DATAGRAM_RESEND) { + printf("Chk TSN:%u size:%d inflight cnt:%d\n", + chk->rec.data.TSN_seq, + chk->send_size, + chk->snd_count + ); inflight++; } else if (chk->sent == SCTP_DATAGRAM_RESEND) { resend++; @@ -4166,10 +4194,15 @@ sctp_fs_audit(struct sctp_association *a #ifdef INVARIANTS panic("Flight size-express incorrect? \n"); #else - SCTP_PRINTF("Flight size-express incorrect inflight:%d inbetween:%d\n", - inflight, inbetween); + printf("asoc->total_flight:%d cnt:%d\n", + entry_flight, entry_cnt); + + SCTP_PRINTF("Flight size-express incorrect F:%d I:%d R:%d Ab:%d ACK:%d\n", + inflight, inbetween, resend, above, acked); + ret = 1; #endif } + return (ret); } @@ -4590,20 +4623,26 @@ again: (asoc->sent_queue_retran_cnt == 0) && (win_probe_recovered == 0) && (done_once == 0)) { - /* huh, this should not happen */ - sctp_fs_audit(asoc); - TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - net->flight_size = 0; - } - asoc->total_flight = 0; - asoc->total_flight_count = 0; - asoc->sent_queue_retran_cnt = 0; - TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { - if (tp1->sent < SCTP_DATAGRAM_RESEND) { - sctp_flight_size_increase(tp1); - sctp_total_flight_increase(stcb, tp1); - } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { - asoc->sent_queue_retran_cnt++; + /* + * huh, this should not happen unless all packets are + * PR-SCTP and marked to skip of course. + */ + if (sctp_fs_audit(asoc)) { + TAILQ_FOREACH(net, &asoc->nets, sctp_next) { + if (net->flight_size) { + net->flight_size = 0; + } + } + asoc->total_flight = 0; + asoc->total_flight_count = 0; + asoc->sent_queue_retran_cnt = 0; + TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { + if (tp1->sent < SCTP_DATAGRAM_RESEND) { + sctp_flight_size_increase(tp1); + sctp_total_flight_increase(stcb, tp1); + } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { + asoc->sent_queue_retran_cnt++; + } } } done_once = 1; @@ -4728,6 +4767,13 @@ again: */ asoc->nonce_sum_check = 0; asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point; + } else if (lchk) { + /* try to FR fwd-tsn's that get lost too */ + lchk->rec.data.fwd_tsn_cnt++; + if (lchk->rec.data.fwd_tsn_cnt > 3) { + send_forward_tsn(stcb, asoc); + lchk->rec.data.fwd_tsn_cnt = 0; + } } } if (lchk) { @@ -4813,10 +4859,6 @@ sctp_handle_sack(struct mbuf *m, int off num_seg = ntohs(sack->num_gap_ack_blks); a_rwnd = rwnd; - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_SACK_ARRIVALS_ENABLE) { - sctp_misc_ints(SCTP_SACK_LOG_NORMAL, cum_ack, - rwnd, stcb->asoc.last_acked_seq, stcb->asoc.peers_rwnd); - } /* CMT DAC algo */ cmt_dac_flag = ch->ch.chunk_flags & SCTP_SACK_CMT_DAC; num_dup = ntohs(sack->num_dup_tsns); @@ -5605,20 +5647,24 @@ again: (asoc->sent_queue_retran_cnt == 0) && (win_probe_recovered == 0) && (done_once == 0)) { - /* huh, this should not happen */ - sctp_fs_audit(asoc); - TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - net->flight_size = 0; - } - asoc->total_flight = 0; - asoc->total_flight_count = 0; - asoc->sent_queue_retran_cnt = 0; - TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { - if (tp1->sent < SCTP_DATAGRAM_RESEND) { - sctp_flight_size_increase(tp1); - sctp_total_flight_increase(stcb, tp1); - } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { - asoc->sent_queue_retran_cnt++; + /* + * huh, this should not happen unless all packets are + * PR-SCTP and marked to skip of course. + */ + if (sctp_fs_audit(asoc)) { + TAILQ_FOREACH(net, &asoc->nets, sctp_next) { + net->flight_size = 0; + } + asoc->total_flight = 0; + asoc->total_flight_count = 0; + asoc->sent_queue_retran_cnt = 0; + TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { + if (tp1->sent < SCTP_DATAGRAM_RESEND) { + sctp_flight_size_increase(tp1); + sctp_total_flight_increase(stcb, tp1); + } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { + asoc->sent_queue_retran_cnt++; + } } } done_once = 1; @@ -5643,6 +5689,11 @@ again: * on issues that will occur when the ECN NONCE * stuff is put into SCTP for cross checking. */ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { + sctp_misc_ints(SCTP_FWD_TSN_CHECK, + 0xee, cum_ack, asoc->advanced_peer_ack_point, + old_adv_peer_ack_point); + } if (compare_with_wrap(asoc->advanced_peer_ack_point, old_adv_peer_ack_point, MAX_TSN)) { send_forward_tsn(stcb, asoc); @@ -5652,6 +5703,13 @@ again: */ asoc->nonce_sum_check = 0; asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point; + } else if (lchk) { + /* try to FR fwd-tsn's that get lost too */ + lchk->rec.data.fwd_tsn_cnt++; + if (lchk->rec.data.fwd_tsn_cnt > 3) { + send_forward_tsn(stcb, asoc); + lchk->rec.data.fwd_tsn_cnt = 0; + } } } if (lchk) { @@ -6019,7 +6077,6 @@ sctp_handle_forward_tsn(struct sctp_tcb return; } SCTP_STAT_INCR(sctps_fwdtsn_map_over); -slide_out: memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); cumack_set_flag = 1; asoc->mapping_array_base_tsn = new_cum_tsn + 1; @@ -6043,13 +6100,8 @@ slide_out: asoc->last_echo_tsn = asoc->highest_tsn_inside_map; } else { SCTP_TCB_LOCK_ASSERT(stcb); - if ((compare_with_wrap(((uint32_t) asoc->cumulative_tsn + gap), asoc->highest_tsn_inside_map, MAX_TSN)) || - (((uint32_t) asoc->cumulative_tsn + gap) == asoc->highest_tsn_inside_map)) { - goto slide_out; - } else { - for (i = 0; i <= gap; i++) { - SCTP_SET_TSN_PRESENT(asoc->mapping_array, i); - } + for (i = 0; i <= gap; i++) { + SCTP_SET_TSN_PRESENT(asoc->mapping_array, i); } /* * Now after marking all, slide thing forward but no sack @@ -6059,7 +6111,6 @@ slide_out: if (*abort_flag) return; } - /*************************************************************/ /* 2. Clear up re-assembly queue */ /*************************************************************/ @@ -6083,9 +6134,9 @@ slide_out: chk = TAILQ_FIRST(&asoc->reasmqueue); while (chk) { at = TAILQ_NEXT(chk, sctp_next); - if (compare_with_wrap(asoc->cumulative_tsn, - chk->rec.data.TSN_seq, MAX_TSN) || - asoc->cumulative_tsn == chk->rec.data.TSN_seq) { + if ((compare_with_wrap(new_cum_tsn, + chk->rec.data.TSN_seq, MAX_TSN)) || + (new_cum_tsn == chk->rec.data.TSN_seq)) { /* It needs to be tossed */ TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next); if (compare_with_wrap(chk->rec.data.TSN_seq, @@ -6614,20 +6665,24 @@ again: (asoc->sent_queue_retran_cnt == 0) && (win_probe_recovered == 0) && (done_once == 0)) { - /* huh, this should not happen */ - sctp_fs_audit(asoc); - TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - net->flight_size = 0; - } - asoc->total_flight = 0; - asoc->total_flight_count = 0; - asoc->sent_queue_retran_cnt = 0; - TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { - if (tp1->sent < SCTP_DATAGRAM_RESEND) { - sctp_flight_size_increase(tp1); - sctp_total_flight_increase(stcb, tp1); - } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { - asoc->sent_queue_retran_cnt++; + /* + * huh, this should not happen unless all packets are + * PR-SCTP and marked to skip of course. + */ + if (sctp_fs_audit(asoc)) { + TAILQ_FOREACH(net, &asoc->nets, sctp_next) { + net->flight_size = 0; + } + asoc->total_flight = 0; + asoc->total_flight_count = 0; + asoc->sent_queue_retran_cnt = 0; + TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { + if (tp1->sent < SCTP_DATAGRAM_RESEND) { + sctp_flight_size_increase(tp1); + sctp_total_flight_increase(stcb, tp1); + } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { + asoc->sent_queue_retran_cnt++; + } } } done_once = 1; @@ -8170,20 +8225,24 @@ again: (asoc->sent_queue_retran_cnt == 0) && (win_probe_recovered == 0) && (done_once == 0)) { - /* huh, this should not happen */ - sctp_fs_audit(asoc); - TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - net->flight_size = 0; - } - asoc->total_flight = 0; - asoc->total_flight_count = 0; - asoc->sent_queue_retran_cnt = 0; - TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { - if (tp1->sent < SCTP_DATAGRAM_RESEND) { - sctp_flight_size_increase(tp1); - sctp_total_flight_increase(stcb, tp1); - } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { - asoc->sent_queue_retran_cnt++; + /* + * huh, this should not happen unless all packets are + * PR-SCTP and marked to skip of course. + */ + if (sctp_fs_audit(asoc)) { + TAILQ_FOREACH(net, &asoc->nets, sctp_next) { + net->flight_size = 0; + } + asoc->total_flight = 0; + asoc->total_flight_count = 0; + asoc->sent_queue_retran_cnt = 0; + TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { + if (tp1->sent < SCTP_DATAGRAM_RESEND) { + sctp_flight_size_increase(tp1); + sctp_total_flight_increase(stcb, tp1); + } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { + asoc->sent_queue_retran_cnt++; + } } } done_once = 1; @@ -8221,6 +8280,13 @@ again: */ asoc->nonce_sum_check = 0; asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point; + } else if (lchk) { + /* try to FR fwd-tsn's that get lost too */ + lchk->rec.data.fwd_tsn_cnt++; + if (lchk->rec.data.fwd_tsn_cnt > 3) { + send_forward_tsn(stcb, asoc); + lchk->rec.data.fwd_tsn_cnt = 0; + } } } if (lchk) { Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Mar 14 11:43:38 2009 (r189789) +++ head/sys/netinet/sctp_output.c Sat Mar 14 13:42:13 2009 (r189790) @@ -7513,7 +7513,7 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, cause = SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_UNSENT; ret_spc = sctp_release_pr_sctp_chunk(stcb, chk, cause, - &asoc->sent_queue, SCTP_SO_LOCKED); + SCTP_SO_LOCKED); freed_spc += ret_spc; if (freed_spc >= dataout) { return; @@ -7538,7 +7538,7 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, ret_spc = sctp_release_pr_sctp_chunk(stcb, chk, SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_UNSENT, - &asoc->send_queue, SCTP_SO_LOCKED); + SCTP_SO_LOCKED); freed_spc += ret_spc; if (freed_spc >= dataout) { @@ -8405,6 +8405,7 @@ sctp_clean_up_ctl(struct sctp_tcb *stcb, (chk->rec.chunk_id.id == SCTP_NR_SELECTIVE_ACK) || /* EY */ (chk->rec.chunk_id.id == SCTP_HEARTBEAT_REQUEST) || (chk->rec.chunk_id.id == SCTP_HEARTBEAT_ACK) || + (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) || (chk->rec.chunk_id.id == SCTP_SHUTDOWN) || (chk->rec.chunk_id.id == SCTP_SHUTDOWN_ACK) || (chk->rec.chunk_id.id == SCTP_OPERATION_ERROR) || @@ -8547,7 +8548,7 @@ one_more_time: * when we took all the data the sender_all_done was * not set. */ - if (sp->put_last_out == 0) { + if ((sp->put_last_out == 0) && (sp->discard_rest == 0)) { SCTP_PRINTF("Gak, put out entire msg with NO end!-1\n"); SCTP_PRINTF("sender_done:%d len:%d msg_comp:%d put_last_out:%d send_lock:%d\n", sp->sender_all_done, @@ -8568,7 +8569,6 @@ one_more_time: sp->data = NULL; } sctp_free_a_strmoq(stcb, sp); - /* we can't be locked to it */ *locked = 0; stcb->asoc.locked_on_sending = NULL; @@ -8596,6 +8596,29 @@ one_more_time: *giveup = 1; to_move = 0; goto out_of; + } else if (sp->discard_rest) { + if (send_lock_up == 0) { + SCTP_TCB_SEND_LOCK(stcb); + send_lock_up = 1; + } + /* Whack down the size */ + atomic_subtract_int(&stcb->asoc.total_output_queue_size, sp->length); + if ((stcb->sctp_socket != NULL) && \ + ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { + atomic_subtract_int(&stcb->sctp_socket->so_snd.sb_cc, sp->length); + } + if (sp->data) { + sctp_m_freem(sp->data); + sp->data = NULL; + sp->tail_mbuf = NULL; + } + sp->length = 0; + sp->some_taken = 1; + *locked = 1; + *giveup = 1; + to_move = 0; + goto out_of; } } some_taken = sp->some_taken; @@ -11533,6 +11556,7 @@ send_forward_tsn(struct sctp_tcb *stcb, { struct sctp_tmit_chunk *chk; struct sctp_forward_tsn_chunk *fwdtsn; + uint32_t advance_peer_ack_point; SCTP_TCB_LOCK_ASSERT(stcb); TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { @@ -11610,11 +11634,23 @@ sctp_fill_in_rest: /* trim to a mtu size */ cnt_of_space = asoc->smallest_mtu - ovh; } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { + sctp_misc_ints(SCTP_FWD_TSN_CHECK, + 0xff, 0, cnt_of_skipped, + asoc->advanced_peer_ack_point); + + } + advance_peer_ack_point = asoc->advanced_peer_ack_point; if (cnt_of_space < space_needed) { /*- * ok we must trim down the chunk by lowering the * advance peer ack point. */ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { + sctp_misc_ints(SCTP_FWD_TSN_CHECK, + 0xff, 0xff, cnt_of_space, + space_needed); + } cnt_of_skipped = (cnt_of_space - ((sizeof(struct sctp_forward_tsn_chunk)) / sizeof(struct sctp_strseq))); @@ -11627,12 +11663,17 @@ sctp_fill_in_rest: tp1 = TAILQ_NEXT(at, sctp_next); at = tp1; } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { + sctp_misc_ints(SCTP_FWD_TSN_CHECK, + 0xff, cnt_of_skipped, at->rec.data.TSN_seq, + asoc->advanced_peer_ack_point); + } last = at; /*- * last now points to last one I can report, update * peer ack point */ - asoc->advanced_peer_ack_point = last->rec.data.TSN_seq; + advance_peer_ack_point = last->rec.data.TSN_seq; space_needed -= (cnt_of_skipped * sizeof(struct sctp_strseq)); } chk->send_size = space_needed; @@ -11641,7 +11682,7 @@ sctp_fill_in_rest: fwdtsn->ch.chunk_length = htons(chk->send_size); fwdtsn->ch.chunk_flags = 0; fwdtsn->ch.chunk_type = SCTP_FORWARD_CUM_TSN; - fwdtsn->new_cumulative_tsn = htonl(asoc->advanced_peer_ack_point); + fwdtsn->new_cumulative_tsn = htonl(advance_peer_ack_point); chk->send_size = (sizeof(struct sctp_forward_tsn_chunk) + (cnt_of_skipped * sizeof(struct sctp_strseq))); SCTP_BUF_LEN(chk->data) = chk->send_size; @@ -11672,6 +11713,9 @@ sctp_fill_in_rest: at = tp1; continue; } + if (at->rec.data.TSN_seq == advance_peer_ack_point) { + at->rec.data.fwd_tsn_cnt = 0; + } strseq->stream = ntohs(at->rec.data.stream_number); strseq->sequence = ntohs(at->rec.data.stream_seq); strseq++; Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Sat Mar 14 11:43:38 2009 (r189789) +++ head/sys/netinet/sctp_timer.c Sat Mar 14 13:42:13 2009 (r189790) @@ -767,7 +767,7 @@ start_again: (void)sctp_release_pr_sctp_chunk(stcb, chk, (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), - &stcb->asoc.sent_queue, SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED); } continue; } @@ -779,7 +779,7 @@ start_again: (void)sctp_release_pr_sctp_chunk(stcb, chk, (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), - &stcb->asoc.sent_queue, SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED); } continue; } Modified: head/sys/netinet/sctp_var.h ============================================================================== --- head/sys/netinet/sctp_var.h Sat Mar 14 11:43:38 2009 (r189789) +++ head/sys/netinet/sctp_var.h Sat Mar 14 13:42:13 2009 (r189790) @@ -96,7 +96,8 @@ extern struct pr_usrreqs sctp_usrreqs; #define sctp_alloc_a_strmoq(_stcb, _strmoq) { \ (_strmoq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_strmoq), struct sctp_stream_queue_pending); \ - if ((_strmoq)) { \ + if ((_strmoq)) { \ + memset(_strmoq, 0, sizeof(struct sctp_stream_queue_pending)); \ SCTP_INCR_STRMOQ_COUNT(); \ (_strmoq)->holds_key_ref = 0; \ } \ @@ -267,6 +268,7 @@ extern struct pr_usrreqs sctp_usrreqs; #else #define sctp_total_flight_decrease(stcb, tp1) do { \ + tp1->window_probe = 0; \ if (stcb->asoc.total_flight >= tp1->book_size) { \ stcb->asoc.total_flight -= tp1->book_size; \ if (stcb->asoc.total_flight_count > 0) \ Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat Mar 14 11:43:38 2009 (r189789) +++ head/sys/netinet/sctputil.c Sat Mar 14 13:42:13 2009 (r189790) @@ -3686,10 +3686,10 @@ sctp_report_all_outbound(struct sctp_tcb while (chk) { TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); asoc->sent_queue_cnt--; - sctp_free_bufspace(stcb, asoc, chk, 1); - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_SENT, chk, so_locked); - if (chk->data) { + if (chk->data != NULL) { + sctp_free_bufspace(stcb, asoc, chk, 1); + sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, + SCTP_NOTIFY_DATAGRAM_SENT, chk, so_locked); sctp_m_freem(chk->data); chk->data = NULL; } @@ -3704,9 +3704,10 @@ sctp_report_all_outbound(struct sctp_tcb while (chk) { TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); asoc->send_queue_cnt--; - sctp_free_bufspace(stcb, asoc, chk, 1); - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, SCTP_NOTIFY_DATAGRAM_UNSENT, chk, so_locked); - if (chk->data) { + if (chk->data != NULL) { + sctp_free_bufspace(stcb, asoc, chk, 1); + sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, + SCTP_NOTIFY_DATAGRAM_UNSENT, chk, so_locked); sctp_m_freem(chk->data); chk->data = NULL; } @@ -4630,64 +4631,46 @@ sctp_free_bufspace(struct sctp_tcb *stcb int sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, - int reason, struct sctpchunk_listhead *queue, int so_locked + int reason, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif ) { + struct sctp_stream_out *strq; + struct sctp_tmit_chunk *chk = NULL; + struct sctp_stream_queue_pending *sp; + uint16_t stream = 0, seq = 0; + uint8_t foundeom = 0; int ret_sz = 0; int notdone; - uint8_t foundeom = 0; + int do_wakeup_routine = 0; + stream = tp1->rec.data.stream_number; + seq = tp1->rec.data.stream_seq; do { ret_sz += tp1->book_size; tp1->sent = SCTP_FORWARD_TSN_SKIP; - if (tp1->data) { + if (tp1->data != NULL) { #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif + printf("Release PR-SCTP chunk tsn:%u flags:%x\n", + tp1->rec.data.TSN_seq, + (unsigned int)tp1->rec.data.rcv_flags); sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); sctp_flight_size_decrease(tp1); sctp_total_flight_decrease(stcb, tp1); + stcb->asoc.peers_rwnd += tp1->send_size; + stcb->asoc.peers_rwnd += SCTP_BASE_SYSCTL(sctp_peer_chunk_oh); sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked); sctp_m_freem(tp1->data); tp1->data = NULL; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - if (!so_locked) { - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* - * assoc was freed while we were - * unlocked - */ - SCTP_SOCKET_UNLOCK(so, 1); - return (ret_sz); - } - } -#endif - sctp_sowwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if (!so_locked) { - SCTP_SOCKET_UNLOCK(so, 1); + do_wakeup_routine = 1; + if (PR_SCTP_BUF_ENABLED(tp1->flags)) { + stcb->asoc.sent_queue_cnt_removeable--; } -#endif - } - if (PR_SCTP_BUF_ENABLED(tp1->flags)) { - stcb->asoc.sent_queue_cnt_removeable--; - } - if (queue == &stcb->asoc.send_queue) { - TAILQ_REMOVE(&stcb->asoc.send_queue, tp1, sctp_next); - /* on to the sent queue */ - TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, tp1, - sctp_next); - stcb->asoc.sent_queue_cnt++; } if ((tp1->rec.data.rcv_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { @@ -4707,22 +4690,146 @@ sctp_release_pr_sctp_chunk(struct sctp_t tp1 = TAILQ_NEXT(tp1, sctp_next); } } while (tp1 && notdone); - if ((foundeom == 0) && (queue == &stcb->asoc.sent_queue)) { + if (foundeom == 0) { /* * The multi-part message was scattered across the send and * sent queue. */ +next_on_sent: tp1 = TAILQ_FIRST(&stcb->asoc.send_queue); /* * recurse throught the send_queue too, starting at the * beginning. */ - if (tp1) { - ret_sz += sctp_release_pr_sctp_chunk(stcb, tp1, reason, - &stcb->asoc.send_queue, so_locked); - } else { - SCTP_PRINTF("hmm, nothing on the send queue and no EOM?\n"); + if ((tp1) && + (tp1->rec.data.stream_number == stream) && + (tp1->rec.data.stream_seq == seq) + ) { + /* + * save to chk in case we have some on stream out + * queue. If so and we have an un-transmitted one we + * don't have to fudge the TSN. + */ + chk = tp1; + ret_sz += tp1->book_size; + sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked); + sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); + sctp_m_freem(tp1->data); + tp1->data = NULL; + if (tp1->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { + foundeom = 1; + } + do_wakeup_routine = 1; + tp1->sent = SCTP_FORWARD_TSN_SKIP; + TAILQ_REMOVE(&stcb->asoc.send_queue, tp1, sctp_next); + /* + * on to the sent queue so we can wait for it to be + * passed by. + */ + TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, tp1, + sctp_next); + stcb->asoc.send_queue_cnt--; + stcb->asoc.sent_queue_cnt++; + goto next_on_sent; + } + } + if (foundeom == 0) { + /* + * Still no eom found. That means there is stuff left on the + * stream out queue.. yuck. + */ + strq = &stcb->asoc.strmout[stream]; + SCTP_TCB_SEND_LOCK(stcb); + sp = TAILQ_FIRST(&strq->outqueue); + while (sp->strseq <= seq) { + /* Check if its our SEQ */ + if (sp->strseq == seq) { + sp->discard_rest = 1; + /* + * We may need to put a chunk on the queue + * that holds the TSN that would have been + * sent with the LAST bit. + */ + if (chk == NULL) { + /* Yep, we have to */ + sctp_alloc_a_chunk(stcb, chk); + if (chk == NULL) { + /* + * we are hosed. All we can + * do is nothing.. which + * will cause an abort if + * the peer is paying + * attention. + */ + goto oh_well; + } + memset(chk, 0, sizeof(*chk)); + chk->rec.data.rcv_flags = SCTP_DATA_LAST_FRAG; + chk->sent = SCTP_FORWARD_TSN_SKIP; + chk->asoc = &stcb->asoc; + chk->rec.data.stream_seq = sp->strseq; + chk->rec.data.stream_number = sp->stream; + chk->rec.data.payloadtype = sp->ppid; + chk->rec.data.context = sp->context; + chk->flags = sp->act_flags; + chk->addr_over = sp->addr_over; + chk->whoTo = sp->net; + atomic_add_int(&chk->whoTo->ref_count, 1); + chk->rec.data.TSN_seq = atomic_fetchadd_int(&stcb->asoc.sending_seq, 1); + stcb->asoc.pr_sctp_cnt++; + chk->pr_sctp_on = 1; + TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, chk, sctp_next); + stcb->asoc.sent_queue_cnt++; + } else { + chk->rec.data.rcv_flags |= SCTP_DATA_LAST_FRAG; + } + oh_well: + if (sp->data) { + /* + * Pull any data to free up the SB + * and allow sender to "add more" + * whilc we will throw away :-) + */ + sctp_free_spbufspace(stcb, &stcb->asoc, + sp); + ret_sz += sp->length; + do_wakeup_routine = 1; + sp->some_taken = 1; + sctp_m_freem(sp->data); + sp->length = 0; + sp->data = NULL; + sp->tail_mbuf = NULL; + } + break; + } else { + /* Next one please */ + sp = TAILQ_NEXT(sp, next); + } + } /* End while */ + SCTP_TCB_SEND_UNLOCK(stcb); + } + if (do_wakeup_routine) { +#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + so = SCTP_INP_SO(stcb->sctp_ep); + if (!so_locked) { + atomic_add_int(&stcb->asoc.refcnt, 1); + SCTP_TCB_UNLOCK(stcb); + SCTP_SOCKET_LOCK(so, 1); + SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); + if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { + /* assoc was freed while we were unlocked */ + SCTP_SOCKET_UNLOCK(so, 1); + return (ret_sz); + } } +#endif + sctp_sowwakeup(stcb->sctp_ep, stcb->sctp_socket); +#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + if (!so_locked) { + SCTP_SOCKET_UNLOCK(so, 1); + } +#endif } return (ret_sz); } Modified: head/sys/netinet/sctputil.h ============================================================================== --- head/sys/netinet/sctputil.h Sat Mar 14 11:43:38 2009 (r189789) +++ head/sys/netinet/sctputil.h Sat Mar 14 13:42:13 2009 (r189790) @@ -237,7 +237,7 @@ sctp_notify_partial_delivery_indication( int sctp_release_pr_sctp_chunk(struct sctp_tcb *, struct sctp_tmit_chunk *, - int, struct sctpchunk_listhead *, int + int, int #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif @@ -287,7 +287,6 @@ do { \ #define sctp_free_spbufspace(stcb, asoc, sp) \ do { \ if (sp->data != NULL) { \ - atomic_subtract_int(&(asoc)->chunks_on_out_queue, 1); \ if ((asoc)->total_output_queue_size >= sp->length) { \ atomic_subtract_int(&(asoc)->total_output_queue_size, sp->length); \ } else { \ From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 14:08:54 2009 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 8F0EB106566B; Sat, 14 Mar 2009 14:08:54 +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 7D8408FC34; Sat, 14 Mar 2009 14:08:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EE8sPP095290; Sat, 14 Mar 2009 14:08:54 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EE8sHW095288; Sat, 14 Mar 2009 14:08:54 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903141408.n2EE8sHW095288@svn.freebsd.org> From: Warner Losh Date: Sat, 14 Mar 2009 14:08: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: r189792 - head/sys/dev/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: Sat, 14 Mar 2009 14:08:55 -0000 Author: imp Date: Sat Mar 14 14:08:53 2009 New Revision: 189792 URL: http://svn.freebsd.org/changeset/base/189792 Log: Two fixes: (1) Fix pcib_read/write_config prototypes. (2) When contrainting a resource request for a 'subtractive' bridge, it is important to select a range outside the base/limit registers, since those are the only values known to not possibly work. On my HP laptop, the base bridge excludes I/O ports 0xa000-0xafff, however that was the range we were passing up the tree. Instead, when a range spans the "hole" we now arbitrarily pick the range just above the hole to allocate from. All of my rl and xl cards, at a minimum, started working again on this laptop with those fixes. Modified: head/sys/dev/pci/pci_pci.c head/sys/dev/pci/pcib_private.h Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Sat Mar 14 14:02:53 2009 (r189791) +++ head/sys/dev/pci/pci_pci.c Sat Mar 14 14:08:53 2009 (r189792) @@ -413,12 +413,12 @@ pcib_alloc_resource(device_t dev, device } } else { ok = 1; -#if 1 - if (start < sc->iobase && end > sc->iolimit) { - start = sc->iobase; - end = sc->iolimit; - } -#endif + /* + * If we overlap with the subtractive range, then + * pick the upper range to use. + */ + if (start < sc->iolimit && end > sc->iobase) + start = sc->iolimit + 1; } if (end < start) { device_printf(dev, "ioport: end (%lx) < start (%lx)\n", @@ -479,16 +479,12 @@ pcib_alloc_resource(device_t dev, device } else if (!ok) { ok = 1; /* subtractive bridge: always ok */ if (pcib_is_nonprefetch_open(sc)) { - if (start < sc->membase && end > sc->memlimit) { - start = sc->membase; - end = sc->memlimit; - } + if (start < sc->memlimit && end > sc->membase) + start = sc->memlimit + 1; } if (pcib_is_prefetch_open(sc)) { - if (start < sc->pmembase && end > sc->pmemlimit) { - start = sc->pmembase; - end = sc->pmemlimit; - } + if (start < sc->pmemlimit && end > sc->pmembase) + start = sc->pmemlimit + 1; } } if (end < start) { @@ -536,13 +532,13 @@ pcib_maxslots(device_t dev) * Since we are a child of a PCI bus, its parent must support the pcib interface. */ uint32_t -pcib_read_config(device_t dev, int b, int s, int f, int reg, int width) +pcib_read_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, int width) { return(PCIB_READ_CONFIG(device_get_parent(device_get_parent(dev)), b, s, f, reg, width)); } void -pcib_write_config(device_t dev, int b, int s, int f, int reg, uint32_t val, int width) +pcib_write_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, uint32_t val, int width) { PCIB_WRITE_CONFIG(device_get_parent(device_get_parent(dev)), b, s, f, reg, val, width); } Modified: head/sys/dev/pci/pcib_private.h ============================================================================== --- head/sys/dev/pci/pcib_private.h Sat Mar 14 14:02:53 2009 (r189791) +++ head/sys/dev/pci/pcib_private.h Sat Mar 14 14:08:53 2009 (r189792) @@ -74,8 +74,8 @@ int pcib_write_ivar(device_t dev, devic struct resource *pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); int pcib_maxslots(device_t dev); -uint32_t pcib_read_config(device_t dev, int b, int s, int f, int reg, int width); -void pcib_write_config(device_t dev, int b, int s, int f, int reg, uint32_t val, int width); +uint32_t pcib_read_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, int width); +void pcib_write_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, uint32_t val, int width); int pcib_route_interrupt(device_t pcib, device_t dev, int pin); int pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs); int pcib_release_msi(device_t pcib, device_t dev, int count, int *irqs); From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 14:15:21 2009 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 0928C1065762; Sat, 14 Mar 2009 14:15:21 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id A31028FC2D; Sat, 14 Mar 2009 14:15:20 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n2EEADU0034204; Sat, 14 Mar 2009 08:10:14 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 14 Mar 2009 23:10:36 +0900 (JST) Message-Id: <20090314.231036.-432837894.imp@bsdimp.com> To: ed@80386.nl From: "M. Warner Losh" In-Reply-To: <20090314105656.GW31961@hoeg.nl> References: <200903132241.n2DMfUax075094@svn.freebsd.org> <20090314105656.GW31961@hoeg.nl> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, gabor@FreeBSD.org Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 14:15:22 -0000 In message: <20090314105656.GW31961@hoeg.nl> Ed Schouten writes: : Hi Gabor, : : * Gabor Kovesdan wrote: : > mkdir -p ${CANONICALOBJDIR}/../../lib32/usr/share/nls/${c} : > mkdir -p ${CANONICALOBJDIR}/../../tmp/usr/share/nls/${c} : : This also seems to cause directories to be created in /usr/obj/lib32 : when lib32 is explicitly disabled. The change is clearly wrong, and must be backed out. If there's a bug, this isn't the fix. Warner From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 14:15:22 2009 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 6F9CE106574E; Sat, 14 Mar 2009 14:15:22 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2F9288FC08; Sat, 14 Mar 2009 14:15:22 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n2EEC1oo034286; Sat, 14 Mar 2009 08:12:02 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 14 Mar 2009 23:12:27 +0900 (JST) Message-Id: <20090314.231227.1649765955.imp@bsdimp.com> To: gabor@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <49BB98A1.80403@FreeBSD.org> References: <200903132241.n2DMfUax075094@svn.freebsd.org> <20090314055836.GV31961@hoeg.nl> <49BB98A1.80403@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, ed@80386.nl, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 14:15:25 -0000 In message: <49BB98A1.80403@FreeBSD.org> G=E1bor_K=F6vesd=E1n writes: : Ed Schouten escribi=F3: : > * Gabor Kovesdan wrote: : > = : >> - Fix object directory creation when running threaded buildworld= : >> = : > : > Isn't this normally done by the mtrees? : > = : I haven't yet found a better solution for this. I also grepped for mt= ree = : in the source tree hoping that it will point me a good solution with = : mtrees but it didn't. Ruslan might suggest something if he has some t= ime = : to take a look. Adding all the new NLS directories to BSD.mtree.usr is the canonical way, I'd think. Warner From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 14:35:23 2009 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 75980106566C; Sat, 14 Mar 2009 14:35:23 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 2C4A08FC15; Sat, 14 Mar 2009 14:35:23 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 7BE8414D877A; Sat, 14 Mar 2009 15:35:21 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1wd6dCHy7bGP; Sat, 14 Mar 2009 15:35:21 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id B835714D86CB; Sat, 14 Mar 2009 15:35:20 +0100 (CET) Message-ID: <49BBC0A5.3080002@FreeBSD.org> Date: Sat, 14 Mar 2009 15:35:17 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: "M. Warner Losh" References: <200903132241.n2DMfUax075094@svn.freebsd.org> <20090314055836.GV31961@hoeg.nl> <49BB98A1.80403@FreeBSD.org> <20090314.231227.1649765955.imp@bsdimp.com> In-Reply-To: <20090314.231227.1649765955.imp@bsdimp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@FreeBSD.org, ed@80386.nl, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 14:35:24 -0000 M. Warner Losh escribió: > In message: <49BB98A1.80403@FreeBSD.org> > Gábor_Kövesdán writes: > : Ed Schouten escribió: > : > * Gabor Kovesdan wrote: > : > > : >> - Fix object directory creation when running threaded buildworld > : >> > : > > : > Isn't this normally done by the mtrees? > : > > : I haven't yet found a better solution for this. I also grepped for mtree > : in the source tree hoping that it will point me a good solution with > : mtrees but it didn't. Ruslan might suggest something if he has some time > : to take a look. > > Adding all the new NLS directories to BSD.mtree.usr is the canonical > way, I'd think. > They are already there (well, actually not the lib32-ones but the rest) and it doesn't seem to help anything. It seems from buildworld logs that there's no usr mtree creation for /usr/obj, just the include mtree is applied. Should usr mtree be applied to /usr/obj, as well? -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 14:41:20 2009 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 B109D1065670; Sat, 14 Mar 2009 14:41:20 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 6FB918FC08; Sat, 14 Mar 2009 14:41:20 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n2EEdGRb034785; Sat, 14 Mar 2009 08:39:17 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 14 Mar 2009 23:39:39 +0900 (JST) Message-Id: <20090314.233939.-1625878868.imp@bsdimp.com> To: gabor@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <49BBC0A5.3080002@FreeBSD.org> References: <49BB98A1.80403@FreeBSD.org> <20090314.231227.1649765955.imp@bsdimp.com> <49BBC0A5.3080002@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, ed@80386.nl, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 14:41:21 -0000 In message: <49BBC0A5.3080002@FreeBSD.org> G=E1bor_K=F6vesd=E1n writes: : M. Warner Losh escribi=F3: : > In message: <49BB98A1.80403@FreeBSD.org> : > G=E1bor_K=F6vesd=E1n writes: : > : Ed Schouten escribi=F3: : > : > * Gabor Kovesdan wrote: : > : > = : > : >> - Fix object directory creation when running threaded buildw= orld : > : >> = : > : > : > : > Isn't this normally done by the mtrees? : > : > = : > : I haven't yet found a better solution for this. I also grepped fo= r mtree = : > : in the source tree hoping that it will point me a good solution w= ith = : > : mtrees but it didn't. Ruslan might suggest something if he has so= me time = : > : to take a look. : > : > Adding all the new NLS directories to BSD.mtree.usr is the canonica= l : > way, I'd think. : > = : They are already there (well, actually not the lib32-ones but the res= t) = : and it doesn't seem to help anything. It seems from buildworld logs t= hat = : there's no usr mtree creation for /usr/obj, just the include mtree is= = : applied. Should usr mtree be applied to /usr/obj, as well? I'm pretty sure that it is applied for that indirectly... Maybe we kludge something elsewhere already that really needs something better... Warner From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 15:37:20 2009 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 37C301065670; Sat, 14 Mar 2009 15:37:20 +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 263CC8FC2E; Sat, 14 Mar 2009 15:37:20 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EFbJNo097029; Sat, 14 Mar 2009 15:37:19 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EFbJpg097028; Sat, 14 Mar 2009 15:37:19 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200903141537.n2EFbJpg097028@svn.freebsd.org> From: Alan Cox Date: Sat, 14 Mar 2009 15:37:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189795 - head/sys/i386/i386 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 Mar 2009 15:37:20 -0000 Author: alc Date: Sat Mar 14 15:37:19 2009 New Revision: 189795 URL: http://svn.freebsd.org/changeset/base/189795 Log: MFamd64 r189785 Update the pmap's resident page count when a page table page is freed in pmap_remove_pde() and pmap_remove_pages(). MFC after: 6 weeks Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat Mar 14 15:32:04 2009 (r189794) +++ head/sys/i386/i386/pmap.c Sat Mar 14 15:37:19 2009 (r189795) @@ -2442,6 +2442,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t mpte = pmap_lookup_pt_page(pmap, sva); if (mpte != NULL) { pmap_remove_pt_page(pmap, mpte); + pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pde: pte page wire count error")); mpte->wire_count = 0; @@ -3990,6 +3991,7 @@ pmap_remove_pages(pmap_t pmap) mpte = pmap_lookup_pt_page(pmap, pv->pv_va); if (mpte != NULL) { pmap_remove_pt_page(pmap, mpte); + pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pages: pte page wire count error")); mpte->wire_count = 0; From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 16:06:07 2009 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 42C201065670; Sat, 14 Mar 2009 16:06:07 +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 2F20D8FC18; Sat, 14 Mar 2009 16:06:07 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EG67pj098763; Sat, 14 Mar 2009 16:06:07 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EG66Ch098755; Sat, 14 Mar 2009 16:06:06 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903141606.n2EG66Ch098755@svn.freebsd.org> From: Robert Watson Date: Sat, 14 Mar 2009 16:06: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: r189797 - head/sys/security/mac 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 Mar 2009 16:06:07 -0000 Author: rwatson Date: Sat Mar 14 16:06:06 2009 New Revision: 189797 URL: http://svn.freebsd.org/changeset/base/189797 Log: Rework MAC Framework synchronization in a number of ways in order to improve performance: - Eliminate custom reference count and condition variable to monitor threads entering the framework, as this had both significant overhead and behaved badly in the face of contention. - Replace reference count with two locks: an rwlock and an sx lock, which will be read-acquired by threads entering the framework depending on whether a give policy entry point is permitted to sleep or not. - Replace previous mutex locking of the reference count for exclusive access with write acquiring of both the policy list sx and rw locks, which occurs only when policies are attached or detached. - Do a lockless read of the dynamic policy list head before acquiring any locks in order to reduce overhead when no dynamic policies are loaded; this a race we can afford to lose. - For every policy entry point invocation, decide whether sleeping is permitted, and if not, use a _NOSLEEP() variant of the composition macros, which will use the rwlock instead of the sxlock. In some cases, we decide which to use based on allocation flags passed to the MAC Framework entry point. As with the move to rwlocks/rmlocks in pfil, this may trigger witness warnings, but these should (generally) be false positives as all acquisition of the locks is for read with two very narrow exceptions for policy load/unload, and those code blocks should never acquire other locks. Sponsored by: Google, Inc. Obtained from: TrustedBSD Project Discussed with: csjp (idea, not specific patch) Modified: head/sys/security/mac/mac_atalk.c head/sys/security/mac/mac_audit.c head/sys/security/mac/mac_cred.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_inet.c head/sys/security/mac/mac_inet6.c head/sys/security/mac/mac_internal.h head/sys/security/mac/mac_net.c head/sys/security/mac/mac_pipe.c head/sys/security/mac/mac_posix_sem.c head/sys/security/mac/mac_posix_shm.c head/sys/security/mac/mac_priv.c head/sys/security/mac/mac_process.c head/sys/security/mac/mac_socket.c head/sys/security/mac/mac_syscalls.c head/sys/security/mac/mac_system.c head/sys/security/mac/mac_sysv_msg.c head/sys/security/mac/mac_sysv_sem.c head/sys/security/mac/mac_sysv_shm.c head/sys/security/mac/mac_vfs.c Modified: head/sys/security/mac/mac_atalk.c ============================================================================== --- head/sys/security/mac/mac_atalk.c Sat Mar 14 15:53:06 2009 (r189796) +++ head/sys/security/mac/mac_atalk.c Sat Mar 14 16:06:06 2009 (r189797) @@ -1,9 +1,12 @@ /*- - * Copyright (c) 2007 Robert N. M. Watson + * Copyright (c) 2007-2009 Robert N. M. Watson * All rights reserved. * * This software was developed by Robert Watson for the TrustedBSD Project. * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -61,6 +64,7 @@ mac_netatalk_aarp_send(struct ifnet *ifp mlabel = mac_mbuf_to_label(m); MAC_IFNET_LOCK(ifp); - MAC_PERFORM(netatalk_aarp_send, ifp, ifp->if_label, m, mlabel); + MAC_PERFORM_NOSLEEP(netatalk_aarp_send, ifp, ifp->if_label, m, + mlabel); MAC_IFNET_UNLOCK(ifp); } Modified: head/sys/security/mac/mac_audit.c ============================================================================== --- head/sys/security/mac/mac_audit.c Sat Mar 14 15:53:06 2009 (r189796) +++ head/sys/security/mac/mac_audit.c Sat Mar 14 16:06:06 2009 (r189797) @@ -66,7 +66,7 @@ mac_cred_check_setaudit(struct ucred *cr { int error; - MAC_CHECK(cred_check_setaudit, cred, ai); + MAC_CHECK_NOSLEEP(cred_check_setaudit, cred, ai); MAC_CHECK_PROBE2(cred_check_setaudit, error, cred, ai); return (error); @@ -80,7 +80,7 @@ mac_cred_check_setaudit_addr(struct ucre { int error; - MAC_CHECK(cred_check_setaudit_addr, cred, aia); + MAC_CHECK_NOSLEEP(cred_check_setaudit_addr, cred, aia); MAC_CHECK_PROBE2(cred_check_setaudit_addr, error, cred, aia); return (error); @@ -93,7 +93,7 @@ mac_cred_check_setauid(struct ucred *cre { int error; - MAC_CHECK(cred_check_setauid, cred, auid); + MAC_CHECK_NOSLEEP(cred_check_setauid, cred, auid); MAC_CHECK_PROBE2(cred_check_setauid, error, cred, auid); return (error); @@ -107,7 +107,7 @@ mac_system_check_audit(struct ucred *cre { int error; - MAC_CHECK(system_check_audit, cred, record, length); + MAC_CHECK_NOSLEEP(system_check_audit, cred, record, length); MAC_CHECK_PROBE3(system_check_audit, error, cred, record, length); return (error); @@ -138,7 +138,7 @@ mac_system_check_auditon(struct ucred *c { int error; - MAC_CHECK(system_check_auditon, cred, cmd); + MAC_CHECK_NOSLEEP(system_check_auditon, cred, cmd); MAC_CHECK_PROBE2(system_check_auditon, error, cred, cmd); return (error); Modified: head/sys/security/mac/mac_cred.c ============================================================================== --- head/sys/security/mac/mac_cred.c Sat Mar 14 15:53:06 2009 (r189796) +++ head/sys/security/mac/mac_cred.c Sat Mar 14 16:06:06 2009 (r189797) @@ -100,7 +100,7 @@ void mac_cred_label_free(struct label *label) { - MAC_PERFORM(cred_destroy_label, label); + MAC_PERFORM_NOSLEEP(cred_destroy_label, label); mac_labelzone_free(label); } @@ -127,7 +127,7 @@ void mac_cred_associate_nfsd(struct ucred *cred) { - MAC_PERFORM(cred_associate_nfsd, cred); + MAC_PERFORM_NOSLEEP(cred_associate_nfsd, cred); } /* @@ -138,7 +138,7 @@ void mac_cred_create_swapper(struct ucred *cred) { - MAC_PERFORM(cred_create_swapper, cred); + MAC_PERFORM_NOSLEEP(cred_create_swapper, cred); } /* @@ -149,7 +149,7 @@ void mac_cred_create_init(struct ucred *cred) { - MAC_PERFORM(cred_create_init, cred); + MAC_PERFORM_NOSLEEP(cred_create_init, cred); } int @@ -182,7 +182,7 @@ void mac_cred_copy(struct ucred *src, struct ucred *dest) { - MAC_PERFORM(cred_copy_label, src->cr_label, dest->cr_label); + MAC_PERFORM_NOSLEEP(cred_copy_label, src->cr_label, dest->cr_label); } /* @@ -194,7 +194,7 @@ void mac_cred_relabel(struct ucred *cred, struct label *newlabel) { - MAC_PERFORM(cred_relabel, cred, newlabel); + MAC_PERFORM_NOSLEEP(cred_relabel, cred, newlabel); } MAC_CHECK_PROBE_DEFINE2(cred_check_relabel, "struct ucred *", @@ -205,7 +205,7 @@ mac_cred_check_relabel(struct ucred *cre { int error; - MAC_CHECK(cred_check_relabel, cred, newlabel); + MAC_CHECK_NOSLEEP(cred_check_relabel, cred, newlabel); MAC_CHECK_PROBE2(cred_check_relabel, error, cred, newlabel); return (error); @@ -218,7 +218,7 @@ mac_cred_check_setuid(struct ucred *cred { int error; - MAC_CHECK(cred_check_setuid, cred, uid); + MAC_CHECK_NOSLEEP(cred_check_setuid, cred, uid); MAC_CHECK_PROBE2(cred_check_setuid, error, cred, uid); return (error); @@ -231,7 +231,7 @@ mac_cred_check_seteuid(struct ucred *cre { int error; - MAC_CHECK(cred_check_seteuid, cred, euid); + MAC_CHECK_NOSLEEP(cred_check_seteuid, cred, euid); MAC_CHECK_PROBE2(cred_check_seteuid, error, cred, euid); return (error); @@ -244,7 +244,7 @@ mac_cred_check_setgid(struct ucred *cred { int error; - MAC_CHECK(cred_check_setgid, cred, gid); + MAC_CHECK_NOSLEEP(cred_check_setgid, cred, gid); MAC_CHECK_PROBE2(cred_check_setgid, error, cred, gid); return (error); @@ -257,7 +257,7 @@ mac_cred_check_setegid(struct ucred *cre { int error; - MAC_CHECK(cred_check_setegid, cred, egid); + MAC_CHECK_NOSLEEP(cred_check_setegid, cred, egid); MAC_CHECK_PROBE2(cred_check_setegid, error, cred, egid); return (error); @@ -271,7 +271,7 @@ mac_cred_check_setgroups(struct ucred *c { int error; - MAC_CHECK(cred_check_setgroups, cred, ngroups, gidset); + MAC_CHECK_NOSLEEP(cred_check_setgroups, cred, ngroups, gidset); MAC_CHECK_PROBE3(cred_check_setgroups, error, cred, ngroups, gidset); return (error); @@ -285,7 +285,7 @@ mac_cred_check_setreuid(struct ucred *cr { int error; - MAC_CHECK(cred_check_setreuid, cred, ruid, euid); + MAC_CHECK_NOSLEEP(cred_check_setreuid, cred, ruid, euid); MAC_CHECK_PROBE3(cred_check_setreuid, error, cred, ruid, euid); return (error); @@ -299,7 +299,7 @@ mac_cred_check_setregid(struct ucred *cr { int error; - MAC_CHECK(cred_check_setregid, cred, rgid, egid); + MAC_CHECK_NOSLEEP(cred_check_setregid, cred, rgid, egid); MAC_CHECK_PROBE3(cred_check_setregid, error, cred, rgid, egid); return (error); @@ -314,7 +314,7 @@ mac_cred_check_setresuid(struct ucred *c { int error; - MAC_CHECK(cred_check_setresuid, cred, ruid, euid, suid); + MAC_CHECK_NOSLEEP(cred_check_setresuid, cred, ruid, euid, suid); MAC_CHECK_PROBE4(cred_check_setresuid, error, cred, ruid, euid, suid); @@ -330,7 +330,7 @@ mac_cred_check_setresgid(struct ucred *c { int error; - MAC_CHECK(cred_check_setresgid, cred, rgid, egid, sgid); + MAC_CHECK_NOSLEEP(cred_check_setresgid, cred, rgid, egid, sgid); MAC_CHECK_PROBE4(cred_check_setresgid, error, cred, rgid, egid, sgid); @@ -345,7 +345,7 @@ mac_cred_check_visible(struct ucred *cr1 { int error; - MAC_CHECK(cred_check_visible, cr1, cr2); + MAC_CHECK_NOSLEEP(cred_check_visible, cr1, cr2); MAC_CHECK_PROBE2(cred_check_visible, error, cr1, cr2); return (error); Modified: head/sys/security/mac/mac_framework.c ============================================================================== --- head/sys/security/mac/mac_framework.c Sat Mar 14 15:53:06 2009 (r189796) +++ head/sys/security/mac/mac_framework.c Sat Mar 14 16:06:06 2009 (r189797) @@ -76,10 +76,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include +#include #include +#include #include #include @@ -154,164 +155,125 @@ SYSCTL_QUAD(_security_mac, OID_AUTO, lab MALLOC_DEFINE(M_MACTEMP, "mactemp", "MAC temporary label storage"); /* - * mac_static_policy_list holds a list of policy modules that are not loaded - * while the system is "live", and cannot be unloaded. These policies can be - * invoked without holding the busy count. + * MAC policy modules are placed in one of two lists: mac_static_policy_list, + * for policies that are loaded early and cannot be unloaded, and + * mac_policy_list, which holds policies either loaded later in the boot + * cycle or that may be unloaded. The static policy list does not require + * locks to iterate over, but the dynamic list requires synchronization. + * Support for dynamic policy loading can be compiled out using the + * MAC_STATIC kernel option. * - * mac_policy_list stores the list of dynamic policies. A busy count is - * maintained for the list, stored in mac_policy_busy. The busy count is - * protected by mac_policy_mtx; the list may be modified only while the busy - * count is 0, requiring that the lock be held to prevent new references to - * the list from being acquired. For almost all operations, incrementing the - * busy count is sufficient to guarantee consistency, as the list cannot be - * modified while the busy count is elevated. For a few special operations - * involving a change to the list of active policies, the mtx itself must be - * held. A condition variable, mac_policy_cv, is used to signal potential - * exclusive consumers that they should try to acquire the lock if a first - * attempt at exclusive access fails. - * - * This design intentionally avoids fairness, and may starve attempts to - * acquire an exclusive lock on a busy system. This is required because we - * do not ever want acquiring a read reference to perform an unbounded length - * sleep. Read references are acquired in ithreads, network isrs, etc, and - * any unbounded blocking could lead quickly to deadlock. - * - * Another reason for never blocking on read references is that the MAC - * Framework may recurse: if a policy calls a VOP, for example, this might - * lead to vnode life cycle operations (such as init/destroy). - * - * If the kernel option MAC_STATIC has been compiled in, all locking becomes - * a no-op, and the global list of policies is not allowed to change after - * early boot. - * - * XXXRW: Currently, we signal mac_policy_cv every time the framework becomes - * unbusy and there is a thread waiting to enter it exclusively. Since it - * may take some time before the thread runs, we may issue a lot of signals. - * We should instead keep track of the fact that we've signalled, taking into - * account that the framework may be busy again by the time the thread runs, - * requiring us to re-signal. + * The dynamic policy list is protected by two locks: modifying the list + * requires both locks to be held exclusively. One of the locks, + * mac_policy_rw, is acquired over policy entry points that will never sleep; + * the other, mac_policy_sx, is acquire over policy entry points that may + * sleep. The former category will be used when kernel locks may be held + * over calls to the MAC Framework, during network processing in ithreads, + * etc. The latter will tend to involve potentially blocking memory + * allocations, extended attribute I/O, etc. */ #ifndef MAC_STATIC -static struct mtx mac_policy_mtx; -static struct cv mac_policy_cv; -static int mac_policy_count; -static int mac_policy_wait; +static struct rwlock mac_policy_rw; /* Non-sleeping entry points. */ +static struct sx mac_policy_sx; /* Sleeping entry points. */ #endif + struct mac_policy_list_head mac_policy_list; struct mac_policy_list_head mac_static_policy_list; -/* - * We manually invoke WITNESS_WARN() to allow Witness to generate warnings - * even if we don't end up ever triggering the wait at run-time. The - * consumer of the exclusive interface must not hold any locks (other than - * potentially Giant) since we may sleep for long (potentially indefinite) - * periods of time waiting for the framework to become quiescent so that a - * policy list change may be made. - */ +static void mac_policy_xlock(void); +static void mac_policy_xlock_assert(void); +static void mac_policy_xunlock(void); + void -mac_policy_grab_exclusive(void) +mac_policy_slock_nosleep(void) { #ifndef MAC_STATIC if (!mac_late) return; - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, - "mac_policy_grab_exclusive() at %s:%d", __FILE__, __LINE__); - mtx_lock(&mac_policy_mtx); - while (mac_policy_count != 0) { - mac_policy_wait++; - cv_wait(&mac_policy_cv, &mac_policy_mtx); - mac_policy_wait--; - } + rw_rlock(&mac_policy_rw); #endif } void -mac_policy_assert_exclusive(void) +mac_policy_slock_sleep(void) { + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "mac_policy_slock_sleep"); + #ifndef MAC_STATIC if (!mac_late) return; - mtx_assert(&mac_policy_mtx, MA_OWNED); - KASSERT(mac_policy_count == 0, - ("mac_policy_assert_exclusive(): not exclusive")); + sx_slock(&mac_policy_sx); #endif } void -mac_policy_release_exclusive(void) +mac_policy_sunlock_nosleep(void) { -#ifndef MAC_STATIC - int dowakeup; +#ifndef MAC_STATIC if (!mac_late) return; - KASSERT(mac_policy_count == 0, - ("mac_policy_release_exclusive(): not exclusive")); - dowakeup = (mac_policy_wait != 0); - mtx_unlock(&mac_policy_mtx); - if (dowakeup) - cv_signal(&mac_policy_cv); + rw_runlock(&mac_policy_rw); #endif } void -mac_policy_list_busy(void) +mac_policy_sunlock_sleep(void) { #ifndef MAC_STATIC if (!mac_late) return; - mtx_lock(&mac_policy_mtx); - mac_policy_count++; - mtx_unlock(&mac_policy_mtx); + sx_sunlock(&mac_policy_sx); #endif } -int -mac_policy_list_conditional_busy(void) +static void +mac_policy_xlock(void) { -#ifndef MAC_STATIC - int ret; + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "mac_policy_xlock()"); + +#ifndef MAC_STATIC if (!mac_late) - return (1); + return; - mtx_lock(&mac_policy_mtx); - if (!LIST_EMPTY(&mac_policy_list)) { - mac_policy_count++; - ret = 1; - } else - ret = 0; - mtx_unlock(&mac_policy_mtx); - return (ret); -#else - return (1); + sx_xlock(&mac_policy_sx); + rw_wlock(&mac_policy_rw); #endif } -void -mac_policy_list_unbusy(void) +static void +mac_policy_xunlock(void) { -#ifndef MAC_STATIC - int dowakeup; +#ifndef MAC_STATIC if (!mac_late) return; - mtx_lock(&mac_policy_mtx); - mac_policy_count--; - KASSERT(mac_policy_count >= 0, ("MAC_POLICY_LIST_LOCK")); - dowakeup = (mac_policy_count == 0 && mac_policy_wait != 0); - mtx_unlock(&mac_policy_mtx); + rw_wunlock(&mac_policy_rw); + sx_xunlock(&mac_policy_sx); +#endif +} - if (dowakeup) - cv_signal(&mac_policy_cv); +static void +mac_policy_xlock_assert(void) +{ + +#ifndef MAC_STATIC + if (!mac_late) + return; + + rw_assert(&mac_policy_rw, RA_WLOCKED); + sx_assert(&mac_policy_sx, SA_XLOCKED); #endif } @@ -327,8 +289,8 @@ mac_init(void) mac_labelzone_init(); #ifndef MAC_STATIC - mtx_init(&mac_policy_mtx, "mac_policy_mtx", NULL, MTX_DEF); - cv_init(&mac_policy_cv, "mac_policy_cv"); + rw_init(&mac_policy_rw, "mac_policy_rw"); + sx_init(&mac_policy_sx, "mac_policy_sx"); #endif } @@ -393,7 +355,7 @@ mac_policy_updateflags(void) { struct mac_policy_conf *mpc; - mac_policy_assert_exclusive(); + mac_policy_xlock_assert(); mac_labeled = 0; LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) @@ -414,7 +376,7 @@ mac_policy_register(struct mac_policy_co * We don't technically need exclusive access while !mac_late, but * hold it for assertion consistency. */ - mac_policy_grab_exclusive(); + mac_policy_xlock(); /* * If the module can potentially be unloaded, or we're loading late, @@ -479,7 +441,7 @@ mac_policy_register(struct mac_policy_co mpc->mpc_name); out: - mac_policy_release_exclusive(); + mac_policy_xunlock(); return (error); } @@ -491,9 +453,9 @@ mac_policy_unregister(struct mac_policy_ * If we fail the load, we may get a request to unload. Check to see * if we did the run-time registration, and if not, silently succeed. */ - mac_policy_grab_exclusive(); + mac_policy_xlock(); if ((mpc->mpc_runtime_flags & MPC_RUNTIME_FLAG_REGISTERED) == 0) { - mac_policy_release_exclusive(); + mac_policy_xunlock(); return (0); } #if 0 @@ -501,7 +463,7 @@ mac_policy_unregister(struct mac_policy_ * Don't allow unloading modules with private data. */ if (mpc->mpc_field_off != NULL) { - MAC_POLICY_LIST_UNLOCK(); + mac_policy_xunlock(); return (EBUSY); } #endif @@ -510,7 +472,7 @@ mac_policy_unregister(struct mac_policy_ * its own definition. */ if ((mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_UNLOADOK) == 0) { - mac_policy_release_exclusive(); + mac_policy_xunlock(); return (EBUSY); } if (mpc->mpc_ops->mpo_destroy != NULL) @@ -519,8 +481,7 @@ mac_policy_unregister(struct mac_policy_ LIST_REMOVE(mpc, mpc_list); mpc->mpc_runtime_flags &= ~MPC_RUNTIME_FLAG_REGISTERED; mac_policy_updateflags(); - - mac_policy_release_exclusive(); + mac_policy_xunlock(); SDT_PROBE(mac, kernel, policy, unregister, mpc, 0, 0, 0, 0); printf("Security policy unload: %s (%s)\n", mpc->mpc_fullname, Modified: head/sys/security/mac/mac_inet.c ============================================================================== --- head/sys/security/mac/mac_inet.c Sat Mar 14 15:53:06 2009 (r189796) +++ head/sys/security/mac/mac_inet.c Sat Mar 14 16:06:06 2009 (r189797) @@ -84,9 +84,12 @@ mac_inpcb_label_alloc(int flag) label = mac_labelzone_alloc(flag); if (label == NULL) return (NULL); - MAC_CHECK(inpcb_init_label, label, flag); + if (flag & M_WAITOK) + MAC_CHECK(inpcb_init_label, label, flag); + else + MAC_CHECK_NOSLEEP(inpcb_init_label, label, flag); if (error) { - MAC_PERFORM(inpcb_destroy_label, label); + MAC_PERFORM_NOSLEEP(inpcb_destroy_label, label); mac_labelzone_free(label); return (NULL); } @@ -116,9 +119,12 @@ mac_ipq_label_alloc(int flag) if (label == NULL) return (NULL); - MAC_CHECK(ipq_init_label, label, flag); + if (flag & M_WAITOK) + MAC_CHECK(ipq_init_label, label, flag); + else + MAC_CHECK_NOSLEEP(ipq_init_label, label, flag); if (error) { - MAC_PERFORM(ipq_destroy_label, label); + MAC_PERFORM_NOSLEEP(ipq_destroy_label, label); mac_labelzone_free(label); return (NULL); } @@ -142,7 +148,7 @@ static void mac_inpcb_label_free(struct label *label) { - MAC_PERFORM(inpcb_destroy_label, label); + MAC_PERFORM_NOSLEEP(inpcb_destroy_label, label); mac_labelzone_free(label); } @@ -160,7 +166,7 @@ static void mac_ipq_label_free(struct label *label) { - MAC_PERFORM(ipq_destroy_label, label); + MAC_PERFORM_NOSLEEP(ipq_destroy_label, label); mac_labelzone_free(label); } @@ -178,7 +184,8 @@ void mac_inpcb_create(struct socket *so, struct inpcb *inp) { - MAC_PERFORM(inpcb_create, so, so->so_label, inp, inp->inp_label); + MAC_PERFORM_NOSLEEP(inpcb_create, so, so->so_label, inp, + inp->inp_label); } void @@ -188,7 +195,7 @@ mac_ipq_reassemble(struct ipq *q, struct label = mac_mbuf_to_label(m); - MAC_PERFORM(ipq_reassemble, q, q->ipq_label, m, label); + MAC_PERFORM_NOSLEEP(ipq_reassemble, q, q->ipq_label, m, label); } void @@ -199,7 +206,7 @@ mac_netinet_fragment(struct mbuf *m, str mlabel = mac_mbuf_to_label(m); fraglabel = mac_mbuf_to_label(frag); - MAC_PERFORM(netinet_fragment, m, mlabel, frag, fraglabel); + MAC_PERFORM_NOSLEEP(netinet_fragment, m, mlabel, frag, fraglabel); } void @@ -209,7 +216,7 @@ mac_ipq_create(struct mbuf *m, struct ip label = mac_mbuf_to_label(m); - MAC_PERFORM(ipq_create, m, label, q, q->ipq_label); + MAC_PERFORM_NOSLEEP(ipq_create, m, label, q, q->ipq_label); } void @@ -220,7 +227,8 @@ mac_inpcb_create_mbuf(struct inpcb *inp, INP_LOCK_ASSERT(inp); mlabel = mac_mbuf_to_label(m); - MAC_PERFORM(inpcb_create_mbuf, inp, inp->inp_label, m, mlabel); + MAC_PERFORM_NOSLEEP(inpcb_create_mbuf, inp, inp->inp_label, m, + mlabel); } int @@ -232,7 +240,7 @@ mac_ipq_match(struct mbuf *m, struct ipq label = mac_mbuf_to_label(m); result = 1; - MAC_BOOLEAN(ipq_match, &&, m, label, q, q->ipq_label); + MAC_BOOLEAN_NOSLEEP(ipq_match, &&, m, label, q, q->ipq_label); return (result); } @@ -245,7 +253,7 @@ mac_netinet_arp_send(struct ifnet *ifp, mlabel = mac_mbuf_to_label(m); MAC_IFNET_LOCK(ifp); - MAC_PERFORM(netinet_arp_send, ifp, ifp->if_label, m, mlabel); + MAC_PERFORM_NOSLEEP(netinet_arp_send, ifp, ifp->if_label, m, mlabel); MAC_IFNET_UNLOCK(ifp); } @@ -257,7 +265,7 @@ mac_netinet_icmp_reply(struct mbuf *mrec mrecvlabel = mac_mbuf_to_label(mrecv); msendlabel = mac_mbuf_to_label(msend); - MAC_PERFORM(netinet_icmp_reply, mrecv, mrecvlabel, msend, + MAC_PERFORM_NOSLEEP(netinet_icmp_reply, mrecv, mrecvlabel, msend, msendlabel); } @@ -268,7 +276,7 @@ mac_netinet_icmp_replyinplace(struct mbu label = mac_mbuf_to_label(m); - MAC_PERFORM(netinet_icmp_replyinplace, m, label); + MAC_PERFORM_NOSLEEP(netinet_icmp_replyinplace, m, label); } void @@ -279,7 +287,8 @@ mac_netinet_igmp_send(struct ifnet *ifp, mlabel = mac_mbuf_to_label(m); MAC_IFNET_LOCK(ifp); - MAC_PERFORM(netinet_igmp_send, ifp, ifp->if_label, m, mlabel); + MAC_PERFORM_NOSLEEP(netinet_igmp_send, ifp, ifp->if_label, m, + mlabel); MAC_IFNET_UNLOCK(ifp); } @@ -290,7 +299,7 @@ mac_netinet_tcp_reply(struct mbuf *m) label = mac_mbuf_to_label(m); - MAC_PERFORM(netinet_tcp_reply, m, label); + MAC_PERFORM_NOSLEEP(netinet_tcp_reply, m, label); } void @@ -300,7 +309,7 @@ mac_ipq_update(struct mbuf *m, struct ip label = mac_mbuf_to_label(m); - MAC_PERFORM(ipq_update, m, label, q, q->ipq_label); + MAC_PERFORM_NOSLEEP(ipq_update, m, label, q, q->ipq_label); } MAC_CHECK_PROBE_DEFINE2(inpcb_check_deliver, "struct inpcb *", @@ -316,7 +325,8 @@ mac_inpcb_check_deliver(struct inpcb *in label = mac_mbuf_to_label(m); - MAC_CHECK(inpcb_check_deliver, inp, inp->inp_label, m, label); + MAC_CHECK_NOSLEEP(inpcb_check_deliver, inp, inp->inp_label, m, + label); MAC_CHECK_PROBE2(inpcb_check_deliver, error, inp, m); return (error); @@ -332,7 +342,7 @@ mac_inpcb_check_visible(struct ucred *cr INP_LOCK_ASSERT(inp); - MAC_CHECK(inpcb_check_visible, cred, inp, inp->inp_label); + MAC_CHECK_NOSLEEP(inpcb_check_visible, cred, inp, inp->inp_label); MAC_CHECK_PROBE2(inpcb_check_visible, error, cred, inp); return (error); @@ -344,7 +354,9 @@ mac_inpcb_sosetlabel(struct socket *so, INP_WLOCK_ASSERT(inp); SOCK_LOCK_ASSERT(so); - MAC_PERFORM(inpcb_sosetlabel, so, so->so_label, inp, inp->inp_label); + + MAC_PERFORM_NOSLEEP(inpcb_sosetlabel, so, so->so_label, inp, + inp->inp_label); } void @@ -358,7 +370,7 @@ mac_netinet_firewall_reply(struct mbuf * mrecvlabel = mac_mbuf_to_label(mrecv); msendlabel = mac_mbuf_to_label(msend); - MAC_PERFORM(netinet_firewall_reply, mrecv, mrecvlabel, msend, + MAC_PERFORM_NOSLEEP(netinet_firewall_reply, mrecv, mrecvlabel, msend, msendlabel); } @@ -368,8 +380,10 @@ mac_netinet_firewall_send(struct mbuf *m struct label *label; M_ASSERTPKTHDR(m); + label = mac_mbuf_to_label(m); - MAC_PERFORM(netinet_firewall_send, m, label); + + MAC_PERFORM_NOSLEEP(netinet_firewall_send, m, label); } /* @@ -386,7 +400,7 @@ mac_syncache_destroy(struct label **labe { if (*label != NULL) { - MAC_PERFORM(syncache_destroy_label, *label); + MAC_PERFORM_NOSLEEP(syncache_destroy_label, *label); mac_labelzone_free(*label); *label = NULL; } @@ -408,9 +422,9 @@ mac_syncache_init(struct label **label) * MAC_PERFORM so we can propagate allocation failures back * to the syncache code. */ - MAC_CHECK(syncache_init_label, *label, M_NOWAIT); + MAC_CHECK_NOSLEEP(syncache_init_label, *label, M_NOWAIT); if (error) { - MAC_PERFORM(syncache_destroy_label, *label); + MAC_PERFORM_NOSLEEP(syncache_destroy_label, *label); mac_labelzone_free(*label); } return (error); @@ -424,7 +438,8 @@ mac_syncache_create(struct label *label, { INP_WLOCK_ASSERT(inp); - MAC_PERFORM(syncache_create, label, inp); + + MAC_PERFORM_NOSLEEP(syncache_create, label, inp); } void @@ -433,6 +448,8 @@ mac_syncache_create_mbuf(struct label *s struct label *mlabel; M_ASSERTPKTHDR(m); + mlabel = mac_mbuf_to_label(m); - MAC_PERFORM(syncache_create_mbuf, sc_label, m, mlabel); + + MAC_PERFORM_NOSLEEP(syncache_create_mbuf, sc_label, m, mlabel); } Modified: head/sys/security/mac/mac_inet6.c ============================================================================== --- head/sys/security/mac/mac_inet6.c Sat Mar 14 15:53:06 2009 (r189796) +++ head/sys/security/mac/mac_inet6.c Sat Mar 14 16:06:06 2009 (r189797) @@ -1,9 +1,12 @@ /*- - * Copyright (c) 2007-2008 Robert N. M. Watson + * Copyright (c) 2007-2009 Robert N. M. Watson * All rights reserved. * * This software was developed by Robert Watson for the TrustedBSD Project. * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -67,9 +70,12 @@ mac_ip6q_label_alloc(int flag) if (label == NULL) return (NULL); - MAC_CHECK(ip6q_init_label, label, flag); + if (flag & M_WAITOK) + MAC_CHECK(ip6q_init_label, label, flag); + else + MAC_CHECK_NOSLEEP(ip6q_init_label, label, flag); if (error) { - MAC_PERFORM(ip6q_destroy_label, label); + MAC_PERFORM_NOSLEEP(ip6q_destroy_label, label); mac_labelzone_free(label); return (NULL); } @@ -93,7 +99,7 @@ static void mac_ip6q_label_free(struct label *label) { - MAC_PERFORM(ip6q_destroy_label, label); + MAC_PERFORM_NOSLEEP(ip6q_destroy_label, label); mac_labelzone_free(label); } @@ -114,7 +120,7 @@ mac_ip6q_reassemble(struct ip6q *q6, str label = mac_mbuf_to_label(m); - MAC_PERFORM(ip6q_reassemble, q6, q6->ip6q_label, m, label); + MAC_PERFORM_NOSLEEP(ip6q_reassemble, q6, q6->ip6q_label, m, label); } void @@ -124,7 +130,7 @@ mac_ip6q_create(struct mbuf *m, struct i label = mac_mbuf_to_label(m); - MAC_PERFORM(ip6q_create, m, label, q6, q6->ip6q_label); + MAC_PERFORM_NOSLEEP(ip6q_create, m, label, q6, q6->ip6q_label); } int @@ -136,7 +142,7 @@ mac_ip6q_match(struct mbuf *m, struct ip label = mac_mbuf_to_label(m); result = 1; - MAC_BOOLEAN(ip6q_match, &&, m, label, q6, q6->ip6q_label); + MAC_BOOLEAN_NOSLEEP(ip6q_match, &&, m, label, q6, q6->ip6q_label); return (result); } @@ -148,7 +154,7 @@ mac_ip6q_update(struct mbuf *m, struct i label = mac_mbuf_to_label(m); - MAC_PERFORM(ip6q_update, m, label, q6, q6->ip6q_label); + MAC_PERFORM_NOSLEEP(ip6q_update, m, label, q6, q6->ip6q_label); } void @@ -158,5 +164,6 @@ mac_netinet6_nd6_send(struct ifnet *ifp, mlabel = mac_mbuf_to_label(m); - MAC_PERFORM(netinet6_nd6_send, ifp, ifp->if_label, m, mlabel); + MAC_PERFORM_NOSLEEP(netinet6_nd6_send, ifp, ifp->if_label, m, + mlabel); } Modified: head/sys/security/mac/mac_internal.h ============================================================================== --- head/sys/security/mac/mac_internal.h Sat Mar 14 15:53:06 2009 (r189796) +++ head/sys/security/mac/mac_internal.h Sat Mar 14 16:06:06 2009 (r189797) @@ -194,12 +194,10 @@ extern struct mtx mac_ifnet_mtx; */ int mac_error_select(int error1, int error2); -void mac_policy_grab_exclusive(void); -void mac_policy_assert_exclusive(void); -void mac_policy_release_exclusive(void); -void mac_policy_list_busy(void); -int mac_policy_list_conditional_busy(void); -void mac_policy_list_unbusy(void); +void mac_policy_slock_nosleep(void); +void mac_policy_slock_sleep(void); +void mac_policy_sunlock_nosleep(void); +void mac_policy_sunlock_sleep(void); struct label *mac_labelzone_alloc(int flags); void mac_labelzone_free(struct label *label); @@ -255,13 +253,16 @@ int vn_setlabel(struct vnode *vp, struct struct ucred *cred); /* + * MAC Framework composition macros invoke all registered MAC policies for a + * specific entry point. They come in two forms: one which permits policies + * to sleep/block, and another that does not. + * * MAC_CHECK performs the designated check by walking the policy module list * and checking with each as to how it feels about the request. Note that it * returns its value via 'error' in the scope of the caller. */ #define MAC_CHECK(check, args...) do { \ struct mac_policy_conf *mpc; \ - int entrycount; \ \ error = 0; \ LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) { \ @@ -270,14 +271,37 @@ int vn_setlabel(struct vnode *vp, struct mpc->mpc_ops->mpo_ ## check (args), \ error); \ } \ - if ((entrycount = mac_policy_list_conditional_busy()) != 0) { \ + if (!LIST_EMPTY(&mac_policy_list)) { \ + mac_policy_slock_sleep(); \ LIST_FOREACH(mpc, &mac_policy_list, mpc_list) { \ if (mpc->mpc_ops->mpo_ ## check != NULL) \ error = mac_error_select( \ mpc->mpc_ops->mpo_ ## check (args), \ error); \ } \ - mac_policy_list_unbusy(); \ + mac_policy_sunlock_sleep(); \ + } \ +} while (0) + +#define MAC_CHECK_NOSLEEP(check, args...) do { \ + struct mac_policy_conf *mpc; \ + \ + error = 0; \ + LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) { \ + if (mpc->mpc_ops->mpo_ ## check != NULL) \ + error = mac_error_select( \ + mpc->mpc_ops->mpo_ ## check (args), \ + error); \ + } \ + if (!LIST_EMPTY(&mac_policy_list)) { \ + mac_policy_slock_nosleep(); \ + LIST_FOREACH(mpc, &mac_policy_list, mpc_list) { \ + if (mpc->mpc_ops->mpo_ ## check != NULL) \ + error = mac_error_select( \ + mpc->mpc_ops->mpo_ ## check (args), \ + error); \ + } \ + mac_policy_sunlock_nosleep(); \ } \ } while (0) @@ -288,9 +312,8 @@ int vn_setlabel(struct vnode *vp, struct * EPERM. Note that it returns its value via 'error' in the scope of the * caller. */ -#define MAC_GRANT(check, args...) do { \ +#define MAC_GRANT_NOSLEEP(check, args...) do { \ struct mac_policy_conf *mpc; \ - int entrycount; \ \ error = EPERM; \ LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) { \ @@ -299,7 +322,8 @@ int vn_setlabel(struct vnode *vp, struct error = 0; \ } \ } \ - if ((entrycount = mac_policy_list_conditional_busy()) != 0) { \ + if (!LIST_EMPTY(&mac_policy_list)) { \ + mac_policy_slock_nosleep(); \ LIST_FOREACH(mpc, &mac_policy_list, mpc_list) { \ if (mpc->mpc_ops->mpo_ ## check != NULL) { \ if (mpc->mpc_ops->mpo_ ## check (args) \ @@ -307,7 +331,7 @@ int vn_setlabel(struct vnode *vp, struct error = 0; \ } \ } \ - mac_policy_list_unbusy(); \ + mac_policy_sunlock_nosleep(); \ } \ } while (0) @@ -320,21 +344,41 @@ int vn_setlabel(struct vnode *vp, struct */ #define MAC_BOOLEAN(operation, composition, args...) do { \ struct mac_policy_conf *mpc; \ - int entrycount; \ \ LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) { \ if (mpc->mpc_ops->mpo_ ## operation != NULL) \ result = result composition \ mpc->mpc_ops->mpo_ ## operation (args); \ } \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 16:06:51 2009 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 022B0106567A; Sat, 14 Mar 2009 16:06:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 9592E8FC15; Sat, 14 Mar 2009 16:06:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LiWNs-000JcP-OK; Sat, 14 Mar 2009 18:06:48 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n2EG6gJ9017303 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 14 Mar 2009 18:06:42 +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.3/8.14.3) with ESMTP id n2EG6g0b060410; Sat, 14 Mar 2009 18:06:42 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n2EG6gpi060409; Sat, 14 Mar 2009 18:06:42 +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: Sat, 14 Mar 2009 18:06:42 +0200 From: Kostik Belousov To: Randall Stewart Message-ID: <20090314160642.GY41617@deviant.kiev.zoral.com.ua> References: <200903141342.n2EDgESI094655@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wdAtavOaSyB5+AHQ" Content-Disposition: inline In-Reply-To: <200903141342.n2EDgESI094655@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 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 X-Virus-Scanned: mail.terabit.net.ua 1LiWNs-000JcP-OK 0ca8c389cfa0c051869c127b4a4b57e7 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189790 - 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 Mar 2009 16:06:51 -0000 --wdAtavOaSyB5+AHQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 14, 2009 at 01:42:14PM +0000, Randall Stewart wrote: > Author: rrs > Date: Sat Mar 14 13:42:13 2009 > New Revision: 189790 > URL: http://svn.freebsd.org/changeset/base/189790 >=20 > Log: > Fixes several PR-SCTP releated bugs. > - When sending large PR-SCTP messages over a > lossy link we would incorrectly calculate the fwd-tsn > - When receiving large multipart pr-sctp packets we would > incorrectly send back a SACK that would renege improperly > on already received packets thus causing unneeded retransmissions. With this commit, I get /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c: In funct= ion 'sctp_express_handle_sack': /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c:4772: err= or: 'struct sctp_data_chunkrec' has no member named 'fwd_tsn_cnt' /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c:4773: err= or: 'struct sctp_data_chunkrec' has no member named 'fwd_tsn_cnt' /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c:4775: err= or: 'struct sctp_data_chunkrec' has no member named 'fwd_tsn_cnt' =2E.. --wdAtavOaSyB5+AHQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm71hEACgkQC3+MBN1Mb4h48QCdG+o1OQUXhNpiWJnvc0YrpsT3 tpoAmwS54lUXysclIbJ5OoRc76MaXmVs =JGON -----END PGP SIGNATURE----- --wdAtavOaSyB5+AHQ-- From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 17:54:58 2009 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 DC633106566B; Sat, 14 Mar 2009 17:54:58 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B079F8FC08; Sat, 14 Mar 2009 17:54:58 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EHsw45003174; Sat, 14 Mar 2009 17:54:58 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EHswaj003173; Sat, 14 Mar 2009 17:54:58 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903141754.n2EHswaj003173@svn.freebsd.org> From: Sam Leffler Date: Sat, 14 Mar 2009 17:54: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: r189800 - 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 Mar 2009 17:54:59 -0000 Author: sam Date: Sat Mar 14 17:54:58 2009 New Revision: 189800 URL: http://svn.freebsd.org/changeset/base/189800 Log: remove stray ; Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sat Mar 14 17:53:01 2009 (r189799) +++ head/sys/net/if.c Sat Mar 14 17:54:58 2009 (r189800) @@ -533,7 +533,7 @@ if_free_type(struct ifnet *ifp, u_char t IF_ADDR_LOCK_DESTROY(ifp); free(ifp, M_IFNET); -}; +} void ifq_attach(struct ifaltq *ifq, struct ifnet *ifp) From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 17:55:16 2009 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 ABC5C10656D9; Sat, 14 Mar 2009 17:55:16 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97CC58FC15; Sat, 14 Mar 2009 17:55:16 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EHtG3L003238; Sat, 14 Mar 2009 17:55:16 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EHtGj1003232; Sat, 14 Mar 2009 17:55:16 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200903141755.n2EHtGj1003232@svn.freebsd.org> From: Roman Divacky Date: Sat, 14 Mar 2009 17:55: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: r189801 - in head: cddl cddl/lib/libzpool cddl/usr.bin/ztest cddl/usr.sbin/zdb share/mk tools/regression/include/tgmath 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 Mar 2009 17:55:17 -0000 Author: rdivacky Date: Sat Mar 14 17:55:16 2009 New Revision: 189801 URL: http://svn.freebsd.org/changeset/base/189801 Log: Switch over to gnu99 compilation on default for userland. Tested by: make universe Tested by: ports exp build (done by pav) Reviewed by: ru Reviewed by: silence on arch Approved by: ed (mentor) Modified: head/cddl/Makefile.inc head/cddl/lib/libzpool/Makefile head/cddl/usr.bin/ztest/Makefile head/cddl/usr.sbin/zdb/Makefile head/share/mk/bsd.sys.mk head/tools/regression/include/tgmath/Makefile Modified: head/cddl/Makefile.inc ============================================================================== --- head/cddl/Makefile.inc Sat Mar 14 17:54:58 2009 (r189800) +++ head/cddl/Makefile.inc Sat Mar 14 17:55:16 2009 (r189801) @@ -6,3 +6,5 @@ OPENSOLARIS_SYS_DISTDIR= ${.CURDIR}/../. IGNORE_PRAGMA= YES CFLAGS+= -DNEED_SOLARIS_BOOLEAN + +CSTD?= gnu89 Modified: head/cddl/lib/libzpool/Makefile ============================================================================== --- head/cddl/lib/libzpool/Makefile Sat Mar 14 17:54:58 2009 (r189800) +++ head/cddl/lib/libzpool/Makefile Sat Mar 14 17:55:16 2009 (r189801) @@ -33,8 +33,6 @@ SRCS= ${ZFS_COMMON_SRCS} ${ZFS_SHARED_S ${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \ ${UNICODE_SRCS} -CFLAGS+= -std=c99 - CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem @@ -60,4 +58,6 @@ LDADD= -lpthread -lz # atomic.S doesn't like profiling. NO_PROFILE= +CSTD= c99 + .include Modified: head/cddl/usr.bin/ztest/Makefile ============================================================================== --- head/cddl/usr.bin/ztest/Makefile Sat Mar 14 17:54:58 2009 (r189800) +++ head/cddl/usr.bin/ztest/Makefile Sat Mar 14 17:55:16 2009 (r189801) @@ -5,8 +5,6 @@ PROG= ztest NO_MAN= -CFLAGS+= -std=c99 - CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/include CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/lib/libumem @@ -21,4 +19,6 @@ DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} $ ${LIBPTHREAD} ${LIBZ} ${LIBAVL} LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl +CSTD= c99 + .include Modified: head/cddl/usr.sbin/zdb/Makefile ============================================================================== --- head/cddl/usr.sbin/zdb/Makefile Sat Mar 14 17:54:58 2009 (r189800) +++ head/cddl/usr.sbin/zdb/Makefile Sat Mar 14 17:55:16 2009 (r189801) @@ -6,8 +6,6 @@ PROG= zdb MAN= zdb.8 SRCS= zdb.c zdb_il.c -CFLAGS+= -std=c99 - CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem @@ -25,4 +23,6 @@ DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LI ${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL} LDADD= -lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool +CSTD= c99 + .include Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Sat Mar 14 17:54:58 2009 (r189800) +++ head/share/mk/bsd.sys.mk Sat Mar 14 17:55:16 2009 (r189801) @@ -8,22 +8,23 @@ # for GCC: http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143 +# the default is gnu99 for now +CSTD ?= gnu99 + .if !defined(NO_WARNS) && ${CC} != "icc" -. if defined(CSTD) -. if ${CSTD} == "k&r" +. if ${CSTD} == "k&r" CFLAGS += -traditional -. elif ${CSTD} == "c89" || ${CSTD} == "c90" +. elif ${CSTD} == "c89" || ${CSTD} == "c90" CFLAGS += -std=iso9899:1990 -. elif ${CSTD} == "c94" || ${CSTD} == "c95" +. elif ${CSTD} == "c94" || ${CSTD} == "c95" CFLAGS += -std=iso9899:199409 -. elif ${CSTD} == "c99" +. elif ${CSTD} == "c99" CFLAGS += -std=iso9899:1999 -. else +. else CFLAGS += -std=${CSTD} -. endif +. endif # -pedantic is problematic because it also imposes namespace restrictions #CFLAGS += -pedantic -. endif . if defined(WARNS) . if ${WARNS} >= 1 CWARNFLAGS += -Wsystem-headers Modified: head/tools/regression/include/tgmath/Makefile ============================================================================== --- head/tools/regression/include/tgmath/Makefile Sat Mar 14 17:54:58 2009 (r189800) +++ head/tools/regression/include/tgmath/Makefile Sat Mar 14 17:55:16 2009 (r189801) @@ -1,7 +1,8 @@ # $FreeBSD$ PROG= tgmath -CFLAGS+= -fno-builtin -std=c99 +CSTD= c99 +CFLAGS+= -fno-builtin NO_MAN= .include From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 18:24:15 2009 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 E0EB8106564A; Sat, 14 Mar 2009 18:24:15 +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 CEE038FC14; Sat, 14 Mar 2009 18:24:15 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EIOFfr003865; Sat, 14 Mar 2009 18:24:15 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EIOFGJ003860; Sat, 14 Mar 2009 18:24:15 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141824.n2EIOFGJ003860@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 18:24: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: r189803 - head/lib/msun/src 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 Mar 2009 18:24:16 -0000 Author: das Date: Sat Mar 14 18:24:15 2009 New Revision: 189803 URL: http://svn.freebsd.org/changeset/base/189803 Log: Eliminate __real__ and __imag__ gccisms. Modified: head/lib/msun/src/math_private.h head/lib/msun/src/s_cimag.c head/lib/msun/src/s_cimagf.c head/lib/msun/src/s_cimagl.c Modified: head/lib/msun/src/math_private.h ============================================================================== --- head/lib/msun/src/math_private.h Sat Mar 14 18:19:50 2009 (r189802) +++ head/lib/msun/src/math_private.h Sat Mar 14 18:24:15 2009 (r189803) @@ -190,6 +190,27 @@ do { \ void _scan_nan(uint32_t *__words, int __num_words, const char *__s); #ifdef _COMPLEX_H + +/* + * C99 specifies that complex numbers have the same representation as + * an array of two elements, where the first element is the real part + * and the second element is the imaginary part. + */ +typedef union { + float complex f; + float a[2]; +} float_complex; +typedef union { + double complex f; + double a[2]; +} double_complex; +typedef union { + long double complex f; + long double a[2]; +} long_double_complex; +#define REALPART(z) ((z).a[0]) +#define IMAGPART(z) ((z).a[1]) + /* * Inline functions that can be used to construct complex values. * @@ -203,31 +224,31 @@ void _scan_nan(uint32_t *__words, int __ static __inline float complex cpackf(float x, float y) { - float complex z; + float_complex z; - __real__ z = x; - __imag__ z = y; - return (z); + REALPART(z) = x; + IMAGPART(z) = y; + return (z.f); } static __inline double complex cpack(double x, double y) { - double complex z; + double_complex z; - __real__ z = x; - __imag__ z = y; - return (z); + REALPART(z) = x; + IMAGPART(z) = y; + return (z.f); } static __inline long double complex cpackl(long double x, long double y) { - long double complex z; + long_double_complex z; - __real__ z = x; - __imag__ z = y; - return (z); + REALPART(z) = x; + IMAGPART(z) = y; + return (z.f); } #endif /* _COMPLEX_H */ Modified: head/lib/msun/src/s_cimag.c ============================================================================== --- head/lib/msun/src/s_cimag.c Sat Mar 14 18:19:50 2009 (r189802) +++ head/lib/msun/src/s_cimag.c Sat Mar 14 18:24:15 2009 (r189803) @@ -27,10 +27,12 @@ */ #include +#include "math_private.h" double cimag(double complex z) { + const double_complex z1 = { .f = z }; - return (__imag__ z); + return (IMAGPART(z1)); } Modified: head/lib/msun/src/s_cimagf.c ============================================================================== --- head/lib/msun/src/s_cimagf.c Sat Mar 14 18:19:50 2009 (r189802) +++ head/lib/msun/src/s_cimagf.c Sat Mar 14 18:24:15 2009 (r189803) @@ -27,10 +27,12 @@ */ #include +#include "math_private.h" float cimagf(float complex z) { + const float_complex z1 = { .f = z }; - return (__imag__ z); + return (IMAGPART(z1)); } Modified: head/lib/msun/src/s_cimagl.c ============================================================================== --- head/lib/msun/src/s_cimagl.c Sat Mar 14 18:19:50 2009 (r189802) +++ head/lib/msun/src/s_cimagl.c Sat Mar 14 18:24:15 2009 (r189803) @@ -27,10 +27,12 @@ */ #include +#include "math_private.h" long double cimagl(long double complex z) { + const long_double_complex z1 = { .f = z }; - return (__imag__ z); + return (IMAGPART(z1)); } From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 18:55:51 2009 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 B28C0106564A; Sat, 14 Mar 2009 18:55:51 +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 9F3A38FC1C; Sat, 14 Mar 2009 18:55:51 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EItpR5004553; Sat, 14 Mar 2009 18:55:51 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EItpnp004551; Sat, 14 Mar 2009 18:55:51 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141855.n2EItpnp004551@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 18:55: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: r189804 - head/usr.bin/ncal 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 Mar 2009 18:55:52 -0000 Author: das Date: Sat Mar 14 18:55:51 2009 New Revision: 189804 URL: http://svn.freebsd.org/changeset/base/189804 Log: Multibyte character support for cal(1). PR: 131578 Modified: head/usr.bin/ncal/ncal.1 head/usr.bin/ncal/ncal.c Modified: head/usr.bin/ncal/ncal.1 ============================================================================== --- head/usr.bin/ncal/ncal.1 Sat Mar 14 18:24:15 2009 (r189803) +++ head/usr.bin/ncal/ncal.1 Sat Mar 14 18:55:51 2009 (r189804) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2005 +.Dd March 14, 2009 .Dt CAL 1 .Os .Sh NAME @@ -142,7 +142,3 @@ command and manual were written by .Sh BUGS The assignment of Julian\(enGregorian switching dates to country codes is historically naive for many countries. -.Pp -The -.Nm -utility does not recognize multibyte characters. Modified: head/usr.bin/ncal/ncal.c ============================================================================== --- head/usr.bin/ncal/ncal.c Sat Mar 14 18:24:15 2009 (r189803) +++ head/usr.bin/ncal/ncal.c Sat Mar 14 18:55:51 2009 (r189804) @@ -40,6 +40,8 @@ static const char rcsid[] = #include #include #include +#include +#include /* Width of one month with backward compatibility */ #define MONTH_WIDTH_B_J 27 @@ -53,13 +55,13 @@ static const char rcsid[] = typedef struct date date; struct monthlines { - char name[MAX_WIDTH + 1]; + wchar_t name[MAX_WIDTH + 1]; char lines[7][MAX_WIDTH + 1]; char weeks[MAX_WIDTH + 1]; }; struct weekdays { - char names[7][4]; + wchar_t names[7][4]; }; /* The switches from Julian to Gregorian in some countries */ @@ -159,6 +161,7 @@ int nswitch; /* user defined switch int nswitchb; /* switch date for backward compatibility */ 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); @@ -418,9 +421,9 @@ printmonth(int y, int m, int jd_flag) mkmonth(y, m - 1, jd_flag, &month); mkweekdays(&wds); - printf(" %s %d\n", month.name, y); + printf(" %ls %d\n", month.name, y); for (i = 0; i != 7; i++) - printf("%.2s%s\n", wds.names[i], month.lines[i]); + printf("%.2ls%s\n", wds.names[i], month.lines[i]); if (flag_weeks) printf(" %s\n", month.weeks); } @@ -430,7 +433,7 @@ printmonthb(int y, int m, int jd_flag) { struct monthlines month; struct weekdays wds; - char s[MAX_WIDTH], t[MAX_WIDTH]; + wchar_t s[MAX_WIDTH], t[MAX_WIDTH]; int i; int mw; @@ -439,16 +442,17 @@ printmonthb(int y, int m, int jd_flag) mw = jd_flag ? MONTH_WIDTH_B_J : MONTH_WIDTH_B; - sprintf(s, "%s %d", month.name, y); - printf("%s\n", center(t, s, mw)); + swprintf(s, MAX_WIDTH, L"%ls %d", month.name, y); + wprintf(L"%ls\n", wcenter(t, s, mw)); if (jd_flag) - printf(" %s %s %s %s %s %s %.2s\n", wds.names[6], wds.names[0], + wprintf(L" %ls %ls %ls %ls %ls %ls %.2ls\n", + wds.names[6], wds.names[0], wds.names[1], wds.names[2], wds.names[3], wds.names[4], wds.names[5]); else - printf("%s%s%s%s%s%s%.2s\n", wds.names[6], wds.names[0], - wds.names[1], wds.names[2], wds.names[3], + wprintf(L"%ls%ls%ls%ls%ls%ls%.2ls\n", wds.names[6], + wds.names[0], wds.names[1], wds.names[2], wds.names[3], wds.names[4], wds.names[5]); for (i = 0; i != 6; i++) @@ -475,17 +479,17 @@ printyear(int y, int jd_flag) printf("%s\n", center(t, s, mpl * mw)); for (j = 0; j != 12; j += mpl) { - printf(" %-*s%-*s", + printf(" %-*ls%-*ls", mw, year[j].name, mw, year[j + 1].name); if (mpl == 3) - printf("%s\n", year[j + 2].name); + printf("%ls\n", year[j + 2].name); else - printf("%-*s%s\n", + printf("%-*ls%ls\n", mw, year[j + 2].name, year[j + 3].name); for (i = 0; i != 7; i++) { - printf("%.2s%-*s%-*s", + printf("%.2ls%-*s%-*s", wds.names[i], mw, year[j].lines[i], mw, year[j + 1].lines[i]); @@ -518,6 +522,7 @@ printyearb(int y, int jd_flag) struct monthlines year[12]; struct weekdays wds; char s[80], t[80]; + wchar_t ws[80], wt[80]; int i, j; int mpl; int mw; @@ -532,17 +537,17 @@ printyearb(int y, int jd_flag) printf("%s\n\n", center(t, s, mw * mpl + mpl)); for (j = 0; j != 12; j += mpl) { - printf("%-*s ", mw, center(s, year[j].name, mw)); + printf("%-*ls ", mw, wcenter(ws, year[j].name, mw)); if (mpl == 2) - printf("%s\n", center(s, year[j + 1].name, mw)); + printf("%ls\n", wcenter(ws, year[j + 1].name, mw)); else - printf("%-*s %s\n", mw, - center(s, year[j + 1].name, mw), - center(t, year[j + 2].name, mw)); + printf("%-*ls %ls\n", mw, + wcenter(ws, year[j + 1].name, mw), + wcenter(wt, year[j + 2].name, mw)); if (mpl == 2) - printf(" %s %s %s %s %s %s %s " - " %s %s %s %s %s %s %.2s\n", + wprintf(L" %ls %ls %ls %ls %ls %ls %ls " + " %ls %ls %ls %ls %ls %ls %.2ls\n", wds.names[6], wds.names[0], wds.names[1], wds.names[2], wds.names[3], wds.names[4], wds.names[5], @@ -550,9 +555,9 @@ printyearb(int y, int jd_flag) wds.names[2], wds.names[3], wds.names[4], wds.names[5]); else - printf("%s%s%s%s%s%s%s " - "%s%s%s%s%s%s%s " - "%s%s%s%s%s%s%.2s\n", + wprintf(L"%ls%ls%ls%ls%ls%ls%ls " + "%ls%ls%ls%ls%ls%ls%ls " + "%ls%ls%ls%ls%ls%ls%.2ls\n", wds.names[6], wds.names[0], wds.names[1], wds.names[2], wds.names[3], wds.names[4], wds.names[5], @@ -596,8 +601,9 @@ mkmonth(int y, int m, int jd_flag, struc /* Set name of month. */ memset(&tm, 0, sizeof(tm)); tm.tm_mon = m; - strftime(mlines->name, sizeof(mlines->name), "%OB", &tm); - mlines->name[0] = toupper((unsigned char)mlines->name[0]); + wcsftime(mlines->name, sizeof(mlines->name) / sizeof(mlines->name[0]), + L"%OB", &tm); + mlines->name[0] = towupper(mlines->name[0]); /* * Set first and last to the day number of the first day of this @@ -688,8 +694,9 @@ mkmonthb(int y, int m, int jd_flag, stru /* Set name of month centered */ memset(&tm, 0, sizeof(tm)); tm.tm_mon = m; - strftime(mlines->name, sizeof(mlines->name), "%OB", &tm); - mlines->name[0] = toupper((unsigned char)mlines->name[0]); + wcsftime(mlines->name, sizeof(mlines->name) / sizeof(mlines->name[0]), + L"%OB", &tm); + mlines->name[0] = towupper(mlines->name[0]); /* * Set first and last to the day number of the first day of this @@ -754,18 +761,18 @@ mkweekdays(struct weekdays *wds) { int i, len; struct tm tm; - char buf[20]; + wchar_t buf[20]; memset(&tm, 0, sizeof(tm)); for (i = 0; i != 7; i++) { tm.tm_wday = (i+1) % 7; - strftime(buf, sizeof(buf), "%a", &tm); - len = strlen(buf); + wcsftime(buf, sizeof(buf), L"%a", &tm); + len = wcslen(buf); if (len > 2) len = 2; - strcpy(wds->names[i], " "); - strncpy(wds->names[i] + 2 - len, buf, len); + wcscpy(wds->names[i], L" "); + wcsncpy(wds->names[i] + 2 - len, buf, len); } } @@ -858,6 +865,17 @@ center(char *s, char *t, int w) return (s); } +/* Center string t in string s of length w by putting enough leading blanks */ +wchar_t * +wcenter(wchar_t *s, wchar_t *t, int w) +{ + char blanks[80]; + + memset(blanks, ' ', sizeof(blanks)); + swprintf(s, MAX_WIDTH, L"%.*s%ls", (int)(w - wcslen(t)) / 2, blanks, t); + return (s); +} + int parsemonth(const char *s, int *m, int *y) { From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 18:58:53 2009 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 AD6A21065670; Sat, 14 Mar 2009 18:58:53 +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 9AB638FC0C; Sat, 14 Mar 2009 18:58:53 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EIwr1S004640; Sat, 14 Mar 2009 18:58:53 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EIwrVM004639; Sat, 14 Mar 2009 18:58:53 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141858.n2EIwrVM004639@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 18: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: r189805 - head/lib/msun/src 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 Mar 2009 18:58:54 -0000 Author: das Date: Sat Mar 14 18:58:53 2009 New Revision: 189805 URL: http://svn.freebsd.org/changeset/base/189805 Log: Namespace: scalb() is withdrawn from POSIX. Modified: head/lib/msun/src/math.h Modified: head/lib/msun/src/math.h ============================================================================== --- head/lib/msun/src/math.h Sat Mar 14 18:55:51 2009 (r189804) +++ head/lib/msun/src/math.h Sat Mar 14 18:58:53 2009 (r189805) @@ -249,7 +249,6 @@ double rint(double); double j0(double); double j1(double); double jn(int, double); -double scalb(double, double); double y0(double); double y1(double); double yn(int, double); @@ -257,6 +256,10 @@ double yn(int, double); #if __XSI_VISIBLE <= 500 || __BSD_VISIBLE double gamma(double); #endif + +#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE +double scalb(double, double); +#endif #endif /* __BSD_VISIBLE || __XSI_VISIBLE */ #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:00:16 2009 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 92889106564A; Sat, 14 Mar 2009 19:00:16 +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 811E38FC13; Sat, 14 Mar 2009 19:00:16 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ0G4D004727; Sat, 14 Mar 2009 19:00:16 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ0GBL004726; Sat, 14 Mar 2009 19:00:16 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141900.n2EJ0GBL004726@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19: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: r189806 - head/include/arpa 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 Mar 2009 19:00:17 -0000 Author: das Date: Sat Mar 14 19:00:16 2009 New Revision: 189806 URL: http://svn.freebsd.org/changeset/base/189806 Log: Namespace: inet_ntoa_r() is a BSD extension. Modified: head/include/arpa/inet.h Modified: head/include/arpa/inet.h ============================================================================== --- head/include/arpa/inet.h Sat Mar 14 18:58:53 2009 (r189805) +++ head/include/arpa/inet.h Sat Mar 14 19:00:16 2009 (r189806) @@ -148,7 +148,6 @@ uint16_t ntohs(uint16_t); in_addr_t inet_addr(const char *); /*const*/ char *inet_ntoa(struct in_addr); -char *inet_ntoa_r(struct in_addr, char *buf, socklen_t size); const char *inet_ntop(int, const void * __restrict, char * __restrict, socklen_t); int inet_pton(int, const char * __restrict, void * __restrict); @@ -162,6 +161,7 @@ in_addr_t inet_netof(struct in_addr); in_addr_t inet_network(const char *); char *inet_net_ntop(int, const void *, int, char *, size_t); int inet_net_pton(int, const char *, void *, size_t); +char *inet_ntoa_r(struct in_addr, char *buf, socklen_t size); char *inet_cidr_ntop(int, const void *, int, char *, size_t); int inet_cidr_pton(int, const char *, void *, int *); unsigned inet_nsap_addr(const char *, unsigned char *, int); From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:01:27 2009 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 4B1901065675; Sat, 14 Mar 2009 19:01:27 +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 39A328FC15; Sat, 14 Mar 2009 19:01:27 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ1RM3004785; Sat, 14 Mar 2009 19:01:27 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ1RTE004784; Sat, 14 Mar 2009 19:01:27 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141901.n2EJ1RTE004784@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:01: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: r189807 - 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: Sat, 14 Mar 2009 19:01:27 -0000 Author: das Date: Sat Mar 14 19:01:26 2009 New Revision: 189807 URL: http://svn.freebsd.org/changeset/base/189807 Log: Namespace: _setjmp() and _longjmp() are XSI extensions. Modified: head/include/setjmp.h Modified: head/include/setjmp.h ============================================================================== --- head/include/setjmp.h Sat Mar 14 19:00:16 2009 (r189806) +++ head/include/setjmp.h Sat Mar 14 19:01:26 2009 (r189807) @@ -48,7 +48,7 @@ #include __BEGIN_DECLS -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __BSD_VISIBLE || __XSI_VISIBLE >= 600 void _longjmp(jmp_buf, int) __dead2; int _setjmp(jmp_buf); #endif From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:02:28 2009 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 C85E81065670; Sat, 14 Mar 2009 19:02:28 +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 B701C8FC18; Sat, 14 Mar 2009 19:02:28 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ2SJt004844; Sat, 14 Mar 2009 19:02:28 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ2Shn004843; Sat, 14 Mar 2009 19:02:28 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141902.n2EJ2Shn004843@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:02: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: r189808 - 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: Sat, 14 Mar 2009 19:02:29 -0000 Author: das Date: Sat Mar 14 19:02:28 2009 New Revision: 189808 URL: http://svn.freebsd.org/changeset/base/189808 Log: Namespace: dbm_forder() and dbm_dirfno() are BSD extensions. Modified: head/include/ndbm.h Modified: head/include/ndbm.h ============================================================================== --- head/include/ndbm.h Sat Mar 14 19:01:26 2009 (r189807) +++ head/include/ndbm.h Sat Mar 14 19:02:28 2009 (r189808) @@ -70,11 +70,15 @@ int dbm_delete(DBM *, datum); int dbm_error(DBM *); datum dbm_fetch(DBM *, datum); datum dbm_firstkey(DBM *); +#if __BSD_VISIBLE long dbm_forder(DBM *, datum); +#endif datum dbm_nextkey(DBM *); DBM *dbm_open(const char *, int, int); int dbm_store(DBM *, datum, datum, int); +#if __BSD_VISIBLE int dbm_dirfno(DBM *); +#endif __END_DECLS #endif /* !_NDBM_H_ */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:03:34 2009 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 99694106566B; Sat, 14 Mar 2009 19:03:34 +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 87C6E8FC1B; Sat, 14 Mar 2009 19:03:34 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ3YIu004906; Sat, 14 Mar 2009 19:03:34 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ3Ytw004905; Sat, 14 Mar 2009 19:03:34 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141903.n2EJ3Ytw004905@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:03: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: r189809 - 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: Sat, 14 Mar 2009 19:03:35 -0000 Author: das Date: Sat Mar 14 19:03:34 2009 New Revision: 189809 URL: http://svn.freebsd.org/changeset/base/189809 Log: Namespace: memccpy() and memchr() are XSI, and memrchr() is a BSD extension. Modified: head/include/string.h Modified: head/include/string.h ============================================================================== --- head/include/string.h Sat Mar 14 19:02:28 2009 (r189808) +++ head/include/string.h Sat Mar 14 19:03:34 2009 (r189809) @@ -55,11 +55,13 @@ typedef __size_t size_t; #endif __BEGIN_DECLS -#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __XSI_VISIBLE >= 600 void *memccpy(void * __restrict, const void * __restrict, int, size_t); #endif void *memchr(const void *, int, size_t) __pure; +#if __BSD_VISIBLE void *memrchr(const void *, int, size_t) __pure; +#endif int memcmp(const void *, const void *, size_t) __pure; void *memcpy(void * __restrict, const void * __restrict, size_t); #if __BSD_VISIBLE From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:04:25 2009 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 4692A1065675; Sat, 14 Mar 2009 19:04:25 +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 354488FC1F; Sat, 14 Mar 2009 19:04:25 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ4PYq004998; Sat, 14 Mar 2009 19:04:25 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ4PLP004997; Sat, 14 Mar 2009 19:04:25 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141904.n2EJ4PLP004997@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:04: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: r189811 - 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: Sat, 14 Mar 2009 19:04:26 -0000 Author: das Date: Sat Mar 14 19:04:24 2009 New Revision: 189811 URL: http://svn.freebsd.org/changeset/base/189811 Log: Don't prototype _tolower() and _toupper(). They're not supposed to be functions, and there's no implementation of them in any case. Modified: head/include/ctype.h Modified: head/include/ctype.h ============================================================================== --- head/include/ctype.h Sat Mar 14 19:03:40 2009 (r189810) +++ head/include/ctype.h Sat Mar 14 19:04:24 2009 (r189811) @@ -65,8 +65,6 @@ int tolower(int); int toupper(int); #if __XSI_VISIBLE -int _tolower(int); -int _toupper(int); int isascii(int); int toascii(int); #endif From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:05:18 2009 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 6E918106564A; Sat, 14 Mar 2009 19:05:18 +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 5D8648FC1B; Sat, 14 Mar 2009 19:05:18 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ5I2f005059; Sat, 14 Mar 2009 19:05:18 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ5Ik5005058; Sat, 14 Mar 2009 19:05:18 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141905.n2EJ5Ik5005058@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:05: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: r189812 - 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: Sat, 14 Mar 2009 19:05:19 -0000 Author: das Date: Sat Mar 14 19:05:18 2009 New Revision: 189812 URL: http://svn.freebsd.org/changeset/base/189812 Log: Namespace: setgrent() is an XSI extension. Modified: head/include/grp.h Modified: head/include/grp.h ============================================================================== --- head/include/grp.h Sat Mar 14 19:04:24 2009 (r189811) +++ head/include/grp.h Sat Mar 14 19:05:18 2009 (r189812) @@ -74,9 +74,11 @@ struct group *getgrnam(const char *); #if __BSD_VISIBLE const char *group_from_gid(gid_t, int); #endif -#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __BSD_VISIBLE || __XSI_VISIBLE /* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ int setgrent(void); +#endif +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); int getgrnam_r(const char *, struct group *, char *, size_t, From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:06:07 2009 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 819F11065689; Sat, 14 Mar 2009 19:06:07 +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 6FD878FC20; Sat, 14 Mar 2009 19:06:07 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ67Ud005120; Sat, 14 Mar 2009 19:06:07 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ67p2005119; Sat, 14 Mar 2009 19:06:07 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141906.n2EJ67p2005119@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:06: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: r189813 - head/sys/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: Sat, 14 Mar 2009 19:06:08 -0000 Author: das Date: Sat Mar 14 19:06:07 2009 New Revision: 189813 URL: http://svn.freebsd.org/changeset/base/189813 Log: Use namespace visibility macros instead of checking for _POSIX_SOURCE. Modified: head/sys/sys/termios.h Modified: head/sys/sys/termios.h ============================================================================== --- head/sys/sys/termios.h Sat Mar 14 19:05:18 2009 (r189812) +++ head/sys/sys/termios.h Sat Mar 14 19:06:07 2009 (r189813) @@ -273,10 +273,10 @@ int tcsendbreak(int, int); pid_t tcgetsid(int); #endif -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE void cfmakeraw(struct termios *); int cfsetspeed(struct termios *, speed_t); -#endif /* !_POSIX_SOURCE */ +#endif __END_DECLS #endif /* !_KERNEL */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:06:53 2009 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 368511065743; Sat, 14 Mar 2009 19:06:53 +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 2183F8FC17; Sat, 14 Mar 2009 19:06:53 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ6rDW005167; Sat, 14 Mar 2009 19:06:53 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ6qv4005165; Sat, 14 Mar 2009 19:06:52 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141906.n2EJ6qv4005165@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:06: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: r189814 - head/sys/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: Sat, 14 Mar 2009 19:06:54 -0000 Author: das Date: Sat Mar 14 19:06:52 2009 New Revision: 189814 URL: http://svn.freebsd.org/changeset/base/189814 Log: Namespace: semsys() and shmsys() aren't standard. Modified: head/sys/sys/sem.h head/sys/sys/shm.h Modified: head/sys/sys/sem.h ============================================================================== --- head/sys/sys/sem.h Sat Mar 14 19:06:07 2009 (r189813) +++ head/sys/sys/sem.h Sat Mar 14 19:06:52 2009 (r189814) @@ -117,7 +117,9 @@ void semexit(struct proc *p); #else /* ! _KERNEL */ __BEGIN_DECLS +#if __BSD_VISIBLE int semsys(int, ...); +#endif int semctl(int, int, int, ...); int semget(key_t, int, int); int semop(int, struct sembuf *, size_t); Modified: head/sys/sys/shm.h ============================================================================== --- head/sys/sys/shm.h Sat Mar 14 19:06:07 2009 (r189813) +++ head/sys/sys/shm.h Sat Mar 14 19:06:52 2009 (r189814) @@ -138,7 +138,9 @@ typedef __size_t size_t; #endif __BEGIN_DECLS +#ifdef __BSD_VISIBLE int shmsys(int, ...); +#endif void *shmat(int, const void *, int); int shmget(key_t, size_t, int); int shmctl(int, int, struct shmid_ds *); From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:07:26 2009 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 4C2331065674; Sat, 14 Mar 2009 19:07:26 +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 0C3988FC27; Sat, 14 Mar 2009 19:07:26 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ7Psh005219; Sat, 14 Mar 2009 19:07:25 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ7PKs005218; Sat, 14 Mar 2009 19:07:25 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141907.n2EJ7PKs005218@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:07:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189815 - head/sys/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: Sat, 14 Mar 2009 19:07:26 -0000 Author: das Date: Sat Mar 14 19:07:25 2009 New Revision: 189815 URL: http://svn.freebsd.org/changeset/base/189815 Log: Namespace: vsyslog() is a BSD extension. Modified: head/sys/sys/syslog.h Modified: head/sys/sys/syslog.h ============================================================================== --- head/sys/sys/syslog.h Sat Mar 14 19:06:52 2009 (r189814) +++ head/sys/sys/syslog.h Sat Mar 14 19:07:25 2009 (r189815) @@ -193,7 +193,9 @@ void closelog(void); void openlog(const char *, int, int); int setlogmask(int); void syslog(int, const char *, ...) __printflike(2, 3); +#if __BSD_VISIBLE void vsyslog(int, const char *, __va_list) __printflike(2, 0); +#endif __END_DECLS #endif /* !_KERNEL */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:07:59 2009 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 0D30A106566B; Sat, 14 Mar 2009 19:07:59 +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 F05128FC28; Sat, 14 Mar 2009 19:07:58 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJ7w6S005265; Sat, 14 Mar 2009 19:07:58 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJ7wct005264; Sat, 14 Mar 2009 19:07:58 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141907.n2EJ7wct005264@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:07: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: r189816 - head/sys/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: Sat, 14 Mar 2009 19:07:59 -0000 Author: das Date: Sat Mar 14 19:07:58 2009 New Revision: 189816 URL: http://svn.freebsd.org/changeset/base/189816 Log: Namespace: preadv() and pwritev() are extensions. Modified: head/sys/sys/uio.h Modified: head/sys/sys/uio.h ============================================================================== --- head/sys/sys/uio.h Sat Mar 14 19:07:25 2009 (r189815) +++ head/sys/sys/uio.h Sat Mar 14 19:07:58 2009 (r189816) @@ -106,8 +106,10 @@ int uiomoveco(void *cp, int n, struct ui __BEGIN_DECLS ssize_t readv(int, const struct iovec *, int); ssize_t writev(int, const struct iovec *, int); +#if __BSD_VISIBLE ssize_t preadv(int, const struct iovec *, int, off_t); ssize_t pwritev(int, const struct iovec *, int, off_t); +#endif __END_DECLS #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:11:08 2009 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 CEDC61065670; Sat, 14 Mar 2009 19:11:08 +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 BD1918FC2F; Sat, 14 Mar 2009 19:11:08 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJB89j005380; Sat, 14 Mar 2009 19:11:08 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJB8cY005378; Sat, 14 Mar 2009 19:11:08 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141911.n2EJB8cY005378@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:11: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: r189817 - in head: include sys/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: Sat, 14 Mar 2009 19:11:09 -0000 Author: das Date: Sat Mar 14 19:11:08 2009 New Revision: 189817 URL: http://svn.freebsd.org/changeset/base/189817 Log: Various namespace cleanups, including exposing fchmod() and fchmodat() in the POSIX namespace, and hiding eaccess() and setproctitle(). Also move mknodat() from unistd.h to sys/stat.h where it belongs. The *at() syscalls are only in CURRENT, so this shouldn't cause problems. Modified: head/include/unistd.h head/sys/sys/stat.h Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Sat Mar 14 19:07:58 2009 (r189816) +++ head/include/unistd.h Sat Mar 14 19:11:08 2009 (r189817) @@ -328,7 +328,6 @@ int chown(const char *, uid_t, gid_t); int close(int); int dup(int); int dup2(int, int); -int eaccess(const char *, int); int execl(const char *, const char *, ...); int execle(const char *, const char *, ...); int execlp(const char *, const char *, ...); @@ -360,7 +359,6 @@ ssize_t read(int, void *, size_t); int rmdir(const char *); int setgid(gid_t); int setpgid(pid_t, pid_t); -void setproctitle(const char *_fmt, ...) __printf0like(1, 2); pid_t setsid(void); int setuid(uid_t); unsigned int sleep(unsigned int); @@ -431,7 +429,6 @@ int truncate(const char *, off_t); #if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE int faccessat(int, const char *, int, int); -int fchmodat(int, const char *, mode_t, int); int fchownat(int, const char *, uid_t, gid_t, int); int fexecve(int, char *const [], char *const []); int linkat(int, const char *, int, const char *, int); @@ -470,7 +467,7 @@ void sync(void); #endif /* __XSI_VISIBLE */ -#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE +#if (__XSI_VISIBLE && __XSI_VISIBLE <= 500) || __BSD_VISIBLE int brk(const void *); int chroot(const char *); int getdtablesize(void); @@ -479,7 +476,7 @@ char *getpass(const char *); void *sbrk(intptr_t); #endif -#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE +#if (__XSI_VISIBLE && __XSI_VISIBLE <= 600) || __BSD_VISIBLE char *getwd(char *); /* obsoleted by getcwd() */ useconds_t ualarm(useconds_t, useconds_t); @@ -497,6 +494,7 @@ const char * int crypt_set_format(const char *); int des_cipher(const char *, char *, long, int); int des_setkey(const char *key); +int eaccess(const char *, int); void endusershell(void); int exect(const char *, char * const *, char * const *); int execvP(const char *, const char *, char * const *); @@ -563,6 +561,7 @@ int setkey(const char *); #endif int setlogin(const char *); void *setmode(const char *); +void setproctitle(const char *_fmt, ...) __printf0like(1, 2); int setresgid(gid_t, gid_t, gid_t); int setresuid(uid_t, uid_t, uid_t); int setrgid(gid_t); Modified: head/sys/sys/stat.h ============================================================================== --- head/sys/sys/stat.h Sat Mar 14 19:07:58 2009 (r189816) +++ head/sys/sys/stat.h Sat Mar 14 19:11:08 2009 (r189817) @@ -312,8 +312,13 @@ int chflags(const char *, unsigned long) int chmod(const char *, mode_t); #if __BSD_VISIBLE int fchflags(int, unsigned long); +#endif +#if __POSIX_VISIBLE >= 200112 int fchmod(int, mode_t); #endif +#if __POSIX_VISIBLE >= 200809 +int fchmodat(int, const char *, mode_t, int); +#endif int fstat(int, struct stat *); #if __BSD_VISIBLE int lchflags(const char *, int); @@ -334,6 +339,8 @@ mode_t umask(mode_t); int fstatat(int, const char *, struct stat *, int); int mkdirat(int, const char *, mode_t); int mkfifoat(int, const char *, mode_t); +#endif +#if __BSD_VISIBLE || __XSI_VISIBLE >= 700 int mknodat(int, const char *, mode_t, dev_t); #endif __END_DECLS From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:12:12 2009 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 06C9D106566B; Sat, 14 Mar 2009 19:12:12 +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 E9D428FC14; Sat, 14 Mar 2009 19:12:11 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJCBUv005434; Sat, 14 Mar 2009 19:12:11 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJCB3P005433; Sat, 14 Mar 2009 19:12:11 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141912.n2EJCB3P005433@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:12: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: r189818 - 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: Sat, 14 Mar 2009 19:12:12 -0000 Author: das Date: Sat Mar 14 19:12:11 2009 New Revision: 189818 URL: http://svn.freebsd.org/changeset/base/189818 Log: Namespace: dprintf() and getline() are in P1003.1-2008. Modified: head/include/stdio.h Modified: head/include/stdio.h ============================================================================== --- head/include/stdio.h Sat Mar 14 19:11:08 2009 (r189817) +++ head/include/stdio.h Sat Mar 14 19:12:11 2009 (r189818) @@ -360,7 +360,7 @@ int vdprintf(int, const char * __restri #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) #define _WITH_GETLINE #elif defined(_POSIX_C_SOURCE) -#if _POSIX_C_SOURCE > 200809 +#if _POSIX_C_SOURCE >= 200809 #define _WITH_GETLINE #endif #endif @@ -374,7 +374,7 @@ ssize_t getline(char ** __restrict, siz #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) #define _WITH_DPRINTF #elif defined(_POSIX_C_SOURCE) -#if _POSIX_C_SOURCE > 200809 +#if _POSIX_C_SOURCE >= 200809 #define _WITH_DPRINTF #endif #endif From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:13:01 2009 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 6553F1065673; Sat, 14 Mar 2009 19:13:01 +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 540288FC13; Sat, 14 Mar 2009 19:13:01 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJD1xs005489; Sat, 14 Mar 2009 19:13:01 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJD11P005488; Sat, 14 Mar 2009 19:13:01 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141913.n2EJD11P005488@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:13: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: r189819 - 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: Sat, 14 Mar 2009 19:13:01 -0000 Author: das Date: Sat Mar 14 19:13:01 2009 New Revision: 189819 URL: http://svn.freebsd.org/changeset/base/189819 Log: Namespace: endpwent, getpwent, and setpwent are XSI extensions. Modified: head/include/pwd.h Modified: head/include/pwd.h ============================================================================== --- head/include/pwd.h Sat Mar 14 19:12:11 2009 (r189818) +++ head/include/pwd.h Sat Mar 14 19:13:01 2009 (r189819) @@ -152,10 +152,13 @@ __BEGIN_DECLS struct passwd *getpwnam(const char *); struct passwd *getpwuid(uid_t); -#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 +#if __XSI_VISIBLE >= 500 void endpwent(void); struct passwd *getpwent(void); void setpwent(void); +#endif + +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 int getpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **); int getpwuid_r(uid_t, struct passwd *, char *, size_t, From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:13:31 2009 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 501891065676; Sat, 14 Mar 2009 19:13: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 3EAF38FC13; Sat, 14 Mar 2009 19:13:31 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJDVc2005541; Sat, 14 Mar 2009 19:13:31 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJDV7a005540; Sat, 14 Mar 2009 19:13:31 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141913.n2EJDV7a005540@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:13: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: r189820 - 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: Sat, 14 Mar 2009 19:13:31 -0000 Author: das Date: Sat Mar 14 19:13:30 2009 New Revision: 189820 URL: http://svn.freebsd.org/changeset/base/189820 Log: Namespace: abort2() is a BSD extension. Modified: head/include/stdlib.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Sat Mar 14 19:13:01 2009 (r189819) +++ head/include/stdlib.h Sat Mar 14 19:13:30 2009 (r189820) @@ -80,7 +80,6 @@ extern int __mb_cur_max; __BEGIN_DECLS void abort(void) __dead2; -void abort2(const char *, int, void **) __dead2; int abs(int) __pure2; int atexit(void (*)(void)); double atof(const char *); @@ -240,6 +239,7 @@ extern void (*_malloc_message)(const cha void *alloca(size_t); #endif +void abort2(const char *, int, void **) __dead2; __uint32_t arc4random(void); void arc4random_addrandom(unsigned char *, int); From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:15:13 2009 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 E55FA1065676; Sat, 14 Mar 2009 19:15:13 +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 D3E368FC29; Sat, 14 Mar 2009 19:15:13 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJFDpN005629; Sat, 14 Mar 2009 19:15:13 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJFDp2005628; Sat, 14 Mar 2009 19:15:13 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141915.n2EJFDp2005628@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:15: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: r189821 - head/sys/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: Sat, 14 Mar 2009 19:15:14 -0000 Author: das Date: Sat Mar 14 19:15:13 2009 New Revision: 189821 URL: http://svn.freebsd.org/changeset/base/189821 Log: Namespace: adjtime(), futimes(), futimesat(), lutimes(), and settimeofday() are BSD extensions. Also include in user code, since this header is also supposed to define most of the symbols there. Modified: head/sys/sys/time.h Modified: head/sys/sys/time.h ============================================================================== --- head/sys/sys/time.h Sat Mar 14 19:13:30 2009 (r189820) +++ head/sys/sys/time.h Sat Mar 14 19:15:13 2009 (r189821) @@ -316,17 +316,25 @@ int tvtohz(struct timeval *tv); #include #include +#include __BEGIN_DECLS +int setitimer(int, const struct itimerval *, struct itimerval *); +int utimes(const char *, const struct timeval *); + +#if __BSD_VISIBLE int adjtime(const struct timeval *, struct timeval *); int futimes(int, const struct timeval *); -int getitimer(int, struct itimerval *); -int gettimeofday(struct timeval *, struct timezone *); +int futimesat(int, const char *, const struct timeval [2]); int lutimes(const char *, const struct timeval *); -int setitimer(int, const struct itimerval *, struct itimerval *); int settimeofday(const struct timeval *, const struct timezone *); -int utimes(const char *, const struct timeval *); -int futimesat(int, const char *, const struct timeval [2]); +#endif + +#if __XSI_VISIBLE +int getitimer(int, struct itimerval *); +int gettimeofday(struct timeval *, struct timezone *); +#endif + __END_DECLS #endif /* !_KERNEL */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:17:00 2009 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 A7B5E106566C; Sat, 14 Mar 2009 19:17:00 +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 967B08FC18; Sat, 14 Mar 2009 19:17:00 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJH0hB005706; Sat, 14 Mar 2009 19:17:00 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJH0NA005705; Sat, 14 Mar 2009 19:17:00 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141917.n2EJH0NA005705@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:17: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: r189822 - head/sys/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: Sat, 14 Mar 2009 19:17:00 -0000 Author: das Date: Sat Mar 14 19:17:00 2009 New Revision: 189822 URL: http://svn.freebsd.org/changeset/base/189822 Log: Namespace: aio_waitcomplete() is a BSD extension. Also, don't pollute the namespace by including . Modified: head/sys/sys/aio.h Modified: head/sys/sys/aio.h ============================================================================== --- head/sys/sys/aio.h Sat Mar 14 19:15:13 2009 (r189821) +++ head/sys/sys/aio.h Sat Mar 14 19:17:00 2009 (r189822) @@ -19,7 +19,6 @@ #ifndef _SYS_AIO_H_ #define _SYS_AIO_H_ -#include #include #include @@ -79,6 +78,8 @@ typedef struct aiocb { #ifndef _KERNEL +struct timespec; + __BEGIN_DECLS /* * Asynchronously read from a file @@ -123,7 +124,9 @@ int aio_cancel(int, struct aiocb *); */ int aio_suspend(const struct aiocb * const[], int, const struct timespec *); +#ifdef __BSD_VISIBLE int aio_waitcomplete(struct aiocb **, struct timespec *); +#endif int aio_fsync(int op, struct aiocb *aiocbp); __END_DECLS From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:36:13 2009 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 BE754106564A; Sat, 14 Mar 2009 19:36:13 +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 AB86A8FC37; Sat, 14 Mar 2009 19:36:13 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJaD94006136; Sat, 14 Mar 2009 19:36:13 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJaDM5006130; Sat, 14 Mar 2009 19:36:13 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141936.n2EJaDM5006130@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:36: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: r189824 - in head/contrib/gcc: . doc 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 Mar 2009 19:36:14 -0000 Author: das Date: Sat Mar 14 19:36:13 2009 New Revision: 189824 URL: http://svn.freebsd.org/changeset/base/189824 Log: Make gcc use C99 inline semantics in c99 and gnu99 mode. This was the original intent, but the functionality wasn't implemented until after gcc 4.2 was released. However, if you compiled a program that would behave differently before and after this change, gcc 4.2 would have warned you; hence, everything currently in the base system is unaffected by this change. This patch also adds additional warnings about certain inline function-related bogosity, e.g., using a static non-const local variable in an inline function. These changes were merged from a snapshot of gcc mainline from March 2007, prior to the GPLv3 switch. I then ran the regression test suite from a more recent gcc snapshot and fixed the important bugs it found. I also squelched the following warning unless -pedantic is specified: foo is static but used in inline function bar which is not static This is consistent with LLVM's behavior, but not consistent with gcc 4.3. Reviewed by: arch@ Modified: head/contrib/gcc/c-cppbuiltin.c head/contrib/gcc/c-decl.c head/contrib/gcc/c-opts.c head/contrib/gcc/c-tree.h head/contrib/gcc/c-typeck.c head/contrib/gcc/doc/extend.texi Modified: head/contrib/gcc/c-cppbuiltin.c ============================================================================== --- head/contrib/gcc/c-cppbuiltin.c Sat Mar 14 19:35:13 2009 (r189823) +++ head/contrib/gcc/c-cppbuiltin.c Sat Mar 14 19:36:13 2009 (r189824) @@ -1,5 +1,6 @@ /* Define builtin-in macros for the C family front ends. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of GCC. @@ -484,7 +485,10 @@ c_cpp_builtins (cpp_reader *pfile) /* Misc. */ builtin_define_with_value ("__VERSION__", version_string, 1); - cpp_define (pfile, "__GNUC_GNU_INLINE__"); + if (flag_gnu89_inline) + cpp_define (pfile, "__GNUC_GNU_INLINE__"); + else + cpp_define (pfile, "__GNUC_STDC_INLINE__"); /* Definitions for LP64 model. */ if (TYPE_PRECISION (long_integer_type_node) == 64 Modified: head/contrib/gcc/c-decl.c ============================================================================== --- head/contrib/gcc/c-decl.c Sat Mar 14 19:35:13 2009 (r189823) +++ head/contrib/gcc/c-decl.c Sat Mar 14 19:36:13 2009 (r189824) @@ -1,6 +1,6 @@ /* Process declarations and variables for C compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -20,6 +20,9 @@ Software Foundation, 51 Franklin Street, 02110-1301, USA. */ /* $FreeBSD$ */ +/* Merged C99 inline changes from gcc trunk 122565 2007-03-05 */ +/* Fixed problems with compiling inline-25.c and inline-26.c */ +/* XXX still fails inline-29.c, inline-31.c, and inline-32.c */ /* Process declarations and symbol lookup for C front end. Also constructs types; the standard scalar types at initialization, @@ -156,10 +159,6 @@ int current_function_returns_abnormally; static int warn_about_return_type; -/* Nonzero when starting a function declared `extern inline'. */ - -static int current_extern_inline; - /* Nonzero when the current toplevel function contains a declaration of a nested function which is never defined. */ @@ -804,6 +803,15 @@ pop_scope (void) error ("nested function %q+D declared but never defined", p); undef_nested_function = true; } + /* C99 6.7.4p6: "a function with external linkage... declared + with an inline function specifier ... shall also be defined in the + same translation unit." */ + else if (DECL_DECLARED_INLINE_P (p) + && TREE_PUBLIC (p) + && !DECL_INITIAL (p) + && !flag_gnu89_inline) + pedwarn ("inline function %q+D declared but never defined", p); + goto common_symbol; case VAR_DECL: @@ -1294,10 +1302,11 @@ diagnose_mismatched_decls (tree newdecl, /* Function declarations can either be 'static' or 'extern' (no qualifier is equivalent to 'extern' - C99 6.2.2p5) and therefore - can never conflict with each other on account of linkage (6.2.2p4). - Multiple definitions are not allowed (6.9p3,5) but GCC permits - two definitions if one is 'extern inline' and one is not. The non- - extern-inline definition supersedes the extern-inline definition. */ + can never conflict with each other on account of linkage + (6.2.2p4). Multiple definitions are not allowed (6.9p3,5) but + gnu89 mode permits two definitions if one is 'extern inline' and + one is not. The non- extern-inline definition supersedes the + extern-inline definition. */ else if (TREE_CODE (newdecl) == FUNCTION_DECL) { @@ -1323,16 +1332,18 @@ diagnose_mismatched_decls (tree newdecl, { /* If both decls are in the same TU and the new declaration isn't overriding an extern inline reject the new decl. - When we handle c99 style inline rules we'll want to reject - the following: - - DECL_EXTERN_INLINE (olddecl) - && !DECL_EXTERN_INLINE (newdecl) - - if they're in the same translation unit. Until we implement - the full semantics we accept the construct. */ - if (!(DECL_EXTERN_INLINE (olddecl) - && !DECL_EXTERN_INLINE (newdecl)) + In c99, no overriding is allowed in the same translation + unit. */ + if ((!DECL_EXTERN_INLINE (olddecl) + || DECL_EXTERN_INLINE (newdecl) + || (!flag_gnu89_inline + && (!DECL_DECLARED_INLINE_P (olddecl) + || !lookup_attribute ("gnu_inline", + DECL_ATTRIBUTES (olddecl))) + && (!DECL_DECLARED_INLINE_P (newdecl) + || !lookup_attribute ("gnu_inline", + DECL_ATTRIBUTES (newdecl)))) + ) && same_translation_unit_p (newdecl, olddecl)) { error ("redefinition of %q+D", newdecl); @@ -1392,6 +1403,23 @@ diagnose_mismatched_decls (tree newdecl, warned = true; } } + + /* Make sure gnu_inline attribute is either not present, or + present on all inline decls. */ + if (DECL_DECLARED_INLINE_P (olddecl) + && DECL_DECLARED_INLINE_P (newdecl)) + { + bool newa = lookup_attribute ("gnu_inline", + DECL_ATTRIBUTES (newdecl)) != NULL; + bool olda = lookup_attribute ("gnu_inline", + DECL_ATTRIBUTES (olddecl)) != NULL; + if (newa != olda) + { + error ("% attribute present on %q+D", + newa ? newdecl : olddecl); + error ("%Jbut not here", newa ? olddecl : newdecl); + } + } } else if (TREE_CODE (newdecl) == VAR_DECL) { @@ -1523,9 +1551,13 @@ diagnose_mismatched_decls (tree newdecl, ??? Should we still warn about this now we have unit-at-a-time mode and can get it right? Definitely don't complain if the decls are in different translation - units. */ + units. + C99 permits this, so don't warn in that case. (The function + may not be inlined everywhere in function-at-a-time mode, but + we still shouldn't warn.) */ if (DECL_DECLARED_INLINE_P (newdecl) && !DECL_DECLARED_INLINE_P (olddecl) - && same_translation_unit_p (olddecl, newdecl)) + && same_translation_unit_p (olddecl, newdecl) + && flag_gnu89_inline) { if (TREE_USED (olddecl)) { @@ -1602,12 +1634,13 @@ diagnose_mismatched_decls (tree newdecl, static void merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) { - int new_is_definition = (TREE_CODE (newdecl) == FUNCTION_DECL - && DECL_INITIAL (newdecl) != 0); - int new_is_prototype = (TREE_CODE (newdecl) == FUNCTION_DECL - && TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != 0); - int old_is_prototype = (TREE_CODE (olddecl) == FUNCTION_DECL - && TYPE_ARG_TYPES (TREE_TYPE (olddecl)) != 0); + bool new_is_definition = (TREE_CODE (newdecl) == FUNCTION_DECL + && DECL_INITIAL (newdecl) != 0); + bool new_is_prototype = (TREE_CODE (newdecl) == FUNCTION_DECL + && TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != 0); + bool old_is_prototype = (TREE_CODE (olddecl) == FUNCTION_DECL + && TYPE_ARG_TYPES (TREE_TYPE (olddecl)) != 0); + bool extern_changed = false; /* For real parm decl following a forward decl, rechain the old decl in its new location and clear TREE_ASM_WRITTEN (it's not a @@ -1750,6 +1783,20 @@ merge_decls (tree newdecl, tree olddecl, } } + /* In c99, 'extern' declaration before (or after) 'inline' means this + function is not DECL_EXTERNAL, unless 'gnu_inline' attribute + is present. */ + if (TREE_CODE (newdecl) == FUNCTION_DECL + && !flag_gnu89_inline + && (DECL_DECLARED_INLINE_P (newdecl) + || DECL_DECLARED_INLINE_P (olddecl)) + && (!DECL_DECLARED_INLINE_P (newdecl) + || !DECL_DECLARED_INLINE_P (olddecl) + || !DECL_EXTERNAL (olddecl)) + && DECL_EXTERNAL (newdecl) + && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl))) + DECL_EXTERNAL (newdecl) = 0; + if (DECL_EXTERNAL (newdecl)) { TREE_STATIC (newdecl) = TREE_STATIC (olddecl); @@ -1842,6 +1889,8 @@ merge_decls (tree newdecl, tree olddecl, } } + extern_changed = DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl); + /* Copy most of the decl-specific fields of NEWDECL into OLDDECL. But preserve OLDDECL's DECL_UID and DECL_CONTEXT. */ { @@ -1884,6 +1933,13 @@ merge_decls (tree newdecl, tree olddecl, || (TREE_CODE (olddecl) == VAR_DECL && TREE_STATIC (olddecl)))) make_decl_rtl (olddecl); + + /* If we changed a function from DECL_EXTERNAL to !DECL_EXTERNAL, + and the definition is coming from the old version, cgraph needs + to be called again. */ + if (extern_changed && !new_is_definition + && TREE_CODE (olddecl) == FUNCTION_DECL && DECL_INITIAL (olddecl)) + cgraph_finalize_function (olddecl, false); } /* Handle when a new declaration NEWDECL has the same name as an old @@ -3274,6 +3330,18 @@ start_decl (struct c_declarator *declara /* Set attributes here so if duplicate decl, will have proper attributes. */ decl_attributes (&decl, attributes, 0); + /* Handle gnu_inline attribute. */ + if (declspecs->inline_p + && !flag_gnu89_inline + && TREE_CODE (decl) == FUNCTION_DECL + && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl))) + { + if (declspecs->storage_class == csc_auto && current_scope != file_scope) + ; + else if (declspecs->storage_class != csc_static) + DECL_EXTERNAL (decl) = !DECL_EXTERNAL (decl); + } + if (TREE_CODE (decl) == FUNCTION_DECL && targetm.calls.promote_prototypes (TREE_TYPE (decl))) { @@ -3301,6 +3369,18 @@ start_decl (struct c_declarator *declara warning (OPT_Wattributes, "inline function %q+D given attribute noinline", decl); + /* C99 6.7.4p3: An inline definition of a function with external + linkage shall not contain a definition of a modifiable object + with static storage duration... */ + if (TREE_CODE (decl) == VAR_DECL + && current_scope != file_scope + && TREE_STATIC (decl) + && !TREE_READONLY (decl) + && DECL_DECLARED_INLINE_P (current_function_decl) + && DECL_EXTERNAL (current_function_decl)) + pedwarn ("%q+D is static but declared in inline function %qD " + "which is not static", decl, current_function_decl); + /* Add this decl to the current scope. TEM may equal DECL or it may be a previous decl of the same name. */ tem = pushdecl (decl); @@ -4755,8 +4835,16 @@ grokdeclarator (const struct c_declarato GCC to signify a forward declaration of a nested function. */ if (storage_class == csc_auto && current_scope != file_scope) DECL_EXTERNAL (decl) = 0; + /* In C99, a function which is declared 'inline' with 'extern' + is not an external reference (which is confusing). It + means that the later definition of the function must be output + in this file, C99 6.7.4p6. In GNU C89, a function declared + 'extern inline' is an external reference. */ + else if (declspecs->inline_p && storage_class != csc_static) + DECL_EXTERNAL (decl) = ((storage_class == csc_extern) + == flag_gnu89_inline); else - DECL_EXTERNAL (decl) = 1; + DECL_EXTERNAL (decl) = !initialized; /* Record absence of global scope for `static' or `auto'. */ TREE_PUBLIC (decl) @@ -4786,11 +4874,7 @@ grokdeclarator (const struct c_declarato the abstract origin pointing between the declarations, which will confuse dwarf2out. */ if (initialized) - { - DECL_INLINE (decl) = 1; - if (storage_class == csc_extern) - current_extern_inline = 1; - } + DECL_INLINE (decl) = 1; } /* If -finline-functions, assume it can be inlined. This does two things: let the function be deferred until it is actually @@ -5288,12 +5372,15 @@ start_struct (enum tree_code code, tree error ("nested redefinition of %", name); else error ("nested redefinition of %", name); + /* Don't create structures that contain themselves. */ + ref = NULL_TREE; } } - else - { - /* Otherwise create a forward-reference just so the tag is in scope. */ + /* Otherwise create a forward-reference just so the tag is in scope. */ + + if (ref == NULL_TREE || TREE_CODE (ref) != code) + { ref = make_node (code); pushtag (name, ref); } @@ -5985,7 +6072,6 @@ start_function (struct c_declspecs *decl current_function_returns_null = 0; current_function_returns_abnormally = 0; warn_about_return_type = 0; - current_extern_inline = 0; c_switch_stack = NULL; nstack_se = XOBNEW (&parser_obstack, struct c_label_context_se); @@ -6025,6 +6111,16 @@ start_function (struct c_declspecs *decl warning (OPT_Wattributes, "inline function %q+D given attribute noinline", decl1); + /* Handle gnu_inline attribute. */ + if (declspecs->inline_p + && !flag_gnu89_inline + && TREE_CODE (decl1) == FUNCTION_DECL + && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1))) + { + if (declspecs->storage_class != csc_static) + DECL_EXTERNAL (decl1) = !DECL_EXTERNAL (decl1); + } + announce_function (decl1); if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl1)))) @@ -6137,36 +6233,6 @@ start_function (struct c_declspecs *decl warning (OPT_Wmissing_declarations, "%q+D was used with no declaration before its definition", decl1); - /* This is a definition, not a reference. - So normally clear DECL_EXTERNAL. - However, `extern inline' acts like a declaration - except for defining how to inline. So set DECL_EXTERNAL in that case. */ - DECL_EXTERNAL (decl1) = current_extern_inline; - - /* C99 specified different behaviour for non-static inline - functions, compared with the traditional GNU behaviour. We don't - support the C99 behaviour, but we do warn about non-static inline - functions here. The warning can be disabled via an explicit use - of -fgnu89-inline, or by using the gnu_inline attribute. */ - if (DECL_DECLARED_INLINE_P (decl1) - && TREE_PUBLIC (decl1) - && flag_isoc99 - && flag_gnu89_inline != 1 - && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1)) - && diagnostic_report_warnings_p ()) - { - static bool info = false; - - warning (0, "C99 inline functions are not supported; using GNU89"); - if (!info) - { - warning (0, - "to disable this warning use -fgnu89-inline or " - "the gnu_inline function attribute"); - info = true; - } - } - /* This function exists in static storage. (This does not mean `static' in the C sense!) */ TREE_STATIC (decl1) = 1; @@ -6942,7 +7008,6 @@ c_push_function_context (struct function p->returns_null = current_function_returns_null; p->returns_abnormally = current_function_returns_abnormally; p->warn_about_return_type = warn_about_return_type; - p->extern_inline = current_extern_inline; } /* Restore the variables used during compilation of a C function. */ @@ -6971,7 +7036,6 @@ c_pop_function_context (struct function current_function_returns_null = p->returns_null; current_function_returns_abnormally = p->returns_abnormally; warn_about_return_type = p->warn_about_return_type; - current_extern_inline = p->extern_inline; f->language = NULL; } Modified: head/contrib/gcc/c-opts.c ============================================================================== --- head/contrib/gcc/c-opts.c Sat Mar 14 19:35:13 2009 (r189823) +++ head/contrib/gcc/c-opts.c Sat Mar 14 19:36:13 2009 (r189824) @@ -21,6 +21,7 @@ Software Foundation, 51 Franklin Street, 02110-1301, USA. */ /* $FreeBSD$ */ +/* Merged C99 inline changes from gcc trunk 122565 2007-03-05 */ #include "config.h" #include "system.h" @@ -1008,11 +1009,12 @@ c_common_post_options (const char **pfil if (flag_inline_functions) flag_inline_trees = 2; - /* We recognize -fgnu89-inline in preparation for 4.3 where the - option will be meaningful. Here we just reject - -fno-gnu89-inline, since we don't support it. */ - if (!flag_gnu89_inline) - error ("-fno-gnu89-inline is not supported"); + /* By default we use C99 inline semantics in GNU99 or C99 mode. C99 + inline semantics are not supported in GNU89 or C89 mode. */ + if (flag_gnu89_inline == -1) + flag_gnu89_inline = !flag_isoc99; + else if (!flag_gnu89_inline && !flag_isoc99) + error ("-fno-gnu89-inline is only supported in GNU99 or C99 mode"); /* If we are given more than one input file, we must use unit-at-a-time mode. */ Modified: head/contrib/gcc/c-tree.h ============================================================================== --- head/contrib/gcc/c-tree.h Sat Mar 14 19:35:13 2009 (r189823) +++ head/contrib/gcc/c-tree.h Sat Mar 14 19:36:13 2009 (r189824) @@ -384,7 +384,6 @@ struct language_function GTY(()) int returns_null; int returns_abnormally; int warn_about_return_type; - int extern_inline; }; /* Save lists of labels used or defined in particular contexts. Modified: head/contrib/gcc/c-typeck.c ============================================================================== --- head/contrib/gcc/c-typeck.c Sat Mar 14 19:35:13 2009 (r189823) +++ head/contrib/gcc/c-typeck.c Sat Mar 14 19:36:13 2009 (r189824) @@ -2109,6 +2109,19 @@ build_external_ref (tree id, int fun, lo if (context != 0 && context != current_function_decl) DECL_NONLOCAL (ref) = 1; } + /* C99 6.7.4p3: An inline definition of a function with external + linkage ... shall not contain a reference to an identifier with + internal linkage. */ + else if (current_function_decl != 0 + && DECL_DECLARED_INLINE_P (current_function_decl) + && DECL_EXTERNAL (current_function_decl) + && VAR_OR_FUNCTION_DECL_P (ref) + && DECL_FILE_SCOPE_P (ref) + && pedantic + && (TREE_CODE (ref) != VAR_DECL || TREE_STATIC (ref)) + && ! TREE_PUBLIC (ref)) + pedwarn ("%H%qD is static but used in inline function %qD " + "which is not static", &loc, ref, current_function_decl); return ref; } Modified: head/contrib/gcc/doc/extend.texi ============================================================================== --- head/contrib/gcc/doc/extend.texi Sat Mar 14 19:35:13 2009 (r189823) +++ head/contrib/gcc/doc/extend.texi Sat Mar 14 19:36:13 2009 (r189824) @@ -3829,66 +3829,54 @@ These attributes mainly are intended to @cindex open coding @cindex macros, inline alternative -By declaring a function @code{inline}, you can direct GCC to +By declaring a function inline, you can direct GCC to make +calls to that function faster. One way GCC can achieve this is to integrate that function's code into the code for its callers. This makes execution faster by eliminating the function-call overhead; in -addition, if any of the actual argument values are constant, their known -values may permit simplifications at compile time so that not all of the -inline function's code needs to be included. The effect on code size is -less predictable; object code may be larger or smaller with function -inlining, depending on the particular case. Inlining of functions is an -optimization and it really ``works'' only in optimizing compilation. If -you don't use @option{-O}, no function is really inline. - -Inline functions are included in the ISO C99 standard, but there are -currently substantial differences between what GCC implements and what -the ISO C99 standard requires. GCC will fully support C99 inline -functions in version 4.3. The traditional GCC handling of inline -functions will still be available with @option{-std=gnu89}, -@option{-fgnu89-inline} or when @code{gnu_inline} attribute is present -on all inline declarations. The preprocessor macros -@code{__GNUC_GNU_INLINE__} and @code{__GNUC_STDC_INLINE__} may be used -to determine the handling of @code{inline} during a particular -compilation (@pxref{Common Predefined Macros,,,cpp,The C -Preprocessor}). +addition, if any of the actual argument values are constant, their +known values may permit simplifications at compile time so that not +all of the inline function's code needs to be included. The effect on +code size is less predictable; object code may be larger or smaller +with function inlining, depending on the particular case. You can +also direct GCC to try to integrate all ``simple enough'' functions +into their callers with the option @option{-finline-functions}. + +GCC implements three different semantics of declaring a function +inline. One is available with @option{-std=gnu89}, another when +@option{-std=c99} or @option{-std=gnu99}, and the third is used when +compiling C++. To declare a function inline, use the @code{inline} keyword in its declaration, like this: @smallexample -inline int +static inline int inc (int *a) @{ (*a)++; @} @end smallexample -(If you are writing a header file to be included in ISO C programs, write -@code{__inline__} instead of @code{inline}. @xref{Alternate Keywords}.) -You can also make all ``simple enough'' functions inline with the option -@option{-finline-functions}. - -@opindex Winline -Note that certain usages in a function definition can make it unsuitable -for inline substitution. Among these usages are: use of varargs, use of -alloca, use of variable sized data types (@pxref{Variable Length}), -use of computed goto (@pxref{Labels as Values}), use of nonlocal goto, -and nested functions (@pxref{Nested Functions}). Using @option{-Winline} -will warn when a function marked @code{inline} could not be substituted, -and will give the reason for the failure. +If you are writing a header file to be included in ISO C89 programs, write +@code{__inline__} instead of @code{inline}. @xref{Alternate Keywords}. -Note that in C and Objective-C, unlike C++, the @code{inline} keyword -does not affect the linkage of the function. +The three types of inlining behave similarly in two important cases: +when the @code{inline} keyword is used on a @code{static} function, +like the example above, and when a function is first declared without +using the @code{inline} keyword and then is defined with +@code{inline}, like this: -@cindex automatic @code{inline} for C++ member fns -@cindex @code{inline} automatic for C++ member fns -@cindex member fns, automatically @code{inline} -@cindex C++ member fns, automatically @code{inline} -@opindex fno-default-inline -GCC automatically inlines member functions defined within the class -body of C++ programs even if they are not explicitly declared -@code{inline}. (You can override this with @option{-fno-default-inline}; -@pxref{C++ Dialect Options,,Options Controlling C++ Dialect}.) +@smallexample +extern int inc (int *a); +inline int +inc (int *a) +@{ + (*a)++; +@} +@end smallexample + +In both of these common cases, the program behaves the same as if you +had not used the @code{inline} keyword, except for its speed. @cindex inline functions, omission of @opindex fkeep-inline-functions @@ -3904,6 +3892,27 @@ nonintegrated call, then the function is usual. The function must also be compiled as usual if the program refers to its address, because that can't be inlined. +@cindex automatic @code{inline} for C++ member fns +@cindex @code{inline} automatic for C++ member fns +@cindex member fns, automatically @code{inline} +@cindex C++ member fns, automatically @code{inline} +@opindex fno-default-inline +As required by ISO C++, GCC considers member functions defined within +the body of a class to be marked inline even if they are +not explicitly declared with the @code{inline} keyword. You can +override this with @option{-fno-default-inline}; @pxref{C++ Dialect +Options,,Options Controlling C++ Dialect}. + +GCC does not inline any functions when not optimizing unless you specify +the @samp{always_inline} attribute for the function, like this: + +@smallexample +/* @r{Prototype.} */ +inline void foo (const char) __attribute__((always_inline)); +@end smallexample + +The remainder of this section is specific to GNU C89 inlining. + @cindex non-static inline function When an inline function is not @code{static}, then the compiler must assume that there may be calls from other source files; since a global symbol can @@ -3926,24 +3935,6 @@ The definition in the header file will c to be inlined. If any uses of the function remain, they will refer to the single copy in the library. -Since GCC 4.3 will implement ISO C99 semantics for -inline functions, it is simplest to use @code{static inline} only -to guarantee compatibility. (The -existing semantics will remain available when @option{-std=gnu89} is -specified, but eventually the default will be @option{-std=gnu99}; -that will implement the C99 semantics, though it does not do so in -versions of GCC before 4.3. After the default changes, the existing -semantics will still be available via the @option{-fgnu89-inline} -option or the @code{gnu_inline} function attribute.) - -GCC does not inline any functions when not optimizing unless you specify -the @samp{always_inline} attribute for the function, like this: - -@smallexample -/* @r{Prototype.} */ -inline void foo (const char) __attribute__((always_inline)); -@end smallexample - @node Extended Asm @section Assembler Instructions with C Expression Operands @cindex extended @code{asm} From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:44:14 2009 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 4B2161065670; Sat, 14 Mar 2009 19:44:14 +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 39FED8FC16; Sat, 14 Mar 2009 19:44:14 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EJiElw006325; Sat, 14 Mar 2009 19:44:14 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EJiE0l006324; Sat, 14 Mar 2009 19:44:14 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903141944.n2EJiE0l006324@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 19:44: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: r189825 - head/sys/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: Sat, 14 Mar 2009 19:44:14 -0000 Author: das Date: Sat Mar 14 19:44:13 2009 New Revision: 189825 URL: http://svn.freebsd.org/changeset/base/189825 Log: Bump __FreeBSD_version to 800071 for gcc patch to add support for C99 inline functions in c99 and gnu99 mode. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Mar 14 19:36:13 2009 (r189824) +++ head/sys/sys/param.h Sat Mar 14 19:44:13 2009 (r189825) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800070 /* Master, propagated to newvers */ +#define __FreeBSD_version 800071 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 19:54:06 2009 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 80D2C106566B; Sat, 14 Mar 2009 19:54:06 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.169]) by mx1.freebsd.org (Postfix) with ESMTP id 3DB6D8FC15; Sat, 14 Mar 2009 19:54:06 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by wf-out-1314.google.com with SMTP id 27so2287654wfd.7 for ; Sat, 14 Mar 2009 12:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=3d88z4hLbYQSHJClLZwRsRRgz3qXGL2VFq0mwEfQk+Y=; b=rty5GLnJS0X57IK1a5UMXGgXLCgPXwMea3kOhtY8vPpMvxG7tgQxbBaUe2Z7UzGxCz hxu8Yd4cKx+Lk7Vz/GvAe+XMN9t/wyoHD57tL8yU72vgyIhLZfQ/SMrYRc9tpZPEpkUn U2YNXuh3j7aItNCblTVdm9AU6KRVHay/5q+cw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=olar3T3FgCy8geR/jjlqzk1BbHMw2/KxEgKWFH6Qg3GWNpLr+51ne1Y7P87dfAgjy2 VPIoP6UJ6AZW6qwKznC8BuafXETTXL6vqLwlho6eQwjGjbIklAZEyv8nI4rXdAO7VlV7 12nbrsKCaepdkgRSArlAkmD/ppFlBGZRhz5wY= MIME-Version: 1.0 Received: by 10.142.51.4 with SMTP id y4mr1249590wfy.39.1237060445857; Sat, 14 Mar 2009 12:54:05 -0700 (PDT) In-Reply-To: <20090314160642.GY41617@deviant.kiev.zoral.com.ua> References: <200903141342.n2EDgESI094655@svn.freebsd.org> <20090314160642.GY41617@deviant.kiev.zoral.com.ua> Date: Sat, 14 Mar 2009 12:54:05 -0700 Message-ID: <7d6fde3d0903141254j5ff4d7dcy20f24e8acb42a3bd@mail.gmail.com> From: Garrett Cooper To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Randall Stewart , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189790 - 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 Mar 2009 19:54:06 -0000 On Sat, Mar 14, 2009 at 9:06 AM, Kostik Belousov wrot= e: > On Sat, Mar 14, 2009 at 01:42:14PM +0000, Randall Stewart wrote: >> Author: rrs >> Date: Sat Mar 14 13:42:13 2009 >> New Revision: 189790 >> URL: http://svn.freebsd.org/changeset/base/189790 >> >> Log: >> =A0 Fixes several PR-SCTP releated bugs. >> =A0 =A0- When sending large PR-SCTP messages over a >> =A0 =A0 =A0lossy link we would incorrectly calculate the fwd-tsn >> =A0 =A0- When receiving large multipart pr-sctp packets we would >> =A0 =A0 =A0incorrectly send back a SACK that would renege improperly >> =A0 =A0 =A0on already received packets thus causing unneeded retransmiss= ions. > > With this commit, I get > /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c: In fun= ction 'sctp_express_handle_sack': > /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c:4772: e= rror: 'struct sctp_data_chunkrec' has no member named 'fwd_tsn_cnt' > /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c:4773: e= rror: 'struct sctp_data_chunkrec' has no member named 'fwd_tsn_cnt' > /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c:4775: e= rror: 'struct sctp_data_chunkrec' has no member named 'fwd_tsn_cnt' As do I. -Garrett From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 20:04:28 2009 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 6049D106564A; Sat, 14 Mar 2009 20:04:28 +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 4EE918FC12; Sat, 14 Mar 2009 20:04:28 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EK4Sx2006749; Sat, 14 Mar 2009 20:04:28 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EK4SUv006748; Sat, 14 Mar 2009 20:04:28 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903142004.n2EK4SUv006748@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 20: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: r189826 - 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: Sat, 14 Mar 2009 20:04:28 -0000 Author: das Date: Sat Mar 14 20:04:28 2009 New Revision: 189826 URL: http://svn.freebsd.org/changeset/base/189826 Log: Hide numerous BSD extensions in the POSIX namespace. Modified: head/include/netdb.h Modified: head/include/netdb.h ============================================================================== --- head/include/netdb.h Sat Mar 14 19:44:13 2009 (r189825) +++ head/include/netdb.h Sat Mar 14 20:04:28 2009 (r189826) @@ -217,67 +217,73 @@ struct addrinfo { __BEGIN_DECLS void endhostent(void); void endnetent(void); -void endnetgrent(void); void endprotoent(void); void endservent(void); -void freehostent(struct hostent *); +#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 200112) struct hostent *gethostbyaddr(const void *, socklen_t, int); +struct hostent *gethostbyname(const char *); +#endif +struct hostent *gethostent(void); +struct netent *getnetbyaddr(uint32_t, int); +struct netent *getnetbyname(const char *); +struct netent *getnetent(void); +struct protoent *getprotobyname(const char *); +struct protoent *getprotobynumber(int); +struct protoent *getprotoent(void); +struct servent *getservbyname(const char *, const char *); +struct servent *getservbyport(int, const char *); +struct servent *getservent(void); +void sethostent(int); +/* void sethostfile(const char *); */ +void setnetent(int); +void setprotoent(int); +int getaddrinfo(const char *, const char *, + const struct addrinfo *, struct addrinfo **); +int getnameinfo(const struct sockaddr *, socklen_t, char *, + size_t, char *, size_t, int); +void freeaddrinfo(struct addrinfo *); +const char *gai_strerror(int); +void setservent(int); + +#if __BSD_VISIBLE +void endnetgrent(void); +void freehostent(struct hostent *); int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *); -struct hostent *gethostbyname(const char *); int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *); struct hostent *gethostbyname2(const char *, int); int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *); -struct hostent *gethostent(void); int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *); struct hostent *getipnodebyaddr(const void *, size_t, int, int *); struct hostent *getipnodebyname(const char *, int, int, int *); -struct netent *getnetbyaddr(uint32_t, int); int getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t, struct netent**, int *); -struct netent *getnetbyname(const char *); int getnetbyname_r(const char *, struct netent *, char *, size_t, struct netent **, int *); -struct netent *getnetent(void); int getnetent_r(struct netent *, char *, size_t, struct netent **, int *); int getnetgrent(char **, char **, char **); -struct protoent *getprotobyname(const char *); int getprotobyname_r(const char *, struct protoent *, char *, size_t, struct protoent **); -struct protoent *getprotobynumber(int); int getprotobynumber_r(int, struct protoent *, char *, size_t, struct protoent **); -struct protoent *getprotoent(void); int getprotoent_r(struct protoent *, char *, size_t, struct protoent **); -struct servent *getservbyname(const char *, const char *); int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **); -struct servent *getservbyport(int, const char *); int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **); -struct servent *getservent(void); int getservent_r(struct servent *, char *, size_t, struct servent **); void herror(const char *); __const char *hstrerror(int); int innetgr(const char *, const char *, const char *, const char *); -void sethostent(int); -/* void sethostfile(const char *); */ -void setnetent(int); -void setprotoent(int); -int getaddrinfo(const char *, const char *, - const struct addrinfo *, struct addrinfo **); -int getnameinfo(const struct sockaddr *, socklen_t, char *, - size_t, char *, size_t, int); -void freeaddrinfo(struct addrinfo *); -const char *gai_strerror(int); void setnetgrent(const char *); -void setservent(int); +#endif + /* * PRIVATE functions specific to the FreeBSD implementation From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 20:05:28 2009 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 232681065673; Sat, 14 Mar 2009 20:05:28 +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 06E408FC0C; Sat, 14 Mar 2009 20:05:28 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EK5Rhb006809; Sat, 14 Mar 2009 20:05:27 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EK5RiD006808; Sat, 14 Mar 2009 20:05:27 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903142005.n2EK5RiD006808@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 20:05: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: r189827 - 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: Sat, 14 Mar 2009 20:05:28 -0000 Author: das Date: Sat Mar 14 20:05:27 2009 New Revision: 189827 URL: http://svn.freebsd.org/changeset/base/189827 Log: Hide dbopen() in the POSIX namespace, and use standard type names throughout so that this compiles in strict POSIX mode. Modified: head/include/db.h Modified: head/include/db.h ============================================================================== --- head/include/db.h Sat Mar 14 20:04:28 2009 (r189826) +++ head/include/db.h Sat Mar 14 20:05:27 2009 (r189827) @@ -47,11 +47,11 @@ #define RET_SPECIAL 1 #define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ -typedef u_int32_t pgno_t; +typedef uint32_t pgno_t; #define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ -typedef u_int16_t indx_t; +typedef uint16_t indx_t; #define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ -typedef u_int32_t recno_t; +typedef uint32_t recno_t; /* Key/data structure -- a Data-Base Thang. */ typedef struct { @@ -101,11 +101,11 @@ typedef enum { DB_BTREE, DB_HASH, DB_REC typedef struct __db { DBTYPE type; /* Underlying db type. */ int (*close)(struct __db *); - int (*del)(const struct __db *, const DBT *, u_int); - int (*get)(const struct __db *, const DBT *, DBT *, u_int); - int (*put)(const struct __db *, DBT *, const DBT *, u_int); - int (*seq)(const struct __db *, DBT *, DBT *, u_int); - int (*sync)(const struct __db *, u_int); + int (*del)(const struct __db *, const DBT *, unsigned int); + int (*get)(const struct __db *, const DBT *, DBT *, unsigned int); + int (*put)(const struct __db *, DBT *, const DBT *, unsigned int); + int (*seq)(const struct __db *, DBT *, DBT *, unsigned int); + int (*sync)(const struct __db *, unsigned int); void *internal; /* Access method private. */ int (*fd)(const struct __db *); } DB; @@ -116,16 +116,16 @@ typedef struct __db { /* Structure used to pass parameters to the btree routines. */ typedef struct { #define R_DUP 0x01 /* duplicate keys */ - u_long flags; - u_int cachesize; /* bytes to cache */ - int maxkeypage; /* maximum keys per page */ - int minkeypage; /* minimum keys per page */ - u_int psize; /* page size */ - int (*compare) /* comparison function */ - (const DBT *, const DBT *); - size_t (*prefix) /* prefix function */ - (const DBT *, const DBT *); - int lorder; /* byte order */ + unsigned long flags; + unsigned int cachesize; /* bytes to cache */ + int maxkeypage; /* maximum keys per page */ + int minkeypage; /* minimum keys per page */ + unsigned int psize; /* page size */ + int (*compare) /* comparison function */ + (const DBT *, const DBT *); + size_t (*prefix) /* prefix function */ + (const DBT *, const DBT *); + int lorder; /* byte order */ } BTREEINFO; #define HASHMAGIC 0x061561 @@ -133,11 +133,11 @@ typedef struct { /* Structure used to pass parameters to the hashing routines. */ typedef struct { - u_int bsize; /* bucket size */ - u_int ffactor; /* fill factor */ - u_int nelem; /* number of elements */ - u_int cachesize; /* bytes to cache */ - u_int32_t /* hash function */ + unsigned int bsize; /* bucket size */ + unsigned int ffactor; /* fill factor */ + unsigned int nelem; /* number of elements */ + unsigned int cachesize; /* bytes to cache */ + uint32_t /* hash function */ (*hash)(const void *, size_t); int lorder; /* byte order */ } HASHINFO; @@ -147,12 +147,12 @@ typedef struct { #define R_FIXEDLEN 0x01 /* fixed-length records */ #define R_NOKEY 0x02 /* key not required */ #define R_SNAPSHOT 0x04 /* snapshot the input */ - u_long flags; - u_int cachesize; /* bytes to cache */ - u_int psize; /* page size */ - int lorder; /* byte order */ - size_t reclen; /* record length (fixed-length records) */ - u_char bval; /* delimiting byte (variable-length records */ + unsigned long flags; + unsigned int cachesize; /* bytes to cache */ + unsigned int psize; /* page size */ + int lorder; /* byte order */ + size_t reclen; /* record length (fixed-length records) */ + unsigned char bval; /* delimiting byte (variable-length records */ char *bfname; /* btree file name */ } RECNOINFO; @@ -164,14 +164,14 @@ typedef struct { * P_32_COPY swap from one location to another */ #define M_32_SWAP(a) { \ - u_int32_t _tmp = a; \ + uint32_t _tmp = a; \ ((char *)&a)[0] = ((char *)&_tmp)[3]; \ ((char *)&a)[1] = ((char *)&_tmp)[2]; \ ((char *)&a)[2] = ((char *)&_tmp)[1]; \ ((char *)&a)[3] = ((char *)&_tmp)[0]; \ } #define P_32_SWAP(a) { \ - u_int32_t _tmp = *(u_int32_t *)a; \ + uint32_t _tmp = *(uint32_t *)a; \ ((char *)a)[0] = ((char *)&_tmp)[3]; \ ((char *)a)[1] = ((char *)&_tmp)[2]; \ ((char *)a)[2] = ((char *)&_tmp)[1]; \ @@ -191,12 +191,12 @@ typedef struct { * P_16_COPY swap from one location to another */ #define M_16_SWAP(a) { \ - u_int16_t _tmp = a; \ + uint16_t _tmp = a; \ ((char *)&a)[0] = ((char *)&_tmp)[1]; \ ((char *)&a)[1] = ((char *)&_tmp)[0]; \ } #define P_16_SWAP(a) { \ - u_int16_t _tmp = *(u_int16_t *)a; \ + uint16_t _tmp = *(uint16_t *)a; \ ((char *)a)[0] = ((char *)&_tmp)[1]; \ ((char *)a)[1] = ((char *)&_tmp)[0]; \ } @@ -207,7 +207,9 @@ typedef struct { #endif __BEGIN_DECLS +#if __BSD_VISIBLE DB *dbopen(const char *, int, int, DBTYPE, const void *); +#endif #ifdef __DBINTERFACE_PRIVATE DB *__bt_open(const char *, int, int, const BTREEINFO *, int); From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 20:10:14 2009 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 AC607106566C; Sat, 14 Mar 2009 20:10:14 +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 9AC1A8FC18; Sat, 14 Mar 2009 20:10:14 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EKAEdh006948; Sat, 14 Mar 2009 20:10:14 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EKAESF006945; Sat, 14 Mar 2009 20:10:14 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903142010.n2EKAESF006945@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 20:10: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: r189828 - in head: include sys/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: Sat, 14 Mar 2009 20:10:15 -0000 Author: das Date: Sat Mar 14 20:10:14 2009 New Revision: 189828 URL: http://svn.freebsd.org/changeset/base/189828 Log: Fix the visibility of several prototypes. Also move pthread_kill() and pthread_sigmask() to signal.h. In principle, this shouldn't break anything, since they're already in signal.h on other systems, and the FreeBSD manpage says that both pthread.h and signal.h need to be included to get these functions. Add a hack to declare pthread_t in the P1003.1-2008 namespace in signal.h. Modified: head/include/pthread.h head/include/signal.h head/sys/sys/_pthreadtypes.h Modified: head/include/pthread.h ============================================================================== --- head/include/pthread.h Sat Mar 14 20:05:27 2009 (r189827) +++ head/include/pthread.h Sat Mar 14 20:10:14 2009 (r189828) @@ -205,7 +205,6 @@ int pthread_join(pthread_t, void **); int pthread_key_create(pthread_key_t *, void (*) (void *)); int pthread_key_delete(pthread_key_t); -int pthread_kill(pthread_t, int); int pthread_mutexattr_init(pthread_mutexattr_t *); int pthread_mutexattr_destroy(pthread_mutexattr_t *); int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, @@ -241,7 +240,6 @@ int pthread_rwlockattr_setpshared(pthre int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); pthread_t pthread_self(void); int pthread_setspecific(pthread_key_t, const void *); -int pthread_sigmask(int, const __sigset_t *, __sigset_t *); int pthread_spin_init(pthread_spinlock_t *, int); int pthread_spin_destroy(pthread_spinlock_t *); @@ -253,9 +251,11 @@ int pthread_setcancelstate(int, int *); int pthread_setcanceltype(int, int *); void pthread_testcancel(void); +#if __BSD_VISIBLE int pthread_getprio(pthread_t); int pthread_setprio(pthread_t, int); void pthread_yield(void); +#endif int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, int *); @@ -281,8 +281,10 @@ int pthread_getschedparam(pthread_t pth struct sched_param *); int pthread_setschedparam(pthread_t, int, const struct sched_param *); +#if __XSI_VISIBLE int pthread_getconcurrency(void); int pthread_setconcurrency(int); +#endif void __pthread_cleanup_push_imp(void (*)(void *), void *, struct _pthread_cleanup_info *); Modified: head/include/signal.h ============================================================================== --- head/include/signal.h Sat Mar 14 20:05:27 2009 (r189827) +++ head/include/signal.h Sat Mar 14 20:10:14 2009 (r189828) @@ -58,11 +58,22 @@ typedef __pid_t pid_t; #endif #endif +#if __POSIX_VISIBLE || __XSI_VISIBLE +struct pthread; /* XXX */ +typedef struct pthread *__pthread_t; +#if !defined(_PTHREAD_T_DECLARED) && __POSIX_VISIBLE >= 200809 +typedef __pthread_t pthread_t; +#define _PTHREAD_T_DECLARED +#endif +#endif /* __POSIX_VISIBLE || __XSI_VISIBLE */ + __BEGIN_DECLS int raise(int); #if __POSIX_VISIBLE || __XSI_VISIBLE int kill(__pid_t, int); +int pthread_kill(__pthread_t, int); +int pthread_sigmask(int, const __sigset_t *, __sigset_t *); int sigaction(int, const struct sigaction * __restrict, struct sigaction * __restrict); int sigaddset(sigset_t *, int); @@ -91,7 +102,7 @@ int sigaltstack(const stack_t * __restri int sigpause(int); #endif -#if __POSIX_VISIBLE >= 200112 +#if __XSI_VISIBLE >= 600 int siginterrupt(int, int); #endif Modified: head/sys/sys/_pthreadtypes.h ============================================================================== --- head/sys/sys/_pthreadtypes.h Sat Mar 14 20:05:27 2009 (r189827) +++ head/sys/sys/_pthreadtypes.h Sat Mar 14 20:10:14 2009 (r189828) @@ -61,7 +61,10 @@ struct pthread_spinlock; * or assignment operators for the types pthread_attr_t, pthread_cond_t, * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. */ +#ifndef _PTHREAD_T_DECLARED typedef struct pthread *pthread_t; +#define _PTHREAD_T_DECLARED +#endif typedef struct pthread_attr *pthread_attr_t; typedef struct pthread_mutex *pthread_mutex_t; typedef struct pthread_mutex_attr *pthread_mutexattr_t; From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 20:12:39 2009 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 62E811065677; Sat, 14 Mar 2009 20:12:39 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 19DF48FC14; Sat, 14 Mar 2009 20:12:39 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 9720F14D87BB; Sat, 14 Mar 2009 21:12:36 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id EAfTVt8pF38b; Sat, 14 Mar 2009 21:12:35 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 4A08A14D877A; Sat, 14 Mar 2009 21:12:35 +0100 (CET) Message-ID: <49BC0FAF.4020308@FreeBSD.org> Date: Sat, 14 Mar 2009 21:12:31 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: "M. Warner Losh" References: <49BB98A1.80403@FreeBSD.org> <20090314.231227.1649765955.imp@bsdimp.com> <49BBC0A5.3080002@FreeBSD.org> <20090314.233939.-1625878868.imp@bsdimp.com> In-Reply-To: <20090314.233939.-1625878868.imp@bsdimp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@FreeBSD.org, ed@80386.nl, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 20:12:39 -0000 M. Warner Losh escribió: > In message: <49BBC0A5.3080002@FreeBSD.org> > Gábor_Kövesdán writes: > : M. Warner Losh escribió: > : > In message: <49BB98A1.80403@FreeBSD.org> > : > Gábor_Kövesdán writes: > : > : Ed Schouten escribió: > : > : > * Gabor Kovesdan wrote: > : > : > > : > : >> - Fix object directory creation when running threaded buildworld > : > : >> > : > : > > : > : > Isn't this normally done by the mtrees? > : > : > > : > : I haven't yet found a better solution for this. I also grepped for mtree > : > : in the source tree hoping that it will point me a good solution with > : > : mtrees but it didn't. Ruslan might suggest something if he has some time > : > : to take a look. > : > > : > Adding all the new NLS directories to BSD.mtree.usr is the canonical > : > way, I'd think. > : > > : They are already there (well, actually not the lib32-ones but the rest) > : and it doesn't seem to help anything. It seems from buildworld logs that > : there's no usr mtree creation for /usr/obj, just the include mtree is > : applied. Should usr mtree be applied to /usr/obj, as well? > > I'm pretty sure that it is applied for that indirectly... Maybe we > kludge something elsewhere already that really needs something > better... > Do you think this is the right fix? http://kovesdan.org/patches/mtree-fix.diff Thanks, -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 20:16:54 2009 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 692231065672; Sat, 14 Mar 2009 20:16:54 +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 582A18FC1C; Sat, 14 Mar 2009 20:16:54 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EKGsGB007109; Sat, 14 Mar 2009 20:16:54 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EKGse2007108; Sat, 14 Mar 2009 20:16:54 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903142016.n2EKGse2007108@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 20:16: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: r189829 - 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 Mar 2009 20:16:54 -0000 Author: das Date: Sat Mar 14 20:16:54 2009 New Revision: 189829 URL: http://svn.freebsd.org/changeset/base/189829 Log: Namespace: Defining htonl() and friends here instead of arpa/inet.h is a BSD extension. Modified: head/sys/netinet/in.h Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Sat Mar 14 20:10:14 2009 (r189828) +++ head/sys/netinet/in.h Sat Mar 14 20:16:54 2009 (r189829) @@ -120,7 +120,7 @@ struct sockaddr_in { char sin_zero[8]; }; -#ifndef _KERNEL +#if !defined(_KERNEL) && __BSD_VISIBLE #ifndef _BYTEORDER_PROTOTYPED #define _BYTEORDER_PROTOTYPED @@ -140,7 +140,7 @@ __END_DECLS #define ntohs(x) __ntohs(x) #endif -#endif /* !_KERNEL */ +#endif /* !_KERNEL && __BSD_VISIBLE */ #if __POSIX_VISIBLE >= 200112 #define IPPROTO_RAW 255 /* raw IP packet */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 20:22:53 2009 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 58A33106568B; Sat, 14 Mar 2009 20:22:53 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.233]) by mx1.freebsd.org (Postfix) with ESMTP id 11D4E8FC2A; Sat, 14 Mar 2009 20:22:52 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by rv-out-0506.google.com with SMTP id f6so2360810rvb.43 for ; Sat, 14 Mar 2009 13:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=lbKEk7bESW79d6smCh4L9J1375nu/bVri8h1nbA+Dbc=; b=HWzEjPgtyqtEb9hwNnEPy8axbfdNSzD595eK/dAyY7XQxXcVe11KtH38cY16Izoiwz KB0hvkJKiT8dvxoUb50btnQkjLSN1j9/DZ8CzocwWW6TtDnBOpLm3PU6zkdEttRog3it GrOvq0n1aj+zyYphnh5Mygcvkyn17+j+GG7Pg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=TleXNCL+G4iA+hZcVEcsT7ngkOzkYYitIK9QNERsy3NWBM+bn6cmX38w3IFyw3Pd7P sIKpACCT0/SwdK7hr7XWYp0BYJat4Vn7j30+ISVF6sGvRpDjd7T8vaE1O98d4uLhBQy/ 0baERqeZLlTnz3r7BoOxAwu9MKNP5T7smWmFs= MIME-Version: 1.0 Received: by 10.143.6.19 with SMTP id j19mr1302964wfi.128.1237062172661; Sat, 14 Mar 2009 13:22:52 -0700 (PDT) Date: Sat, 14 Mar 2009 13:22:52 -0700 Message-ID: <7d6fde3d0903141322m2171e0d9h84788db92d5eaa14@mail.gmail.com> From: Garrett Cooper To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Randall Stewart , svn-src-all@freebsd.org, src-committers@freebsd.org, FreeBSD Current Subject: Fixes for SCTP compile errors on CURRENT [was Re: svn commit: r189790 - 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 Mar 2009 20:22:54 -0000 On Sat, Mar 14, 2009 at 12:54 PM, Garrett Cooper wrote= : > On Sat, Mar 14, 2009 at 9:06 AM, Kostik Belousov wr= ote: >> On Sat, Mar 14, 2009 at 01:42:14PM +0000, Randall Stewart wrote: >>> Author: rrs >>> Date: Sat Mar 14 13:42:13 2009 >>> New Revision: 189790 >>> URL: http://svn.freebsd.org/changeset/base/189790 >>> >>> Log: >>> =A0 Fixes several PR-SCTP releated bugs. >>> =A0 =A0- When sending large PR-SCTP messages over a >>> =A0 =A0 =A0lossy link we would incorrectly calculate the fwd-tsn >>> =A0 =A0- When receiving large multipart pr-sctp packets we would >>> =A0 =A0 =A0incorrectly send back a SACK that would renege improperly >>> =A0 =A0 =A0on already received packets thus causing unneeded retransmis= sions. >> >> With this commit, I get >> /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c: In fu= nction 'sctp_express_handle_sack': >> /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c:4772: = error: 'struct sctp_data_chunkrec' has no member named 'fwd_tsn_cnt' >> /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c:4773: = error: 'struct sctp_data_chunkrec' has no member named 'fwd_tsn_cnt' >> /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c:4775: = error: 'struct sctp_data_chunkrec' has no member named 'fwd_tsn_cnt' > > As do I. > -Garrett The attached patch fixes all SCTP related compile errors, but I'm a bit worried about whether or not discard_rest is set anywhere in the code, or the entire data struct is properly zero'ed out (haven't inspected it yet): Thanks, -Garrett Index: sys/netinet/sctp_structs.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 --- sys/netinet/sctp_structs.h (revision 189829) +++ sys/netinet/sctp_structs.h (working copy) @@ -31,7 +31,7 @@ /* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $ */ #include -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/sys/netinet/sctp_structs.h,v 1.30 2009/02/20 15:03:54 rrs Exp $"); #ifndef __sctp_structs_h__ #define __sctp_structs_h__ @@ -310,6 +310,8 @@ /* ECN Nonce: Nonce Value for this chunk */ uint8_t ect_nonce; + uint8_t fwd_tsn_cnt; + /* * part of the Highest sacked algorithm to be able to stroke counts * on ones that are FR'd. @@ -445,6 +447,7 @@ uint8_t pr_sctp_on; uint8_t sender_all_done; uint8_t put_last_out; + uint8_t discard_rest; }; /* From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 20:40:06 2009 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 B25AF1065675; Sat, 14 Mar 2009 20:40:06 +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 A15968FC1A; Sat, 14 Mar 2009 20:40:06 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EKe6D0007628; Sat, 14 Mar 2009 20:40:06 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EKe60h007627; Sat, 14 Mar 2009 20:40:06 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200903142040.n2EKe60h007627@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 14 Mar 2009 20:40: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: r189830 - head/sys/security/mac_portacl 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 Mar 2009 20:40:07 -0000 Author: pjd Date: Sat Mar 14 20:40:06 2009 New Revision: 189830 URL: http://svn.freebsd.org/changeset/base/189830 Log: - Correct logic in if statement - we want to allocate temporary buffer when someone is passing new rules, not when he only want to read them. Because of this bug, even if the given rules were incorrect, they ended up in rule_string. - Add missing protection for rule_string when coping it. Reviewed by: rwatson MFC after: 1 week Modified: head/sys/security/mac_portacl/mac_portacl.c Modified: head/sys/security/mac_portacl/mac_portacl.c ============================================================================== --- head/sys/security/mac_portacl/mac_portacl.c Sat Mar 14 20:16:54 2009 (r189829) +++ head/sys/security/mac_portacl/mac_portacl.c Sat Mar 14 20:40:06 2009 (r189830) @@ -341,10 +341,12 @@ sysctl_rules(SYSCTL_HANDLER_ARGS) int error; new_string = NULL; - if (req->newptr == NULL) { + if (req->newptr != NULL) { new_string = malloc(MAC_RULE_STRING_LEN, M_PORTACL, M_WAITOK | M_ZERO); + mtx_lock(&rule_mtx); strcpy(new_string, rule_string); + mtx_unlock(&rule_mtx); string = new_string; } else string = rule_string; From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 20:56:19 2009 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 278B21065670; Sat, 14 Mar 2009 20:56:19 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id B3A3A8FC17; Sat, 14 Mar 2009 20:56:18 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id BA9611CE0D; Sat, 14 Mar 2009 21:56:17 +0100 (CET) Date: Sat, 14 Mar 2009 21:56:17 +0100 From: Ed Schouten To: =?iso-8859-1?Q?G=E1bor_K=F6vesd=E1n?= Message-ID: <20090314205617.GX31961@hoeg.nl> References: <49BB98A1.80403@FreeBSD.org> <20090314.231227.1649765955.imp@bsdimp.com> <49BBC0A5.3080002@FreeBSD.org> <20090314.233939.-1625878868.imp@bsdimp.com> <49BC0FAF.4020308@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WcQ7DTTOeW3GIUV5" Content-Disposition: inline In-Reply-To: <49BC0FAF.4020308@FreeBSD.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "M. Warner Losh" Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 20:56:19 -0000 --WcQ7DTTOeW3GIUV5 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi G=E1bor, * G=E1bor K=F6vesd=E1n wrote: > Do you think this is the right fix? > http://kovesdan.org/patches/mtree-fix.diff That seems to be a lot better (though someone else should still review it). Maybe we can remove some of those mkdir calls there as well? --=20 Ed Schouten WWW: http://80386.nl/ --WcQ7DTTOeW3GIUV5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm8GfEACgkQ52SDGA2eCwUWnQCeKcA1eJUlk3bMxGfj4bm/yjMo XG8AnjCOilsRZj7SRufEKzvC2PiHBx26 =uDmA -----END PGP SIGNATURE----- --WcQ7DTTOeW3GIUV5-- From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 21:02:38 2009 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 0D95A106564A; Sat, 14 Mar 2009 21:02:38 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id B7EED8FC18; Sat, 14 Mar 2009 21:02:37 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 7F3B014D7CFC; Sat, 14 Mar 2009 22:02:36 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1x1tZbLKB8Ig; Sat, 14 Mar 2009 22:02:35 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 05DAF14D7CEB; Sat, 14 Mar 2009 22:02:34 +0100 (CET) Message-ID: <49BC1B65.8030001@FreeBSD.org> Date: Sat, 14 Mar 2009 22:02:29 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Ed Schouten References: <49BB98A1.80403@FreeBSD.org> <20090314.231227.1649765955.imp@bsdimp.com> <49BBC0A5.3080002@FreeBSD.org> <20090314.233939.-1625878868.imp@bsdimp.com> <49BC0FAF.4020308@FreeBSD.org> <20090314205617.GX31961@hoeg.nl> In-Reply-To: <20090314205617.GX31961@hoeg.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "M. Warner Losh" Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 21:02:38 -0000 Ed Schouten escribió: > Hi Gábor, > > * Gábor Kövesdán wrote: > >> Do you think this is the right fix? >> http://kovesdan.org/patches/mtree-fix.diff >> > > That seems to be a lot better (though someone else should still review > it). Maybe we can remove some of those mkdir calls there as well? > Good point. Running another buildworld with those parts ripped out... -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 21:54:19 2009 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 9DED4106564A; Sat, 14 Mar 2009 21:54:19 +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 8C1718FC17; Sat, 14 Mar 2009 21:54:19 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ELsJ5O009019; Sat, 14 Mar 2009 21:54:19 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ELsJ6V009015; Sat, 14 Mar 2009 21:54:19 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200903142154.n2ELsJ6V009015@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 14 Mar 2009 21:54: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: r189832 - head/tools/regression/mac/mac_portacl 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 Mar 2009 21:54:19 -0000 Author: pjd Date: Sat Mar 14 21:54:19 2009 New Revision: 189832 URL: http://svn.freebsd.org/changeset/base/189832 Log: Regression tests for mac_portacl(4). Added: head/tools/regression/mac/mac_portacl/ head/tools/regression/mac/mac_portacl/LICENSE (contents, props changed) head/tools/regression/mac/mac_portacl/misc.sh (contents, props changed) head/tools/regression/mac/mac_portacl/nobody.t (contents, props changed) head/tools/regression/mac/mac_portacl/root.t (contents, props changed) Added: head/tools/regression/mac/mac_portacl/LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/mac/mac_portacl/LICENSE Sat Mar 14 21:54:19 2009 (r189832) @@ -0,0 +1,27 @@ +$FreeBSD$ + +License for all regression tests available with fstest: + +Copyright (c) 2009 Pawel Jakub Dawidek +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. Added: head/tools/regression/mac/mac_portacl/misc.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/mac/mac_portacl/misc.sh Sat Mar 14 21:54:19 2009 (r189832) @@ -0,0 +1,97 @@ +#!/bin/sh +# $FreeBSD$ + +sysctl security.mac.portacl >/dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "1..1" + echo "not ok 1 # MAC_PORTACL is unavailable." + exit 0 +fi + +ntest=1 + +check_bind() { + idtype=${1} + name=${2} + proto=${3} + port=${4} + + [ "${proto}" = "udp" ] && udpflag="-u" + + out=`( + case "${idtype}" in + uid|gid) + ( echo -n | su -m ${name} -c "nc ${udpflag} -o -l 127.0.0.1 $port" 2>&1 ) & + ;; + jail) + kill $$ + ;; + *) + kill $$ + esac + sleep 0.3 + echo | nc ${udpflag} -o 127.0.0.1 $port >/dev/null 2>&1 + wait + )` + case "${out}" in + "nc: Permission denied"*|"nc: Operation not permitted"*) + echo fl + ;; + "") + echo ok + ;; + *) + echo ${out} + ;; + esac +} + +bind_test() { + expect_without_rule=${1} + expect_with_rule=${2} + idtype=${3} + name=${4} + proto=${5} + port=${6} + + sysctl security.mac.portacl.rules= >/dev/null + out=`check_bind ${idtype} ${name} ${proto} ${port}` + if [ "${out}" = "${expect_without_rule}" ]; then + echo "ok ${ntest}" + elif [ "${out}" = "ok" -o "${out}" = "fl" ]; then + echo "not ok ${ntest}" + else + echo "not ok ${ntest} # ${out}" + fi + ntest=$((ntest+1)) + + if [ "${idtype}" = "uid" ]; then + idstr=`id -u ${name}` + elif [ "${idtype}" = "gid" ]; then + idstr=`id -g ${name}` + else + idstr=${name} + fi + sysctl security.mac.portacl.rules=${idtype}:${idstr}:${proto}:${port} >/dev/null + out=`check_bind ${idtype} ${name} ${proto} ${port}` + if [ "${out}" = "${expect_with_rule}" ]; then + echo "ok ${ntest}" + elif [ "${out}" = "ok" -o "${out}" = "fl" ]; then + echo "not ok ${ntest}" + else + echo "not ok ${ntest} # ${out}" + fi + ntest=$((ntest+1)) + + sysctl security.mac.portacl.rules= >/dev/null +} + +reserved_high=`sysctl -n net.inet.ip.portrange.reservedhigh` +suser_exempt=`sysctl -n security.mac.portacl.suser_exempt` +port_high=`sysctl -n security.mac.portacl.port_high` + +restore_settings() { + sysctl -n net.inet.ip.portrange.reservedhigh=${reserved_high} >/dev/null + sysctl -n security.mac.portacl.suser_exempt=${suser_exempt} >/dev/null + sysctl -n security.mac.portacl.port_high=${port_high} >/dev/null +} Added: head/tools/regression/mac/mac_portacl/nobody.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/mac/mac_portacl/nobody.t Sat Mar 14 21:54:19 2009 (r189832) @@ -0,0 +1,67 @@ +#!/bin/sh +# $FreeBSD$ + +dir=`dirname $0` +. ${dir}/misc.sh + +echo "1..64" + +# security.mac.portacl.suser_exempt value doesn't affect unprivileged users +# behaviour. +# mac_portacl has no impact on ports <= net.inet.ip.portrange.reservedhigh. + +sysctl security.mac.portacl.suser_exempt=1 >/dev/null +sysctl net.inet.ip.portrange.reservedhigh=78 >/dev/null + +bind_test fl fl uid nobody tcp 77 +bind_test ok ok uid nobody tcp 7777 +bind_test fl fl uid nobody udp 77 +bind_test ok ok uid nobody udp 7777 + +bind_test fl fl gid nobody tcp 77 +bind_test ok ok gid nobody tcp 7777 +bind_test fl fl gid nobody udp 77 +bind_test ok ok gid nobody udp 7777 + +sysctl security.mac.portacl.suser_exempt=0 >/dev/null + +bind_test fl fl uid nobody tcp 77 +bind_test ok ok uid nobody tcp 7777 +bind_test fl fl uid nobody udp 77 +bind_test ok ok uid nobody udp 7777 + +bind_test fl fl gid nobody tcp 77 +bind_test ok ok gid nobody tcp 7777 +bind_test fl fl gid nobody udp 77 +bind_test ok ok gid nobody udp 7777 + +# Verify if security.mac.portacl.port_high works. + +sysctl security.mac.portacl.port_high=7778 >/dev/null + +bind_test fl fl uid nobody tcp 77 +bind_test fl ok uid nobody tcp 7777 +bind_test fl fl uid nobody udp 77 +bind_test fl ok uid nobody udp 7777 + +bind_test fl fl gid nobody tcp 77 +bind_test fl ok gid nobody tcp 7777 +bind_test fl fl gid nobody udp 77 +bind_test fl ok gid nobody udp 7777 + +# Verify if mac_portacl rules work. + +sysctl net.inet.ip.portrange.reservedhigh=76 >/dev/null +sysctl security.mac.portacl.port_high=7776 >/dev/null + +bind_test fl ok uid nobody tcp 77 +bind_test ok ok uid nobody tcp 7777 +bind_test fl ok uid nobody udp 77 +bind_test ok ok uid nobody udp 7777 + +bind_test fl ok gid nobody tcp 77 +bind_test ok ok gid nobody tcp 7777 +bind_test fl ok gid nobody udp 77 +bind_test ok ok gid nobody udp 7777 + +restore_settings Added: head/tools/regression/mac/mac_portacl/root.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/mac/mac_portacl/root.t Sat Mar 14 21:54:19 2009 (r189832) @@ -0,0 +1,51 @@ +#!/bin/sh +# $FreeBSD$ + +dir=`dirname $0` +. ${dir}/misc.sh + +echo "1..48" + +# Verify if security.mac.portacl.suser_exempt=1 really exempts super-user. + +sysctl security.mac.portacl.suser_exempt=1 >/dev/null + +bind_test ok ok uid root tcp 77 +bind_test ok ok uid root tcp 7777 +bind_test ok ok uid root udp 77 +bind_test ok ok uid root udp 7777 + +bind_test ok ok gid root tcp 77 +bind_test ok ok gid root tcp 7777 +bind_test ok ok gid root udp 77 +bind_test ok ok gid root udp 7777 + +# Verify if security.mac.portacl.suser_exempt=0 really doesn't exempt super-user. + +sysctl security.mac.portacl.suser_exempt=0 >/dev/null + +bind_test fl ok uid root tcp 77 +bind_test ok ok uid root tcp 7777 +bind_test fl ok uid root udp 77 +bind_test ok ok uid root udp 7777 + +bind_test fl ok gid root tcp 77 +bind_test ok ok gid root tcp 7777 +bind_test fl ok gid root udp 77 +bind_test ok ok gid root udp 7777 + +# Verify if security.mac.portacl.port_high works for super-user. + +sysctl security.mac.portacl.port_high=7778 >/dev/null + +bind_test fl ok uid root tcp 77 +bind_test fl ok uid root tcp 7777 +bind_test fl ok uid root udp 77 +bind_test fl ok uid root udp 7777 + +bind_test fl ok gid root tcp 77 +bind_test fl ok gid root tcp 7777 +bind_test fl ok gid root udp 77 +bind_test fl ok gid root udp 7777 + +restore_settings From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 21:59:12 2009 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 86A9C1065672; Sat, 14 Mar 2009 21:59:12 +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 75DA08FC0C; Sat, 14 Mar 2009 21:59:12 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ELxCuf009151; Sat, 14 Mar 2009 21:59:12 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ELxCjV009150; Sat, 14 Mar 2009 21:59:12 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200903142159.n2ELxCjV009150@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 14 Mar 2009 21:59: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: r189833 - head/tools/regression/mac/mac_portacl 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 Mar 2009 21:59:12 -0000 Author: pjd Date: Sat Mar 14 21:59:12 2009 New Revision: 189833 URL: http://svn.freebsd.org/changeset/base/189833 Log: Oops. Correct comment in the LICENSE file. Modified: head/tools/regression/mac/mac_portacl/LICENSE Modified: head/tools/regression/mac/mac_portacl/LICENSE ============================================================================== --- head/tools/regression/mac/mac_portacl/LICENSE Sat Mar 14 21:54:19 2009 (r189832) +++ head/tools/regression/mac/mac_portacl/LICENSE Sat Mar 14 21:59:12 2009 (r189833) @@ -1,6 +1,6 @@ $FreeBSD$ -License for all regression tests available with fstest: +License for all mac_portacl regression tests: Copyright (c) 2009 Pawel Jakub Dawidek All rights reserved. From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 22:01:13 2009 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 D3A35106566C for ; Sat, 14 Mar 2009 22:01:13 +0000 (UTC) (envelope-from martin_voros@yahoo.com) Received: from web55506.mail.re4.yahoo.com (web55506.mail.re4.yahoo.com [206.190.58.215]) by mx1.freebsd.org (Postfix) with SMTP id 7B7CB8FC15 for ; Sat, 14 Mar 2009 22:01:13 +0000 (UTC) (envelope-from martin_voros@yahoo.com) Received: (qmail 27430 invoked by uid 60001); 14 Mar 2009 21:34:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1237066471; bh=/gQlm60u8VNI1IFQUKbwzTQ8Q1h/NVChdP6WJWpDbyE=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:MIME-Version:Content-Type; b=rmTmjw0ARmb06mUdsPmyj1c5fvLuKMS+nbdkV654ZS1qfaqPZOJo2SyTOGlKqaFBi26zKqSKkmfTBmGrmxrXOu8pnLG8Pc1LYqHjAVlqpDSe8dhrYt5eEYvqgHHUig+rPIahiHujDtDUgZWNiZcDtjvjo5XdrI7ZCMqHKpdlws4= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:MIME-Version:Content-Type; b=dqN7IO/+FkI/VKmXFkbwP4Ue/CR5Auf134rjt2xpubsWk98i7wcFuW7KSImO4SsZdEMLgto9R9JG1+HBaqVfVlv+tsicz584AN4eoiB35j2y/OqO99FvubYtpzSOECTwz2tt2RWxn3DxycR9WRXWTuJo4wtDME4HJivH6cWSLNY=; Message-ID: <942531.27013.qm@web55506.mail.re4.yahoo.com> X-YMail-OSG: 2PhJZ6AVM1mCeY6iDNl4TWxFyz_dxt4K5Nizvij09937Yi.JG8Ak6Xwzv7ssfd0tJ4BbS0ZM7C4n7YYgzL9y7AnyO95nqa2MIs2OC__qsPGKC7Cj1h63yq.qO8LFytM4bj2FV0yyV4UKZ10Kg9ZWnVkViKzSL7SPlV3uEzeaqtKWZ.FR2bTVpnUr3pfFXqlUWmmd2TXTWc_P_IAj.fcIK1Vx2a4- Received: from [124.170.6.217] by web55506.mail.re4.yahoo.com via HTTP; Sat, 14 Mar 2009 14:34:31 PDT X-Mailer: YahooMailRC/1155.45 YahooMailWebService/0.7.289.1 References: <200903141755.n2EHtGj1003232@svn.freebsd.org> Date: Sat, 14 Mar 2009 14:34:31 -0700 (PDT) From: Martin Voros To: Roman Divacky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Subject: Re: svn commit: r189801 - in head: cddl cddl/lib/libzpool cddl/usr.bin/ztest cddl/usr.sbin/zdb share/mk tools/regression/include/tgmath 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 Mar 2009 22:01:14 -0000 ----- Original Message ---- > From: Roman Divacky > To: src-committers@freebsd.org; svn-src-all@freebsd.org; svn-src-head@freebsd.org > Sent: Sunday, March 15, 2009 4:55:16 AM > Subject: svn commit: r189801 - in head: cddl cddl/lib/libzpool cddl/usr.bin/ztest cddl/usr.sbin/zdb share/mk tools/regression/include/tgmath > > Author: rdivacky > Date: Sat Mar 14 17:55:16 2009 > New Revision: 189801 > URL: http://svn.freebsd.org/changeset/base/189801 > > Log: > Switch over to gnu99 compilation on default for userland. > > Tested by: make universe > Tested by: ports exp build (done by pav) > Reviewed by: ru > Reviewed by: silence on arch > Approved by: ed (mentor) > > Modified: > head/cddl/Makefile.inc > head/cddl/lib/libzpool/Makefile > head/cddl/usr.bin/ztest/Makefile > head/cddl/usr.sbin/zdb/Makefile > head/share/mk/bsd.sys.mk > head/tools/regression/include/tgmath/Makefile > > Modified: head/cddl/Makefile.inc > ============================================================================== > --- head/cddl/Makefile.inc Sat Mar 14 17:54:58 2009 (r189800) > +++ head/cddl/Makefile.inc Sat Mar 14 17:55:16 2009 (r189801) > @@ -6,3 +6,5 @@ OPENSOLARIS_SYS_DISTDIR= ${.CURDIR}/../. > IGNORE_PRAGMA= YES > > CFLAGS+= -DNEED_SOLARIS_BOOLEAN > + > +CSTD?= gnu89 Hi, I assume that you should have gnu99 here. Cheers From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 22:50:03 2009 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 BBF42106566C; Sat, 14 Mar 2009 22:50:03 +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 AB37D8FC21; Sat, 14 Mar 2009 22:50:03 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2EMo3vQ010195; Sat, 14 Mar 2009 22:50:03 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2EMo3J0010193; Sat, 14 Mar 2009 22:50:03 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903142250.n2EMo3J0010193@svn.freebsd.org> From: David Schultz Date: Sat, 14 Mar 2009 22:50: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: r189834 - in head: gnu/usr.bin/cc usr.sbin/wpa 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 Mar 2009 22:50:04 -0000 Author: das Date: Sat Mar 14 22:50:03 2009 New Revision: 189834 URL: http://svn.freebsd.org/changeset/base/189834 Log: Fix build breakage due to the interplay between r189801 and r189824. In particular, vendor sources that aren't ready for gnu99 should still be compiled with gnu89. (Before r189824, these would have generated warnings if you tried to compile them in gnu99 mode, but the warnings went unheeded due to -Wno-error.) Modified: head/gnu/usr.bin/cc/Makefile.inc head/usr.sbin/wpa/Makefile.inc Modified: head/gnu/usr.bin/cc/Makefile.inc ============================================================================== --- head/gnu/usr.bin/cc/Makefile.inc Sat Mar 14 21:59:12 2009 (r189833) +++ head/gnu/usr.bin/cc/Makefile.inc Sat Mar 14 22:50:03 2009 (r189834) @@ -18,6 +18,7 @@ GCC_TARGET= ${TARGET_ARCH}-undermydesk-f CFLAGS+= -DIN_GCC -DHAVE_CONFIG_H CFLAGS+= -DPREFIX=\"${TOOLS_PREFIX}/usr\" #CFLAGS+= -DWANT_COMPILER_INVARIANTS +CSTD?= gnu89 # If building 64-bit longs for the i386, "_LARGE_LONG" should also be defined # to get the proper sizes in limits.h Modified: head/usr.sbin/wpa/Makefile.inc ============================================================================== --- head/usr.sbin/wpa/Makefile.inc Sat Mar 14 21:59:12 2009 (r189833) +++ head/usr.sbin/wpa/Makefile.inc Sat Mar 14 22:50:03 2009 (r189834) @@ -24,4 +24,6 @@ CFLAGS+=-I${WPA_DISTDIR}/src/utils CFLAGS+= -DCONFIG_CTRL_IFACE CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX +CSTD= gnu89 # XXX + .include From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 23:11:32 2009 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 DDCE51065672; Sat, 14 Mar 2009 23:11:32 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 84D718FC23; Sat, 14 Mar 2009 23:11:32 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n2EN9kpG041555; Sat, 14 Mar 2009 17:09:47 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 15 Mar 2009 08:10:13 +0900 (JST) Message-Id: <20090315.081013.58456133.imp@bsdimp.com> To: ed@80386.nl From: "M. Warner Losh" In-Reply-To: <20090314205617.GX31961@hoeg.nl> References: <20090314.233939.-1625878868.imp@bsdimp.com> <49BC0FAF.4020308@FreeBSD.org> <20090314205617.GX31961@hoeg.nl> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) 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, gabor@freebsd.org Subject: Re: svn commit: r189777 - head/lib/libc/nls 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 Mar 2009 23:11:33 -0000 In message: <20090314205617.GX31961@hoeg.nl> Ed Schouten writes: : Hi G=E1bor, : = : * G=E1bor K=F6vesd=E1n wrote: : > Do you think this is the right fix? : > http://kovesdan.org/patches/mtree-fix.diff : = : That seems to be a lot better (though someone else should still revie= w : it). Maybe we can remove some of those mkdir calls there as well? Agreed. I think this is the start of an excellent patch, and some of the by hand mkdir's in the code near by could be eliminated... Warner From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 23:13:16 2009 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 B4EBD106564A; Sat, 14 Mar 2009 23:13:16 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4A908FC23; Sat, 14 Mar 2009 23:13:16 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ENDGi1010735; Sat, 14 Mar 2009 23:13:16 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ENDGU7010734; Sat, 14 Mar 2009 23:13:16 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <200903142313.n2ENDGU7010734@svn.freebsd.org> From: Randall Stewart Date: Sat, 14 Mar 2009 23:13: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: r189836 - 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 Mar 2009 23:13:17 -0000 Author: rrs Date: Sat Mar 14 23:13:16 2009 New Revision: 189836 URL: http://svn.freebsd.org/changeset/base/189836 Log: Opps.. I missed a file on the commit :-) Modified: head/sys/netinet/sctp_structs.h Modified: head/sys/netinet/sctp_structs.h ============================================================================== --- head/sys/netinet/sctp_structs.h Sat Mar 14 23:12:20 2009 (r189835) +++ head/sys/netinet/sctp_structs.h Sat Mar 14 23:13:16 2009 (r189836) @@ -309,7 +309,7 @@ struct sctp_data_chunkrec { /* ECN Nonce: Nonce Value for this chunk */ uint8_t ect_nonce; - + uint8_t fwd_tsn_cnt; /* * part of the Highest sacked algorithm to be able to stroke counts * on ones that are FR'd. @@ -445,6 +445,7 @@ struct sctp_stream_queue_pending { uint8_t pr_sctp_on; uint8_t sender_all_done; uint8_t put_last_out; + uint8_t discard_rest; }; /* From owner-svn-src-head@FreeBSD.ORG Sat Mar 14 23:17:52 2009 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 608D61065673; Sat, 14 Mar 2009 23:17:52 +0000 (UTC) (envelope-from rrs@lakerest.net) Received: from lakerest.net (unknown [IPv6:2001:240:585:2:203:6dff:fe1a:4ddc]) by mx1.freebsd.org (Postfix) with ESMTP id EEFC28FC08; Sat, 14 Mar 2009 23:17:51 +0000 (UTC) (envelope-from rrs@lakerest.net) Received: from [10.1.1.53] ([10.1.1.53]) (authenticated bits=0) by lakerest.net (8.14.3/8.14.3) with ESMTP id n2ENI0Zu004271 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Sat, 14 Mar 2009 19:18:00 -0400 (EDT) (envelope-from rrs@lakerest.net) Message-Id: <591E79E9-26A4-4616-B99E-D44FFCEABC9F@lakerest.net> From: Randall Stewart To: Garrett Cooper In-Reply-To: <7d6fde3d0903141322m2171e0d9h84788db92d5eaa14@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Sat, 14 Mar 2009 19:17:51 -0400 References: <7d6fde3d0903141322m2171e0d9h84788db92d5eaa14@mail.gmail.com> X-Mailer: Apple Mail (2.930.3) Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Randall Stewart , FreeBSD Current , Kostik Belousov , svn-src-head@FreeBSD.org Subject: Re: Fixes for SCTP compile errors on CURRENT [was Re: svn commit: r189790 - 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 Mar 2009 23:17:52 -0000 Garret: That was my bad.. I missed a file on the commit (sctp_structs.h).. Its now committed :-) As far as it being set.. of course it is.. basically the flag is used for large messages when doing PR-SCTP (something that is probably not wise.. but I had someone in Chile doing this).. and it highlighted a few problems in the way PR-SCTP with large messages worked... Still an issue that will cause a print out if you do mixed mode sending PR-SCTP and reliable SCTP.. I need to hunt that down.. its a flight size accounting problem that the audit code catches and fixes.. but I need to figure out what's going on with that :-D R On Mar 14, 2009, at 4:22 PM, Garrett Cooper wrote: > On Sat, Mar 14, 2009 at 12:54 PM, Garrett Cooper > wrote: >> On Sat, Mar 14, 2009 at 9:06 AM, Kostik Belousov >> wrote: >>> On Sat, Mar 14, 2009 at 01:42:14PM +0000, Randall Stewart wrote: >>>> Author: rrs >>>> Date: Sat Mar 14 13:42:13 2009 >>>> New Revision: 189790 >>>> URL: http://svn.freebsd.org/changeset/base/189790 >>>> >>>> Log: >>>> Fixes several PR-SCTP releated bugs. >>>> - When sending large PR-SCTP messages over a >>>> lossy link we would incorrectly calculate the fwd-tsn >>>> - When receiving large multipart pr-sctp packets we would >>>> incorrectly send back a SACK that would renege improperly >>>> on already received packets thus causing unneeded >>>> retransmissions. >>> >>> With this commit, I get >>> /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c: >>> In function 'sctp_express_handle_sack': >>> /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c: >>> 4772: error: 'struct sctp_data_chunkrec' has no member named >>> 'fwd_tsn_cnt' >>> /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c: >>> 4773: error: 'struct sctp_data_chunkrec' has no member named >>> 'fwd_tsn_cnt' >>> /usr/home/kostik/work/build/bsd/DEV/src/sys/netinet/sctp_indata.c: >>> 4775: error: 'struct sctp_data_chunkrec' has no member named >>> 'fwd_tsn_cnt' >> >> As do I. >> -Garrett > > The attached patch fixes all SCTP related compile errors, but I'm a > bit worried about whether or not discard_rest is set anywhere in the > code, or the entire data struct is properly zero'ed out (haven't > inspected it yet): > > Thanks, > -Garrett > > Index: sys/netinet/sctp_structs.h > =================================================================== > --- sys/netinet/sctp_structs.h (revision 189829) > +++ sys/netinet/sctp_structs.h (working copy) > @@ -31,7 +31,7 @@ > /* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $ */ > > #include > -__FBSDID("$FreeBSD$"); > +__FBSDID("$FreeBSD: src/sys/netinet/sctp_structs.h,v 1.30 2009/02/20 > 15:03:54 rrs Exp $"); > > #ifndef __sctp_structs_h__ > #define __sctp_structs_h__ > @@ -310,6 +310,8 @@ > /* ECN Nonce: Nonce Value for this chunk */ > uint8_t ect_nonce; > > + uint8_t fwd_tsn_cnt; > + > /* > * part of the Highest sacked algorithm to be able to stroke counts > * on ones that are FR'd. > @@ -445,6 +447,7 @@ > uint8_t pr_sctp_on; > uint8_t sender_all_done; > uint8_t put_last_out; > + uint8_t discard_rest; > }; > > /* > ------------------------------ Randall Stewart 803-317-4952 (cell) 803-345-0391(direct)