From owner-svn-src-user@FreeBSD.ORG Sun Feb 21 04:41:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C085C106566C; Sun, 21 Feb 2010 04:41:28 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABB418FC15; Sun, 21 Feb 2010 04:41:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1L4fSrB019336; Sun, 21 Feb 2010 04:41:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1L4fSEF019332; Sun, 21 Feb 2010 04:41:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002210441.o1L4fSEF019332@svn.freebsd.org> From: Kip Macy Date: Sun, 21 Feb 2010 04:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204163 - in user/kmacy/releng_8_fcs_buf_xen: cddl/contrib/opensolaris/cmd/zpool sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2010 04:41:28 -0000 Author: kmacy Date: Sun Feb 21 04:41:28 2010 New Revision: 204163 URL: http://svn.freebsd.org/changeset/base/204163 Log: MFC 201143 - updating zpool to version 14 Modified: user/kmacy/releng_8_fcs_buf_xen/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c user/kmacy/releng_8_fcs_buf_xen/sys/cddl/boot/zfs/zfsimpl.h user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: user/kmacy/releng_8_fcs_buf_xen/cddl/compat/opensolaris/ (props changed) user/kmacy/releng_8_fcs_buf_xen/cddl/contrib/opensolaris/ (props changed) user/kmacy/releng_8_fcs_buf_xen/cddl/lib/libnvpair/ (props changed) Modified: user/kmacy/releng_8_fcs_buf_xen/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- user/kmacy/releng_8_fcs_buf_xen/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Feb 21 04:10:25 2010 (r204162) +++ user/kmacy/releng_8_fcs_buf_xen/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Feb 21 04:41:28 2010 (r204163) @@ -3488,6 +3488,8 @@ zpool_do_upgrade(int argc, char **argv) (void) printf(gettext(" 11 Improved scrub performance\n")); (void) printf(gettext(" 12 Snapshot properties\n")); (void) printf(gettext(" 13 snapused property\n")); + (void) printf(gettext(" 14 passthrough-x aclinherit " + "support\n")); (void) printf(gettext("For more information on a particular " "version, including supported releases, see:\n\n")); (void) printf("http://www.opensolaris.org/os/community/zfs/" Modified: user/kmacy/releng_8_fcs_buf_xen/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- user/kmacy/releng_8_fcs_buf_xen/sys/cddl/boot/zfs/zfsimpl.h Sun Feb 21 04:10:25 2010 (r204162) +++ user/kmacy/releng_8_fcs_buf_xen/sys/cddl/boot/zfs/zfsimpl.h Sun Feb 21 04:41:28 2010 (r204163) @@ -479,13 +479,14 @@ typedef enum { #define SPA_VERSION_11 11ULL #define SPA_VERSION_12 12ULL #define SPA_VERSION_13 13ULL +#define SPA_VERSION_14 14ULL /* * When bumping up SPA_VERSION, make sure GRUB ZFS understand the on-disk * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*}, * and do the appropriate changes. */ -#define SPA_VERSION SPA_VERSION_13 -#define SPA_VERSION_STRING "13" +#define SPA_VERSION SPA_VERSION_14 +#define SPA_VERSION_STRING "14" /* * Symbolic names for the changes that caused a SPA_VERSION switch. @@ -520,6 +521,7 @@ typedef enum { #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11 #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12 #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13 +#define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14 /* * The following are configuration names used in the nvlist describing a pool's Modified: user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c ============================================================================== --- user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Sun Feb 21 04:10:25 2010 (r204162) +++ user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Sun Feb 21 04:41:28 2010 (r204163) @@ -97,6 +97,7 @@ zfs_prop_init(void) { "restricted", ZFS_ACL_RESTRICTED }, { "passthrough", ZFS_ACL_PASSTHROUGH }, { "secure", ZFS_ACL_RESTRICTED }, /* bkwrd compatability */ + { "passthrough-x", ZFS_ACL_PASSTHROUGH_X }, { NULL } }; @@ -173,7 +174,7 @@ zfs_prop_init(void) "discard | groupmask | passthrough", "ACLMODE", acl_mode_table); register_index(ZFS_PROP_ACLINHERIT, "aclinherit", ZFS_ACL_RESTRICTED, PROP_INHERIT, ZFS_TYPE_FILESYSTEM, - "discard | noallow | restricted | passthrough", + "discard | noallow | restricted | passthrough | passthrough-x", "ACLINHERIT", acl_inherit_table); register_index(ZFS_PROP_COPIES, "copies", 1, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, Modified: user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h ============================================================================== --- user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Sun Feb 21 04:10:25 2010 (r204162) +++ user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Sun Feb 21 04:41:28 2010 (r204163) @@ -26,8 +26,6 @@ #ifndef _SYS_FS_ZFS_ACL_H #define _SYS_FS_ZFS_ACL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef _KERNEL #include #endif @@ -180,6 +178,7 @@ typedef struct zfs_acl { #define ZFS_ACL_GROUPMASK 2 #define ZFS_ACL_PASSTHROUGH 3 #define ZFS_ACL_RESTRICTED 4 +#define ZFS_ACL_PASSTHROUGH_X 5 struct znode; struct zfsvfs; Modified: user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Sun Feb 21 04:10:25 2010 (r204162) +++ user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Sun Feb 21 04:41:28 2010 (r204163) @@ -1663,7 +1663,8 @@ zfs_ace_can_use(znode_t *zp, uint16_t ac * inherit inheritable ACEs from parent */ static zfs_acl_t * -zfs_acl_inherit(znode_t *zp, zfs_acl_t *paclp, boolean_t *need_chmod) +zfs_acl_inherit(znode_t *zp, zfs_acl_t *paclp, uint64_t mode, + boolean_t *need_chmod) { zfsvfs_t *zfsvfs = zp->z_zfsvfs; void *pacep; @@ -1676,112 +1677,123 @@ zfs_acl_inherit(znode_t *zp, zfs_acl_t * size_t ace_size; void *data1, *data2; size_t data1sz, data2sz; - enum vtype vntype = ZTOV(zp)->v_type; + boolean_t vdir = ZTOV(zp)->v_type == VDIR; + boolean_t vreg = ZTOV(zp)->v_type == VREG; + boolean_t passthrough, passthrough_x, noallow; + + passthrough_x = + zfsvfs->z_acl_inherit == ZFS_ACL_PASSTHROUGH_X; + passthrough = passthrough_x || + zfsvfs->z_acl_inherit == ZFS_ACL_PASSTHROUGH; + noallow = + zfsvfs->z_acl_inherit == ZFS_ACL_NOALLOW; *need_chmod = B_TRUE; pacep = NULL; aclp = zfs_acl_alloc(paclp->z_version); - if (zfsvfs->z_acl_inherit != ZFS_ACL_DISCARD) { - while (pacep = zfs_acl_next_ace(paclp, pacep, &who, - &access_mask, &iflags, &type)) { + if (zfsvfs->z_acl_inherit == ZFS_ACL_DISCARD) + return (aclp); + while (pacep = zfs_acl_next_ace(paclp, pacep, &who, + &access_mask, &iflags, &type)) { - /* - * don't inherit bogus ACEs - */ - if (!zfs_acl_valid_ace_type(type, iflags)) - continue; + /* + * don't inherit bogus ACEs + */ + if (!zfs_acl_valid_ace_type(type, iflags)) + continue; - if (zfsvfs->z_acl_inherit == ZFS_ACL_NOALLOW && - type == ALLOW) - continue; + if (noallow && type == ALLOW) + continue; - ace_size = aclp->z_ops.ace_size(pacep); + ace_size = aclp->z_ops.ace_size(pacep); - if (!zfs_ace_can_use(zp, iflags)) - continue; + if (!zfs_ace_can_use(zp, iflags)) + continue; - /* - * If owner@, group@, or everyone@ inheritable - * then zfs_acl_chmod() isn't needed. - */ - if (zfsvfs->z_acl_inherit == - ZFS_ACL_PASSTHROUGH && - ((iflags & (ACE_OWNER|ACE_EVERYONE)) || - ((iflags & OWNING_GROUP) == - OWNING_GROUP)) && (vntype == VREG || - (vntype == VDIR && - (iflags & ACE_DIRECTORY_INHERIT_ACE)))) - *need_chmod = B_FALSE; - - aclnode = zfs_acl_node_alloc(ace_size); - list_insert_tail(&aclp->z_acl, aclnode); - acep = aclnode->z_acldata; - zfs_set_ace(aclp, acep, access_mask, type, - who, iflags|ACE_INHERITED_ACE); + /* + * If owner@, group@, or everyone@ inheritable + * then zfs_acl_chmod() isn't needed. + */ + if (passthrough && + ((iflags & (ACE_OWNER|ACE_EVERYONE)) || + ((iflags & OWNING_GROUP) == + OWNING_GROUP)) && (vreg || (vdir && (iflags & + ACE_DIRECTORY_INHERIT_ACE)))) { + *need_chmod = B_FALSE; + + if (!vdir && passthrough_x && + ((mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0)) { + access_mask &= ~ACE_EXECUTE; + } + } + + aclnode = zfs_acl_node_alloc(ace_size); + list_insert_tail(&aclp->z_acl, aclnode); + acep = aclnode->z_acldata; + + zfs_set_ace(aclp, acep, access_mask, type, + who, iflags|ACE_INHERITED_ACE); + + /* + * Copy special opaque data if any + */ + if ((data1sz = paclp->z_ops.ace_data(pacep, &data1)) != 0) { + VERIFY((data2sz = aclp->z_ops.ace_data(acep, + &data2)) == data1sz); + bcopy(data1, data2, data2sz); + } + aclp->z_acl_count++; + aclnode->z_ace_count++; + aclp->z_acl_bytes += aclnode->z_size; + newflags = aclp->z_ops.ace_flags_get(acep); + + if (vdir) + aclp->z_hints |= ZFS_INHERIT_ACE; + + if ((iflags & ACE_NO_PROPAGATE_INHERIT_ACE) || !vdir) { + newflags &= ~ALL_INHERIT; + aclp->z_ops.ace_flags_set(acep, + newflags|ACE_INHERITED_ACE); + zfs_restricted_update(zfsvfs, aclp, acep); + continue; + } + + ASSERT(vdir); + + newflags = aclp->z_ops.ace_flags_get(acep); + if ((iflags & (ACE_FILE_INHERIT_ACE | + ACE_DIRECTORY_INHERIT_ACE)) != + ACE_FILE_INHERIT_ACE) { + aclnode2 = zfs_acl_node_alloc(ace_size); + list_insert_tail(&aclp->z_acl, aclnode2); + acep2 = aclnode2->z_acldata; + zfs_set_ace(aclp, acep2, + access_mask, type, who, + iflags|ACE_INHERITED_ACE); + newflags |= ACE_INHERIT_ONLY_ACE; + aclp->z_ops.ace_flags_set(acep, newflags); + newflags &= ~ALL_INHERIT; + aclp->z_ops.ace_flags_set(acep2, + newflags|ACE_INHERITED_ACE); /* * Copy special opaque data if any */ - if ((data1sz = paclp->z_ops.ace_data(pacep, + if ((data1sz = aclp->z_ops.ace_data(acep, &data1)) != 0) { - VERIFY((data2sz = aclp->z_ops.ace_data(acep, + VERIFY((data2sz = + aclp->z_ops.ace_data(acep2, &data2)) == data1sz); - bcopy(data1, data2, data2sz); + bcopy(data1, data2, data1sz); } aclp->z_acl_count++; - aclnode->z_ace_count++; + aclnode2->z_ace_count++; aclp->z_acl_bytes += aclnode->z_size; - newflags = aclp->z_ops.ace_flags_get(acep); - - if (vntype == VDIR) - aclp->z_hints |= ZFS_INHERIT_ACE; - - if ((iflags & ACE_NO_PROPAGATE_INHERIT_ACE) || - (vntype != VDIR)) { - newflags &= ~ALL_INHERIT; - aclp->z_ops.ace_flags_set(acep, - newflags|ACE_INHERITED_ACE); - zfs_restricted_update(zfsvfs, aclp, acep); - continue; - } - - ASSERT(vntype == VDIR); - - newflags = aclp->z_ops.ace_flags_get(acep); - if ((iflags & (ACE_FILE_INHERIT_ACE | - ACE_DIRECTORY_INHERIT_ACE)) != - ACE_FILE_INHERIT_ACE) { - aclnode2 = zfs_acl_node_alloc(ace_size); - list_insert_tail(&aclp->z_acl, aclnode2); - acep2 = aclnode2->z_acldata; - zfs_set_ace(aclp, acep2, - access_mask, type, who, - iflags|ACE_INHERITED_ACE); - newflags |= ACE_INHERIT_ONLY_ACE; - aclp->z_ops.ace_flags_set(acep, newflags); - newflags &= ~ALL_INHERIT; - aclp->z_ops.ace_flags_set(acep2, - newflags|ACE_INHERITED_ACE); - - /* - * Copy special opaque data if any - */ - if ((data1sz = aclp->z_ops.ace_data(acep, - &data1)) != 0) { - VERIFY((data2sz = - aclp->z_ops.ace_data(acep2, - &data2)) == data1sz); - bcopy(data1, data2, data1sz); - } - aclp->z_acl_count++; - aclnode2->z_ace_count++; - aclp->z_acl_bytes += aclnode->z_size; - zfs_restricted_update(zfsvfs, aclp, acep2); - } else { - newflags |= ACE_INHERIT_ONLY_ACE; - aclp->z_ops.ace_flags_set(acep, - newflags|ACE_INHERITED_ACE); - } + zfs_restricted_update(zfsvfs, aclp, acep2); + } else { + newflags |= ACE_INHERIT_ONLY_ACE; + aclp->z_ops.ace_flags_set(acep, + newflags|ACE_INHERITED_ACE); } } return (aclp); @@ -1876,7 +1888,7 @@ zfs_perm_init(znode_t *zp, znode_t *pare mutex_enter(&parent->z_acl_lock); VERIFY(0 == zfs_acl_node_read(parent, &paclp, B_FALSE)); mutex_exit(&parent->z_acl_lock); - aclp = zfs_acl_inherit(zp, paclp, &need_chmod); + aclp = zfs_acl_inherit(zp, paclp, mode, &need_chmod); zfs_acl_free(paclp); } else { aclp = zfs_acl_alloc(zfs_acl_version_zp(zp)); Modified: user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Feb 21 04:10:25 2010 (r204162) +++ user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Feb 21 04:41:28 2010 (r204163) @@ -1491,6 +1491,14 @@ zfs_set_prop_nvlist(const char *name, nv if (zpl_earlier_version(name, ZPL_VERSION_FUID)) return (ENOTSUP); break; + + case ZFS_PROP_ACLINHERIT: + if (nvpair_type(elem) == DATA_TYPE_UINT64 && + nvpair_value_uint64(elem, &intval) == 0) + if (intval == ZFS_ACL_PASSTHROUGH_X && + zfs_earlier_version(name, + SPA_VERSION_PASSTHROUGH_X)) + return (ENOTSUP); } } Modified: user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sun Feb 21 04:10:25 2010 (r204162) +++ user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sun Feb 21 04:41:28 2010 (r204163) @@ -253,13 +253,14 @@ typedef enum zfs_cache_type { #define SPA_VERSION_11 11ULL #define SPA_VERSION_12 12ULL #define SPA_VERSION_13 13ULL +#define SPA_VERSION_14 14ULL /* * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*}, * and do the appropriate changes. */ -#define SPA_VERSION SPA_VERSION_13 -#define SPA_VERSION_STRING "13" +#define SPA_VERSION SPA_VERSION_14 +#define SPA_VERSION_STRING "14" /* * Symbolic names for the changes that caused a SPA_VERSION switch. @@ -294,6 +295,7 @@ typedef enum zfs_cache_type { #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11 #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12 #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13 +#define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14 /* * ZPL version - rev'd whenever an incompatible on-disk format change From owner-svn-src-user@FreeBSD.ORG Sun Feb 21 05:21:25 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DB0C1065670; Sun, 21 Feb 2010 05:21:25 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 12EB58FC0A; Sun, 21 Feb 2010 05:21:25 +0000 (UTC) Received: from apple.my.domain (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o1L5LAa6019792; Sun, 21 Feb 2010 05:21:11 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4B80C2C6.8090902@freebsd.org> Date: Sun, 21 Feb 2010 13:21:10 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20080612) MIME-Version: 1.0 To: Konstantin Belousov References: <201002201634.o1KGYg2f057928@svn.freebsd.org> In-Reply-To: <201002201634.o1KGYg2f057928@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r204132 - in user/kib/vm6/sys: conf dev/md kern sys ufs/ffs ufs/ufs vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2010 05:21:25 -0000 Konstantin Belousov wrote: > Author: kib > Date: Sat Feb 20 16:34:42 2010 > New Revision: 204132 > URL: http://svn.freebsd.org/changeset/base/204132 > > Log: > Implementation of range locking for i/o and vm i/o. > > First vm_readwrite.c implementation by: jeff > In collaboration with: pho The range locking is confusing, if there are thread A,B and C, if A reads range 0-100, B writes range 0-100, C reads 200-300, why should C waits before B is guaranteed ? C should be able to freely read its data. Regards, David Xu From owner-svn-src-user@FreeBSD.ORG Sun Feb 21 13:44:54 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B605D106566C for ; Sun, 21 Feb 2010 13:44:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 8225C8FC16 for ; Sun, 21 Feb 2010 13:44:53 +0000 (UTC) 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 o1LD6s9C032576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 21 Feb 2010 15:06:54 +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 o1LD6stu095905; Sun, 21 Feb 2010 15:06:54 +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 o1LD6sQe095904; Sun, 21 Feb 2010 15:06:54 +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, 21 Feb 2010 15:06:54 +0200 From: Kostik Belousov To: David Xu Message-ID: <20100221130654.GG50403@deviant.kiev.zoral.com.ua> References: <201002201634.o1KGYg2f057928@svn.freebsd.org> <4B80C2C6.8090902@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PjJPTMFqUKxQUast" Content-Disposition: inline In-Reply-To: <4B80C2C6.8090902@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-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 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r204132 - in user/kib/vm6/sys: conf dev/md kern sys ufs/ffs ufs/ufs vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2010 13:44:54 -0000 --PjJPTMFqUKxQUast Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 21, 2010 at 01:21:10PM +0800, David Xu wrote: > Konstantin Belousov wrote: > >Author: kib > >Date: Sat Feb 20 16:34:42 2010 > >New Revision: 204132 > >URL: http://svn.freebsd.org/changeset/base/204132 > > > >Log: > > Implementation of range locking for i/o and vm i/o. > > =20 > > First vm_readwrite.c implementation by: jeff > > In collaboration with: pho > The range locking is confusing, if there are thread A,B and C, > if A reads range 0-100, B writes range 0-100, C reads 200-300, > why should C waits before B is guaranteed ? C should be able to freely > read its data. I was very conservative. My main goal was to grant range locks to the threads in the order of arrival. This implicitely avoids any starvation as a consequence. Implementation in the kern_rangelock.c is temporal anyway, since it suffers from the same scalability issues as old sx/lockmgr due to the use of interlock. --PjJPTMFqUKxQUast Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkuBL+0ACgkQC3+MBN1Mb4gBYwCgg3XQCeJhnMfK4DA02qvJDhG7 /1AAoLIKwT9FXMOGQbsnL2gBtsuuDNLf =OP70 -----END PGP SIGNATURE----- --PjJPTMFqUKxQUast-- From owner-svn-src-user@FreeBSD.ORG Mon Feb 22 04:43:04 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22822106566C; Mon, 22 Feb 2010 04:43:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 119968FC0C; Mon, 22 Feb 2010 04:43:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1M4h3sC039076; Mon, 22 Feb 2010 04:43:03 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1M4h3xw039074; Mon, 22 Feb 2010 04:43:03 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002220443.o1M4h3xw039074@svn.freebsd.org> From: Kip Macy Date: Mon, 22 Feb 2010 04:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204187 - user/kmacy/releng_8_fcs_buf_xen/sys/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 04:43:04 -0000 Author: kmacy Date: Mon Feb 22 04:43:03 2010 New Revision: 204187 URL: http://svn.freebsd.org/changeset/base/204187 Log: don't enable queue debugging by default Modified: user/kmacy/releng_8_fcs_buf_xen/sys/sys/queue.h Modified: user/kmacy/releng_8_fcs_buf_xen/sys/sys/queue.h ============================================================================== --- user/kmacy/releng_8_fcs_buf_xen/sys/sys/queue.h Mon Feb 22 01:48:38 2010 (r204186) +++ user/kmacy/releng_8_fcs_buf_xen/sys/sys/queue.h Mon Feb 22 04:43:03 2010 (r204187) @@ -35,6 +35,11 @@ #include +#if 0 +#ifdef _KERNEL +#define QUEUE_MACRO_DEBUG +#endif +#endif /* * This file defines four types of data structures: singly-linked lists, * singly-linked tail queues, lists and tail queues. From owner-svn-src-user@FreeBSD.ORG Mon Feb 22 04:43:37 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B4CA106566B; Mon, 22 Feb 2010 04:43:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A0028FC0A; Mon, 22 Feb 2010 04:43:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1M4hbjg039241; Mon, 22 Feb 2010 04:43:37 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1M4hbZa039239; Mon, 22 Feb 2010 04:43:37 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002220443.o1M4hbZa039239@svn.freebsd.org> From: Kip Macy Date: Mon, 22 Feb 2010 04:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204188 - user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 04:43:37 -0000 Author: kmacy Date: Mon Feb 22 04:43:37 2010 New Revision: 204188 URL: http://svn.freebsd.org/changeset/base/204188 Log: _zio_cache_valid should be a no-op if page caching is disabled Modified: user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_bio.c Modified: user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_bio.c ============================================================================== --- user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_bio.c Mon Feb 22 04:43:03 2010 (r204187) +++ user/kmacy/releng_8_fcs_buf_xen/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_bio.c Mon Feb 22 04:43:37 2010 (r204188) @@ -1025,6 +1025,9 @@ _zio_cache_valid(void *data, uint64_t si buf_t bp; int i; + if (zfs_page_cache_disable) + return; + bp = zio_buf_va_lookup(data, size); if ((bp->b_flags & B_VMIO) == 0) return; From owner-svn-src-user@FreeBSD.ORG Mon Feb 22 06:59:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18A36106568D; Mon, 22 Feb 2010 06:59:17 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 063AB8FC16; Mon, 22 Feb 2010 06:59:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1M6xGYO069070; Mon, 22 Feb 2010 06:59:16 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1M6xGoL069067; Mon, 22 Feb 2010 06:59:16 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002220659.o1M6xGoL069067@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 22 Feb 2010 06:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204189 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 06:59:17 -0000 Author: edwin Date: Mon Feb 22 06:59:16 2010 New Revision: 204189 URL: http://svn.freebsd.org/changeset/base/204189 Log: - Fix off-by-one error in the equinoxe/solstice calculations. - Make solar and lunar events fully UTC/longitude compliant. - Be able to give correct times on solar and lunar events. Modified: user/edwin/calendar/calendar.h user/edwin/calendar/events.c user/edwin/calendar/io.c user/edwin/calendar/parsedata.c user/edwin/calendar/sunpos.c Modified: user/edwin/calendar/calendar.h ============================================================================== --- user/edwin/calendar/calendar.h Mon Feb 22 04:43:37 2010 (r204188) +++ user/edwin/calendar/calendar.h Mon Feb 22 06:59:16 2010 (r204189) @@ -114,7 +114,7 @@ extern int year1, year2; * - Use event_continue() to add more text to the last added event * - Use event_print_all() to display them in time chronological order */ -struct event *event_add(int, int, int, char *, int, char *); +struct event *event_add(int, int, int, char *, int, char *, char *); void event_continue(struct event *events, char *txt); void event_print_all(FILE *fp); struct event { @@ -124,6 +124,7 @@ struct event { int var; char *date; char *text; + char *extra; struct event *next; }; @@ -151,7 +152,7 @@ void settimes(time_t,int, int, struct tm time_t Mktime(char *); /* parsedata.c */ -int parsedaymonth(char *, int *, int *, int *, int *); +int parsedaymonth(char *, int *, int *, int *, int *, char **); void dodebug(char *type); /* io.c */ @@ -183,4 +184,5 @@ void fpom(int year, double utcoffset, do /* sunpos.c */ void equinoxsolstice(int year, double UTCoffset, int *equinoxdays, int *solsticedays); +void fequinoxsolstice(int year, double UTCoffset, double *equinoxdays, double *solsticedays); int calculatesunlongitude30(int year, int degreeGMToffset, int *ichinesemonths); Modified: user/edwin/calendar/events.c ============================================================================== --- user/edwin/calendar/events.c Mon Feb 22 04:43:37 2010 (r204188) +++ user/edwin/calendar/events.c Mon Feb 22 06:59:16 2010 (r204189) @@ -37,7 +37,8 @@ __FBSDID("$FreeBSD: user/edwin/calendar/ #include "calendar.h" struct event * -event_add(int year, int month, int day, char *date, int var, char *txt) +event_add(int year, int month, int day, char *date, int var, char *txt, + char *extra) { struct event *e; @@ -60,6 +61,9 @@ event_add(int year, int month, int day, e->text = strdup(txt); if (e->text == NULL) errx(1, "event_add: cannot allocate memory"); + e->extra = NULL; + if (extra != NULL) + e->extra = strdup(extra); addtodate(e, year, month, day); return (e); } @@ -108,8 +112,13 @@ event_print_all(FILE *fp) * dates */ while (e != NULL) { - (void)fprintf(fp, "%s%c%s\n", e->date, - e->var ? '*' : ' ', e->text); + (void)fprintf(fp, "%s%c%s%s%s%s\n", e->date, + e->var ? '*' : ' ', e->text, + e->extra != NULL ? " (" : "", + e->extra != NULL ? e->extra : "", + e->extra != NULL ? ")" : "" + ); + e = e->next; } } Modified: user/edwin/calendar/io.c ============================================================================== --- user/edwin/calendar/io.c Mon Feb 22 04:43:37 2010 (r204188) +++ user/edwin/calendar/io.c Mon Feb 22 06:59:16 2010 (r204189) @@ -102,6 +102,7 @@ cal(void) int month[MAXCOUNT]; int day[MAXCOUNT]; int year[MAXCOUNT]; + char **extradata; /* strings of 20 length */ int flags; static int d_first = -1; char buf[2048 + 1]; @@ -109,6 +110,11 @@ cal(void) struct tm tm; char dbuf[80]; + extradata = (char **)calloc(MAXCOUNT, sizeof(char *)); + for (i = 0; i < MAXCOUNT; i++) { + extradata[i] = (char *)calloc(1, 20); + } + /* Unused */ tm.tm_sec = 0; tm.tm_min = 0; @@ -172,7 +178,8 @@ cal(void) p = *pp; *pp = '\0'; - if ((count = parsedaymonth(buf, year, month, day, &flags)) == 0) + if ((count = parsedaymonth(buf, year, month, day, &flags, + extradata)) == 0) continue; *pp = p; @@ -192,7 +199,8 @@ cal(void) if (debug) fprintf(stderr, "got %s\n", pp); events[i] = event_add(year[i], month[i], day[i], dbuf, - ((flags &= F_VARIABLE) != 0) ? 1 : 0, pp); + ((flags &= F_VARIABLE) != 0) ? 1 : 0, pp, + extradata[i]); } } Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Mon Feb 22 04:43:37 2010 (r204188) +++ user/edwin/calendar/parsedata.c Mon Feb 22 06:59:16 2010 (r204189) @@ -46,6 +46,7 @@ static int isonlydigits(char *s, int nos static int indextooffset(char *s); static int parseoffset(char *s); static char *floattoday(int year, double f); +static char *floattotime(double f); /* * Expected styles: @@ -297,12 +298,17 @@ allfine: } static void -remember(int index, int *y, int *m, int *d, int yy, int mm, int dd) +remember(int index, int *y, int *m, int *d, char **ed, int yy, int mm, int dd, + char *extra) { y[index] = yy; m[index] = mm; d[index] = dd; + if (extra != NULL) + strcpy(ed[index], extra); + else + ed[index][0] = '\0'; } static void @@ -336,7 +342,8 @@ struct yearinfo { int ieaster, ipaskha, firstcnyday; double ffullmoon[MAXMOONS], fnewmoon[MAXMOONS]; double ffullmooncny[MAXMOONS], fnewmooncny[MAXMOONS]; - int ichinesemonths[MAXMOONS], equinoxdays[2], solsticedays[2]; + int ichinesemonths[MAXMOONS]; + double equinoxdays[2], solsticedays[2]; int *mondays; struct yearinfo *next; }; @@ -351,12 +358,14 @@ struct yearinfo { * along with the matched line. */ int -parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags) +parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags, + char **edp) { char month[100], dayofmonth[100], dayofweek[100], modifieroffset[100]; char modifierindex[100], specialday[100]; int idayofweek, imonth, idayofmonth, year, index; int d, m, dow, rm, rd, offset; + char *ed; static struct yearinfo *years, *yearinfo; @@ -413,7 +422,7 @@ parsedaymonth(char *date, int *yearp, in yearinfo->fnewmoon); fpom(year, UTCOFFSET_CNY, yearinfo->ffullmooncny, yearinfo->fnewmooncny); - equinoxsolstice(year, 0.0, + fequinoxsolstice(year, UTCoffset, yearinfo->equinoxdays, yearinfo->solsticedays); /* @@ -436,8 +445,8 @@ parsedaymonth(char *date, int *yearp, in if (*flags == (F_MONTH | F_DAYOFMONTH)) { if (!remember_ymd(year, imonth, idayofmonth)) continue; - remember(index++, yearp, monthp, dayp, - year, imonth, idayofmonth); + remember(index++, yearp, monthp, dayp, edp, + year, imonth, idayofmonth, NULL); continue; } @@ -446,8 +455,8 @@ parsedaymonth(char *date, int *yearp, in for (m = 1; m <= 12; m++) { if (!remember_ymd(year, m, idayofmonth)) continue; - remember(index++, yearp, monthp, dayp, - year, m, idayofmonth); + remember(index++, yearp, monthp, dayp, edp, + year, m, idayofmonth, NULL); } continue; } @@ -457,8 +466,8 @@ parsedaymonth(char *date, int *yearp, in for (d = 1; d <= yearinfo->mondays[imonth]; d++) { if (!remember_ymd(year, imonth, d)) continue; - remember(index++, yearp, monthp, dayp, - year, imonth, d); + remember(index++, yearp, monthp, dayp, edp, + year, imonth, d, NULL); } continue; } @@ -468,8 +477,8 @@ parsedaymonth(char *date, int *yearp, in for (m = 1; m <= 12; m++) { if (!remember_ymd(year, m, idayofmonth)) continue; - remember(index++, yearp, monthp, dayp, - year, m, idayofmonth); + remember(index++, yearp, monthp, dayp, edp, + year, m, idayofmonth, NULL); } continue; } @@ -480,8 +489,9 @@ parsedaymonth(char *date, int *yearp, in d = (idayofweek - dow + 8) % 7; while (d <= 366) { if (remember_yd(year, d, &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + remember(index++, + yearp, monthp, dayp, edp, + year, rm, rd, NULL); d += 7; } continue; @@ -498,9 +508,9 @@ parsedaymonth(char *date, int *yearp, in while (d <= yearinfo->mondays[imonth]) { if (--offset == 0 && remember_ymd(year, imonth, d)) { - remember(index++, yearp, - monthp, dayp, year, imonth, - d); + remember(index++, + yearp, monthp, dayp, edp, + year, imonth, d, NULL); continue; } d += 7; @@ -515,8 +525,9 @@ parsedaymonth(char *date, int *yearp, in d -= 7; } if (remember_ymd(year, imonth, d)) - remember(index++, yearp, - monthp, dayp, year, imonth, d); + remember(index++, + yearp, monthp, dayp, edp, + year, imonth, d, NULL); continue; } continue; @@ -528,8 +539,9 @@ parsedaymonth(char *date, int *yearp, in d = (idayofweek - dow + 8) % 7; while (d <= yearinfo->mondays[imonth]) { if (remember_ymd(year, imonth, d)) - remember(index++, yearp, monthp, dayp, - year, imonth, d); + remember(index++, + yearp, monthp, dayp, edp, + year, imonth, d, NULL); d += 7; } continue; @@ -543,8 +555,8 @@ parsedaymonth(char *date, int *yearp, in offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->ieaster + offset, &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + remember(index++, yearp, monthp, dayp, edp, + year, rm, rd, NULL); continue; } @@ -556,8 +568,8 @@ parsedaymonth(char *date, int *yearp, in offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->ipaskha + offset, &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + remember(index++, yearp, monthp, dayp, edp, + year, rm, rd, NULL); continue; } @@ -569,8 +581,8 @@ parsedaymonth(char *date, int *yearp, in offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->firstcnyday + offset, &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + remember(index++, yearp, monthp, dayp, edp, + year, rm, rd, NULL); continue; } @@ -585,9 +597,13 @@ parsedaymonth(char *date, int *yearp, in for (i = 0; yearinfo->ffullmoon[i] > 0; i++) { if (remember_yd(year, floor(yearinfo->ffullmoon[i]) + offset, - &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + &rm, &rd)) { + ed = floattotime( + yearinfo->ffullmoon[i]); + remember(index++, + yearp, monthp, dayp, edp, + year, rm, rd, ed); + } } continue; } @@ -603,9 +619,12 @@ parsedaymonth(char *date, int *yearp, in for (i = 0; yearinfo->ffullmoon[i] > 0; i++) { if (remember_yd(year, floor(yearinfo->fnewmoon[i]) + offset, - &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + &rm, &rd)) { + ed = floattotime(yearinfo->fnewmoon[i]); + remember(index++, + yearp, monthp, dayp, edp, + year, rm, rd, ed); + } } continue; } @@ -617,9 +636,11 @@ parsedaymonth(char *date, int *yearp, in if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->equinoxdays[0] + offset, - &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + &rm, &rd)) { + ed = floattotime(yearinfo->equinoxdays[0]); + remember(index++, yearp, monthp, dayp, edp, + year, rm, rd, ed); + } continue; } if ((*flags & ~F_MODIFIEROFFSET) == @@ -628,9 +649,11 @@ parsedaymonth(char *date, int *yearp, in if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->equinoxdays[1] + offset, - &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + &rm, &rd)) { + ed = floattotime(yearinfo->equinoxdays[1]); + remember(index++, yearp, monthp, dayp, edp, + year, rm, rd, ed); + } continue; } @@ -641,9 +664,11 @@ parsedaymonth(char *date, int *yearp, in if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, - yearinfo->solsticedays[0] + offset, &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + yearinfo->solsticedays[0] + offset, &rm, &rd)) { + ed = floattotime(yearinfo->solsticedays[0]); + remember(index++, yearp, monthp, dayp, edp, + year, rm, rd, ed); + } continue; } if ((*flags & ~F_MODIFIEROFFSET) == @@ -652,9 +677,11 @@ parsedaymonth(char *date, int *yearp, in if ((*flags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, - yearinfo->solsticedays[1] + offset, &rm, &rd)) - remember(index++, yearp, monthp, dayp, - year, rm, rd); + yearinfo->solsticedays[1] + offset, &rm, &rd)) { + ed = floattotime(yearinfo->solsticedays[1]); + remember(index++, yearp, monthp, dayp, edp, + year, rm, rd, ed); + } continue; } @@ -854,6 +881,25 @@ parseoffset(char *s) } static char * +floattotime(double f) +{ + static char buf[100]; + int hh, mm, ss, i; + + f -= floor(f); + i = f * SECSPERDAY; + + hh = i / SECSPERHOUR; + i %= SECSPERHOUR; + mm = i / SECSPERMINUTE; + i %= SECSPERMINUTE; + ss = i; + + sprintf(buf, "%02d:%02d:%02d", hh, mm, ss); + return (buf); +} + +static char * floattoday(int year, double f) { static char buf[100]; @@ -924,4 +970,26 @@ dodebug(char *what) return; } + + if (strcmp(what, "sun") == 0) { + double equinoxdays[2], solsticedays[2]; + for (year = year1; year <= year2; year++) { + printf("Sun in %d:\n", year); + fequinoxsolstice(year, UTCoffset, equinoxdays, + solsticedays); + printf("e[0] - %g (%s)\n", + equinoxdays[0], + floattoday(year, equinoxdays[0])); + printf("e[1] - %g (%s)\n", + equinoxdays[1], + floattoday(year, equinoxdays[1])); + printf("s[0] - %g (%s)\n", + solsticedays[0], + floattoday(year, solsticedays[0])); + printf("s[1] - %g (%s)\n", + solsticedays[1], + floattoday(year, solsticedays[1])); + } + return; + } } Modified: user/edwin/calendar/sunpos.c ============================================================================== --- user/edwin/calendar/sunpos.c Mon Feb 22 04:43:37 2010 (r204188) +++ user/edwin/calendar/sunpos.c Mon Feb 22 06:59:16 2010 (r204189) @@ -191,6 +191,18 @@ sunpos(int inYY, int inMM, int inDD, dou void equinoxsolstice(int year, double UTCoffset, int *equinoxdays, int *solsticedays) { + double fe[2], fs[2]; + + fequinoxsolstice(year, UTCoffset, fe, fs); + equinoxdays[0] = round(fe[0]); + equinoxdays[1] = round(fe[1]); + solsticedays[0] = round(fs[0]); + solsticedays[1] = round(fs[1]); +} + +void +fequinoxsolstice(int year, double UTCoffset, double *equinoxdays, double *solsticedays) +{ double dec, prevdec, L; int h, d, prevangle, angle; int found = 0; @@ -214,7 +226,8 @@ equinoxsolstice(int year, double UTCoffs DEBUG1(year, 3, d, HOUR(h), MIN(h), prevdec, dec); #endif - equinoxdays[0] = cumdays[3] + d; + equinoxdays[0] = 1 + cumdays[3] + d + + ((h / 4.0) / 24.0); found = 1; break; } @@ -239,7 +252,8 @@ equinoxsolstice(int year, double UTCoffs DEBUG1(year, 9, d, HOUR(h), MIN(h), prevdec, dec); #endif - equinoxdays[1] = cumdays[9] + d; + equinoxdays[1] = 1 + cumdays[9] + d + + ((h / 4.0) / 24.0); found = 1; break; } @@ -267,7 +281,8 @@ equinoxsolstice(int year, double UTCoffs DEBUG2(year, 6, d, HOUR(h), MIN(h), prevdec, dec, prevangle, angle); #endif - solsticedays[0] = cumdays[6] + d; + solsticedays[0] = 1 + cumdays[6] + d + + ((h / 4.0) / 24.0); found = 1; break; } @@ -296,7 +311,8 @@ equinoxsolstice(int year, double UTCoffs DEBUG2(year, 12, d, HOUR(h), MIN(h), prevdec, dec, prevangle, angle); #endif - solsticedays[1] = cumdays[12] + d; + solsticedays[1] = 1 + cumdays[12] + d + + ((h / 4.0) / 24.0); found = 1; break; } From owner-svn-src-user@FreeBSD.ORG Mon Feb 22 07:01:10 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2255F106566B; Mon, 22 Feb 2010 07:01:10 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 102218FC0A; Mon, 22 Feb 2010 07:01:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1M71AWT069535; Mon, 22 Feb 2010 07:01:10 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1M71AO3069528; Mon, 22 Feb 2010 07:01:10 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002220701.o1M71AO3069528@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 22 Feb 2010 07:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204190 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 07:01:10 -0000 Author: edwin Date: Mon Feb 22 07:01:09 2010 New Revision: 204190 URL: http://svn.freebsd.org/changeset/base/204190 Log: Add some reference data. Does not need to be added back into the base system. Added: user/edwin/calendar/equinox.txt user/edwin/calendar/moon2008.txt user/edwin/calendar/moon2009.txt user/edwin/calendar/moon2010.txt user/edwin/calendar/moon2011.txt user/edwin/calendar/moon2012.txt Added: user/edwin/calendar/equinox.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/calendar/equinox.txt Mon Feb 22 07:01:09 2010 (r204190) @@ -0,0 +1,77 @@ +Current location: Home page > Calendar > Seasons Calculator - UTC years +2000-2049 + + Seasons Calculator - UTC years 2000-2049 + +The Seasons Calculator calculates the approximate time and date of +the March equinox, the June solstice, the September equinox and the +December solstice. These dates mark the beginning of the four seasons +of the year in many countries: spring, summer, autumn (or fall) and +winter. + +It is important to note that the seasons in the northern hemisphere +are opposite to those in the southern hemisphere. For example, +spring in the northern hemisphere is autumn (or fall) in the southern +hemisphere. Therefore the March equinox is known as the spring or +vernal equinox in the northern hemisphere and the autumnal equinox +in the southern hemisphere. The September equinox is known as the +autumnal equinox in the northern hemisphere and the spring or vernal +equinox in the southern hemisphere. + +Reference to the start of the seasons on this page are taken from +an astronomical viewpoint. In meteorological terms the start dates +for the seasons are different. So spring in many countries in the +northern hemisphere begins on March 1, summer on June 1, autumn (or +fall) on September 1, and winter on December 1. + +Year March Equinox June Solstice September Equinox December Solstice +2000 20 Mar 07:35 21 Jun 01:48 22 Sep 17:28 21 Dec 13:38 +2001 20 Mar 13:31 21 Jun 07:38 22 Sep 23:05 21 Dec 19:21 +2002 20 Mar 19:16 21 Jun 13:25 23 Sep 04:55 22 Dec 01:14 +2003 21 Mar 01:00 21 Jun 19:11 23 Sep 10:47 22 Dec 07:04 +2004 20 Mar 06:48 21 Jun 12:57 22 Sep 16:30 21 Dec 12:42 +2005 20 Mar 12:33 21 Jun 06:46 22 Sep 22:23 21 Dec 18:35 +2006 20 Mar 18:25 21 Jun 12:26 23 Sep 04:04 22 Dec 12:22 +2007 21 Mar 12:07 21 Jun 18:06 23 Sep 09:51 22 Dec 06:07 +2008 20 Mar 05:48 20 Jun 23:59 22 Sep 15:44 21 Dec 12:04 +2009 20 Mar 11:44 21 Jun 05:46 22 Sep 21:19 21 Dec 17:47 +2010 20 Mar 17:32 21 Jun 11:29 23 Sep 03:09 21 Dec 23:38 +2011 20 Mar 23:21 21 Jun 17:16 23 Sep 09:04 22 Dec 05:30 +2012 20 Mar 05:14 20 Jun 23:08 22 Sep 14:49 21 Dec 11:12 +2013 20 Mar 11:02 21 Jun 05:04 22 Sep 20:44 21 Dec 17:11 +2014 20 Mar 16:57 21 Jun 10:52 23 Sep 02:29 21 Dec 23:03 +2015 20 Mar 22:45 21 Jun 16:38 23 Sep 08:21 22 Dec 04:48 +2016 20 Mar 04:30 20 Jun 22:35 22 Sep 14:21 21 Dec 10:44 +2017 20 Mar 10:29 21 Jun 04:24 22 Sep 20:02 21 Dec 16:28 +2018 20 Mar 16:15 21 Jun 10:07 23 Sep 01:54 21 Dec 22:22 +2019 20 Mar 21:59 21 Jun 15:54 23 Sep 07:50 22 Dec 04:19 +2020 20 Mar 03:50 20 Jun 21:44 22 Sep 13:31 21 Dec 10:03 +2021 20 Mar 09:37 21 Jun 03:32 22 Sep 19:21 21 Dec 15:59 +2022 20 Mar 15:33 21 Jun 09:14 23 Sep 01:04 21 Dec 21:48 +2023 20 Mar 21:24 21 Jun 14:57 23 Sep 06:50 22 Dec 03:27 +2024 20 Mar 03:06 20 Jun 20:51 22 Sep 12:44 21 Dec 09:20 +2025 20 Mar 09:02 21 Jun 02:42 22 Sep 18:20 21 Dec 15:03 +2026 20 Mar 14:46 21 Jun 08:25 23 Sep 12:05 21 Dec 20:50 +2027 20 Mar 20:25 21 Jun 14:11 23 Sep 06:02 22 Dec 02:42 +2028 20 Mar 02:17 20 Jun 20:02 22 Sep 11:45 21 Dec 08:20 +2029 20 Mar 08:02 21 Jun 01:48 22 Sep 17:38 21 Dec 14:14 +2030 20 Mar 13:52 21 Jun 07:31 22 Sep 23:27 21 Dec 20:10 +2031 20 Mar 19:41 21 Jun 13:17 23 Sep 05:15 22 Dec 01:56 +2032 20 Mar 01:22 20 Jun 19:09 22 Sep 11:11 21 Dec 07:56 +2033 20 Mar 07:23 21 Jun 01:01 22 Sep 16:52 21 Dec 13:46 +2034 20 Mar 13:18 21 Jun 06:44 22 Sep 22:40 21 Dec 19:34 +2035 20 Mar 19:03 21 Jun 12:33 23 Sep 04:39 22 Dec 01:31 +2036 20 Mar 01:03 20 Jun 18:32 22 Sep 10:24 21 Dec 07:13 +2037 20 Mar 06:50 21 Jun 12:22 22 Sep 16:13 21 Dec 13:08 +2038 20 Mar 12:40 21 Jun 06:09 22 Sep 22:02 21 Dec 19:02 +2039 20 Mar 18:32 21 Jun 11:57 23 Sep 03:50 22 Dec 12:40 +2040 20 Mar 12:11 20 Jun 17:47 22 Sep 09:45 21 Dec 06:33 +2041 20 Mar 06:07 20 Jun 23:36 22 Sep 15:27 21 Dec 12:18 +2042 20 Mar 11:53 21 Jun 05:16 22 Sep 21:12 21 Dec 18:04 +2043 20 Mar 17:28 21 Jun 10:58 23 Sep 03:07 22 Dec 12:01 +2044 19 Mar 23:20 20 Jun 16:51 22 Sep 08:48 21 Dec 05:44 +2045 20 Mar 05:07 20 Jun 22:34 22 Sep 14:33 21 Dec 11:35 +2046 20 Mar 10:58 21 Jun 04:15 22 Sep 20:22 21 Dec 17:28 +2047 20 Mar 16:53 21 Jun 10:03 23 Sep 02:08 21 Dec 23:07 +2048 19 Mar 22:34 20 Jun 15:54 22 Sep 08:01 21 Dec 05:02 +2049 20 Mar 04:29 20 Jun 21:47 22 Sep 13:43 21 Dec 10:52 Added: user/edwin/calendar/moon2008.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/calendar/moon2008.txt Mon Feb 22 07:01:09 2010 (r204190) @@ -0,0 +1,75 @@ + +Moon Phases, 2008 + + Moon Phases, January 2008 + New Moon - January 8, 11:37 + First Quarter - January 15, 19:46 + Full Moon - January 22, 13:35 + Last Quarter - January 30, 05:03 + + Moon Phases, February 2008 + New Moon - February 7, 03:44 + First Quarter - February 14, 03:33 + Full Moon - February 21, 03:30 + Last Quarter - February 29, 02:18 + + Moon Phases, March 2008 + New Moon - March 7, 17:14 + First Quarter - March 14, 10:46 + Full Moon - March 21, 18:40 + Last Quarter - March 29, 21:47 + + Moon Phases, April 2008 + New Moon - April 6, 3:55 + First Quarter - April 12, 18:32 + Full Moon - April 20, 10:25 + Last Quarter - April 28, 14:12 + + Moon Phases, May 2008 + New Moon - May 5, 17:14 + First Quarter - May 12, 03:47 + Full Moon - May 20, 02:11 + Last Quarter - May 28, 02:57 + + Moon Phases, June 2008 + New Moon - June 3, 19:23 + First Quarter - June 10, 15:04 + Full Moon - June 18, 17:30 + Last Quarter - June 25, 18:42 + + Moon Phases, July 2008 + New Moon - July 3, 02:19 + First Quarter - July 10, 04:35 + Full Moon - July 18, 07:59 + Last Quarter - July 25, 18:42 + + Moon Phases, August 2008 + New Moon - August 1, 10:13 + First Quarter - August 8, 20:20 + Full Moon - August 16, 21:16 + Last Quarter - August 23, 23:50 + New Moon - August 30, 19:59 + + Moon Phases, September 2008 + First Quarter - September 7, 14:04 + Full Moon - September 15, 09:13 + Last Quarter - September 22, 05:04 + New Moon - September 29, 08:12 + + Moon Phases, October 2008 + First Quarter - October 7, 09:04 + Full Moon - October 12, 20:02 + Last Quarter - October 21, 11:55 + New Moon - October 28, 23:14 + + Moon Phases, November 2008 + First Quarter - November 6, 04:03 + Full Moon - November 13, 06:17 + Last Quarter - November 19, 21:31 + New Moon - November 27, 16:55 + + Moon Phases, December 2008 + First Quarter - December 5, 21:26 + Full Moon - December 12, 16:37 + Last Quarter - December 19, 10:29 + New Moon - December 27, 12:22 Added: user/edwin/calendar/moon2009.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/calendar/moon2009.txt Mon Feb 22 07:01:09 2010 (r204190) @@ -0,0 +1,76 @@ + +Moon Phases, 2009 + + Moon Phases, January 2009 + First Quarter - January 4, 11:56 + Full Moon - January 11, 03:27 + Last Quarter - January 18, 02:46 + New Moon - January 26, 07:55 + + Moon Phases, February 2009 + First Quarter - February 2, 23:13 + Full Moon - February 9, 14:49 + Last Quarter - February 16, 21:37 + New Moon - February 25, 01:35 + + Moon Phases, March 2009 + First Quarter - March 4, 07:46 + Full Moon - March 11, 02:38 + Last Quarter - March 18, 17:47 + New Moon - March 26, 16:06 + + Moon Phases, April 2009 + First Quarter - April 2, 14:34 + Full Moon - April 9, 14:56 + Last Quarter - April 17, 13:36 + New Moon - April 25, 03:23 + + Moon Phases, May 2009 + First Quarter - May 1, 20:44 + Full Moon - May 9, 04:01 + Last Quarter - May 17, 07:26 + New Moon - May 24, 12:11 + First Quarter - May 31, 03:22 + + Moon Phases, June 2009 + Full Moon - June 7, 18:12 + Last Quarter - June 15, 22:15 + New Moon - June 22, 19:35 + First Quarter - June 29, 11:28 + + Moon Phases, July 2009 + Full Moon - July 7, 09:21 + Last Quarter - July 15, 09:53 + New Moon - July 22, 02:35 + First Quarter - July 28, 22:00 + + Moon Phases, August 2009 + Full Moon - August 6, 00:55 + Last Quarter - August 13, 18:55 + New Moon - August 20, 10:02 + First Quarter - August 27, 11:42 + + Moon Phases, September 2009 + Full Moon - September 4, 16:03 + Last Quarter - September 12, 02:16 + New Moon - September 18, 18:44 + First Quarter - September 26, 04:50 + + Moon Phases, October 2009 + Full Moon - October 4, 06:10 + Last Quarter - October 11, 08:56 + New Moon - October 18, 05:33 + First Quarter - October 26, 00:42 + + Moon Phases, November 2009 + Full Moon - November 2, 19:14 + Last Quarter - November 9, 15:56 + New Moon - November 16, 19:14 + First Quarter - November 24, 21:39 + + Moon Phases, December 2009 + Full Moon - December 2, 07:30 + Last Quarter - December 9, 00:13 + New Moon - December 16, 12:02 + First Quarter - December 24, 17:36 + Full Moon - December 31, 19:13 (blue moon) Added: user/edwin/calendar/moon2010.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/calendar/moon2010.txt Mon Feb 22 07:01:09 2010 (r204190) @@ -0,0 +1,80 @@ + +Moon Phases, 2010 + + Here is the schedule for all the Moon phases for 2010. If you're going to + go skywatching, remember that the best time to see the night sky is when + you have a new moon. When there's a full moon, the dimmer skies are washed + out. Please note that all the times listed are in Universal Time. + + Moon Phases, January 2010 + Last Quarter - January 7, 10:39 + New Moon - January 15, 07:11 + First Quarter - January 23, 10:53 + Full Moon - January 30, 06:18 + + Moon Phases, February 2010 + Last Quarter - February 5, 23:48 + New Moon - February 14, 02:51 + First Quarter - February 22, 00:42 + Full Moon - February 28, 16:38 + + Moon Phases, March 2010 + Last Quarter - March 7, 15:42 + New Moon - March 15, 21:01 + First Quarter - March 23, 11:00 + Full Moon - March 30, 02:25 + + Moon Phases, April 2010 + Last Quarter - April 6, 09:37 + New Moon - April 14, 12:29 + First Quarter - April 21, 18:20 + Full Moon - April 28, 12:18 + + Moon Phases, May 2010 + Last Quarter - May 6, 04:15 + New Moon - May 14, 01:04 + First Quarter - May 20, 23:43 + Full Moon - May 27, 23:07 + + Moon Phases, June 2010 + Last Quarter - June 4, 22:13 + New Moon - June 12, 11:15 + First Quarter - June 19, 04:29 + Full Moon - June 26, 11:30 + + Moon Phases, July 2010 + Last Quarter - July 4, 14:35 + New Moon - July 11, 19:40 + First Quarter - July 18, 10:11 + Full Moon - July 26, 01:37 + + Moon Phases, August 2010 + Last Quarter - August 3, 04:59 + New Moon - August 10, 03:08 + First Quarter - August 16, 18:14 + Full Moon - August 24, 17:05 + + Moon Phases, September 2010 + Last Quarter - September 1, 17:22 + New Moon - September 8, 10:30 + First Quarter - September 15, 05:50 + Full Moon - September 23, 09:17 + + Moon Phases, October 2010 + Last Quarter - October 1, 03:52 + New Moon - October 7, 18:44 + First Quarter - October 14, 21:27 + Full Moon - October 23, 01:36 + Last Quarter - October 30, 12:46 + + Moon Phases, November 2010 + New Moon - November 6, 04:52 + First Quarter - November 13, 16:39 + Full Moon - November 21, 17:27 + Last Quarter - November 28, 20:36 + + Moon Phases, December 2010 + New Moon - December 5, 17:36 + First Quarter - December 13, 13:59 + Full Moon - December 21, 08:13 + Last Quarter - December 28, 04:18 Added: user/edwin/calendar/moon2011.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/calendar/moon2011.txt Mon Feb 22 07:01:09 2010 (r204190) @@ -0,0 +1,75 @@ + +Moon Phases, 2011 + + Moon Phases, January 2011 + New Moon - January 4, 09:03 + First Quarter - January 12, 11:31 + Full Moon - January 19, 21:21 + Last Quarter - January 26, 12:57 + + Moon Phases, February 2011 + New Moon - February 3, 02:31 + First Quarter - February 11, 07:18 + Full Moon - February 18, 08:36 + Last Quarter - February 24, 23:26 + + Moon Phases, March 2011 + New Moon - March 4, 20:46 + First Quarter - March 12, 23:45 + Full Moon - March 19, 18:10 + Last Quarter - March 26, 12:07 + + Moon Phases, April 2011 + New Moon - April 3, 14:32 + First Quarter - April 11, 12:05 + Full Moon - April 18, 02:44 + Last Quarter - April 25, 02:47 + + Moon Phases, May 2011 + New Moon - May 3, 06:51 + First Quarter - May 10, 20:33 + Full Moon - May 17, 11:09 + Last Quarter - May 24, 18:52 + + Moon Phases, June 2011 + New Moon - June 1, 21:03 + First Quarter - June 9, 02:11 + Full Moon - June 15, 20:14 + Last Quarter - June 23, 11:48 + + Moon Phases, July 2011 + New Moon - July 1, 08:54 + First Quarter - July 8, 06:29 + Full Moon - July 15, 06:40 + Last Quarter - July 23, 05:02 + New Moon - July 30, 18:40 + + Moon Phases, August 2011 + First Quarter - August 6, 11:08 + Full Moon - August 13, 18:57 + Last Quarter - August 21, 21:54 + New Moon - August 29, 03:04 + + Moon Phases, September 2011 + First Quarter - September 4, 17:39 + Full Moon - September 12, 09:27 + Last Quarter - September 20, 13:39 + New Moon - September 27, 11:09 + + Moon Phases, October 2011 + First Quarter - October 4, 03:15 + Full Moon - October 12, 02:06 + Last Quarter - October 20, 03:30 + New Moon - October 26, 19:56 + + Moon Phases, November 2011 + First Quarter - November 2, 16:38 + Full Moon - November 10, 20:16 + Last Quarter - November 18, 15:09 + New Moon - November 25, 06:10 + + Moon Phases, December 2011 + First Quarter - December 2, 09:52 + Full Moon - December 10, 14:36 + Last Quarter - December 18, 00:48 + New Moon - December 24, 18:06 Added: user/edwin/calendar/moon2012.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/calendar/moon2012.txt Mon Feb 22 07:01:09 2010 (r204190) @@ -0,0 +1,76 @@ + +Moon Phases, 2012 + + Moon Phases, January 2012 + First Quarter - January 1, 06:15 + Full Moon - January 9, 07:30 + Last Quarter - January 16, 09:08 + New Moon - January 23, 07:39 + First Quarter - January 31, 04:10 + + Moon Phases, February 2012 + Full Moon - February 7, 21:54 + Last Quarter - February 14, 17:04 + New Moon - February 21, 22:35 + + Moon Phases, March 2012 + First Quarter - March 1, 01:21 + Full Moon - March 8, 09:39 + Last Quarter - March 15, 01:25 + New Moon - March 22, 14:37 + First Quarter - March 30, 19:41 + + Moon Phases, April 2012 + Full Moon - April 6, 19:19 + Last Quarter - April 13, 10:50 + New Moon - April 21, 07:18 + First Quarter - April 29, 09:57 + + Moon Phases, May 2012 + Full Moon - May 6, 03:35 + Last Quarter - May 12, 21:47 + New Moon - May 20, 23:47 + First Quarter - May 28, 20:16 + + Moon Phases, June 2012 + Full Moon - June 4, 11:12 + Last Quarter - June 11, 10:41 + New Moon - June 19, 15:02 + First Quarter - June 27, 03:30 + + Moon Phases, July 2012 + Full Moon - July 3, 18:52 + Last Quarter - July 11, 01:48 + New Moon - July 19, 04:24 + First Quarter - July 26, 08:56 + + Moon Phases, August 2012 + Full Moon - August 2, 03:27 + Last Quarter - August 9, 18:55 + New Moon - August 17, 15:54 + First Quarter - August 24, 13:54 + Full Moon - August 31, 13:58 (blue moon) + + Moon Phases, September 2012 + Last Quarter - September 8, 13:15 + New Moon - September 16, 02:11 + First Quarter - September 22, 19:41 + Full Moon - September 30, 03:19 + + Moon Phases, October 2012 + Last Quarter - October 8, 07:33 + New Moon - October 15, 12:02 + First Quarter - October 22, 03:32 + Full Moon - October 29, 19:49 + + Moon Phases, November 2012 + Last Quarter - November 7, 00:36 + New Moon - November 13, 22:08 + First Quarter - November 20, 14:31 + Full Moon - November 28, 14:46 + + Moon Phases, December 2012 + Last Quarter - December 6, 15:31 + New Moon - December 13, 08:42 + First Quarter - December 20, 05:19 + Full Moon - December 28, 10:21 From owner-svn-src-user@FreeBSD.ORG Mon Feb 22 07:20:26 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 746E91065676; Mon, 22 Feb 2010 07:20:26 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62B178FC1F; Mon, 22 Feb 2010 07:20:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1M7KQkG073787; Mon, 22 Feb 2010 07:20:26 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1M7KQX8073782; Mon, 22 Feb 2010 07:20:26 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002220720.o1M7KQX8073782@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 22 Feb 2010 07:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204192 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 07:20:26 -0000 Author: edwin Date: Mon Feb 22 07:20:26 2010 New Revision: 204192 URL: http://svn.freebsd.org/changeset/base/204192 Log: Properly limit the amount of repeats of an occurance (i.e. don't segfault) Modified: user/edwin/calendar/calendar.h user/edwin/calendar/events.c user/edwin/calendar/io.c user/edwin/calendar/parsedata.c Modified: user/edwin/calendar/calendar.h ============================================================================== --- user/edwin/calendar/calendar.h Mon Feb 22 07:19:25 2010 (r204191) +++ user/edwin/calendar/calendar.h Mon Feb 22 07:20:26 2010 (r204192) @@ -95,6 +95,15 @@ extern int eastlongitude; #define STRING_JUNSOLSTICE "JunSolstice" #define STRING_DECSOLSTICE "DecSolstice" +#define MAXCOUNT 125 /* Random number of maximum number of + * repeats of an event. Should be 52 + * (number of weeks per year), if you + * want to show two years then it + * should be 104. If you are seeing + * more than this you are using this + * program wrong. + */ + /* * All the astronomical calculations are carried out for the meridian 120 * degrees east of Greenwich. Modified: user/edwin/calendar/events.c ============================================================================== --- user/edwin/calendar/events.c Mon Feb 22 07:19:25 2010 (r204191) +++ user/edwin/calendar/events.c Mon Feb 22 07:20:26 2010 (r204192) @@ -62,7 +62,7 @@ event_add(int year, int month, int day, if (e->text == NULL) errx(1, "event_add: cannot allocate memory"); e->extra = NULL; - if (extra != NULL) + if (extra != NULL && extra[0] != '\0') e->extra = strdup(extra); addtodate(e, year, month, day); return (e); Modified: user/edwin/calendar/io.c ============================================================================== --- user/edwin/calendar/io.c Mon Feb 22 07:19:25 2010 (r204191) +++ user/edwin/calendar/io.c Mon Feb 22 07:20:26 2010 (r204192) @@ -82,7 +82,6 @@ struct iovec header[] = { {"'s Calendar\nPrecedence: bulk\n\n", 30}, }; -#define MAXCOUNT 55 #define REPLACE(string, slen, struct_) \ if (strncasecmp(buf, (string), (slen)) == 0 && buf[(slen)]) { \ if (struct_.name != NULL) \ Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Mon Feb 22 07:19:25 2010 (r204191) +++ user/edwin/calendar/parsedata.c Mon Feb 22 07:20:26 2010 (r204192) @@ -298,17 +298,25 @@ allfine: } static void -remember(int index, int *y, int *m, int *d, char **ed, int yy, int mm, int dd, +remember(int *index, int *y, int *m, int *d, char **ed, int yy, int mm, int dd, char *extra) { + static int warned = 0; - y[index] = yy; - m[index] = mm; - d[index] = dd; + if (*index >= MAXCOUNT - 1) { + if (warned == 0) + warnx("Index > %d, ignored", MAXCOUNT); + warned++; + return; + } + y[*index] = yy; + m[*index] = mm; + d[*index] = dd; if (extra != NULL) - strcpy(ed[index], extra); + strcpy(ed[*index], extra); else - ed[index][0] = '\0'; + ed[*index][0] = '\0'; + *index += 1; } static void @@ -445,7 +453,7 @@ parsedaymonth(char *date, int *yearp, in if (*flags == (F_MONTH | F_DAYOFMONTH)) { if (!remember_ymd(year, imonth, idayofmonth)) continue; - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, imonth, idayofmonth, NULL); continue; } @@ -455,7 +463,7 @@ parsedaymonth(char *date, int *yearp, in for (m = 1; m <= 12; m++) { if (!remember_ymd(year, m, idayofmonth)) continue; - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, m, idayofmonth, NULL); } continue; @@ -466,7 +474,7 @@ parsedaymonth(char *date, int *yearp, in for (d = 1; d <= yearinfo->mondays[imonth]; d++) { if (!remember_ymd(year, imonth, d)) continue; - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, imonth, d, NULL); } continue; @@ -477,7 +485,7 @@ parsedaymonth(char *date, int *yearp, in for (m = 1; m <= 12; m++) { if (!remember_ymd(year, m, idayofmonth)) continue; - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, m, idayofmonth, NULL); } continue; @@ -489,7 +497,7 @@ parsedaymonth(char *date, int *yearp, in d = (idayofweek - dow + 8) % 7; while (d <= 366) { if (remember_yd(year, d, &rm, &rd)) - remember(index++, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, NULL); d += 7; @@ -508,7 +516,7 @@ parsedaymonth(char *date, int *yearp, in while (d <= yearinfo->mondays[imonth]) { if (--offset == 0 && remember_ymd(year, imonth, d)) { - remember(index++, + remember(&index, yearp, monthp, dayp, edp, year, imonth, d, NULL); continue; @@ -525,7 +533,7 @@ parsedaymonth(char *date, int *yearp, in d -= 7; } if (remember_ymd(year, imonth, d)) - remember(index++, + remember(&index, yearp, monthp, dayp, edp, year, imonth, d, NULL); continue; @@ -539,7 +547,7 @@ parsedaymonth(char *date, int *yearp, in d = (idayofweek - dow + 8) % 7; while (d <= yearinfo->mondays[imonth]) { if (remember_ymd(year, imonth, d)) - remember(index++, + remember(&index, yearp, monthp, dayp, edp, year, imonth, d, NULL); d += 7; @@ -555,7 +563,7 @@ parsedaymonth(char *date, int *yearp, in offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->ieaster + offset, &rm, &rd)) - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, NULL); continue; } @@ -568,7 +576,7 @@ parsedaymonth(char *date, int *yearp, in offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->ipaskha + offset, &rm, &rd)) - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, NULL); continue; } @@ -581,7 +589,7 @@ parsedaymonth(char *date, int *yearp, in offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->firstcnyday + offset, &rm, &rd)) - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, NULL); continue; } @@ -600,7 +608,7 @@ parsedaymonth(char *date, int *yearp, in &rm, &rd)) { ed = floattotime( yearinfo->ffullmoon[i]); - remember(index++, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, ed); } @@ -621,7 +629,7 @@ parsedaymonth(char *date, int *yearp, in floor(yearinfo->fnewmoon[i]) + offset, &rm, &rd)) { ed = floattotime(yearinfo->fnewmoon[i]); - remember(index++, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, ed); } @@ -638,7 +646,7 @@ parsedaymonth(char *date, int *yearp, in if (remember_yd(year, yearinfo->equinoxdays[0] + offset, &rm, &rd)) { ed = floattotime(yearinfo->equinoxdays[0]); - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, ed); } continue; @@ -651,7 +659,7 @@ parsedaymonth(char *date, int *yearp, in if (remember_yd(year, yearinfo->equinoxdays[1] + offset, &rm, &rd)) { ed = floattotime(yearinfo->equinoxdays[1]); - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, ed); } continue; @@ -666,7 +674,7 @@ parsedaymonth(char *date, int *yearp, in if (remember_yd(year, yearinfo->solsticedays[0] + offset, &rm, &rd)) { ed = floattotime(yearinfo->solsticedays[0]); - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, ed); } continue; @@ -679,7 +687,7 @@ parsedaymonth(char *date, int *yearp, in if (remember_yd(year, yearinfo->solsticedays[1] + offset, &rm, &rd)) { ed = floattotime(yearinfo->solsticedays[1]); - remember(index++, yearp, monthp, dayp, edp, + remember(&index, yearp, monthp, dayp, edp, year, rm, rd, ed); } continue; From owner-svn-src-user@FreeBSD.ORG Mon Feb 22 15:35:31 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7109C106566B; Mon, 22 Feb 2010 15:35:31 +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 5F55E8FC14; Mon, 22 Feb 2010 15:35:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1MFZVPE084667; Mon, 22 Feb 2010 15:35:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MFZV2x084663; Mon, 22 Feb 2010 15:35:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201002221535.o1MFZV2x084663@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 22 Feb 2010 15:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204200 - user/kib/vm6/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 15:35:31 -0000 Author: kib Date: Mon Feb 22 15:35:31 2010 New Revision: 204200 URL: http://svn.freebsd.org/changeset/base/204200 Log: Detect sequential writes in vnode_pager_write() and initiate immediate page cleanup for continous regions written sequentially. This allows the buffer clustering and UFS reallocation code to defragment the file. Tested by: pho Modified: user/kib/vm6/sys/vm/vm_object.h user/kib/vm6/sys/vm/vm_readwrite.c user/kib/vm6/sys/vm/vnode_pager.c Modified: user/kib/vm6/sys/vm/vm_object.h ============================================================================== --- user/kib/vm6/sys/vm/vm_object.h Mon Feb 22 15:03:16 2010 (r204199) +++ user/kib/vm6/sys/vm/vm_object.h Mon Feb 22 15:35:31 2010 (r204200) @@ -109,9 +109,13 @@ struct vm_object { * VNode pager * * vnp_size - current size of file + * wpos - start write position for seq write detector + * off - offset from wpos for current write */ struct { off_t vnp_size; + off_t wpos; + ssize_t off; } vnp; /* Modified: user/kib/vm6/sys/vm/vm_readwrite.c ============================================================================== --- user/kib/vm6/sys/vm/vm_readwrite.c Mon Feb 22 15:03:16 2010 (r204199) +++ user/kib/vm6/sys/vm/vm_readwrite.c Mon Feb 22 15:35:31 2010 (r204200) @@ -715,10 +715,10 @@ vnode_pager_write(struct vnode *vp, stru vm_pindex_t idx, clean_start, clean_end; vm_page_t reserv; struct vattr vattr; - ssize_t size, size1, osize, osize1, resid, sresid; - int error, vn_locked, wpmax, wp, i; + ssize_t size, size1, osize, osize1, resid, sresid, written; + int error, vn_locked, wpmax, wp, i, pflags; u_int bits; - boolean_t vnode_locked; + boolean_t vnode_locked, freed, freed1; struct thread *td; if (ioflags & (IO_EXT|IO_INVAL|IO_DIRECT)) @@ -735,6 +735,16 @@ vnode_pager_write(struct vnode *vp, stru vnode_locked = TRUE; error = 0; + /* + * Reversed logic from vnode_generic_putpages(). + */ + if (ioflags & IO_SYNC) + pflags = VM_PAGER_PUT_SYNC; + else if (ioflags & IO_ASYNC) + pflags = 0; + else + pflags = VM_PAGER_CLUSTER_OK; + wpmax = atomic_load_acq_int(&vmio_write_pack); vm_page_t ma[wpmax + 1]; @@ -1002,6 +1012,7 @@ vnode_pager_write(struct vnode *vp, stru error = uiomove_fromphys(ma, off, size, uio); td->td_pflags &= ~TDP_VMIO; + freed = FALSE; VM_OBJECT_LOCK(obj); vm_page_lock_queues(); for (i = 0; i < wp; i++) { @@ -1019,12 +1030,50 @@ vnode_pager_write(struct vnode *vp, stru ma[i]->flags |= PG_WRITEDIRTY; vmio_writedirty++; } + freed1 = FALSE; + if (VM_PAGE_GETQUEUE(ma[i]) == PQ_HOLD) + freed = freed1 = TRUE; vm_page_unhold(ma[i]); - vm_page_activate(ma[i]); + if (!freed1) + vm_page_activate(ma[i]); } - vm_page_unlock_queues(); /* See the comment above about page dirtiness. */ vm_object_set_writeable_dirty(obj); + + /* + * Try to cluster writes. + */ + written = sresid - uio->uio_resid; + if (obj->un_pager.vnp.wpos + obj->un_pager.vnp.off == + uio->uio_offset - written) { + /* + * Sequential writes detected, make a note and + * try to take immediate advantage of it. + */ + if (!freed && OFF_TO_IDX(uio->uio_offset) > + OFF_TO_IDX(uio->uio_offset - written) && + vn_lock(vp, vn_locked | LK_NOWAIT) == 0) { + vm_pageout_flush(ma, wp, pflags); + VOP_UNLOCK(vp, 0); + } +/* printf("seq write, wpos %jd off %jd written %d\n", (intmax_t)obj->un_pager.vnp.wpos, (intmax_t)obj->un_pager.vnp.off, written); */ + obj->un_pager.vnp.off += written; + } else { + /* + * Not a sequential write situation, still + * might be good to not split large write in + * the daemons struggling under pressure. + */ + if (!freed && wp >= vm_pageout_page_count && + vn_lock(vp, vn_locked | LK_NOWAIT) == 0) { + vm_pageout_flush(ma, wp, pflags); + VOP_UNLOCK(vp, 0); + } +/* printf("nonseq write, wpos %jd off %jd wp %d\n", (intmax_t)obj->un_pager.vnp.wpos, (intmax_t)obj->un_pager.vnp.off, wp); */ + obj->un_pager.vnp.wpos = uio->uio_offset; + obj->un_pager.vnp.off = 0; + } + vm_page_unlock_queues(); vm_object_pip_wakeup(obj); VM_OBJECT_UNLOCK(obj); if (error != 0) Modified: user/kib/vm6/sys/vm/vnode_pager.c ============================================================================== --- user/kib/vm6/sys/vm/vnode_pager.c Mon Feb 22 15:03:16 2010 (r204199) +++ user/kib/vm6/sys/vm/vnode_pager.c Mon Feb 22 15:35:31 2010 (r204200) @@ -1017,7 +1017,6 @@ vnode_pager_putpages(object, m, count, s { int rtval; struct vnode *vp; - struct mount *mp; int bytes = count * PAGE_SIZE; /* @@ -1040,8 +1039,6 @@ vnode_pager_putpages(object, m, count, s */ vp = object->handle; VM_OBJECT_UNLOCK(object); - if (vp->v_type != VREG) - mp = NULL; rtval = VOP_PUTPAGES(vp, m, bytes, sync, rtvals, 0); KASSERT(rtval != EOPNOTSUPP, ("vnode_pager: stale FS putpages\n")); From owner-svn-src-user@FreeBSD.ORG Mon Feb 22 15:49:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B352106568F; Mon, 22 Feb 2010 15:49:17 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC3678FC29; Mon, 22 Feb 2010 15:49:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1MFnG53087746; Mon, 22 Feb 2010 15:49:16 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MFnG5D087740; Mon, 22 Feb 2010 15:49:16 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002221549.o1MFnG5D087740@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 22 Feb 2010 15:49:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204201 - in user/luigi/ipfw3-head: sbin/ipfw sys/netinet sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 15:49:17 -0000 Author: luigi Date: Mon Feb 22 15:49:16 2010 New Revision: 204201 URL: http://svn.freebsd.org/changeset/base/204201 Log: updates to profile handling Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_glue.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Mon Feb 22 15:35:31 2010 (r204200) +++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Mon Feb 22 15:49:16 2010 (r204201) @@ -511,7 +511,7 @@ static void read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen) { if (*bandwidth != -1) - warn("duplicate token, override bandwidth value!"); + warnx("duplicate token, override bandwidth value!"); if (arg[0] >= 'a' && arg[0] <= 'z') { if (!if_name) { @@ -592,8 +592,7 @@ load_extra_delays(const char *filename, struct point points[ED_MAX_SAMPLES_NO]; int points_no = 0; - if (link == NULL) - return; /*XXX error */ + /* XXX link never NULL? */ p->link_nr = link->link_nr; profile_name[0] = '\0'; @@ -637,7 +636,7 @@ load_extra_delays(const char *filename, do_points = 0; } else if (!strcasecmp(name, ED_TOK_BW)) { char buf[IFNAMSIZ]; - read_bandwidth(arg, &p->bandwidth, buf, sizeof(buf)); + read_bandwidth(arg, &link->bandwidth, buf, sizeof(buf)); } else if (!strcasecmp(name, ED_TOK_LOSS)) { if (loss != -1.0) errx(ED_EFMT("duplicated token: %s"), name); @@ -1101,9 +1100,9 @@ end_mask: NEED((!pf), "profile already set"); NEED(p, "profile"); { - pf = o_next(&buf, sizeof(*pf), DN_PROFILE); NEED1("extra delay needs the file name\n"); - load_extra_delays(av[0], pf, p); + pf = o_next(&buf, sizeof(*pf), DN_PROFILE); + load_extra_delays(av[0], pf, p); //XXX can't fail? --ac; ++av; } break; @@ -1198,9 +1197,6 @@ end_mask: * correct. But on the other hand, why do we want RED with * WF2Q+ ? */ - /* XXX MPD TODO do it in kernel space when attaching the - * flowset to scheduler? - */ #if 0 if (p.bandwidth==0) /* this is a WF2Q+ queue */ s = 0; @@ -1226,13 +1222,6 @@ end_mask: } } -#if 0 /* XXX profile ? */ - if (p.samples_no <= 0) { - struct dn_profile *prof; - prof = o_next(&o, sizeof(*prof), DN_PROFILE); - i = do_cmd(IP_DUMMYNET_CONFIGURE, prof, sizeof *prof); - } else -#endif i = do_cmd(IP_DUMMYNET3, base, (char *)buf - (char *)base); if (i) Modified: user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Mon Feb 22 15:35:31 2010 (r204200) +++ user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Mon Feb 22 15:49:16 2010 (r204201) @@ -204,7 +204,7 @@ struct dn_profile { char name[ED_MAX_NAME_LEN]; int link_nr; int loss_level; - int bandwidth; // XXX maybe not needed ? + int bandwidth; // XXX use link bandwidth? int samples_no; /* actual length of samples[] */ int samples[ED_MAX_SAMPLES_NO]; /* may be shorter */ }; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_glue.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_glue.c Mon Feb 22 15:35:31 2010 (r204200) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_glue.c Mon Feb 22 15:49:16 2010 (r204201) @@ -417,11 +417,8 @@ dn_compat_config_pipe(struct dn_sch *sch p->bandwidth = p7->bandwidth; p->delay = p7->delay; if (!is7) { - /* FreeBSD 8 has burst and profile */ + /* FreeBSD 8 has burst */ p->burst = p8->burst; - if (p8->samples > 0) - /*XXX TODO */ - ; } /* fill the fifo flowset */ @@ -448,12 +445,11 @@ dn_compat_config_profile(struct dn_profi { struct dn_pipe8 *p8 = (struct dn_pipe8 *)v; - /* XXX NOT TESTED YET */ p8->samples = &(((struct dn_pipe_max8 *)p8)->samples[0]); pf->link_nr = p->link_nr; pf->loss_level = p8->loss_level; - pf->bandwidth = p->bandwidth; +// pf->bandwidth = p->bandwidth; //XXX bandwidth redundant? pf->samples_no = p8->samples_no; strncpy(pf->name, p8->name,sizeof(pf->name)); bcopy(p8->samples, pf->samples, sizeof(pf->samples)); @@ -605,7 +601,7 @@ dn_c_copy_pipe(struct dn_schk *s, struct pipe8->loss_level = pf->loss_level; pipe8->samples_no = pf->samples_no; } - pipe8->burst = l->burst / 8 / hz; + pipe8->burst = div64(l->burst , 8 * hz); } fs->flow_mask = s->sch.sched_mask; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Mon Feb 22 15:35:31 2010 (r204200) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Mon Feb 22 15:49:16 2010 (r204201) @@ -255,7 +255,7 @@ red_drops (struct dn_queue *q, int len) * XXX check wraps... */ if (q->avg) { - u_int t = (dn_cfg.curr_time - q->q_time) / fs->lookup_step; + u_int t = div64((dn_cfg.curr_time - q->q_time), fs->lookup_step); q->avg = (t < fs->lookup_depth) ? SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0; @@ -293,7 +293,7 @@ red_drops (struct dn_queue *q, int len) } if (fs->fs.flags & DN_QSIZE_BYTES) - p_b = (p_b * len) / fs->max_pkt_size; + p_b = div64((p_b * len) , fs->max_pkt_size); if (++q->count == 0) q->random = random() & 0xffff; else { @@ -556,7 +556,7 @@ dummynet_send(struct mbuf *m) struct mbuf *n; for (; m != NULL; m = n) { - struct ifnet *ifp; + struct ifnet *ifp = NULL; /* gcc 3.4.6 complains */ struct m_tag *tag; int dst; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Mon Feb 22 15:35:31 2010 (r204200) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Mon Feb 22 15:49:16 2010 (r204201) @@ -746,6 +746,10 @@ schk_delete_cb(void *obj, void *arg) dn_ht_scan(s->siht, si_destroy, NULL); else if (s->siht) si_destroy(s->siht, NULL); + if (s->profile) { + free(s->profile, M_DUMMYNET); + s->profile = NULL; + } s->siht = NULL; if (s->fp->destroy) s->fp->destroy(s); @@ -984,8 +988,8 @@ config_red(struct dn_fsk *fs) s = (i <= 0) ? 0 : hz * dn_cfg.red_avg_pkt_size * 8 * SCALE(1) / i; - idle = (s * 3) / fs->w_q; /* s, fs->w_q scaled; idle not scaled */ - fs->lookup_step = idle / dn_cfg.red_lookup_depth; + idle = div64((s * 3) , fs->w_q); /* s, fs->w_q scaled; idle not scaled */ + fs->lookup_step = div64(idle , dn_cfg.red_lookup_depth); /* fs->lookup_step not scaled, */ if (!fs->lookup_step) fs->lookup_step = 1; @@ -1170,6 +1174,11 @@ config_link(struct dn_link *p, struct dn D("sched %d not found", i); return EINVAL; } + /* remove profile if exists */ + if (s->profile) { + free(s->profile, M_DUMMYNET); + s->profile = NULL; + } /* copy all parameters */ s->link.oid = p->oid; s->link.link_nr = i; @@ -1281,6 +1290,7 @@ config_sched(struct dn_sch *_nsch, struc struct schk_new_arg a; /* argument for schk_new */ int i; struct dn_link p; /* copy of oldlink */ + struct dn_profile *pf; /* copy of old link profile */ /* Used to preserv mask parameter */ struct ipfw_flow_id new_mask; int new_buckets = 0; @@ -1301,6 +1311,11 @@ config_sched(struct dn_sch *_nsch, struc 1, dn_cfg.max_hash_size, "sched buckets"); /* XXX other sanity checks */ bzero(&p, sizeof(p)); + pf = malloc(sizeof(struct dn_profile), M_DUMMYNET, M_NOWAIT | M_ZERO); + if (pf == NULL) { + D("Error allocating profile"); + return ENOMEM; + } pipe_cmd = a.sch->flags & DN_PIPE_CMD; a.sch->flags &= ~DN_PIPE_CMD; //XXX do it even if is not set? @@ -1360,8 +1375,13 @@ again: /* run twice, for wfq and fifo */ return ENOMEM; } /* restore existing link if any */ - if (p.link_nr) + if (p.link_nr) { s->link = p; + if (pf->link_nr == p.link_nr) /* Restore profile */ + s->profile = pf; + else + s->profile = NULL; /* XXX maybe not needed */ + } p.link_nr = 0; if (s->fp == NULL) { DX(2, "sched %d new type %s", i, a.fp->name); @@ -1376,6 +1396,8 @@ again: /* run twice, for wfq and fifo */ if (s->link.link_nr == 0) D("XXX WARNING link 0 for sched %d", i); p = s->link; /* preserve link */ + if (s->profile) /* preserve profile */ + bcopy(s->profile, pf, sizeof(struct dn_profile)); /* remove from the hash */ dn_ht_find(dn_cfg.schedhash, i, DNHT_REMOVE, NULL); /* Detach flowsets, preserve queues. */ From owner-svn-src-user@FreeBSD.ORG Mon Feb 22 16:17:38 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FC0C1065670; Mon, 22 Feb 2010 16:17:38 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C88E8FC12; Mon, 22 Feb 2010 16:17:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1MGHcwI094339; Mon, 22 Feb 2010 16:17:38 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MGHcYl094335; Mon, 22 Feb 2010 16:17:38 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002221617.o1MGHcYl094335@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 22 Feb 2010 16:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204209 - user/luigi/ipfw3-head/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 16:17:38 -0000 Author: luigi Date: Mon Feb 22 16:17:37 2010 New Revision: 204209 URL: http://svn.freebsd.org/changeset/base/204209 Log: simplify the command parsing by creating a n av[] array with a NULL entry at the end. This removes the need to carry both ac and av during the processing of the arguments. (not all routines are converted). Submitted by: Marta Carbone Modified: user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c user/luigi/ipfw3-head/sbin/ipfw/ipfw2.h user/luigi/ipfw3-head/sbin/ipfw/main.c Modified: user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c Mon Feb 22 16:16:16 2010 (r204208) +++ user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c Mon Feb 22 16:17:37 2010 (r204209) @@ -57,7 +57,7 @@ struct cmdline_opts co; /* global option int resvd_set_number = RESVD_SET; #define GET_UINT_ARG(arg, min, max, tok, s_x) do { \ - if (!ac) \ + if (!av[0]) \ errx(EX_USAGE, "%s: missing argument", match_value(s_x, tok)); \ if (_substrcmp(*av, "tablearg") == 0) { \ arg = IP_FW_TABLEARG; \ @@ -1613,17 +1613,16 @@ show_dyn_ipfw(ipfw_dyn_rule *d, int pcwi * ipfw set move rule X to Y */ void -ipfw_sets_handler(int ac, char *av[]) +ipfw_sets_handler(char *av[]) { uint32_t set_disable, masks[2]; int i, nbytes; uint16_t rulenum; uint8_t cmd, new_set; - ac--; av++; - if (!ac) + if (av[0] == NULL) errx(EX_USAGE, "set needs command"); if (_substrcmp(*av, "show") == 0) { void *data; @@ -1649,8 +1648,8 @@ ipfw_sets_handler(int ac, char *av[]) } printf("\n"); } else if (_substrcmp(*av, "swap") == 0) { - ac--; av++; - if (ac != 2) + av++; + if ( av[0] == NULL || av[1] == NULL ) errx(EX_USAGE, "set swap needs 2 set numbers\n"); rulenum = atoi(av[0]); new_set = atoi(av[1]); @@ -1661,13 +1660,14 @@ ipfw_sets_handler(int ac, char *av[]) masks[0] = (4 << 24) | (new_set << 16) | (rulenum); i = do_cmd(IP_FW_DEL, masks, sizeof(uint32_t)); } else if (_substrcmp(*av, "move") == 0) { - ac--; av++; - if (ac && _substrcmp(*av, "rule") == 0) { + av++; + if (!av[0] && _substrcmp(*av, "rule") == 0) { cmd = 2; - ac--; av++; + av++; } else cmd = 3; - if (ac != 3 || _substrcmp(av[1], "to") != 0) + if (av[0] == NULL || av[1] == NULL || av[2] == NULL || + av[3] != NULL || _substrcmp(av[1], "to") != 0) errx(EX_USAGE, "syntax: set move [rule] X to Y\n"); rulenum = atoi(av[0]); new_set = atoi(av[2]); @@ -1682,10 +1682,10 @@ ipfw_sets_handler(int ac, char *av[]) _substrcmp(*av, "enable") == 0 ) { int which = _substrcmp(*av, "enable") == 0 ? 1 : 0; - ac--; av++; + av++; masks[0] = masks[1] = 0; - while (ac) { + while (!av[0]) { if (isdigit(**av)) { i = atoi(*av); if (i < 0 || i > RESVD_SET) @@ -1699,7 +1699,7 @@ ipfw_sets_handler(int ac, char *av[]) else errx(EX_DATAERR, "invalid set command %s\n", *av); - av++; ac--; + av++; } if ( (masks[0] & masks[1]) != 0 ) errx(EX_DATAERR, @@ -1713,12 +1713,11 @@ ipfw_sets_handler(int ac, char *av[]) } void -ipfw_sysctl_handler(int ac, char *av[], int which) +ipfw_sysctl_handler(char *av[], int which) { - ac--; av++; - if (ac == 0) { + if (av[0] == NULL) { warnx("missing keyword to enable/disable\n"); } else if (_substrcmp(*av, "firewall") == 0) { sysctlbyname("net.inet.ip.fw.enable", NULL, 0, @@ -2207,29 +2206,28 @@ fill_flags(ipfw_insn *cmd, enum ipfw_opc void -ipfw_delete(int ac, char *av[]) +ipfw_delete(char *av[]) { uint32_t rulenum; int i; int exitval = EX_OK; int do_set = 0; - - av++; ac--; + av++; NEED1("missing rule specification"); - if (ac > 0 && _substrcmp(*av, "set") == 0) { + if ( *av && _substrcmp(*av, "set") == 0) { /* Do not allow using the following syntax: * ipfw set N delete set M */ if (co.use_set) errx(EX_DATAERR, "invalid syntax"); do_set = 1; /* delete set */ - ac--; av++; + av++; } /* Rule number */ - while (ac && isdigit(**av)) { - i = atoi(*av); av++; ac--; + while (*av && isdigit(**av)) { + i = atoi(*av); av++; if (co.do_nat) { exitval = do_cmd(IP_FW_NAT_DEL, &i, sizeof i); if (exitval) { @@ -2345,7 +2343,7 @@ next_cmd(ipfw_insn *cmd) * Takes arguments and copies them into a comment */ static void -fill_comment(ipfw_insn *cmd, int ac, char **av) +fill_comment(ipfw_insn *cmd, char **av) { int i, l; char *p = (char *)(cmd + 1); @@ -2354,7 +2352,7 @@ fill_comment(ipfw_insn *cmd, int ac, cha cmd->len = (cmd->len & (F_NOT | F_OR)); /* Compute length of comment string. */ - for (i = 0, l = 0; i < ac; i++) + for (i = 0, l = 0; av[i] != NULL; i++) l += strlen(av[i]) + 1; if (l == 0) return; @@ -2363,7 +2361,7 @@ fill_comment(ipfw_insn *cmd, int ac, cha "comment too long (max 80 chars)"); l = 1 + (l+3)/4; cmd->len = (cmd->len & (F_NOT | F_OR)) | l; - for (i = 0; i < ac; i++) { + for (i = 0; av[i] != NULL; i++) { strcpy(p, av[i]); p += strlen(av[i]); *p++ = ' '; @@ -2388,11 +2386,11 @@ fill_cmd(ipfw_insn *cmd, enum ipfw_opcod * two microinstructions, and returns the pointer to the last one. */ static ipfw_insn * -add_mac(ipfw_insn *cmd, int ac, char *av[]) +add_mac(ipfw_insn *cmd, char *av[]) { ipfw_insn_mac *mac; - if (ac < 2) + if ( ( av[0] == NULL ) || ( av[1] == NULL ) ) errx(EX_DATAERR, "MAC dst src"); cmd->opcode = O_MACADDR2; @@ -2406,9 +2404,9 @@ add_mac(ipfw_insn *cmd, int ac, char *av } static ipfw_insn * -add_mactype(ipfw_insn *cmd, int ac, char *av) +add_mactype(ipfw_insn *cmd, char *av) { - if (ac < 1) + if (!av) errx(EX_DATAERR, "missing MAC type"); if (strcmp(av, "any") != 0) { /* we have a non-null type */ fill_newports((ipfw_insn_u16 *)cmd, av, IPPROTO_ETHERTYPE); @@ -2591,7 +2589,7 @@ add_dst(ipfw_insn *cmd, char *av, u_char * */ void -ipfw_add(int ac, char *av[]) +ipfw_add(char *av[]) { /* * rules are added into the 'rulebuf' and then copied in @@ -2630,37 +2628,36 @@ ipfw_add(int ac, char *av[]) cmd = (ipfw_insn *)cmdbuf; action = (ipfw_insn *)actbuf; - av++; ac--; + av++; /* [rule N] -- Rule number optional */ - if (ac && isdigit(**av)) { + if (av[0] && isdigit(**av)) { rule->rulenum = atoi(*av); av++; - ac--; } /* [set N] -- set number (0..RESVD_SET), optional */ - if (ac > 1 && _substrcmp(*av, "set") == 0) { + if (av[0] && !av[1] && _substrcmp(*av, "set") == 0) { int set = strtoul(av[1], NULL, 10); if (set < 0 || set > RESVD_SET) errx(EX_DATAERR, "illegal set %s", av[1]); rule->set = set; - av += 2; ac -= 2; + av += 2; } /* [prob D] -- match probability, optional */ - if (ac > 1 && _substrcmp(*av, "prob") == 0) { + if (av[0] && av[1] && _substrcmp(*av, "prob") == 0) { match_prob = strtod(av[1], NULL); if (match_prob <= 0 || match_prob > 1) errx(EX_DATAERR, "illegal match prob. %s", av[1]); - av += 2; ac -= 2; + av += 2; } /* action -- mandatory */ NEED1("missing action"); i = match_token(rule_actions, *av); - ac--; av++; + av++; action->len = 1; /* default */ switch(i) { case TOK_CHECKSTATE: @@ -2696,14 +2693,14 @@ ipfw_add(int ac, char *av[]) action->opcode = O_REJECT; NEED1("missing reject code"); fill_reject_code(&action->arg1, *av); - ac--; av++; + av++; break; case TOK_UNREACH6: action->opcode = O_UNREACH6; NEED1("missing unreach code"); fill_unreach6_code(&action->arg1, *av); - ac--; av++; + av++; break; case TOK_COUNT: @@ -2736,7 +2733,7 @@ ipfw_add(int ac, char *av[]) case TOK_TEE: action->opcode = O_TEE; chkarg: - if (!ac) + if (!av[0]) errx(EX_USAGE, "missing argument for %s", *(av - 1)); if (isdigit(**av)) { action->arg1 = strtoul(*av, NULL, 10); @@ -2755,7 +2752,7 @@ chkarg: errx(EX_DATAERR, "illegal divert/tee port"); } else errx(EX_DATAERR, "illegal argument for %s", *(av - 1)); - ac--; av++; + av++; break; case TOK_FORWARD: { @@ -2793,13 +2790,13 @@ chkarg: p->sa.sin_addr.s_addr = INADDR_ANY; else lookup_host(*av, &(p->sa.sin_addr)); - ac--; av++; + av++; break; } case TOK_COMMENT: /* pretend it is a 'count' rule followed by the comment */ action->opcode = O_COUNT; - ac++; av--; /* go back... */ + av--; /* go back... */ break; case TOK_SETFIB: @@ -2814,7 +2811,7 @@ chkarg: errx(EX_DATAERR, "fibs not suported.\n"); if (action->arg1 >= numfibs) /* Temporary */ errx(EX_DATAERR, "fib too large.\n"); - ac--; av++; + av++; break; } @@ -2834,8 +2831,8 @@ chkarg: * If they exist, it go first in the cmdbuf, but then it is * skipped in the copy section to the end of the buffer. */ - while (ac != 0 && (i = match_token(rule_action_params, *av)) != -1) { - ac--; av++; + while (av[0] != NULL && (i = match_token(rule_action_params, *av)) != -1) { + av++; switch (i) { case TOK_LOG: { @@ -2848,15 +2845,15 @@ chkarg: have_log = (ipfw_insn *)c; cmd->len = F_INSN_SIZE(ipfw_insn_log); cmd->opcode = O_LOG; - if (ac && _substrcmp(*av, "logamount") == 0) { - ac--; av++; + if (av[0] && _substrcmp(*av, "logamount") == 0) { + av++; NEED1("logamount requires argument"); l = atoi(*av); if (l < 0) errx(EX_DATAERR, "logamount must be positive"); c->max_log = l; - ac--; av++; + av++; } else { len = sizeof(c->max_log); if (sysctlbyname("net.inet.ip.fw.verbose_limit", @@ -2880,7 +2877,7 @@ chkarg: cmd->len = F_INSN_SIZE(ipfw_insn_altq); cmd->opcode = O_ALTQ; a->qid = altq_name_to_qid(*av); - ac--; av++; + av++; } break; #endif @@ -2896,7 +2893,7 @@ chkarg: rule_action_params); have_tag = cmd; fill_cmd(cmd, O_TAG, (i == TOK_TAG) ? 0: F_NOT, tag); - ac--; av++; + av++; break; } @@ -2910,13 +2907,13 @@ chkarg: goto done; #define OR_START(target) \ - if (ac && (*av[0] == '(' || *av[0] == '{')) { \ + if (av[0] && (*av[0] == '(' || *av[0] == '{')) { \ if (open_par) \ errx(EX_USAGE, "nested \"(\" not allowed\n"); \ prev = NULL; \ open_par = 1; \ if ( (av[0])[1] == '\0') { \ - ac--; av++; \ + av++; \ } else \ (*av)++; \ } \ @@ -2925,30 +2922,30 @@ chkarg: #define CLOSE_PAR \ if (open_par) { \ - if (ac && ( \ + if (av[0] && ( \ strcmp(*av, ")") == 0 || \ strcmp(*av, "}") == 0)) { \ prev = NULL; \ open_par = 0; \ - ac--; av++; \ + av++; \ } else \ errx(EX_USAGE, "missing \")\"\n"); \ } #define NOT_BLOCK \ - if (ac && _substrcmp(*av, "not") == 0) { \ + if (av[0] && _substrcmp(*av, "not") == 0) { \ if (cmd->len & F_NOT) \ errx(EX_USAGE, "double \"not\" not allowed\n"); \ cmd->len |= F_NOT; \ - ac--; av++; \ + av++; \ } #define OR_BLOCK(target) \ - if (ac && _substrcmp(*av, "or") == 0) { \ + if (av[0] && _substrcmp(*av, "or") == 0) { \ if (prev == NULL || open_par == 0) \ errx(EX_DATAERR, "invalid OR block"); \ prev->len |= F_OR; \ - ac--; av++; \ + av++; \ goto target; \ } \ CLOSE_PAR; @@ -2965,15 +2962,15 @@ chkarg: NEED1("missing protocol"); if (_substrcmp(*av, "MAC") == 0 || _substrcmp(*av, "mac") == 0) { - ac--; av++; /* the "MAC" keyword */ - add_mac(cmd, ac, av); /* exits in case of errors */ + av++; /* the "MAC" keyword */ + add_mac(cmd, av); /* exits in case of errors */ cmd = next_cmd(cmd); - ac -= 2; av += 2; /* dst-mac and src-mac */ + av += 2; /* dst-mac and src-mac */ NOT_BLOCK; NEED1("missing mac type"); - if (add_mactype(cmd, ac, av[0])) + if (add_mactype(cmd, av[0])) cmd = next_cmd(cmd); - ac--; av++; /* any or mac-type */ + av++; /* any or mac-type */ goto read_options; } #endif @@ -2985,7 +2982,7 @@ chkarg: NOT_BLOCK; NEED1("missing protocol"); if (add_proto_compat(cmd, *av, &proto)) { - av++; ac--; + av++; if (F_LEN(cmd) != 0) { prev = cmd; cmd = next_cmd(cmd); @@ -2999,9 +2996,9 @@ chkarg: /* * "from", mandatory */ - if (!ac || _substrcmp(*av, "from") != 0) + if ((av[0] == NULL) || _substrcmp(*av, "from") != 0) errx(EX_USAGE, "missing ``from''"); - ac--; av++; + av++; /* * source IP, mandatory @@ -3010,7 +3007,7 @@ chkarg: NOT_BLOCK; /* optional "not" */ NEED1("missing source address"); if (add_src(cmd, *av, proto)) { - ac--; av++; + av++; if (F_LEN(cmd) != 0) { /* ! any */ prev = cmd; cmd = next_cmd(cmd); @@ -3023,10 +3020,10 @@ chkarg: * source ports, optional */ NOT_BLOCK; /* optional "not" */ - if (ac) { + if ( av[0] != NULL ) { if (_substrcmp(*av, "any") == 0 || add_ports(cmd, *av, proto, O_IP_SRCPORT)) { - ac--; av++; + av++; if (F_LEN(cmd) != 0) cmd = next_cmd(cmd); } @@ -3035,9 +3032,9 @@ chkarg: /* * "to", mandatory */ - if (!ac || _substrcmp(*av, "to") != 0) + if ( (av[0] == NULL) || _substrcmp(*av, "to") != 0 ) errx(EX_USAGE, "missing ``to''"); - av++; ac--; + av++; /* * destination, mandatory @@ -3046,7 +3043,7 @@ chkarg: NOT_BLOCK; /* optional "not" */ NEED1("missing dst address"); if (add_dst(cmd, *av, proto)) { - ac--; av++; + av++; if (F_LEN(cmd) != 0) { /* ! any */ prev = cmd; cmd = next_cmd(cmd); @@ -3059,17 +3056,17 @@ chkarg: * dest. ports, optional */ NOT_BLOCK; /* optional "not" */ - if (ac) { + if (av[0]) { if (_substrcmp(*av, "any") == 0 || add_ports(cmd, *av, proto, O_IP_DSTPORT)) { - ac--; av++; + av++; if (F_LEN(cmd) != 0) cmd = next_cmd(cmd); } } read_options: - if (ac && first_cmd == cmd) { + if (av[0] && first_cmd == cmd) { /* * nothing specified so far, store in the rule to ease * printout later. @@ -3077,7 +3074,7 @@ read_options: rule->_pad = 1; } prev = NULL; - while (ac) { + while ( av[0] != NULL ) { char *s; ipfw_insn_u32 *cmd32; /* alias for cmd */ @@ -3091,7 +3088,7 @@ read_options: s++; } i = match_token(rule_options, s); - ac--; av++; + av++; switch(i) { case TOK_NOT: if (cmd->len & F_NOT) @@ -3153,7 +3150,7 @@ read_options: NEED1("recv, xmit, via require interface name" " or address"); fill_iface((ipfw_insn_if *)cmd, av[0]); - ac--; av++; + av++; if (F_LEN(cmd) == 0) /* not a valid address */ break; if (i == TOK_XMIT) @@ -3167,13 +3164,13 @@ read_options: case TOK_ICMPTYPES: NEED1("icmptypes requires list of types"); fill_icmptypes((ipfw_insn_u32 *)cmd, *av); - av++; ac--; + av++; break; case TOK_ICMP6TYPES: NEED1("icmptypes requires list of types"); fill_icmp6types((ipfw_insn_icmp6 *)cmd, *av); - av++; ac--; + av++; break; case TOK_IPTTL: @@ -3183,7 +3180,7 @@ read_options: errx(EX_DATAERR, "invalid ipttl %s", *av); } else fill_cmd(cmd, O_IPTTL, 0, strtoul(*av, NULL, 0)); - ac--; av++; + av++; break; case TOK_IPID: @@ -3193,7 +3190,7 @@ read_options: errx(EX_DATAERR, "invalid ipid %s", *av); } else fill_cmd(cmd, O_IPID, 0, strtoul(*av, NULL, 0)); - ac--; av++; + av++; break; case TOK_IPLEN: @@ -3203,32 +3200,32 @@ read_options: errx(EX_DATAERR, "invalid ip len %s", *av); } else fill_cmd(cmd, O_IPLEN, 0, strtoul(*av, NULL, 0)); - ac--; av++; + av++; break; case TOK_IPVER: NEED1("ipver requires version"); fill_cmd(cmd, O_IPVER, 0, strtoul(*av, NULL, 0)); - ac--; av++; + av++; break; case TOK_IPPRECEDENCE: NEED1("ipprecedence requires value"); fill_cmd(cmd, O_IPPRECEDENCE, 0, (strtoul(*av, NULL, 0) & 7) << 5); - ac--; av++; + av++; break; case TOK_IPOPTS: NEED1("missing argument for ipoptions"); fill_flags(cmd, O_IPOPT, f_ipopts, *av); - ac--; av++; + av++; break; case TOK_IPTOS: NEED1("missing argument for iptos"); fill_flags(cmd, O_IPTOS, f_iptos, *av); - ac--; av++; + av++; break; case TOK_UID: @@ -3245,7 +3242,7 @@ read_options: errx(EX_DATAERR, "uid \"%s\" nonexistent", *av); cmd32->d[0] = pwd->pw_uid; cmd->len |= F_INSN_SIZE(ipfw_insn_u32); - ac--; av++; + av++; } break; @@ -3263,7 +3260,7 @@ read_options: errx(EX_DATAERR, "gid \"%s\" nonexistent", *av); cmd32->d[0] = grp->gr_gid; cmd->len |= F_INSN_SIZE(ipfw_insn_u32); - ac--; av++; + av++; } break; @@ -3279,7 +3276,7 @@ read_options: errx(EX_DATAERR, "jail requires prison ID"); cmd32->d[0] = (uint32_t)jid; cmd->len |= F_INSN_SIZE(ipfw_insn_u32); - ac--; av++; + av++; } break; @@ -3300,13 +3297,13 @@ read_options: } else fill_cmd(cmd, O_TCPDATALEN, 0, strtoul(*av, NULL, 0)); - ac--; av++; + av++; break; case TOK_TCPOPTS: NEED1("missing argument for tcpoptions"); fill_flags(cmd, O_TCPOPTS, f_tcpopts, *av); - ac--; av++; + av++; break; case TOK_TCPSEQ: @@ -3315,21 +3312,21 @@ read_options: cmd->len = F_INSN_SIZE(ipfw_insn_u32); cmd->opcode = (i == TOK_TCPSEQ) ? O_TCPSEQ : O_TCPACK; cmd32->d[0] = htonl(strtoul(*av, NULL, 0)); - ac--; av++; + av++; break; case TOK_TCPWIN: NEED1("tcpwin requires length"); fill_cmd(cmd, O_TCPWIN, 0, htons(strtoul(*av, NULL, 0))); - ac--; av++; + av++; break; case TOK_TCPFLAGS: NEED1("missing argument for tcpflags"); cmd->opcode = O_TCPFLAGS; fill_flags(cmd, O_TCPFLAGS, f_tcpflags, *av); - ac--; av++; + av++; break; case TOK_KEEPSTATE: @@ -3359,11 +3356,11 @@ read_options: cmd->opcode = O_LIMIT; c->limit_mask = c->conn_limit = 0; - while (ac > 0) { + while ( av[0] != NULL ) { if ((val = match_token(limit_masks, *av)) <= 0) break; c->limit_mask |= val; - ac--; av++; + av++; } if (c->limit_mask == 0) @@ -3372,14 +3369,14 @@ read_options: GET_UINT_ARG(c->conn_limit, IPFW_ARG_MIN, IPFW_ARG_MAX, TOK_LIMIT, rule_options); - ac--; av++; + av++; break; } case TOK_PROTO: NEED1("missing protocol"); if (add_proto(cmd, *av, &proto)) { - ac--; av++; + av++; } else errx(EX_DATAERR, "invalid protocol ``%s''", *av); @@ -3388,28 +3385,28 @@ read_options: case TOK_SRCIP: NEED1("missing source IP"); if (add_srcip(cmd, *av)) { - ac--; av++; + av++; } break; case TOK_DSTIP: NEED1("missing destination IP"); if (add_dstip(cmd, *av)) { - ac--; av++; + av++; } break; case TOK_SRCIP6: NEED1("missing source IP6"); if (add_srcip6(cmd, *av)) { - ac--; av++; + av++; } break; case TOK_DSTIP6: NEED1("missing destination IP6"); if (add_dstip6(cmd, *av)) { - ac--; av++; + av++; } break; @@ -3417,7 +3414,7 @@ read_options: NEED1("missing source port"); if (_substrcmp(*av, "any") == 0 || add_ports(cmd, *av, proto, O_IP_SRCPORT)) { - ac--; av++; + av++; } else errx(EX_DATAERR, "invalid source port %s", *av); break; @@ -3426,23 +3423,22 @@ read_options: NEED1("missing destination port"); if (_substrcmp(*av, "any") == 0 || add_ports(cmd, *av, proto, O_IP_DSTPORT)) { - ac--; av++; + av++; } else errx(EX_DATAERR, "invalid destination port %s", *av); break; case TOK_MAC: - if (add_mac(cmd, ac, av)) { - ac -= 2; av += 2; - } + if (add_mac(cmd, av)) + av += 2; break; case TOK_MACTYPE: NEED1("missing mac type"); - if (!add_mactype(cmd, ac, *av)) + if (!add_mactype(cmd, *av)) errx(EX_DATAERR, "invalid mac type %s", *av); - ac--; av++; + av++; break; case TOK_VERREVPATH: @@ -3471,7 +3467,7 @@ read_options: case TOK_EXT6HDR: fill_ext6hdr( cmd, *av ); - ac--; av++; + av++; break; case TOK_FLOWID: @@ -3479,17 +3475,16 @@ read_options: errx( EX_USAGE, "flow-id filter is active " "only for ipv6 protocol\n"); fill_flow6( (ipfw_insn_u32 *) cmd, *av ); - ac--; av++; + av++; break; case TOK_COMMENT: - fill_comment(cmd, ac, av); - av += ac; - ac = 0; + fill_comment(cmd, av); + av[0]=NULL; break; case TOK_TAGGED: - if (ac > 0 && strpbrk(*av, "-,")) { + if (av[0] && strpbrk(*av, "-,")) { if (!add_ports(cmd, *av, 0, O_TAGGED)) errx(EX_DATAERR, "tagged: invalid tag" " list: %s", *av); @@ -3501,13 +3496,13 @@ read_options: TOK_TAGGED, rule_options); fill_cmd(cmd, O_TAGGED, 0, tag); } - ac--; av++; + av++; break; case TOK_FIB: NEED1("fib requires fib number"); fill_cmd(cmd, O_FIB, 0, strtoul(*av, NULL, 0)); - ac--; av++; + av++; break; case TOK_LOOKUP: { @@ -3515,7 +3510,7 @@ read_options: char *p; int j; - if (ac < 2) + if (av[0] && av[1]) errx(EX_USAGE, "format: lookup argument tablenum"); cmd->opcode = O_IP_DST_LOOKUP; cmd->len |= F_INSN_SIZE(ipfw_insn) + 2; @@ -3527,11 +3522,11 @@ read_options: if (lookup_key[j] <= 0) errx(EX_USAGE, "format: cannot lookup on %s", *av); c->d[1] = j; // i converted to option - ac--; av++; + av++; cmd->arg1 = strtoul(*av, &p, 0); if (p && *p) errx(EX_USAGE, "format: lookup argument tablenum"); - ac--; av++; + av++; } break; Modified: user/luigi/ipfw3-head/sbin/ipfw/ipfw2.h ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/ipfw2.h Mon Feb 22 16:16:16 2010 (r204208) +++ user/luigi/ipfw3-head/sbin/ipfw/ipfw2.h Mon Feb 22 16:17:37 2010 (r204209) @@ -204,7 +204,7 @@ enum tokens { * arguments. */ #define NEED(_p, msg) {if (!_p) errx(EX_USAGE, msg);} -#define NEED1(msg) {if (!ac) errx(EX_USAGE, msg);} +#define NEED1(msg) {if (!(*av)) errx(EX_USAGE, msg);} unsigned long long align_uint64(const uint64_t *pll); @@ -248,14 +248,14 @@ struct _ipfw_insn_icmp6; extern int resvd_set_number; /* first-level command handlers */ -void ipfw_add(int ac, char *av[]); +void ipfw_add(char *av[]); void ipfw_show_nat(int ac, char **av); void ipfw_config_pipe(int ac, char **av); void ipfw_config_nat(int ac, char **av); -void ipfw_sets_handler(int ac, char *av[]); +void ipfw_sets_handler(char *av[]); void ipfw_table_handler(int ac, char *av[]); -void ipfw_sysctl_handler(int ac, char *av[], int which); -void ipfw_delete(int ac, char *av[]); +void ipfw_sysctl_handler(char *av[], int which); +void ipfw_delete(char *av[]); void ipfw_flush(int force); void ipfw_zero(int ac, char *av[], int optname); void ipfw_list(int ac, char *av[], int show_counters); Modified: user/luigi/ipfw3-head/sbin/ipfw/main.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/main.c Mon Feb 22 16:16:16 2010 (r204208) +++ user/luigi/ipfw3-head/sbin/ipfw/main.c Mon Feb 22 16:17:37 2010 (r204209) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2003 Luigi Rizzo + * Copyright (c) 2002-2003,2010 Luigi Rizzo * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp * Copyright (c) 1994 Ugen J.S.Antsilevich * @@ -80,31 +80,27 @@ help(void) } /* - * Free a the (locally allocated) copy of command line arguments. - */ -static void -free_args(int ac, char **av) -{ - int i; - - for (i=0; i < ac; i++) - free(av[i]); - free(av); -} - -/* * Called with the arguments, including program name because getopt * wants it to be present. * Returns 0 if successful, 1 if empty command, errx() in case of errors. + * First thing we do is process parameters creating an argv[] array + * which includes the program name and a NULL entry at the end. + * If we are called with a single string, we split it on whitespace. + * Also, arguments with a trailing ',' are joined to the next one. + * The pointers (av[]) and data are in a a single chunk of memory. + * av[0] points to the original program name, all other entries + * point into the allocated chunk. */ static int ipfw_main(int oldac, char **oldav) { - int ch, ac, save_ac; + int ch, ac; const char *errstr; char **av, **save_av; int do_acct = 0; /* Show packet/byte count */ int try_next = 0; /* set if pipe cmd not found */ + int av_size; /* compute the av size */ + char *av_p; /* used to build the av list */ #define WHITESP " \t\f\v\n\r" if (oldac < 2) @@ -112,10 +108,9 @@ ipfw_main(int oldac, char **oldav) if (oldac == 2) { /* - * If we are called with a single string, try to split it into - * arguments for subsequent parsing. - * But first, remove spaces after a ',', by copying the string - * in-place. + * If we are called with one argument, try to split it into + * words for subsequent parsing. Spaces after a ',' are + * removed by copying the string in-place. */ char *arg = oldav[1]; /* The string is the first arg. */ int l = strlen(arg); @@ -150,31 +145,59 @@ ipfw_main(int oldac, char **oldav) ac++; /* - * Allocate the argument list, including one entry for - * the program name because getopt expects it. + * Allocate the argument list structure as a single block + * of memory, containing pointers and the argument + * strings. We include one entry for the program name + * because getopt expects it, and a NULL at the end + * to simplify further parsing. */ - av = safe_calloc(ac + 1, sizeof(char *)); + ac++; /* add 1 for the program name */ + av_size = (ac+1) * sizeof(char *) + l + 1; + av = safe_calloc(av_size, 1); /* - * Second, copy arguments from arg[] to av[]. For each one, + * Init the argument pointer to the end of the array + * and copy arguments from arg[] to av[]. For each one, * j is the initial character, i is the one past the end. */ - for (ac = 1, i = j = 0; i < l; i++) + av_p = (char *)&av[ac+1]; + for (ac = 1, i = j = 0; i < l; i++) { if (index(WHITESP, arg[i]) != NULL || i == l-1) { if (i == l-1) i++; - av[ac] = safe_calloc(i-j+1, 1); - bcopy(arg+j, av[ac], i-j); + bcopy(arg+j, av_p, i-j); + av[ac] = av_p; + av_p += i-j; /* the lenght of the string */ + *av_p++ = '\0'; ac++; j = i + 1; } + } } else { /* * If an argument ends with ',' join with the next one. */ - int first, i, l; + int first, i, l=0; + + /* + * Allocate the argument list structure as a single block + * of memory, containing both pointers and the argument + * strings. We include some space for the program name + * because getopt expects it. + * We add an extra pointer to the end of the array, + * to make simpler further parsing. + */ + for (i=0; i Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03B65106566C; Mon, 22 Feb 2010 20:42:31 +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 E3C878FC17; Mon, 22 Feb 2010 20:42:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1MKgU7L053264; Mon, 22 Feb 2010 20:42:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MKgUOI053254; Mon, 22 Feb 2010 20:42:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201002222042.o1MKgUOI053254@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 22 Feb 2010 20:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204221 - in user/kib/vm6: contrib/bc contrib/gdb/gdb contrib/gdb/gdb/config/mips games/fortune/fortune gnu/usr.bin gnu/usr.bin/bc gnu/usr.bin/dc gnu/usr.bin/gdb/arch/mips gnu/usr.bin/g... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 20:42:31 -0000 Author: kib Date: Mon Feb 22 20:42:30 2010 New Revision: 204221 URL: http://svn.freebsd.org/changeset/base/204221 Log: MFH Added: user/kib/vm6/contrib/gdb/gdb/config/mips/nm-fbsd.h - copied unchanged from r204220, head/contrib/gdb/gdb/config/mips/nm-fbsd.h user/kib/vm6/contrib/gdb/gdb/config/mips/tm-fbsd.h - copied unchanged from r204220, head/contrib/gdb/gdb/config/mips/tm-fbsd.h user/kib/vm6/contrib/gdb/gdb/mipsfbsd-nat.c - copied unchanged from r204220, head/contrib/gdb/gdb/mipsfbsd-nat.c user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.c - copied unchanged from r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.c user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.h - copied unchanged from r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.h user/kib/vm6/sys/kern/subr_hash.c - copied unchanged from r204220, head/sys/kern/subr_hash.c user/kib/vm6/sys/kern/subr_uio.c - copied unchanged from r204220, head/sys/kern/subr_uio.c user/kib/vm6/sys/mips/rmi/bus_space_rmi_pci.c - copied unchanged from r204220, head/sys/mips/rmi/bus_space_rmi_pci.c user/kib/vm6/usr.bin/netstat/netisr.c - copied unchanged from r204220, head/usr.bin/netstat/netisr.c Deleted: user/kib/vm6/contrib/bc/ user/kib/vm6/gnu/usr.bin/bc/ user/kib/vm6/gnu/usr.bin/dc/ user/kib/vm6/sys/kern/kern_subr.c Modified: user/kib/vm6/contrib/gdb/gdb/mips-tdep.h user/kib/vm6/games/fortune/fortune/fortune.c user/kib/vm6/gnu/usr.bin/Makefile user/kib/vm6/gnu/usr.bin/gdb/arch/mips/Makefile user/kib/vm6/gnu/usr.bin/gdb/arch/mips/init.c user/kib/vm6/gnu/usr.bin/gdb/kgdb/trgt_mips.c user/kib/vm6/lib/libc/gen/sysctl.3 user/kib/vm6/lib/libc/gen/sysctl.c user/kib/vm6/lib/libc/gen/sysctlbyname.c user/kib/vm6/lib/libc/gen/sysctlnametomib.c user/kib/vm6/libexec/rtld-elf/powerpc/reloc.c user/kib/vm6/libexec/rtld-elf/powerpc/rtld_machdep.h user/kib/vm6/libexec/rtld-elf/powerpc/rtld_start.S user/kib/vm6/sbin/atacontrol/atacontrol.c user/kib/vm6/sbin/camcontrol/camcontrol.c user/kib/vm6/sbin/devfs/devfs.8 user/kib/vm6/sbin/hastd/proto_socketpair.c user/kib/vm6/sbin/ifconfig/ifconfig.8 user/kib/vm6/sbin/ifconfig/ifconfig.c user/kib/vm6/sbin/ifconfig/ifvlan.c user/kib/vm6/share/man/man5/devfs.rules.5 user/kib/vm6/share/man/man9/ieee80211_scan.9 user/kib/vm6/share/man/man9/netisr.9 user/kib/vm6/sys/amd64/amd64/busdma_machdep.c user/kib/vm6/sys/amd64/amd64/pmap.c user/kib/vm6/sys/arm/xscale/ixp425/cambria_fled.c user/kib/vm6/sys/boot/powerpc/ofw/Makefile user/kib/vm6/sys/boot/sparc64/loader/main.c user/kib/vm6/sys/cam/ata/ata_xpt.c user/kib/vm6/sys/cam/cam_xpt.c user/kib/vm6/sys/cam/cam_xpt_internal.h user/kib/vm6/sys/cam/scsi/scsi_xpt.c user/kib/vm6/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S user/kib/vm6/sys/conf/files user/kib/vm6/sys/conf/ldscript.mips.cfe user/kib/vm6/sys/dev/ata/ata-all.c user/kib/vm6/sys/dev/ata/ata-pci.c user/kib/vm6/sys/dev/ata/ata-sata.c user/kib/vm6/sys/dev/ata/chipsets/ata-intel.c user/kib/vm6/sys/dev/bge/if_bge.c user/kib/vm6/sys/dev/mii/brgphy.c user/kib/vm6/sys/dev/mii/miidevs user/kib/vm6/sys/dev/msk/if_msk.c user/kib/vm6/sys/dev/mxge/if_mxge.c user/kib/vm6/sys/dev/re/if_re.c user/kib/vm6/sys/dev/xen/netfront/netfront.c user/kib/vm6/sys/i386/conf/XEN user/kib/vm6/sys/i386/xen/pmap.c user/kib/vm6/sys/i386/xen/xen_machdep.c user/kib/vm6/sys/ia64/ia64/context.S user/kib/vm6/sys/ia64/ia64/exception.S user/kib/vm6/sys/ia64/ia64/locore.S user/kib/vm6/sys/ia64/ia64/pmap.c user/kib/vm6/sys/ia64/ia64/support.S user/kib/vm6/sys/ia64/ia64/syscall.S user/kib/vm6/sys/ia64/include/pmap.h user/kib/vm6/sys/kern/uipc_socket.c user/kib/vm6/sys/mips/include/intr_machdep.h user/kib/vm6/sys/mips/rmi/board.c user/kib/vm6/sys/mips/rmi/bus_space_rmi.c user/kib/vm6/sys/mips/rmi/files.xlr user/kib/vm6/sys/mips/rmi/interrupt.h user/kib/vm6/sys/mips/rmi/intr_machdep.c user/kib/vm6/sys/mips/rmi/iodi.c user/kib/vm6/sys/mips/rmi/pcibus.h user/kib/vm6/sys/mips/rmi/xlr_pci.c user/kib/vm6/sys/net/if.c user/kib/vm6/sys/net/if.h user/kib/vm6/sys/net/if_loop.c user/kib/vm6/sys/net/if_vlan.c user/kib/vm6/sys/net/netisr.c user/kib/vm6/sys/net/netisr.h user/kib/vm6/sys/netinet/in_proto.c user/kib/vm6/sys/netinet/ip_input.c user/kib/vm6/sys/netinet/ip_var.h user/kib/vm6/sys/netinet/sctp_input.c user/kib/vm6/sys/netinet/sctp_output.c user/kib/vm6/sys/netinet/sctp_output.h user/kib/vm6/sys/netinet/tcp_syncache.c user/kib/vm6/sys/powerpc/aim/machdep.c user/kib/vm6/sys/powerpc/aim/mmu_oea.c user/kib/vm6/sys/powerpc/aim/mmu_oea64.c user/kib/vm6/sys/powerpc/aim/trap.c user/kib/vm6/sys/powerpc/aim/uma_machdep.c user/kib/vm6/sys/powerpc/booke/copyinout.c user/kib/vm6/sys/powerpc/include/sr.h user/kib/vm6/sys/powerpc/include/vmparam.h user/kib/vm6/sys/powerpc/powermac/smu.c user/kib/vm6/sys/powerpc/powerpc/cpu.c user/kib/vm6/sys/sparc64/include/cache.h user/kib/vm6/sys/sparc64/include/cpu.h user/kib/vm6/sys/sparc64/include/md_var.h user/kib/vm6/sys/sparc64/include/pcpu.h user/kib/vm6/sys/sparc64/include/pmap.h user/kib/vm6/sys/sparc64/include/smp.h user/kib/vm6/sys/sparc64/include/tick.h user/kib/vm6/sys/sparc64/include/ver.h user/kib/vm6/sys/sparc64/sparc64/cache.c user/kib/vm6/sys/sparc64/sparc64/cheetah.c user/kib/vm6/sys/sparc64/sparc64/identcpu.c user/kib/vm6/sys/sparc64/sparc64/iommu.c user/kib/vm6/sys/sparc64/sparc64/machdep.c user/kib/vm6/sys/sparc64/sparc64/mp_locore.S user/kib/vm6/sys/sparc64/sparc64/mp_machdep.c user/kib/vm6/sys/sparc64/sparc64/nexus.c user/kib/vm6/sys/sparc64/sparc64/pmap.c user/kib/vm6/sys/sparc64/sparc64/spitfire.c user/kib/vm6/sys/sparc64/sparc64/tick.c user/kib/vm6/sys/sparc64/sparc64/trap.c user/kib/vm6/sys/sys/sysctl.h user/kib/vm6/sys/sys/systm.h user/kib/vm6/sys/vm/vm_init.c user/kib/vm6/sys/xen/evtchn/evtchn_dev.c user/kib/vm6/usr.bin/netstat/Makefile user/kib/vm6/usr.bin/netstat/main.c user/kib/vm6/usr.bin/netstat/netstat.1 user/kib/vm6/usr.bin/netstat/netstat.h user/kib/vm6/usr.sbin/chown/chgrp.1 user/kib/vm6/usr.sbin/chown/chown.8 user/kib/vm6/usr.sbin/chown/chown.c Directory Properties: user/kib/vm6/ (props changed) Copied: user/kib/vm6/contrib/gdb/gdb/config/mips/nm-fbsd.h (from r204220, head/contrib/gdb/gdb/config/mips/nm-fbsd.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/config/mips/nm-fbsd.h Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/config/mips/nm-fbsd.h) @@ -0,0 +1,48 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Native-dependent definitions for NetBSD/mips. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef NM_FBSD_H +#define NM_FBSD_H + +/* Override child_pid_to_exec_file in 'inftarg.c'. */ +#define CHILD_PID_TO_EXEC_FILE + +/* Type of the third argument to the `ptrace' system call. */ +#define PTRACE_ARG3_TYPE caddr_t + +/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */ +#define FETCH_INFERIOR_REGISTERS + +/* We can attach and detach. */ +#define ATTACH_DETACH + +/* Shared library support. */ + +#include "solib.h" + +#endif /* NM_FBSD_H */ Copied: user/kib/vm6/contrib/gdb/gdb/config/mips/tm-fbsd.h (from r204220, head/contrib/gdb/gdb/config/mips/tm-fbsd.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/config/mips/tm-fbsd.h Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/config/mips/tm-fbsd.h) @@ -0,0 +1,43 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Target-dependent definitions for NetBSD/mips. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef TM_FBSD_H +#define TM_FBSD_H + +#include "mips/tm-mips.h" +#include "solib.h" + +/* We don't want to inherit tm-mips.h's shared library trampoline code. */ +#undef IN_SOLIB_CALL_TRAMPOLINE +#undef IN_SOLIB_RETURN_TRAMPOLINE +#undef SKIP_TRAMPOLINE_CODE +#undef IGNORE_HELPER_CALL + +/* XXX undef a bunch of stuff we want to use multi-arch */ +#undef IN_SIGTRAMP +#endif /* TM_FBSD_H */ Modified: user/kib/vm6/contrib/gdb/gdb/mips-tdep.h ============================================================================== --- user/kib/vm6/contrib/gdb/gdb/mips-tdep.h Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/contrib/gdb/gdb/mips-tdep.h Mon Feb 22 20:42:30 2010 (r204221) @@ -62,6 +62,17 @@ struct mips_regnum extern const struct mips_regnum *mips_regnum (struct gdbarch *gdbarch); enum { + MIPS_S0_REGNUM = 16, + MIPS_S1_REGNUM = 17, + MIPS_S2_REGNUM = 18, + MIPS_S3_REGNUM = 19, + MIPS_S4_REGNUM = 20, + MIPS_S5_REGNUM = 21, + MIPS_S6_REGNUM = 22, + MIPS_S7_REGNUM = 23, + MIPS_SP_REGNUM = 29, + MIPS_FP_REGNUM = 30, + MIPS_RA_REGNUM = 31, MIPS_EMBED_LO_REGNUM = 33, MIPS_EMBED_HI_REGNUM = 34, MIPS_EMBED_BADVADDR_REGNUM = 35, Copied: user/kib/vm6/contrib/gdb/gdb/mipsfbsd-nat.c (from r204220, head/contrib/gdb/gdb/mipsfbsd-nat.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/mipsfbsd-nat.c Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/mipsfbsd-nat.c) @@ -0,0 +1,108 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Native-dependent code for MIPS systems running NetBSD. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "inferior.h" +#include "regcache.h" + +#include "mipsfbsd-tdep.h" + +#include +#include +#include + +/* Determine if PT_GETREGS fetches this register. */ +static int +getregs_supplies (int regno) +{ + return ((regno) >= ZERO_REGNUM && (regno) <= PC_REGNUM); +} + +void +fetch_inferior_registers (int regno) +{ + if (regno == -1 || getregs_supplies (regno)) + { + struct reg regs; + + if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) ®s, 0) == -1) + perror_with_name ("Couldn't get registers"); + + mipsfbsd_supply_reg ((char *) ®s, regno); + if (regno != -1) + return; + } + + if (regno == -1 || regno >= FP0_REGNUM) + { + struct fpreg fpregs; + + if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) + perror_with_name ("Couldn't get floating point status"); + + mipsfbsd_supply_fpreg ((char *) &fpregs, regno); + } +} + +void +store_inferior_registers (int regno) +{ + if (regno == -1 || getregs_supplies (regno)) + { + struct reg regs; + + if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) ®s, 0) == -1) + perror_with_name ("Couldn't get registers"); + + mipsfbsd_fill_reg ((char *) ®s, regno); + + if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) ®s, 0) == -1) + perror_with_name ("Couldn't write registers"); + + if (regno != -1) + return; + } + + if (regno == -1 || regno >= FP0_REGNUM) + { + struct fpreg fpregs; + + if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) + perror_with_name ("Couldn't get floating point status"); + + mipsfbsd_fill_fpreg ((char *) &fpregs, regno); + + if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) + perror_with_name ("Couldn't write floating point status"); + } +} Copied: user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.c (from r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.c Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.c) @@ -0,0 +1,579 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Target-dependent code for MIPS systems running NetBSD. + Copyright 2002, 2003 Free Software Foundation, Inc. + Contributed by Wasabi Systems, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "gdbcore.h" +#include "regcache.h" +#include "target.h" +#include "value.h" +#include "osabi.h" + +#include "nbsd-tdep.h" +#include "mipsfbsd-tdep.h" +#include "mips-tdep.h" + +#include "solib-svr4.h" + +#include +#include "gregset.h" +#include "trad-frame.h" +#include "frame.h" +#include "frame-unwind.h" +#include "bfd.h" +#include "objfiles.h" + +/* Conveniently, GDB uses the same register numbering as the + ptrace register structure used by NetBSD/mips. */ + +void +mipsfbsd_supply_reg (char *regs, int regno) +{ + int i; + + for (i = 0; i <= PC_REGNUM; i++) + { + if (regno == i || regno == -1) + { + if (CANNOT_FETCH_REGISTER (i)) + supply_register (i, NULL); + else + supply_register (i, regs + (i * mips_regsize (current_gdbarch))); + } + } +} +void +supply_gregset (gdb_gregset_t *gregs) +{ + mipsfbsd_supply_reg((char *)gregs, -1); +} + +void +mipsfbsd_fill_reg (char *regs, int regno) +{ + int i; + + for (i = 0; i <= PC_REGNUM; i++) + if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) + regcache_collect (i, regs + (i * mips_regsize (current_gdbarch))); +} + +void +fill_gregset (gdb_gregset_t *gregs, int regno) +{ + mipsfbsd_fill_reg ((char *)gregs, regno); +} + +void +mipsfbsd_supply_fpreg (char *fpregs, int regno) +{ + int i; + + for (i = FP0_REGNUM; + i <= mips_regnum (current_gdbarch)->fp_implementation_revision; + i++) + { + if (regno == i || regno == -1) + { + if (CANNOT_FETCH_REGISTER (i)) + supply_register (i, NULL); + else + supply_register (i, + fpregs + ((i - FP0_REGNUM) * mips_regsize (current_gdbarch))); + } + } +} + +void +supply_fpregset (gdb_fpregset_t *fpregs) +{ + mipsfbsd_supply_fpreg((char *)fpregs, -1); +} + +void +mipsfbsd_fill_fpreg (char *fpregs, int regno) +{ + int i; + + for (i = FP0_REGNUM; i <= mips_regnum (current_gdbarch)->fp_control_status; + i++) + if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) + regcache_collect (i, + fpregs + ((i - FP0_REGNUM) * mips_regsize (current_gdbarch))); +} + +void +fill_fpregset (gdb_fpregset_t *fpregs, int regno) +{ + mipsfbsd_fill_fpreg ((char *)fpregs, regno); +} + +static void +fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, + CORE_ADDR ignore) +{ + char *regs, *fpregs; + + /* We get everything from one section. */ + if (which != 0) + return; + + regs = core_reg_sect; + fpregs = core_reg_sect + SIZEOF_STRUCT_REG; + + /* Integer registers. */ + mipsfbsd_supply_reg (regs, -1); + + /* Floating point registers. */ + mipsfbsd_supply_fpreg (fpregs, -1); +} + +static void +fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which, + CORE_ADDR ignore) +{ + switch (which) + { + case 0: /* Integer registers. */ + if (core_reg_size != SIZEOF_STRUCT_REG) + warning ("Wrong size register set in core file."); + else + mipsfbsd_supply_reg (core_reg_sect, -1); + break; + + case 2: /* Floating point registers. */ + if (core_reg_size != SIZEOF_STRUCT_FPREG) + warning ("Wrong size register set in core file."); + else + mipsfbsd_supply_fpreg (core_reg_sect, -1); + break; + + default: + /* Don't know what kind of register request this is; just ignore it. */ + break; + } +} + +static struct core_fns mipsfbsd_core_fns = +{ + bfd_target_unknown_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_core_registers, /* core_read_registers */ + NULL /* next */ +}; + + +/* + * MIPSFBSD Offsets + * 0x7fff0000 User high mem -> USRSTACK [64K] + * + * 0x7ffefff0 ps_strings -> 16 bytes + * + * 0x7ffeffec sigcode -> 44 bytes + * + * 0x7ffeffc4 sigcode end env strings etc start + */ +#define MIPS_FBSD_SIGTRAMP_START (0x7ffeffc4) +#define MIPS_FBSD_SIGTRAMP_END (0x7ffeffec) +#define MIPS_FBSD_SIGTRAMP_STACK_MOD_START (0x7ffeffc8) +#define MIPS_FBSD_SIGTRAMP_STACK_MOD_END (0x7ffeffd8) + +static LONGEST +mipsfbsd_sigtramp_offset (CORE_ADDR pc) +{ + return pc < MIPS_FBSD_SIGTRAMP_END && + pc >= MIPS_FBSD_SIGTRAMP_START ? 1 : -1; +} + +static int +fbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) +{ + return (name && strcmp (name, "__sigtramp") == 0); +} + +static int +mipsfbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +{ + return (fbsd_pc_in_sigtramp (pc, func_name) + || mipsfbsd_sigtramp_offset (pc) >= 0); +} + +static int +is_sigtramp_sp_modified (CORE_ADDR pc) +{ + return (pc >= MIPS_FBSD_SIGTRAMP_STACK_MOD_START && + pc <= MIPS_FBSD_SIGTRAMP_STACK_MOD_END); +} + + +/* Figure out where the longjmp will land. We expect that we have + just entered longjmp and haven't yet setup the stack frame, so + the args are still in the argument regs. A0_REGNUM points at the + jmp_buf structure from which we extract the PC that we will land + at. The PC is copied into *pc. This routine returns true on + success. */ + +#define FBSD_MIPS_JB_PC (12) +#define FBSD_MIPS_JB_ELEMENT_SIZE mips_regsize (current_gdbarch) +#define FBSD_MIPS_JB_OFFSET (FBSD_MIPS_JB_PC * \ + FBSD_MIPS_JB_ELEMENT_SIZE) + +static int +mipsfbsd_get_longjmp_target (CORE_ADDR *pc) +{ + CORE_ADDR jb_addr; + char *buf; + + buf = alloca (FBSD_MIPS_JB_ELEMENT_SIZE); + + jb_addr = read_register (A0_REGNUM); + + if (target_read_memory (jb_addr + FBSD_MIPS_JB_OFFSET, buf, + FBSD_MIPS_JB_ELEMENT_SIZE)) + return 0; + + *pc = extract_unsigned_integer (buf, FBSD_MIPS_JB_ELEMENT_SIZE); + + return 1; +} + +static int +mipsfbsd_cannot_fetch_register (int regno) +{ + return (regno == ZERO_REGNUM + || regno == mips_regnum (current_gdbarch)->fp_implementation_revision); + /* XXX TODO: Are there other registers that we cannot fetch ? */ +} + +static int +mipsfbsd_cannot_store_register (int regno) +{ + return (regno == ZERO_REGNUM + || regno == mips_regnum (current_gdbarch)->fp_implementation_revision); + /* XXX TODO: Are there other registers that we cannot write ? */ +} + +/* + * This structure is defined in mips-tdep.c. + */ +struct mips_frame_cache +{ + CORE_ADDR base; + struct trad_frame_saved_reg *saved_regs; +}; + +/* + * Prologue cache for sigtramp frame + * When we land in sigtramp, sigcontext is saved on the + * stack just below the sigtramp's stack frame. We have + * the Registers saved at fixed offsets on the stack. + */ + +#define MIPS_FBSD_SIGTRAMP_STACK_SIZE (48) +#define MIPS_FBSD_SIGCONTEXT_REG_OFFSET (32) + +static struct mips_frame_cache * +mipsfbsd_sigtramp_frame_cache (struct frame_info *next_frame, + void **this_cache) +{ + struct mips_frame_cache *cache; + CORE_ADDR gregs_addr, sp, pc; + int regnum; + int sigtramp_stack_size; + + if (*this_cache) + return *this_cache; + + cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache); + *this_cache = cache; + + cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + + /* + * Get sp of next frame which is the adjusted sp of + * tramp code. + */ + sp = frame_unwind_register_unsigned(next_frame, NUM_REGS + SP_REGNUM); + pc = frame_unwind_register_unsigned(next_frame, NUM_REGS + PC_REGNUM); + sigtramp_stack_size = is_sigtramp_sp_modified(pc) ? + MIPS_FBSD_SIGTRAMP_STACK_SIZE : 0; + gregs_addr = sp + sigtramp_stack_size + MIPS_FBSD_SIGCONTEXT_REG_OFFSET; + + for (regnum = 0; regnum < PC_REGNUM; regnum++) { + cache->saved_regs[NUM_REGS + regnum].addr = gregs_addr + + regnum * mips_regsize (current_gdbarch); + } + /* Only retrieve PC and SP */ + cache->saved_regs[NUM_REGS + SP_REGNUM].addr = gregs_addr + + SP_REGNUM * ( mips_regsize (current_gdbarch)); + + cache->saved_regs[NUM_REGS + RA_REGNUM].addr = gregs_addr + + RA_REGNUM * ( mips_regsize (current_gdbarch)); + + cache->base = get_frame_memory_unsigned (next_frame, + cache->saved_regs[NUM_REGS + SP_REGNUM].addr, + mips_regsize (current_gdbarch)); + + /* Todo: Floating point registers */ + + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc] + = cache->saved_regs[NUM_REGS + RA_REGNUM]; + + return *this_cache; +} + +static void +mipsfbsd_sigtramp_frame_this_id (struct frame_info *next_frame, + void **this_cache, + struct frame_id *this_id) +{ + struct mips_frame_cache *cache = + mipsfbsd_sigtramp_frame_cache (next_frame, this_cache); + + (*this_id) = frame_id_build (cache->base, + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc].addr); +} + +static void +mipsfbsd_sigtramp_frame_prev_register (struct frame_info *next_frame, + void **this_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, + CORE_ADDR *addrp, + int *realnump, void *valuep) +{ + struct mips_frame_cache *cache = + mipsfbsd_sigtramp_frame_cache (next_frame, this_cache); + + trad_frame_prev_register (next_frame, cache->saved_regs, regnum, + optimizedp, lvalp, addrp, realnump, valuep); +} + + +static const struct frame_unwind mipsfbsd_sigtramp_frame_unwind = +{ + SIGTRAMP_FRAME, + mipsfbsd_sigtramp_frame_this_id, + mipsfbsd_sigtramp_frame_prev_register +}; + +static const struct frame_unwind * +mipsfbsd_sigtramp_frame_sniffer (struct frame_info *next_frame) +{ + CORE_ADDR pc = frame_pc_unwind (next_frame); + char *name; + + find_pc_partial_function (pc, &name, NULL, NULL); + if (mipsfbsd_pc_in_sigtramp (pc, name) ) + return &mipsfbsd_sigtramp_frame_unwind; + + return NULL; +} + +/* + * Find out if PC has landed into dynamic library stub. + * We can find it by seeing if the name of the object + * file section where the PC lies is "MIPS.stubs" + */ + +int +mipsfbsd_in_stub_section (CORE_ADDR pc, char *name) +{ + struct obj_section *s; + int retval = 0; + + s = find_pc_section (pc); + + retval = (s != NULL + && s->the_bfd_section->name != NULL + && strcmp (s->the_bfd_section->name, ".MIPS.stubs") == 0); + return (retval); +} + + +/* + * Prologue cache for dynamic library stub frame. + * This stub does not modify the SP, so we set the + * cache base to calling frame's SP + */ +static struct mips_frame_cache * +mipsfbsd_stub_frame_cache (struct frame_info *next_frame, + void **this_cache) +{ + struct mips_frame_cache *cache; + + if (*this_cache) + return *this_cache; + + cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache); + *this_cache = cache; + + cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + + + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc].realreg = + NUM_REGS + RA_REGNUM; + cache->base = frame_unwind_register_unsigned (next_frame, + NUM_REGS + SP_REGNUM); + + return (*this_cache); +} + + +static void +mipsfbsd_stub_frame_this_id (struct frame_info *next_frame, + void **this_cache, + struct frame_id *this_id) +{ + struct mips_frame_cache *cache = + mipsfbsd_stub_frame_cache (next_frame, this_cache); + + (*this_id) = frame_id_build (cache->base, + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc].addr); +} + +static void +mipsfbsd_stub_frame_prev_register (struct frame_info *next_frame, + void **this_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *valuep) +{ + struct mips_frame_cache *cache = + mipsfbsd_stub_frame_cache (next_frame, this_cache); + + trad_frame_prev_register (next_frame, cache->saved_regs, regnum, + optimizedp, lvalp, addrp, realnump, valuep); +} + + + +static const struct frame_unwind mipsfbsd_stub_frame_unwind = { + NORMAL_FRAME, + mipsfbsd_stub_frame_this_id, + mipsfbsd_stub_frame_prev_register +}; + +static const struct frame_unwind * +mipsfbsd_stub_frame_sniffer (struct frame_info *next_frame) +{ + CORE_ADDR pc = frame_pc_unwind (next_frame); + + if (mipsfbsd_in_stub_section(pc, NULL)) + return &mipsfbsd_stub_frame_unwind; + + return NULL; +} + +/* + * typedef struct link_map { + * caddr_t l_addr; /* Base Address of library + * #ifdef __mips__ + * caddr_t l_offs; /* Load Offset of library + * #endif + * const char *l_name; /* Absolute Path to Library + * const void *l_ld; /* Pointer to .dynamic in memory + * struct link_map *l_next, *l_prev; /* linked list of of mapped libs + * } Link_map; + * + * struct r_debug { + * int r_version; /* not used + * struct link_map *r_map; /* list of loaded images + * void (*r_brk)(struct r_debug *, struct link_map *); + * /* pointer to break point + * enum { + * RT_CONSISTENT, /* things are stable + * RT_ADD, /* adding a shared library + * RT_DELETE /* removing a shared library + * } r_state; + * }; + * + */ + +static struct link_map_offsets * +mipsfbsd_ilp32_solib_svr4_fetch_link_map_offsets (void) +{ + static struct link_map_offsets lmo; + static struct link_map_offsets *lmp = NULL; + + if (lmp == NULL) + { + lmp = &lmo; + + lmo.r_debug_size = 16; + + lmo.r_map_offset = 4; + lmo.r_map_size = 4; + + lmo.link_map_size = 24; + + lmo.l_addr_offset = 0; + lmo.l_addr_size = 4; + + lmo.l_name_offset = 8; + lmo.l_name_size = 4; + + lmo.l_next_offset = 16; + lmo.l_next_size = 4; + + lmo.l_prev_offset = 20; + lmo.l_prev_size = 4; + } + + return lmp; +} + +static void +mipsfbsd_init_abi (struct gdbarch_info info, + struct gdbarch *gdbarch) +{ + set_gdbarch_pc_in_sigtramp (gdbarch, mipsfbsd_pc_in_sigtramp); + + set_gdbarch_get_longjmp_target (gdbarch, mipsfbsd_get_longjmp_target); + + set_gdbarch_cannot_fetch_register (gdbarch, mipsfbsd_cannot_fetch_register); + set_gdbarch_cannot_store_register (gdbarch, mipsfbsd_cannot_store_register); + + set_gdbarch_software_single_step (gdbarch, mips_software_single_step); + set_solib_svr4_fetch_link_map_offsets (gdbarch, + mipsfbsd_ilp32_solib_svr4_fetch_link_map_offsets); + set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); + set_gdbarch_in_solib_call_trampoline (gdbarch, mipsfbsd_in_stub_section); + + /* frame sniffers */ + frame_unwind_append_sniffer (gdbarch, mipsfbsd_sigtramp_frame_sniffer); + frame_unwind_append_sniffer (gdbarch, mipsfbsd_stub_frame_sniffer); + +} + +void +_initialize_mipsfbsd_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_FREEBSD_ELF, + mipsfbsd_init_abi); +} Copied: user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.h (from r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.h Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.h) @@ -0,0 +1,40 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Common target dependent code for GDB on MIPS systems running NetBSD. + Copyright 2002 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef mipsfbsd_TDEP_H +#define mipsfbsd_TDEP_H + +void mipsfbsd_supply_reg (char *, int); +void mipsfbsd_fill_reg (char *, int); + +void mipsfbsd_supply_fpreg (char *, int); +void mipsfbsd_fill_fpreg (char *, int); + +#define SIZEOF_STRUCT_REG (38 * mips_regsize (current_gdbarch)) +#define SIZEOF_STRUCT_FPREG (33 * mips_regsize (current_gdbarch)) + +#endif /* mipsfbsd_TDEP_H */ Modified: user/kib/vm6/games/fortune/fortune/fortune.c ============================================================================== --- user/kib/vm6/games/fortune/fortune/fortune.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/games/fortune/fortune/fortune.c Mon Feb 22 20:42:30 2010 (r204221) @@ -216,7 +216,7 @@ main(int argc, char *argv[]) sleep((unsigned int) max(Fort_len / CPERS, MINW)); } - return (0); + exit(0); } void Modified: user/kib/vm6/gnu/usr.bin/Makefile ============================================================================== --- user/kib/vm6/gnu/usr.bin/Makefile Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/gnu/usr.bin/Makefile Mon Feb 22 20:42:30 2010 (r204221) @@ -21,10 +21,6 @@ SUBDIR= ${_binutils} \ sort \ ${_texinfo} -.if ${MACHINE_ARCH} == "mips" -MK_GDB=no # not yet -.endif - .if ${MK_CXX} != "no" _gperf= gperf .if ${MK_GROFF} != "no" Modified: user/kib/vm6/gnu/usr.bin/gdb/arch/mips/Makefile ============================================================================== --- user/kib/vm6/gnu/usr.bin/gdb/arch/mips/Makefile Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/gnu/usr.bin/gdb/arch/mips/Makefile Mon Feb 22 20:42:30 2010 (r204221) @@ -1,10 +1,10 @@ # $FreeBSD$ .if !defined(GDB_CROSS_DEBUGGER) -LIBSRCS+= mips-nat.c mips-nat.c mipsfbsd-nat.c +LIBSRCS+= mipsfbsd-nat.c .endif LIBSRCS+= solib.c solib-svr4.c -LIBSRCS+= mips-tdep.c mipsfbsd-tdep.c +LIBSRCS+= mips-tdep.c mipsfbsd-tdep.c fbsd-proc.c nm.h: echo '#include "mips/nm-fbsd.h"' > ${.TARGET} Modified: user/kib/vm6/gnu/usr.bin/gdb/arch/mips/init.c ============================================================================== --- user/kib/vm6/gnu/usr.bin/gdb/arch/mips/init.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/gnu/usr.bin/gdb/arch/mips/init.c Mon Feb 22 20:42:30 2010 (r204221) @@ -123,15 +123,19 @@ initialize_all_files (void) _initialize_ser_pipe (); _initialize_ser_tcp (); #ifndef CROSS_DEBUGGER +#if 0 _initialize_mipsfbsd_nat (); _initialize_mips_nat (); +#endif _initialize_kernel_u_addr (); _initialize_infptrace (); _initialize_inftarg (); _initialize_solib (); _initialize_svr4_solib (); +#if 0 _initialize_svr4_lm (); #endif +#endif _initialize_remote (); _initialize_dcache (); _initialize_sr_support (); Modified: user/kib/vm6/gnu/usr.bin/gdb/kgdb/trgt_mips.c ============================================================================== --- user/kib/vm6/gnu/usr.bin/gdb/kgdb/trgt_mips.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/gnu/usr.bin/gdb/kgdb/trgt_mips.c Mon Feb 22 20:42:30 2010 (r204221) @@ -61,18 +61,17 @@ kgdb_trgt_fetch_registers(int regno __un warnx("kvm_read: %s", kvm_geterr(kvm)); memset(&pcb, 0, sizeof(pcb)); } - supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context.val[0]); - supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context.val[1]); - supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context.val[2]); - supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context.val[3]); - supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context.val[4]); - supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context.val[5]); - supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context.val[6]); - supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context.val[7]); - supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context.val[8]); - supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context.val[8]); - supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context.val[9]); - supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context.val[10]); + supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context[0]); + supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context[1]); + supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context[2]); + supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context[3]); + supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context[4]); + supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context[5]); + supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context[6]); + supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context[7]); + supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context[8]); + supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context[9]); + supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context[10]); } void Modified: user/kib/vm6/lib/libc/gen/sysctl.3 ============================================================================== --- user/kib/vm6/lib/libc/gen/sysctl.3 Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/lib/libc/gen/sysctl.3 Mon Feb 22 20:42:30 2010 (r204221) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd January 28, 2009 +.Dd February 21, 2010 .Dt SYSCTL 3 .Os .Sh NAME @@ -42,9 +42,9 @@ .In sys/types.h .In sys/sysctl.h .Ft int -.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" +.Fn sysctl "const int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "const void *newp" "size_t newlen" .Ft int -.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" +.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "const void *newp" "size_t newlen" .Ft int .Fn sysctlnametomib "const char *name" "int *mibp" "size_t *sizep" .Sh DESCRIPTION Modified: user/kib/vm6/lib/libc/gen/sysctl.c ============================================================================== --- user/kib/vm6/lib/libc/gen/sysctl.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/lib/libc/gen/sysctl.c Mon Feb 22 20:42:30 2010 (r204221) @@ -43,15 +43,12 @@ __FBSDID("$FreeBSD$"); #include #include -extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, - void *newp, size_t newlen); +extern int __sysctl(const int *name, u_int namelen, void *oldp, + size_t *oldlenp, const void *newp, size_t newlen); int -sysctl(name, namelen, oldp, oldlenp, newp, newlen) - int *name; - u_int namelen; - void *oldp, *newp; - size_t *oldlenp, newlen; +sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp, + const void *newp, size_t newlen) { if (name[0] != CTL_USER) return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen)); Modified: user/kib/vm6/lib/libc/gen/sysctlbyname.c ============================================================================== --- user/kib/vm6/lib/libc/gen/sysctlbyname.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/lib/libc/gen/sysctlbyname.c Mon Feb 22 20:42:30 2010 (r204221) @@ -13,27 +13,19 @@ __FBSDID("$FreeBSD$"); #include #include -#include int *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Feb 23 06:35:04 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E0B5106566B; Tue, 23 Feb 2010 06:35:04 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DA928FC19; Tue, 23 Feb 2010 06:35:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1N6Z40j084785; Tue, 23 Feb 2010 06:35:04 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1N6Z4Fo084783; Tue, 23 Feb 2010 06:35:04 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002230635.o1N6Z4Fo084783@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 23 Feb 2010 06:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204243 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 06:35:04 -0000 Author: edwin Date: Tue Feb 23 06:35:04 2010 New Revision: 204243 URL: http://svn.freebsd.org/changeset/base/204243 Log: Use a smarter way to calculate the equinoxes. Modified: user/edwin/calendar/sunpos.c Modified: user/edwin/calendar/sunpos.c ============================================================================== --- user/edwin/calendar/sunpos.c Tue Feb 23 05:02:10 2010 (r204242) +++ user/edwin/calendar/sunpos.c Tue Feb 23 06:35:04 2010 (r204243) @@ -180,6 +180,8 @@ sunpos(int inYY, int inMM, int inDD, dou #define SIGN(a) (((a) > 180) ? -1 : 1) #define ANGLE(a, b) (((a) < (b)) ? 1 : -1) +#define SHOUR(s) ((s) / 3600) +#define SMIN(s) (((s) % 3600) / 60) #define HOUR(h) ((h) / 4) #define MIN(h) (15 * ((h) % 4)) #define DEBUG1(y, m, d, hh, mm, pdec, dec) \ @@ -207,6 +209,9 @@ fequinoxsolstice(int year, double UTCoff int h, d, prevangle, angle; int found = 0; + double decleft, decright, decmiddle; + int dial, s; + int *cumdays; cumdays = cumdaytab[isleap(year)]; @@ -218,23 +223,35 @@ fequinoxsolstice(int year, double UTCoff found = 0; prevdec = 350; for (d = 18; d < 31; d++) { - for (h = 0; h < 4 * HOURSPERDAY; h++) { - sunpos(year, 3, d, UTCoffset, HOUR(h), MIN(h), - 0.0, 0.0, &L, &dec); - if (SIGN(prevdec) != SIGN(dec)) { -#ifdef NOTDEF - DEBUG1(year, 3, d, HOUR(h), MIN(h), - prevdec, dec); -#endif - equinoxdays[0] = 1 + cumdays[3] + d + - ((h / 4.0) / 24.0); - found = 1; - break; +// printf("Comparing day %d to %d.\n", d, d+1); + sunpos(year, 3, d, UTCoffset, 0, 0, 0.0, 0.0, &L, &decleft); + sunpos(year, 3, d + 1, UTCoffset, 0, 0, 0.0, 0.0, + &L, &decright); +// printf("Found %g and %g.\n", decleft, decright); + if (SIGN(decleft) == SIGN(decright)) + continue; + + dial = SECSPERDAY; + s = SECSPERDAY / 2; + while (s > 0) { +// printf("Obtaining %d (%02d:%02d)\n", +// dial, SHOUR(dial), SMIN(dial)); + sunpos(year, 3, d, UTCoffset, SHOUR(dial), SMIN(dial), + 0.0, 0.0, &L, &decmiddle); +// printf("Found %g\n", decmiddle); + if (SIGN(decleft) == SIGN(decmiddle)) { + decleft = decmiddle; + dial += s; + } else { + decright = decmiddle; + dial -= s; } - prevdec = dec; +// printf("New boundaries: %g - %g\n", decleft, decright); + + s /= 2; } - if (found) - break; + equinoxdays[0] = 1 + cumdays[3] + d + (dial / FSECSPERDAY); + break; } /* Find the second equinox, somewhere in September: @@ -244,23 +261,35 @@ fequinoxsolstice(int year, double UTCoff found = 0; prevdec = 10; for (d = 18; d < 31; d++) { - for (h = 0; h < 4 * HOURSPERDAY; h++) { - sunpos(year, 9, d, UTCoffset, HOUR(h), MIN(h), - 0.0, 0.0, &L, &dec); - if (SIGN(prevdec) != SIGN(dec)) { -#ifdef NOTDEF - DEBUG1(year, 9, d, HOUR(h), MIN(h), - prevdec, dec); -#endif - equinoxdays[1] = 1 + cumdays[9] + d + - ((h / 4.0) / 24.0); - found = 1; - break; + printf("Comparing day %d to %d.\n", d, d+1); + sunpos(year, 9, d, UTCoffset, 0, 0, 0.0, 0.0, &L, &decleft); + sunpos(year, 9, d + 1, UTCoffset, 0, 0, 0.0, 0.0, + &L, &decright); + printf("Found %g and %g.\n", decleft, decright); + if (SIGN(decleft) == SIGN(decright)) + continue; + + dial = SECSPERDAY; + s = SECSPERDAY / 2; + while (s > 0) { +// printf("Obtaining %d (%02d:%02d)\n", +// dial, SHOUR(dial), SMIN(dial)); + sunpos(year, 9, d, UTCoffset, SHOUR(dial), SMIN(dial), + 0.0, 0.0, &L, &decmiddle); +// printf("Found %g\n", decmiddle); + if (SIGN(decleft) == SIGN(decmiddle)) { + decleft = decmiddle; + dial += s; + } else { + decright = decmiddle; + dial -= s; } - prevdec = dec; +// printf("New boundaries: %g - %g\n", decleft, decright); + + s /= 2; } - if (found) - break; + equinoxdays[1] = 1 + cumdays[9] + d + (dial / FSECSPERDAY); + break; } /* From owner-svn-src-user@FreeBSD.ORG Tue Feb 23 09:58:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A09D106566C; Tue, 23 Feb 2010 09:58:13 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 255F88FC08; Tue, 23 Feb 2010 09:58:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1N9wDxK029783; Tue, 23 Feb 2010 09:58:13 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1N9wC13029774; Tue, 23 Feb 2010 09:58:12 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <201002230958.o1N9wC13029774@svn.freebsd.org> From: Ermal Luçi Date: Tue, 23 Feb 2010 09:58:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204245 - in user/eri/pf45/head: contrib/csup etc/devd etc/rc.d lib/libarchive lib/libarchive/test lib/libc/gen lib/libc/mips/gen/hardfloat lib/libc/stdlib lib/libefi lib/libgpib lib/li... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 09:58:13 -0000 Author: eri Date: Tue Feb 23 09:58:12 2010 New Revision: 204245 URL: http://svn.freebsd.org/changeset/base/204245 Log: Add files that I missed during MFH. Added: user/eri/pf45/head/contrib/csup/auth.c user/eri/pf45/head/contrib/csup/auth.h user/eri/pf45/head/contrib/csup/cpasswd.1 user/eri/pf45/head/contrib/csup/cpasswd.sh (contents, props changed) user/eri/pf45/head/etc/devd/uath.conf user/eri/pf45/head/etc/rc.d/rtsold (contents, props changed) user/eri/pf45/head/lib/libarchive/archive_crc32.h user/eri/pf45/head/lib/libarchive/archive_entry_xattr.c user/eri/pf45/head/lib/libarchive/archive_hash.h user/eri/pf45/head/lib/libarchive/archive_read_support_compression_uu.c user/eri/pf45/head/lib/libarchive/archive_write_set_format_zip.c user/eri/pf45/head/lib/libarchive/test/test_compat_cpio.c user/eri/pf45/head/lib/libarchive/test/test_compat_cpio_1.cpio.uu user/eri/pf45/head/lib/libarchive/test/test_compat_lzma.c user/eri/pf45/head/lib/libarchive/test/test_compat_lzma_1.tlz.uu user/eri/pf45/head/lib/libarchive/test/test_compat_lzma_2.tlz.uu user/eri/pf45/head/lib/libarchive/test/test_compat_lzma_3.tlz.uu user/eri/pf45/head/lib/libarchive/test/test_fuzz_1.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_ar.ar.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_cpio_bin_lzma.c user/eri/pf45/head/lib/libarchive/test/test_read_format_iso.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_joliet.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_multi_extent.c user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_isojoliet_long.c user/eri/pf45/head/lib/libarchive/test/test_read_format_isojoliet_rr.c user/eri/pf45/head/lib/libarchive/test/test_read_format_isorr_ce.c user/eri/pf45/head/lib/libarchive/test/test_read_format_isorr_new_bz2.c user/eri/pf45/head/lib/libarchive/test/test_read_format_isorr_rr_moved.c user/eri/pf45/head/lib/libarchive/test/test_read_format_isozisofs_bz2.c user/eri/pf45/head/lib/libarchive/test/test_read_format_mtree.mtree.uu user/eri/pf45/head/lib/libarchive/test/test_read_format_tlz.c user/eri/pf45/head/lib/libarchive/test/test_read_uu.c user/eri/pf45/head/lib/libarchive/test/test_write_disk_symlink.c user/eri/pf45/head/lib/libarchive/test/test_write_format_zip.c user/eri/pf45/head/lib/libarchive/test/test_write_format_zip_empty.c user/eri/pf45/head/lib/libarchive/test/test_write_format_zip_no_compression.c user/eri/pf45/head/lib/libc/gen/getutxent.3 user/eri/pf45/head/lib/libc/gen/getutxent.c user/eri/pf45/head/lib/libc/gen/pututxline.c user/eri/pf45/head/lib/libc/gen/sem_new.c user/eri/pf45/head/lib/libc/gen/utxdb.c user/eri/pf45/head/lib/libc/gen/utxdb.h user/eri/pf45/head/lib/libc/mips/gen/hardfloat/ user/eri/pf45/head/lib/libc/mips/gen/hardfloat/fpgetmask.c user/eri/pf45/head/lib/libc/mips/gen/hardfloat/fpgetround.c user/eri/pf45/head/lib/libc/mips/gen/hardfloat/fpgetsticky.c user/eri/pf45/head/lib/libc/mips/gen/hardfloat/fpsetmask.c user/eri/pf45/head/lib/libc/mips/gen/hardfloat/fpsetround.c user/eri/pf45/head/lib/libc/mips/gen/hardfloat/fpsetsticky.c user/eri/pf45/head/lib/libc/stdlib/ql.h user/eri/pf45/head/lib/libc/stdlib/qr.h user/eri/pf45/head/lib/libefi/ user/eri/pf45/head/lib/libefi/Makefile user/eri/pf45/head/lib/libefi/efi_getvar.c user/eri/pf45/head/lib/libefi/efi_nextvarname.c user/eri/pf45/head/lib/libefi/efi_setvar.c user/eri/pf45/head/lib/libefi/libefi.3 user/eri/pf45/head/lib/libefi/libefi.c user/eri/pf45/head/lib/libefi/libefi.h user/eri/pf45/head/lib/libefi/libefi_int.h user/eri/pf45/head/lib/libgpib/gpib.3 user/eri/pf45/head/lib/libpmc/pmc.xscale.3 user/eri/pf45/head/share/doc/usd/05.dc/ user/eri/pf45/head/share/doc/usd/05.dc/Makefile user/eri/pf45/head/share/doc/usd/06.bc/ user/eri/pf45/head/share/doc/usd/06.bc/Makefile user/eri/pf45/head/share/man/man3/pthread_affinity_np.3 user/eri/pf45/head/share/man/man3/pthread_attr_affinity_np.3 user/eri/pf45/head/share/man/man4/alpm.4 user/eri/pf45/head/share/man/man4/amdpm.4 user/eri/pf45/head/share/man/man4/gpib.4 user/eri/pf45/head/share/man/man4/ipwfw.4 user/eri/pf45/head/share/man/man4/iwifw.4 user/eri/pf45/head/share/man/man4/mcd.4 user/eri/pf45/head/share/man/man4/mk48txx.4 user/eri/pf45/head/share/man/man4/nvram.4 user/eri/pf45/head/share/man/man4/padlock.4 user/eri/pf45/head/share/man/man4/pcf.4 user/eri/pf45/head/share/man/man4/pcii.4 user/eri/pf45/head/share/man/man4/run.4 user/eri/pf45/head/share/man/man4/scd.4 user/eri/pf45/head/share/man/man4/siba.4 user/eri/pf45/head/share/man/man4/tnt4882.4 user/eri/pf45/head/share/man/man4/uhso.4 user/eri/pf45/head/share/man/man4/viapm.4 user/eri/pf45/head/sys/arm/arm/cpufunc_asm_fa526.S user/eri/pf45/head/sys/arm/econa/ user/eri/pf45/head/sys/arm/econa/cfi_bus_econa.c user/eri/pf45/head/sys/arm/econa/econa.c user/eri/pf45/head/sys/arm/econa/econa_machdep.c user/eri/pf45/head/sys/arm/econa/econa_reg.h user/eri/pf45/head/sys/arm/econa/econa_var.h user/eri/pf45/head/sys/arm/econa/ehci_ebus.c user/eri/pf45/head/sys/arm/econa/files.econa user/eri/pf45/head/sys/arm/econa/if_ece.c user/eri/pf45/head/sys/arm/econa/if_ecereg.h user/eri/pf45/head/sys/arm/econa/if_ecevar.h user/eri/pf45/head/sys/arm/econa/ohci_ec.c user/eri/pf45/head/sys/arm/econa/std.econa user/eri/pf45/head/sys/arm/econa/timer.c user/eri/pf45/head/sys/arm/econa/uart_bus_ec.c user/eri/pf45/head/sys/arm/econa/uart_cpu_ec.c user/eri/pf45/head/sys/boot/common/md.c user/eri/pf45/head/sys/boot/efi/libefi/efipart.c user/eri/pf45/head/sys/boot/pc98/boot2/boot1.S user/eri/pf45/head/sys/boot/pc98/boot2/boot2.c user/eri/pf45/head/sys/boot/pc98/libpc98/libpc98.h user/eri/pf45/head/sys/boot/pc98/libpc98/pc98_sys.c user/eri/pf45/head/sys/conf/ldscript.mips.mips64 user/eri/pf45/head/sys/conf/ldscript.mips.octeon1.32 user/eri/pf45/head/sys/conf/ldscript.mips.octeon1.64 user/eri/pf45/head/sys/conf/ldscript.mips.octeon1.n32 user/eri/pf45/head/sys/contrib/dev/iwn/iwlwifi-1000-128.50.3.1.fw.uu user/eri/pf45/head/sys/contrib/dev/iwn/iwlwifi-4965-228.61.2.24.fw.uu user/eri/pf45/head/sys/contrib/dev/iwn/iwlwifi-5000-8.24.2.12.fw.uu user/eri/pf45/head/sys/contrib/dev/iwn/iwlwifi-6000-9.176.4.1.fw.uu user/eri/pf45/head/sys/contrib/dev/run/ user/eri/pf45/head/sys/contrib/dev/run/LICENSE user/eri/pf45/head/sys/contrib/dev/run/rt2870.fw.uu user/eri/pf45/head/sys/dev/ath/ath_hal/ar5416/ar9285.ini user/eri/pf45/head/sys/dev/ath/ath_hal/ar5416/ar9285v2.ini user/eri/pf45/head/sys/dev/cfe/cfe_env.c user/eri/pf45/head/sys/dev/drm/drm_hashtab.c user/eri/pf45/head/sys/dev/drm/drm_hashtab.h user/eri/pf45/head/sys/dev/drm/drm_mm.c user/eri/pf45/head/sys/dev/drm/drm_mm.h user/eri/pf45/head/sys/dev/drm/drm_sman.c user/eri/pf45/head/sys/dev/drm/drm_sman.h user/eri/pf45/head/sys/dev/drm/via_3d_reg.h user/eri/pf45/head/sys/dev/drm/via_dma.c user/eri/pf45/head/sys/dev/drm/via_dmablit.c user/eri/pf45/head/sys/dev/drm/via_dmablit.h user/eri/pf45/head/sys/dev/drm/via_drm.h user/eri/pf45/head/sys/dev/drm/via_drv.c user/eri/pf45/head/sys/dev/drm/via_drv.h user/eri/pf45/head/sys/dev/drm/via_irq.c user/eri/pf45/head/sys/dev/drm/via_map.c user/eri/pf45/head/sys/dev/drm/via_mm.c user/eri/pf45/head/sys/dev/drm/via_verifier.c user/eri/pf45/head/sys/dev/drm/via_verifier.h user/eri/pf45/head/sys/dev/drm/via_video.c user/eri/pf45/head/sys/dev/flash/mx25l.c user/eri/pf45/head/sys/dev/flash/mx25lreg.h user/eri/pf45/head/sys/dev/hwpmc/hwpmc_xscale.c user/eri/pf45/head/sys/dev/hwpmc/hwpmc_xscale.h user/eri/pf45/head/sys/dev/ieee488/tnt4882.h user/eri/pf45/head/sys/dev/siba/siba_bwn.c user/eri/pf45/head/sys/dev/siba/siba_cc.c user/eri/pf45/head/sys/dev/siba/siba_core.c user/eri/pf45/head/sys/dev/usb/net/uhso.c user/eri/pf45/head/sys/dev/usb/wlan/if_run.c user/eri/pf45/head/sys/dev/usb/wlan/if_runreg.h user/eri/pf45/head/sys/dev/usb/wlan/if_runvar.h user/eri/pf45/head/sys/fs/ext2fs/ user/eri/pf45/head/sys/fs/ext2fs/ext2_alloc.c user/eri/pf45/head/sys/fs/ext2fs/ext2_balloc.c user/eri/pf45/head/sys/fs/ext2fs/ext2_bmap.c user/eri/pf45/head/sys/fs/ext2fs/ext2_dinode.h (contents, props changed) user/eri/pf45/head/sys/fs/ext2fs/ext2_dir.h (contents, props changed) user/eri/pf45/head/sys/fs/ext2fs/ext2_extern.h user/eri/pf45/head/sys/fs/ext2fs/ext2_inode.c user/eri/pf45/head/sys/fs/ext2fs/ext2_inode_cnv.c user/eri/pf45/head/sys/fs/ext2fs/ext2_lookup.c user/eri/pf45/head/sys/fs/ext2fs/ext2_mount.h user/eri/pf45/head/sys/fs/ext2fs/ext2_readwrite.c user/eri/pf45/head/sys/fs/ext2fs/ext2_subr.c user/eri/pf45/head/sys/fs/ext2fs/ext2_vfsops.c user/eri/pf45/head/sys/fs/ext2fs/ext2_vnops.c user/eri/pf45/head/sys/fs/ext2fs/ext2fs.h (contents, props changed) user/eri/pf45/head/sys/fs/ext2fs/fs.h user/eri/pf45/head/sys/fs/ext2fs/inode.h user/eri/pf45/head/sys/geom/mountver/ user/eri/pf45/head/sys/geom/mountver/g_mountver.c user/eri/pf45/head/sys/geom/mountver/g_mountver.h user/eri/pf45/head/sys/ia64/ia64/bus_machdep.c user/eri/pf45/head/sys/ia64/ia64/iodev_machdep.c user/eri/pf45/head/sys/ia64/include/iodev.h user/eri/pf45/head/sys/mips/alchemy/ user/eri/pf45/head/sys/mips/alchemy/alchemy_machdep.c user/eri/pf45/head/sys/mips/alchemy/aureg.h user/eri/pf45/head/sys/mips/alchemy/files.alchemy user/eri/pf45/head/sys/mips/alchemy/obio.c user/eri/pf45/head/sys/mips/alchemy/std.alchemy user/eri/pf45/head/sys/mips/alchemy/uart_bus_alchemy.c user/eri/pf45/head/sys/mips/alchemy/uart_cpu_alchemy.c user/eri/pf45/head/sys/mips/atheros/ user/eri/pf45/head/sys/mips/atheros/apb.c user/eri/pf45/head/sys/mips/atheros/apbvar.h user/eri/pf45/head/sys/mips/atheros/ar71xx_bus_space_reversed.c user/eri/pf45/head/sys/mips/atheros/ar71xx_bus_space_reversed.h user/eri/pf45/head/sys/mips/atheros/ar71xx_ehci.c user/eri/pf45/head/sys/mips/atheros/ar71xx_machdep.c user/eri/pf45/head/sys/mips/atheros/ar71xx_ohci.c user/eri/pf45/head/sys/mips/atheros/ar71xx_pci.c user/eri/pf45/head/sys/mips/atheros/ar71xx_pci_bus_space.c user/eri/pf45/head/sys/mips/atheros/ar71xx_pci_bus_space.h user/eri/pf45/head/sys/mips/atheros/ar71xx_spi.c user/eri/pf45/head/sys/mips/atheros/ar71xx_wdog.c user/eri/pf45/head/sys/mips/atheros/ar71xxreg.h user/eri/pf45/head/sys/mips/atheros/files.ar71xx user/eri/pf45/head/sys/mips/atheros/if_arge.c user/eri/pf45/head/sys/mips/atheros/if_argevar.h user/eri/pf45/head/sys/mips/atheros/pcf2123_rtc.c user/eri/pf45/head/sys/mips/atheros/pcf2123reg.h user/eri/pf45/head/sys/mips/atheros/uart_bus_ar71xx.c user/eri/pf45/head/sys/mips/atheros/uart_cpu_ar71xx.c user/eri/pf45/head/sys/mips/cavium/ user/eri/pf45/head/sys/mips/cavium/asm_octeon.S user/eri/pf45/head/sys/mips/cavium/dev/ user/eri/pf45/head/sys/mips/cavium/dev/rgmii/ user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_fau.c user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_fau.h user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_fpa.c user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_fpa.h user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_ipd.c user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_ipd.h user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_pip.h user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_pko.c user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_pko.h user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_rgmx.c user/eri/pf45/head/sys/mips/cavium/dev/rgmii/octeon_rgmx.h user/eri/pf45/head/sys/mips/cavium/driveid.h user/eri/pf45/head/sys/mips/cavium/files.octeon1 user/eri/pf45/head/sys/mips/cavium/obio.c user/eri/pf45/head/sys/mips/cavium/obiovar.h user/eri/pf45/head/sys/mips/cavium/octeon_ebt3000_cf.c user/eri/pf45/head/sys/mips/cavium/octeon_ebt3000_cf.h user/eri/pf45/head/sys/mips/cavium/octeon_machdep.c user/eri/pf45/head/sys/mips/cavium/octeon_pcmap_regs.h user/eri/pf45/head/sys/mips/cavium/std.octeon1 user/eri/pf45/head/sys/mips/cavium/uart_bus_octeonusart.c user/eri/pf45/head/sys/mips/cavium/uart_cpu_octeonusart.c user/eri/pf45/head/sys/mips/cavium/uart_dev_oct16550.c user/eri/pf45/head/sys/mips/include/cdefs.h user/eri/pf45/head/sys/mips/include/fls64.h user/eri/pf45/head/sys/mips/mips/bus_space_generic.c user/eri/pf45/head/sys/mips/mips/elf_trampoline.c user/eri/pf45/head/sys/mips/mips/inckern.S user/eri/pf45/head/sys/mips/mips/mpboot.S user/eri/pf45/head/sys/mips/mips/ptrace_machdep.c user/eri/pf45/head/sys/mips/mips/sys_machdep.c user/eri/pf45/head/sys/mips/rmi/ user/eri/pf45/head/sys/mips/rmi/Makefile.msgring user/eri/pf45/head/sys/mips/rmi/board.c user/eri/pf45/head/sys/mips/rmi/board.h user/eri/pf45/head/sys/mips/rmi/bus_space_rmi.c user/eri/pf45/head/sys/mips/rmi/clock.c user/eri/pf45/head/sys/mips/rmi/clock.h user/eri/pf45/head/sys/mips/rmi/debug.h (contents, props changed) user/eri/pf45/head/sys/mips/rmi/dev/ user/eri/pf45/head/sys/mips/rmi/dev/sec/ user/eri/pf45/head/sys/mips/rmi/dev/sec/desc.h (contents, props changed) user/eri/pf45/head/sys/mips/rmi/dev/sec/rmilib.c user/eri/pf45/head/sys/mips/rmi/dev/sec/rmilib.h user/eri/pf45/head/sys/mips/rmi/dev/sec/rmisec.c user/eri/pf45/head/sys/mips/rmi/dev/sec/stats.h user/eri/pf45/head/sys/mips/rmi/dev/xlr/ user/eri/pf45/head/sys/mips/rmi/dev/xlr/atx_cpld.h user/eri/pf45/head/sys/mips/rmi/dev/xlr/rge.c user/eri/pf45/head/sys/mips/rmi/dev/xlr/rge.h user/eri/pf45/head/sys/mips/rmi/dev/xlr/xgmac_mdio.h user/eri/pf45/head/sys/mips/rmi/ehcireg.h user/eri/pf45/head/sys/mips/rmi/ehcivar.h user/eri/pf45/head/sys/mips/rmi/files.xlr user/eri/pf45/head/sys/mips/rmi/interrupt.h user/eri/pf45/head/sys/mips/rmi/intr_machdep.c user/eri/pf45/head/sys/mips/rmi/iodi.c user/eri/pf45/head/sys/mips/rmi/iomap.h user/eri/pf45/head/sys/mips/rmi/msgring.c user/eri/pf45/head/sys/mips/rmi/msgring.cfg user/eri/pf45/head/sys/mips/rmi/msgring.h (contents, props changed) user/eri/pf45/head/sys/mips/rmi/msgring_xls.c user/eri/pf45/head/sys/mips/rmi/msgring_xls.cfg (contents, props changed) user/eri/pf45/head/sys/mips/rmi/on_chip.c user/eri/pf45/head/sys/mips/rmi/pcibus.c user/eri/pf45/head/sys/mips/rmi/pcibus.h user/eri/pf45/head/sys/mips/rmi/perfmon.h user/eri/pf45/head/sys/mips/rmi/perfmon_kern.c user/eri/pf45/head/sys/mips/rmi/perfmon_percpu.c user/eri/pf45/head/sys/mips/rmi/perfmon_utils.h user/eri/pf45/head/sys/mips/rmi/perfmon_xlrconfig.h user/eri/pf45/head/sys/mips/rmi/pic.h user/eri/pf45/head/sys/mips/rmi/rmi_mips_exts.h user/eri/pf45/head/sys/mips/rmi/rootfs_list.txt user/eri/pf45/head/sys/mips/rmi/shared_structs.h (contents, props changed) user/eri/pf45/head/sys/mips/rmi/shared_structs_func.h (contents, props changed) user/eri/pf45/head/sys/mips/rmi/shared_structs_offsets.h (contents, props changed) user/eri/pf45/head/sys/mips/rmi/std.xlr user/eri/pf45/head/sys/mips/rmi/tick.c user/eri/pf45/head/sys/mips/rmi/uart_bus_xlr_iodi.c user/eri/pf45/head/sys/mips/rmi/uart_cpu_mips_xlr.c user/eri/pf45/head/sys/mips/rmi/xlr_boot1_console.c user/eri/pf45/head/sys/mips/rmi/xlr_csum_nocopy.S user/eri/pf45/head/sys/mips/rmi/xlr_i2c.c user/eri/pf45/head/sys/mips/rmi/xlr_machdep.c user/eri/pf45/head/sys/mips/rmi/xlr_pci.c user/eri/pf45/head/sys/mips/rmi/xlrconfig.h user/eri/pf45/head/sys/mips/rmi/xls_ehci.c user/eri/pf45/head/sys/mips/sibyte/ user/eri/pf45/head/sys/mips/sibyte/ata_zbbus.c user/eri/pf45/head/sys/mips/sibyte/files.sibyte user/eri/pf45/head/sys/mips/sibyte/sb_asm.S user/eri/pf45/head/sys/mips/sibyte/sb_machdep.c user/eri/pf45/head/sys/mips/sibyte/sb_scd.c user/eri/pf45/head/sys/mips/sibyte/sb_scd.h user/eri/pf45/head/sys/mips/sibyte/sb_zbbus.c user/eri/pf45/head/sys/mips/sibyte/sb_zbpci.c user/eri/pf45/head/sys/modules/drm/via/ user/eri/pf45/head/sys/modules/drm/via/Makefile user/eri/pf45/head/sys/modules/epic/ user/eri/pf45/head/sys/modules/epic/Makefile user/eri/pf45/head/sys/modules/geom/geom_mountver/ user/eri/pf45/head/sys/modules/geom/geom_mountver/Makefile user/eri/pf45/head/sys/modules/iwnfw/iwn1000/ user/eri/pf45/head/sys/modules/iwnfw/iwn1000/Makefile user/eri/pf45/head/sys/modules/iwnfw/iwn6000/ user/eri/pf45/head/sys/modules/iwnfw/iwn6000/Makefile user/eri/pf45/head/sys/modules/pfsync/opt_global.h user/eri/pf45/head/sys/modules/runfw/ user/eri/pf45/head/sys/modules/runfw/Makefile user/eri/pf45/head/sys/modules/siba_bwn/ user/eri/pf45/head/sys/modules/siba_bwn/Makefile user/eri/pf45/head/sys/modules/usb/run/ user/eri/pf45/head/sys/modules/usb/run/Makefile user/eri/pf45/head/sys/modules/usb/uhso/ user/eri/pf45/head/sys/modules/usb/uhso/Makefile user/eri/pf45/head/sys/netinet/ipfw/ip_fw_dynamic.c user/eri/pf45/head/sys/netinet/ipfw/ip_fw_log.c user/eri/pf45/head/sys/netinet/ipfw/ip_fw_private.h user/eri/pf45/head/sys/netinet/ipfw/ip_fw_sockopt.c user/eri/pf45/head/sys/netinet/ipfw/ip_fw_table.c user/eri/pf45/head/sys/sparc64/ebus/epic.c user/eri/pf45/head/sys/sparc64/pci/fire.c user/eri/pf45/head/sys/sparc64/pci/firereg.h user/eri/pf45/head/sys/sparc64/pci/firevar.h user/eri/pf45/head/sys/sys/_umtx.h user/eri/pf45/head/tools/regression/bin/sh/parameters/mail1.0 user/eri/pf45/head/tools/regression/bin/sh/parameters/mail2.0 user/eri/pf45/head/usr.bin/ee/nls/pt_BR.ISO8859-1/ user/eri/pf45/head/usr.bin/ee/nls/pt_BR.ISO8859-1/ee.msg user/eri/pf45/head/usr.bin/tar/err.c user/eri/pf45/head/usr.bin/tar/err.h user/eri/pf45/head/usr.bin/tar/line_reader.c user/eri/pf45/head/usr.bin/tar/line_reader.h user/eri/pf45/head/usr.bin/tar/matching.h user/eri/pf45/head/usr.bin/tar/pathmatch.c user/eri/pf45/head/usr.bin/tar/pathmatch.h user/eri/pf45/head/usr.sbin/pmcstat/pmcpl_annotate.c user/eri/pf45/head/usr.sbin/pmcstat/pmcpl_annotate.h user/eri/pf45/head/usr.sbin/pmcstat/pmcpl_callgraph.c user/eri/pf45/head/usr.sbin/pmcstat/pmcpl_callgraph.h user/eri/pf45/head/usr.sbin/pmcstat/pmcpl_calltree.c user/eri/pf45/head/usr.sbin/pmcstat/pmcpl_calltree.h user/eri/pf45/head/usr.sbin/pmcstat/pmcpl_gprof.c user/eri/pf45/head/usr.sbin/pmcstat/pmcpl_gprof.h user/eri/pf45/head/usr.sbin/pmcstat/pmcstat_log.h user/eri/pf45/head/usr.sbin/pmcstat/pmcstat_top.h user/eri/pf45/head/usr.sbin/service/ user/eri/pf45/head/usr.sbin/service/Makefile user/eri/pf45/head/usr.sbin/service/service.8 user/eri/pf45/head/usr.sbin/service/service.sh (contents, props changed) user/eri/pf45/head/usr.sbin/traceroute/findsaddr-udp.c user/eri/pf45/head/usr.sbin/uhsoctl/ user/eri/pf45/head/usr.sbin/uhsoctl/Makefile user/eri/pf45/head/usr.sbin/uhsoctl/uhsoctl.1 user/eri/pf45/head/usr.sbin/uhsoctl/uhsoctl.c Added: user/eri/pf45/head/contrib/csup/auth.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/eri/pf45/head/contrib/csup/auth.c Tue Feb 23 09:58:12 2010 (r204245) @@ -0,0 +1,331 @@ +/*- + * Copyright (c) 2003-2007, Petar Zhivkov Petrov + * 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: user/eri/pf45/head/contrib/csup/auth.c 203368 2010-02-02 05:57:42Z lulf $ + */ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "auth.h" +#include "config.h" +#include "misc.h" +#include "proto.h" +#include "stream.h" + +#define MD5_BYTES 16 + +/* This should be at least 2 * MD5_BYTES + 6 (length of "$md5$" + 1) */ +#define MD5_CHARS_MAX (2*(MD5_BYTES)+6) + +struct srvrecord { + char server[MAXHOSTNAMELEN]; + char client[256]; + char password[256]; +}; + +static int auth_domd5auth(struct config *); +static int auth_lookuprecord(char *, struct srvrecord *); +static int auth_parsetoken(char **, char *, int); +static void auth_makesecret(struct srvrecord *, char *); +static void auth_makeresponse(char *, char *, char *); +static void auth_readablesum(unsigned char *, char *); +static void auth_makechallenge(struct config *, char *); +static int auth_checkresponse(char *, char *, char *); + +int auth_login(struct config *config) +{ + struct stream *s; + char hostbuf[MAXHOSTNAMELEN]; + char *login, *host; + int error; + + s = config->server; + error = gethostname(hostbuf, sizeof(hostbuf)); + hostbuf[sizeof(hostbuf) - 1] = '\0'; + if (error) + host = NULL; + else + host = hostbuf; + login = getlogin(); + proto_printf(s, "USER %s %s\n", login != NULL ? login : "?", + host != NULL ? host : "?"); + stream_flush(s); + error = auth_domd5auth(config); + return (error); +} + +static int +auth_domd5auth(struct config *config) +{ + struct stream *s; + char *line, *cmd, *challenge, *realm, *client, *srvresponse, *msg; + char shrdsecret[MD5_CHARS_MAX], response[MD5_CHARS_MAX]; + char clichallenge[MD5_CHARS_MAX]; + struct srvrecord auth; + int error; + + lprintf(2, "MD5 authentication started\n"); + s = config->server; + line = stream_getln(s, NULL); + cmd = proto_get_ascii(&line); + realm = proto_get_ascii(&line); + challenge = proto_get_ascii(&line); + if (challenge == NULL || + line != NULL || + (strcmp(cmd, "AUTHMD5") != 0)) { + lprintf(-1, "Invalid server reply to USER\n"); + return (STATUS_FAILURE); + } + + client = NULL; + response[0] = clichallenge[0] = '.'; + response[1] = clichallenge[1] = 0; + if (config->reqauth || (strcmp(challenge, ".") != 0)) { + if (strcmp(realm, ".") == 0) { + lprintf(-1, "Authentication required, but not enabled on server\n"); + return (STATUS_FAILURE); + } + error = auth_lookuprecord(realm, &auth); + if (error != STATUS_SUCCESS) + return (error); + client = auth.client; + auth_makesecret(&auth, shrdsecret); + } + + if (strcmp(challenge, ".") != 0) + auth_makeresponse(challenge, shrdsecret, response); + if (config->reqauth) + auth_makechallenge(config, clichallenge); + proto_printf(s, "AUTHMD5 %s %s %s\n", + client == NULL ? "." : client, response, clichallenge); + stream_flush(s); + line = stream_getln(s, NULL); + cmd = proto_get_ascii(&line); + if (cmd == NULL || line == NULL) + goto bad; + if (strcmp(cmd, "OK") == 0) { + srvresponse = proto_get_ascii(&line); + if (srvresponse == NULL) + goto bad; + if (config->reqauth && + !auth_checkresponse(srvresponse, clichallenge, shrdsecret)) { + lprintf(-1, "Server failed to authenticate itself to client\n"); + return (STATUS_FAILURE); + } + lprintf(2, "MD5 authentication successfull\n"); + return (STATUS_SUCCESS); + } + if (strcmp(cmd, "!") == 0) { + msg = proto_get_rest(&line); + if (msg == NULL) + goto bad; + lprintf(-1, "Server error: %s\n", msg); + return (STATUS_FAILURE); + } +bad: + lprintf(-1, "Invalid server reply to AUTHMD5\n"); + return (STATUS_FAILURE); +} + +static int +auth_lookuprecord(char *server, struct srvrecord *auth) +{ + char *home, *line, authfile[FILENAME_MAX]; + struct stream *s; + int linenum = 0, error; + + home = getenv("HOME"); + if (home == NULL) { + lprintf(-1, "Environment variable \"HOME\" is not set\n"); + return (STATUS_FAILURE); + } + snprintf(authfile, sizeof(authfile), "%s/%s", home, AUTHFILE); + s = stream_open_file(authfile, O_RDONLY); + if (s == NULL) { + lprintf(-1, "Could not open file %s\n", authfile); + return (STATUS_FAILURE); + } + + while ((line = stream_getln(s, NULL)) != NULL) { + linenum++; + if (line[0] == '#' || line[0] == '\0') + continue; + error = auth_parsetoken(&line, auth->server, + sizeof(auth->server)); + if (error != STATUS_SUCCESS) { + lprintf(-1, "%s:%d Missng client name\n", authfile, linenum); + goto close; + } + /* Skip the rest of this line, it isn't what we are looking for. */ + if (strcmp(auth->server, server) != 0) + continue; + error = auth_parsetoken(&line, auth->client, + sizeof(auth->client)); + if (error != STATUS_SUCCESS) { + lprintf(-1, "%s:%d Missng password\n", authfile, linenum); + goto close; + } + error = auth_parsetoken(&line, auth->password, + sizeof(auth->password)); + if (error != STATUS_SUCCESS) { + lprintf(-1, "%s:%d Missng comment\n", authfile, linenum); + goto close; + } + stream_close(s); + lprintf(2, "Found authentication record for server \"%s\"\n", + server); + return (STATUS_SUCCESS); + } + lprintf(-1, "Unknown server \"%s\". Fix your %s\n", server , authfile); + memset(auth->password, 0, sizeof(auth->password)); +close: + stream_close(s); + return (STATUS_FAILURE); +} + +static int +auth_parsetoken(char **line, char *buf, int len) +{ + char *colon; + + colon = strchr(*line, ':'); + if (colon == NULL) + return (STATUS_FAILURE); + *colon = 0; + buf[len - 1] = 0; + strncpy(buf, *line, len - 1); + *line = colon + 1; + return (STATUS_SUCCESS); +} + +static void +auth_makesecret(struct srvrecord *auth, char *secret) +{ + char *s, ch; + const char *md5salt = "$md5$"; + unsigned char md5sum[MD5_BYTES]; + MD5_CTX md5; + + MD5_Init(&md5); + for (s = auth->client; *s != 0; ++s) { + ch = tolower(*s); + MD5_Update(&md5, &ch, 1); + } + MD5_Update(&md5, ":", 1); + for (s = auth->server; *s != 0; ++s) { + ch = tolower(*s); + MD5_Update(&md5, &ch, 1); + } + MD5_Update(&md5, ":", 1); + MD5_Update(&md5, auth->password, strlen(auth->password)); + MD5_Final(md5sum, &md5); + memset(secret, 0, sizeof(secret)); + strcpy(secret, md5salt); + auth_readablesum(md5sum, secret + strlen(md5salt)); +} + +static void +auth_makeresponse(char *challenge, char *sharedsecret, char *response) +{ + MD5_CTX md5; + unsigned char md5sum[MD5_BYTES]; + + MD5_Init(&md5); + MD5_Update(&md5, sharedsecret, strlen(sharedsecret)); + MD5_Update(&md5, ":", 1); + MD5_Update(&md5, challenge, strlen(challenge)); + MD5_Final(md5sum, &md5); + auth_readablesum(md5sum, response); +} + +/* + * Generates a challenge string which is an MD5 sum + * of a fairly random string. The purpose is to decrease + * the possibility of generating the same challenge + * string (even by different clients) more then once + * for the same server. + */ +static void +auth_makechallenge(struct config *config, char *challenge) +{ + MD5_CTX md5; + unsigned char md5sum[MD5_BYTES]; + char buf[128]; + struct timeval tv; + struct sockaddr_in laddr; + pid_t pid, ppid; + int error, addrlen; + + gettimeofday(&tv, NULL); + pid = getpid(); + ppid = getppid(); + srand(tv.tv_usec ^ tv.tv_sec ^ pid); + addrlen = sizeof(laddr); + error = getsockname(config->socket, (struct sockaddr *)&laddr, &addrlen); + if (error < 0) { + memset(&laddr, 0, sizeof(laddr)); + } + gettimeofday(&tv, NULL); + MD5_Init(&md5); + snprintf(buf, sizeof(buf), "%s:%ld:%ld:%ld:%d:%d", + inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, random(), pid, ppid); + MD5_Update(&md5, buf, strlen(buf)); + MD5_Final(md5sum, &md5); + auth_readablesum(md5sum, challenge); +} + +static int +auth_checkresponse(char *response, char *challenge, char *secret) +{ + char correctresponse[MD5_CHARS_MAX]; + + auth_makeresponse(challenge, secret, correctresponse); + return (strcmp(response, correctresponse) == 0); +} + +static void +auth_readablesum(unsigned char *md5sum, char *readable) +{ + unsigned int i; + char *s = readable; + + for (i = 0; i < MD5_BYTES; ++i, s+=2) { + sprintf(s, "%.2x", md5sum[i]); + } +} + Added: user/eri/pf45/head/contrib/csup/auth.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/eri/pf45/head/contrib/csup/auth.h Tue Feb 23 09:58:12 2010 (r204245) @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2003-2007, Petar Zhivkov Petrov + * 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: user/eri/pf45/head/contrib/csup/auth.h 203368 2010-02-02 05:57:42Z lulf $ + */ +#ifndef _AUTH_H_ +#define _AUTH_H_ + +#define AUTHFILE ".csup/auth" /* user home relative */ + +struct config; + +int auth_login(struct config *); + +#endif /* !_AUTH_H_ */ + Added: user/eri/pf45/head/contrib/csup/cpasswd.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/eri/pf45/head/contrib/csup/cpasswd.1 Tue Feb 23 09:58:12 2010 (r204245) @@ -0,0 +1,120 @@ +.\" Copyright 1999-2003 John D. Polstra. +.\" 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgment: +.\" This product includes software developed by John D. Polstra. +.\" 4. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" 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. +.\" +.\" $Id: cvpasswd.1,v 1.4 2003/03/04 18:24:42 jdp Exp $ +.\" $FreeBSD $ +.\" +.Dd June 27, 2007 +.Os FreeBSD +.Dt CPASSWD 1 +.Sh NAME +.Nm cpasswd +.Nd scramble passwords for csup authentication +.Sh SYNOPSIS +.Nm +.Ar clientName +.Ar serverName +.Sh DESCRIPTION +The +.Nm +utility creates scrambled passwords for the +.Nm CVSup +server's authentication database. It is invoked with a client name +and a server name. +.Ar ClientName +is the name the client uses to gain access to the +server. By convention, e-mail addresses are used for all client +names, e.g., +.Ql BillyJoe@FreeBSD.ORG . +Client names are case-insensitive. +.Pp +.Ar ServerName +is the name of the +.Nm CVSup +server which the client wishes to access. By convention, +it is the canonical fully-qualified domain name of the server, e.g., +.Ql CVSup.FreeBSD.ORG . +This must agree with the server's own idea of its name. The name is +case-insensitive. +.Pp +To set up authentication for a given server, one must perform the +following steps: +.Bl -enum +.It +Obtain the official +.Ar serverName +from the administrator of the server or from some other source. +.It +Choose an appropriate +.Ar clientName . +It should be in the form of a valid e-mail address, to make it easy +for the server administrator to contact the user if necessary. +.It +Choose an arbitrary secret +.Ar password . +.It +Run +.Nm cpasswd , +and type in the +.Ar password +when prompted for it. The utility will print out a line to send +to the server administrator, and instruct you how to modify your +.Li $ Ns Ev HOME Ns Pa /.csup/auth +file. You should use a secure channel to send the line to the +server administrator. +.El +.Pp +Since +.Li $ Ns Ev HOME Ns Pa /.csup/auth +contains passwords, you should ensure that it is not readable by +anyone except yourself. +.Sh FILES +.Bl -tag -width $HOME/.csup/authxx -compact +.It Li $ Ns Ev HOME Ns Pa /.csup/auth +Authentication password file. +.El +.Sh SEE ALSO +.Xr csup 1 , +.Xr cvsup 1 , +.Xr cvsupd 8 . +.Pp +.Bd -literal +http://www.cvsup.org/ +.Ed +.Sh AUTHORS +.An -nosplit +.An Petar Zhivkov Petrov Aq pesho.petrov@gmail.com +is the author of +.Nm , +the rewrite of +.Nm cvpasswd . +.An John Polstra Aq jdp@polstra.com +is the author of +.Nm CVSup . +.Sh LEGALITIES +CVSup is a registered trademark of John D. Polstra. Added: user/eri/pf45/head/contrib/csup/cpasswd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/eri/pf45/head/contrib/csup/cpasswd.sh Tue Feb 23 09:58:12 2010 (r204245) @@ -0,0 +1,135 @@ +#! /bin/sh +# +# Copyright 2007. Petar Zhivkov Petrov +# pesho.petrov@gmail.com +# +# $FreeBSD: user/eri/pf45/head/contrib/csup/cpasswd.sh 203368 2010-02-02 05:57:42Z lulf $ + +usage() { + echo "Usage: $0 clientName serverName" + echo " $0 -v" +} + +countChars() { + _count="`echo "$1" | sed -e "s/[^$2]//g" | tr -d "\n" | wc -c`" + return 0 +} + +readPassword() { + while [ true ]; do + stty -echo + read -p "$1" _password + stty echo + echo "" + countChars "$_password" ":" + if [ $_count != 0 ]; then + echo "Sorry, password must not contain \":\" characters" + echo "" + else + break + fi + done + return 0 +} + +makeSecret() { + local clientLower="`echo "$1" | tr "[:upper:]" "[:lower:]"`" + local serverLower="`echo "$2" | tr "[:upper:]" "[:lower:]"`" + local secret="`md5 -qs "$clientLower:$serverLower:$3"`" + _secret="\$md5\$$secret" +} + +if [ $# -eq 1 -a "X$1" = "X-v" ]; then + echo "Csup authentication key generator" + usage + exit +elif [ $# -ne 2 ]; then + usage + exit +fi + +clientName=$1 +serverName=$2 + +# +# Client name must contain exactly one '@' and at least one '.'. +# It must not contain a ':'. +# + +countChars "$clientName" "@" +aCount=$_count + +countChars "$clientName" "." +dotCount=$_count +if [ $aCount -ne 1 -o $dotCount -eq 0 ]; then + echo "Client name must have the form of an e-mail address," + echo "e.g., \"user@domain.com\"" + exit +fi + +countChars "$clientName" ":" +colonCount=$_count +if [ $colonCount -gt 0 ]; then + echo "Client name must not contain \":\" characters" + exit +fi + +# +# Server name must not contain '@' and must have at least one '.'. +# It also must not contain a ':'. +# + +countChars "$serverName" "@" +aCount=$_count + +countChars "$serverName" "." +dotCount=$_count +if [ $aCount != 0 -o $dotCount = 0 ]; then + echo "Server name must be a fully-qualified domain name." + echo "e.g., \"host.domain.com\"" + exit +fi + +countChars "$serverName" ":" +colonCount=$_count +if [ $colonCount -gt 0 ]; then + echo "Server name must not contain \":\" characters" + exit +fi + +# +# Ask for password and generate secret. +# + +while [ true ]; do + readPassword "Enter password: " + makeSecret "$clientName" "$serverName" "$_password" + secret=$_secret + + readPassword "Enter same password again: " + makeSecret "$clientName" "$serverName" "$_password" + secret2=$_secret + + if [ "X$secret" = "X$secret2" ]; then + break + else + echo "Passwords did not match. Try again." + echo "" + fi +done + +echo "" +echo "Send this line to the server administrator at $serverName:" +echo "-------------------------------------------------------------------------------" +echo "$clientName:$secret::" +echo "-------------------------------------------------------------------------------" +echo "Be sure to send it using a secure channel!" +echo "" +echo "Add this line to your file \"$HOME/.csup/auth\", replacing \"XXX\"" +echo "with the password you typed in:" +echo "-------------------------------------------------------------------------------" +echo "$serverName:$clientName:XXX:" +echo "-------------------------------------------------------------------------------" +echo "Make sure the file is readable and writable only by you!" +echo "" + Added: user/eri/pf45/head/etc/devd/uath.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/eri/pf45/head/etc/devd/uath.conf Tue Feb 23 09:58:12 2010 (r204245) @@ -0,0 +1,120 @@ +# $FreeBSD: user/eri/pf45/head/etc/devd/uath.conf 202610 2010-01-19 01:33:56Z weongyo $ +# +# Atheros USB wireless network device specific devd events + +# Accton +# SMCWUSB-G and SMCWUSBT-G2 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x083a"; + match "product" "(0x4505|0x4507)"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# Atheros Communications +# AR5523 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x168c"; + match "product" "0x0002"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# Atheros Communications +# AR5523 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x0cf3"; + match "product" "(0x0002|0x0004|0x0006)"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# Conceptronic +# AR5523 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x0d8e"; + match "product" "(0x7802|0x7812)"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# D-Link +# DWL-AG132, DWL-G132 and DWL-AG122 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x2001"; + match "product" "(0x3a01|0x3a03|0x3a05)"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# D-Link +# DWA-120 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x07d1"; + match "product" "0x3a0c"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# Gigaset +# SMCWUSBT-G +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x1690"; + match "product" "(0x0711|0x0713)"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# Global Sun Technology +# AR5523 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x16ab"; + match "product" "(0x7802|0x7812)"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# BayNETGEAR +# WG111U +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x0846"; + match "product" "0x4301"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# Netgear +# WG111T and WPN111 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x1385"; + match "product" "(0x4251|0x5f01)"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# U-MEDIA Communications +# TEW-444UB and AR5523 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x157e"; + match "product" "(0x3007|0x3206)"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# Wistron NeWeb +# AR5523 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x1435"; + match "product" "(0x0827|0x0829)"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; + +# Z-Com +# AR5523 +attach 100 { + device-name "ugen[0-9.]+"; + match "vendor" "0x0cde"; + match "product" "0x0013"; + action "/usr/sbin/uathload -d /dev/$device-name"; +}; Added: user/eri/pf45/head/etc/rc.d/rtsold ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/eri/pf45/head/etc/rc.d/rtsold Tue Feb 23 09:58:12 2010 (r204245) @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $FreeBSD: user/eri/pf45/head/etc/rc.d/rtsold 203433 2010-02-03 16:18:42Z ume $ +# + +# PROVIDE: rtsold +# REQUIRE: netif +# BEFORE: NETWORKING +# KEYWORD: nojail + +. /etc/rc.subr + +name="rtsold" +rcvar=`set_rcvar` +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +start_postcmd="rtsold_poststart" + +rtsold_poststart() +{ + # wait for DAD + sleep $(($(${SYSCTL_N} net.inet6.ip6.dad_count) + 1)) +} + +load_rc_config $name +run_rc_command "$1" Added: user/eri/pf45/head/lib/libarchive/archive_crc32.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/eri/pf45/head/lib/libarchive/archive_crc32.h Tue Feb 23 09:58:12 2010 (r204245) @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2009 Joerg Sonnenberger + * 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. + * + * $FreeBSD: user/eri/pf45/head/lib/libarchive/archive_crc32.h 201102 2009-12-28 03:11:36Z kientzle $ + */ + +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + +/* + * When zlib is unavailable, we should still be able to validate + * uncompressed zip archives. That requires us to be able to compute + * the CRC32 check value. This is a drop-in compatible replacement + * for crc32() from zlib. It's slower than the zlib implementation, + * but still pretty fast: This runs about 300MB/s on my 3GHz P4 + * compared to about 800MB/s for the zlib implementation. + */ +static unsigned long +crc32(unsigned long crc, const void *_p, size_t len) +{ + unsigned long crc2, b, i; + const unsigned char *p = _p; + static volatile int crc_tbl_inited = 0; + static unsigned long crc_tbl[256]; + + if (!crc_tbl_inited) { + for (b = 0; b < 256; ++b) { + crc2 = b; + for (i = 8; i > 0; --i) { + if (crc2 & 1) + crc2 = (crc2 >> 1) ^ 0xedb88320UL; + else + crc2 = (crc2 >> 1); + } + crc_tbl[b] = crc2; + } + crc_tbl_inited = 1; + } + + crc = crc ^ 0xffffffffUL; + while (len--) + crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8); + return (crc ^ 0xffffffffUL); +} Added: user/eri/pf45/head/lib/libarchive/archive_entry_xattr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/eri/pf45/head/lib/libarchive/archive_entry_xattr.c Tue Feb 23 09:58:12 2010 (r204245) @@ -0,0 +1,158 @@ +/*- + * Copyright (c) 2003-2007 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 "archive_platform.h" +__FBSDID("$FreeBSD: user/eri/pf45/head/lib/libarchive/archive_entry_xattr.c 201096 2009-12-28 02:41:27Z kientzle $"); + +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif +#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__) +#include /* for Linux file flags */ +#endif +#include +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_WCHAR_H +#include +#endif + +#include "archive.h" +#include "archive_entry.h" +#include "archive_private.h" +#include "archive_entry_private.h" + +/* + * extended attribute handling + */ + +void +archive_entry_xattr_clear(struct archive_entry *entry) +{ + struct ae_xattr *xp; + + while (entry->xattr_head != NULL) { + xp = entry->xattr_head->next; + free(entry->xattr_head->name); + free(entry->xattr_head->value); + free(entry->xattr_head); + entry->xattr_head = xp; + } + + entry->xattr_head = NULL; +} + +void +archive_entry_xattr_add_entry(struct archive_entry *entry, + const char *name, const void *value, size_t size) +{ + struct ae_xattr *xp; + + for (xp = entry->xattr_head; xp != NULL; xp = xp->next) + ; + + if ((xp = (struct ae_xattr *)malloc(sizeof(struct ae_xattr))) == NULL) + /* XXX Error XXX */ + return; + + xp->name = strdup(name); + if ((xp->value = malloc(size)) != NULL) { + memcpy(xp->value, value, size); + xp->size = size; + } else + xp->size = 0; + + xp->next = entry->xattr_head; + entry->xattr_head = xp; +} + + +/* + * returns number of the extended attribute entries + */ +int +archive_entry_xattr_count(struct archive_entry *entry) +{ + struct ae_xattr *xp; + int count = 0; + + for (xp = entry->xattr_head; xp != NULL; xp = xp->next) + count++; + + return count; +} + +int +archive_entry_xattr_reset(struct archive_entry * entry) +{ + entry->xattr_p = entry->xattr_head; + + return archive_entry_xattr_count(entry); +} + +int +archive_entry_xattr_next(struct archive_entry * entry, + const char **name, const void **value, size_t *size) +{ + if (entry->xattr_p) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Feb 23 21:13:49 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A2411065720; Tue, 23 Feb 2010 21:13:49 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 173E08FC13; Tue, 23 Feb 2010 21:13:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1NLDmYY081336; Tue, 23 Feb 2010 21:13:48 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1NLDmPM081334; Tue, 23 Feb 2010 21:13:48 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002232113.o1NLDmPM081334@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 23 Feb 2010 21:13:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204259 - user/edwin/calendar/calendars/de_DE.ISO8859-1 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 21:13:49 -0000 Author: edwin Date: Tue Feb 23 21:13:48 2010 New Revision: 204259 URL: http://svn.freebsd.org/changeset/base/204259 Log: Replace "06" with "06/*" Modified: user/edwin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Modified: user/edwin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte ============================================================================== --- user/edwin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Tue Feb 23 20:28:15 2010 (r204258) +++ user/edwin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Tue Feb 23 21:13:48 2010 (r204259) @@ -29,7 +29,7 @@ LANG=de_DE.ISO8859-1 10/18 Wartburgfest der Deutschen Burschenschaften, 1817 01/01 Inkrafttreten des Vertrages über den deutschen Zollverein, 1834 12/07 Erste deutsche Eisenbahn zwischen Nürnberg und Fürth, 1835 -06 Aufstand der schlesischen Weber, 1844 +06/* Aufstand der schlesischen Weber, 1844 12/21 Verabschiedung des Gesetzes über die Grundrechte des deutschen Volkes durch die Frankfurter Nationalversammlung, 1848 03/27 Annahme der deutschen Reichsverfassung in der Frankfurter @@ -154,7 +154,7 @@ LANG=de_DE.ISO8859-1 04/01 Organisierter Boykott jüdischer Geschäfte, 1933 04/07 Zweites Gesetz zur Gleichschaltung der Länder, 1933 05/02 Auflösung der Gewerkschaften, 1933 -06 Auflösung aller Parteien außer NSDAP, 1933 +06/* Auflösung aller Parteien außer NSDAP, 1933 07/20 Konkordat zwischen Deutschland und dem Vatikan, 1933 06/30 Röhm-Putsch, Ausschaltung der SA-Führung, 1934 09/15 Nürnberger Gesetze, 1935 @@ -165,7 +165,7 @@ LANG=de_DE.ISO8859-1 /* Sozialismus */ 01/21 Lenin gestorben, 1924 -06 Gründung des Bundes der Kommunisten in London +06/* Gründung des Bundes der Kommunisten in London durch Marx und Engels, 1847 05/23 Gründung des Allgemeinen Deutschen Arbeitervereins in Leipzig unter Führung von Ferdinand Lassalles, 1863 From owner-svn-src-user@FreeBSD.ORG Tue Feb 23 21:26:05 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDB2C106566B; Tue, 23 Feb 2010 21:26:05 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCF118FC19; Tue, 23 Feb 2010 21:26:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1NLQ5hj084104; Tue, 23 Feb 2010 21:26:05 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1NLQ5Vb084102; Tue, 23 Feb 2010 21:26:05 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002232126.o1NLQ5Vb084102@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 23 Feb 2010 21:26:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204261 - user/edwin/calendar/calendars/de_DE.ISO8859-1 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 21:26:06 -0000 Author: edwin Date: Tue Feb 23 21:26:05 2010 New Revision: 204261 URL: http://svn.freebsd.org/changeset/base/204261 Log: Fix previous fix properly. 06/* -> */Jun (thanks to the cc dependancy of the calendar) Modified: user/edwin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Modified: user/edwin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte ============================================================================== --- user/edwin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Tue Feb 23 21:15:05 2010 (r204260) +++ user/edwin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Tue Feb 23 21:26:05 2010 (r204261) @@ -29,7 +29,7 @@ LANG=de_DE.ISO8859-1 10/18 Wartburgfest der Deutschen Burschenschaften, 1817 01/01 Inkrafttreten des Vertrages über den deutschen Zollverein, 1834 12/07 Erste deutsche Eisenbahn zwischen Nürnberg und Fürth, 1835 -06/* Aufstand der schlesischen Weber, 1844 +*/Jun Aufstand der schlesischen Weber, 1844 12/21 Verabschiedung des Gesetzes über die Grundrechte des deutschen Volkes durch die Frankfurter Nationalversammlung, 1848 03/27 Annahme der deutschen Reichsverfassung in der Frankfurter @@ -154,7 +154,7 @@ LANG=de_DE.ISO8859-1 04/01 Organisierter Boykott jüdischer Geschäfte, 1933 04/07 Zweites Gesetz zur Gleichschaltung der Länder, 1933 05/02 Auflösung der Gewerkschaften, 1933 -06/* Auflösung aller Parteien außer NSDAP, 1933 +*/Jun Auflösung aller Parteien außer NSDAP, 1933 07/20 Konkordat zwischen Deutschland und dem Vatikan, 1933 06/30 Röhm-Putsch, Ausschaltung der SA-Führung, 1934 09/15 Nürnberger Gesetze, 1935 @@ -165,7 +165,7 @@ LANG=de_DE.ISO8859-1 /* Sozialismus */ 01/21 Lenin gestorben, 1924 -06/* Gründung des Bundes der Kommunisten in London +*/Jun Gründung des Bundes der Kommunisten in London durch Marx und Engels, 1847 05/23 Gründung des Allgemeinen Deutschen Arbeitervereins in Leipzig unter Führung von Ferdinand Lassalles, 1863 @@ -195,4 +195,5 @@ LANG=de_DE.ISO8859-1 10/12 Chruschtschow schlägt während einer Rede in der UNO mit den Schuhen auf den Tisch, 1960 -#endif /* _de_DE_ISO8859_1_geschichte_ */ +#endif +/* _de_DE_ISO8859_1_geschichte_ */ From owner-svn-src-user@FreeBSD.ORG Tue Feb 23 21:28:25 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C02D1065692; Tue, 23 Feb 2010 21:28:25 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6115D8FC12; Tue, 23 Feb 2010 21:28:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1NLSPZS084650; Tue, 23 Feb 2010 21:28:25 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1NLSPST084647; Tue, 23 Feb 2010 21:28:25 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002232128.o1NLSPST084647@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 23 Feb 2010 21:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204262 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 21:28:25 -0000 Author: edwin Date: Tue Feb 23 21:28:25 2010 New Revision: 204262 URL: http://svn.freebsd.org/changeset/base/204262 Log: Properly handle definitions in dayofmonth/month* format. (* means variable each year, which unless these calendar files are updated every year will be out of sync very fast) Modified: user/edwin/calendar/io.c user/edwin/calendar/parsedata.c Modified: user/edwin/calendar/io.c ============================================================================== --- user/edwin/calendar/io.c Tue Feb 23 21:26:05 2010 (r204261) +++ user/edwin/calendar/io.c Tue Feb 23 21:28:25 2010 (r204262) @@ -181,6 +181,13 @@ cal(void) extradata)) == 0) continue; *pp = p; + if (count < 0) { + /* Show error status based on return value */ + fprintf(stderr, "Ignored: %s\n", buf); + if (count == -1) + continue; + count = -count + 1; + } /* Find the last tab */ while (pp[1] == '\t') Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Tue Feb 23 21:26:05 2010 (r204261) +++ user/edwin/calendar/parsedata.c Tue Feb 23 21:28:25 2010 (r204262) @@ -374,6 +374,7 @@ parsedaymonth(char *date, int *yearp, in int idayofweek, imonth, idayofmonth, year, index; int d, m, dow, rm, rd, offset; char *ed; + int retvalsign = 1; static struct yearinfo *years, *yearinfo; @@ -458,6 +459,15 @@ parsedaymonth(char *date, int *yearp, in continue; } + /* XXX Same day every year, but variable */ + if (*flags == (F_MONTH | F_DAYOFMONTH | F_VARIABLE)) { + if (!remember_ymd(year, imonth, idayofmonth)) + continue; + remember(&index, yearp, monthp, dayp, edp, + year, imonth, idayofmonth, NULL); + continue; + } + /* Same day every month */ if (*flags == (F_ALLMONTH | F_DAYOFMONTH)) { for (m = 1; m <= 12; m++) { @@ -697,9 +707,13 @@ parsedaymonth(char *date, int *yearp, in debug_determinestyle(2, date, *flags, month, imonth, dayofmonth, idayofmonth, dayofweek, idayofweek, modifieroffset, modifierindex, specialday); + retvalsign = -1; } - return (index); + if (retvalsign == -1) + return (-index - 1); + else + return (index); } static char * From owner-svn-src-user@FreeBSD.ORG Tue Feb 23 21:39:12 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C9B3106566C; Tue, 23 Feb 2010 21:39:12 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AC1A8FC0A; Tue, 23 Feb 2010 21:39:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1NLdB44087051; Tue, 23 Feb 2010 21:39:11 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1NLdBLt087044; Tue, 23 Feb 2010 21:39:11 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002232139.o1NLdBLt087044@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 23 Feb 2010 21:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204263 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 21:39:12 -0000 Author: edwin Date: Tue Feb 23 21:39:11 2010 New Revision: 204263 URL: http://svn.freebsd.org/changeset/base/204263 Log: Give the solar calculations second precision capability Add the $FreeBSD$ keyword. Modified: user/edwin/calendar/calendar.h user/edwin/calendar/dates.c (contents, props changed) user/edwin/calendar/events.c (contents, props changed) user/edwin/calendar/parsedata.c (contents, props changed) user/edwin/calendar/pom.c (contents, props changed) user/edwin/calendar/sunpos.c (contents, props changed) Directory Properties: user/edwin/calendar/cny.c (props changed) user/edwin/calendar/locale.c (props changed) Modified: user/edwin/calendar/calendar.h ============================================================================== --- user/edwin/calendar/calendar.h Tue Feb 23 21:28:25 2010 (r204262) +++ user/edwin/calendar/calendar.h Tue Feb 23 21:39:11 2010 (r204263) @@ -39,10 +39,12 @@ #define SECSPERDAY (24 * 60 * 60) #define SECSPERHOUR (60 * 60) #define SECSPERMINUTE (60) +#define MINSPERHOUR (60) #define HOURSPERDAY (24) #define FSECSPERDAY (24.0 * 60.0 * 60.0) #define FSECSPERHOUR (60.0 * 60.0) #define FSECSPERMINUTE (60.0) +#define FMINSPERHOUR (60.0) #define FHOURSPERDAY (24.0) #define DAYSPERYEAR 365 Modified: user/edwin/calendar/dates.c ============================================================================== --- user/edwin/calendar/dates.c Tue Feb 23 21:28:25 2010 (r204262) +++ user/edwin/calendar/dates.c Tue Feb 23 21:39:11 2010 (r204263) @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: user/edwin/calendar/calendar.c 201195 2009-12-29 13:14:13Z edwin $"); +__FBSDID("$FreeBSD$"); #include #include Modified: user/edwin/calendar/events.c ============================================================================== --- user/edwin/calendar/events.c Tue Feb 23 21:28:25 2010 (r204262) +++ user/edwin/calendar/events.c Tue Feb 23 21:39:11 2010 (r204263) @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: user/edwin/calendar/io.c 200813 2009-12-21 21:17:59Z edwin $"); +__FBSDID("$FreeBSD$"); #include #include Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Tue Feb 23 21:28:25 2010 (r204262) +++ user/edwin/calendar/parsedata.c Tue Feb 23 21:39:11 2010 (r204263) @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: user/edwin/calendar/day.c 200813 2009-12-21 21:17:59Z edwin $"); +__FBSDID("$FreeBSD$"); #include #include Modified: user/edwin/calendar/pom.c ============================================================================== --- user/edwin/calendar/pom.c Tue Feb 23 21:28:25 2010 (r204262) +++ user/edwin/calendar/pom.c Tue Feb 23 21:39:11 2010 (r204263) @@ -45,7 +45,7 @@ static const char sccsid[] = "@(#)pom.c #endif /* not lint */ #endif #include -__FBSDID("$FreeBSD: head/games/pom/pom.c 201613 2010-01-05 21:14:48Z edwin $"); +__FBSDID("$FreeBSD$"); /* * Phase of the Moon. Calculates the current phase of the moon. Modified: user/edwin/calendar/sunpos.c ============================================================================== --- user/edwin/calendar/sunpos.c Tue Feb 23 21:28:25 2010 (r204262) +++ user/edwin/calendar/sunpos.c Tue Feb 23 21:39:11 2010 (r204263) @@ -93,7 +93,7 @@ static double ZJtable[] = { static void sunpos(int inYY, int inMM, int inDD, double UTCOFFSET, int inHOUR, int inMIN, - double eastlongitude, double latitude, double *L, double *DEC) + int inSEC, double eastlongitude, double latitude, double *L, double *DEC) { int Y; double ZJ, D, T, M, epsilon, lambda, alpha, HA, UTHM; @@ -102,7 +102,7 @@ sunpos(int inYY, int inMM, int inDD, dou if (inMM <= 2 && isleap(inYY)) ZJ -= 1.0; - UTHM = inHOUR + inMIN / FSECSPERMINUTE + UTCOFFSET; + UTHM = inHOUR + inMIN / FMINSPERHOUR + inSEC / FSECSPERHOUR + UTCOFFSET; Y = inYY - 1900; /* 1 */ D = floor(365.25 * Y) + ZJ + inDD + UTHM / FHOURSPERDAY; /* 3 */ T = D / 36525.0; /* 4 */ @@ -134,8 +134,8 @@ sunpos(int inYY, int inMM, int inDD, dou fixup(&HA); fixup(&latitude); #ifdef NOTDEF - printf("%02d/%02d %02d: l:%g d:%g h:%g\n", - inMM, inDD, inHOUR, latitude, *DEC, HA); + printf("%02d/%02d %02d:%02d:%02d l:%g d:%g h:%g\n", + inMM, inDD, inHOUR, inMIN, inSEC, latitude, *DEC, HA); #endif return; @@ -182,8 +182,10 @@ sunpos(int inYY, int inMM, int inDD, dou #define ANGLE(a, b) (((a) < (b)) ? 1 : -1) #define SHOUR(s) ((s) / 3600) #define SMIN(s) (((s) % 3600) / 60) +#define SSEC(s) ((s) % 60) #define HOUR(h) ((h) / 4) #define MIN(h) (15 * ((h) % 4)) +#define SEC(h) 0 #define DEBUG1(y, m, d, hh, mm, pdec, dec) \ printf("%4d-%02d-%02d %02d:%02d:00 - %7.7g -> %7.7g\n", \ y, m, d, hh, mm, pdec, dec) @@ -224,8 +226,8 @@ fequinoxsolstice(int year, double UTCoff prevdec = 350; for (d = 18; d < 31; d++) { // printf("Comparing day %d to %d.\n", d, d+1); - sunpos(year, 3, d, UTCoffset, 0, 0, 0.0, 0.0, &L, &decleft); - sunpos(year, 3, d + 1, UTCoffset, 0, 0, 0.0, 0.0, + sunpos(year, 3, d, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decleft); + sunpos(year, 3, d + 1, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decright); // printf("Found %g and %g.\n", decleft, decright); if (SIGN(decleft) == SIGN(decright)) @@ -236,7 +238,8 @@ fequinoxsolstice(int year, double UTCoff while (s > 0) { // printf("Obtaining %d (%02d:%02d)\n", // dial, SHOUR(dial), SMIN(dial)); - sunpos(year, 3, d, UTCoffset, SHOUR(dial), SMIN(dial), + sunpos(year, 3, d, UTCoffset, + SHOUR(dial), SMIN(dial), SSEC(dial), 0.0, 0.0, &L, &decmiddle); // printf("Found %g\n", decmiddle); if (SIGN(decleft) == SIGN(decmiddle)) { @@ -261,11 +264,11 @@ fequinoxsolstice(int year, double UTCoff found = 0; prevdec = 10; for (d = 18; d < 31; d++) { - printf("Comparing day %d to %d.\n", d, d+1); - sunpos(year, 9, d, UTCoffset, 0, 0, 0.0, 0.0, &L, &decleft); - sunpos(year, 9, d + 1, UTCoffset, 0, 0, 0.0, 0.0, +// printf("Comparing day %d to %d.\n", d, d+1); + sunpos(year, 9, d, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decleft); + sunpos(year, 9, d + 1, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decright); - printf("Found %g and %g.\n", decleft, decright); +// printf("Found %g and %g.\n", decleft, decright); if (SIGN(decleft) == SIGN(decright)) continue; @@ -274,7 +277,8 @@ fequinoxsolstice(int year, double UTCoff while (s > 0) { // printf("Obtaining %d (%02d:%02d)\n", // dial, SHOUR(dial), SMIN(dial)); - sunpos(year, 9, d, UTCoffset, SHOUR(dial), SMIN(dial), + sunpos(year, 9, d, UTCoffset, + SHOUR(dial), SMIN(dial), SSEC(dial), 0.0, 0.0, &L, &decmiddle); // printf("Found %g\n", decmiddle); if (SIGN(decleft) == SIGN(decmiddle)) { @@ -302,7 +306,7 @@ fequinoxsolstice(int year, double UTCoff prevangle = 1; for (d = 18; d < 31; d++) { for (h = 0; h < 4 * HOURSPERDAY; h++) { - sunpos(year, 6, d, UTCoffset, HOUR(h), MIN(h), + sunpos(year, 6, d, UTCoffset, HOUR(h), MIN(h), SEC(h), 0.0, 0.0, &L, &dec); angle = ANGLE(prevdec, dec); if (prevangle != angle) { @@ -332,7 +336,7 @@ fequinoxsolstice(int year, double UTCoff prevangle = -1; for (d = 18; d < 31; d++) { for (h = 0; h < 4 * HOURSPERDAY; h++) { - sunpos(year, 12, d, UTCoffset, HOUR(h), MIN(h), + sunpos(year, 12, d, UTCoffset, HOUR(h), MIN(h), SEC(h), 0.0, 0.0, &L, &dec); angle = ANGLE(prevdec, dec); if (prevangle != angle) { @@ -370,14 +374,15 @@ calculatesunlongitude30(int year, int de sunpos(year - 1, 12, 31, -24 * (degreeGMToffset / 360.0), - HOUR(h), MIN(h), 0.0, 0.0, &prevL, &dec); + HOUR(h), MIN(h), SEC(h), 0.0, 0.0, &prevL, &dec); for (m = 1; m <= 12; m++) { for (d = 1; d <= monthdays[m]; d++) { for (h = 0; h < 4 * HOURSPERDAY; h++) { sunpos(year, m, d, -24 * (degreeGMToffset / 360.0), - HOUR(h), MIN(h), 0.0, 0.0, &curL, &dec); + HOUR(h), MIN(h), SEC(h), + 0.0, 0.0, &curL, &dec); if (curL < 180 && prevL > 180) { *pichinesemonths = cumdays[m] + d; #ifdef DEBUG From owner-svn-src-user@FreeBSD.ORG Thu Feb 25 16:00:54 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7C98106568C; Thu, 25 Feb 2010 16:00:54 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D797E8FC14; Thu, 25 Feb 2010 16:00:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1PG0sS7059160; Thu, 25 Feb 2010 16:00:54 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1PG0r0X059159; Thu, 25 Feb 2010 16:00:53 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002251600.o1PG0r0X059159@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 25 Feb 2010 16:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204320 - user/luigi/ipfw3-head/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 16:00:55 -0000 Author: luigi Date: Thu Feb 25 16:00:52 2010 New Revision: 204320 URL: http://svn.freebsd.org/changeset/base/204320 Log: don't be picky if sysctlbyname fails on two unimportant variables Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Thu Feb 25 15:44:54 2010 (r204319) +++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Thu Feb 25 16:00:52 2010 (r204320) @@ -1171,8 +1171,7 @@ end_mask: len = sizeof(int); if (sysctlbyname("net.inet.ip.dummynet.red_lookup_depth", &lookup_depth, &len, NULL, 0) == -1) - errx(1, "sysctlbyname(\"%s\")", - "net.inet.ip.dummynet.red_lookup_depth"); + lookup_depth = 256; if (lookup_depth == 0) errx(EX_DATAERR, "net.inet.ip.dummynet.red_lookup_depth" " must be greater than zero"); @@ -1180,9 +1179,8 @@ end_mask: len = sizeof(int); if (sysctlbyname("net.inet.ip.dummynet.red_avg_pkt_size", &avg_pkt_size, &len, NULL, 0) == -1) + avg_pkt_size = 512; - errx(1, "sysctlbyname(\"%s\")", - "net.inet.ip.dummynet.red_avg_pkt_size"); if (avg_pkt_size == 0) errx(EX_DATAERR, "net.inet.ip.dummynet.red_avg_pkt_size must" From owner-svn-src-user@FreeBSD.ORG Thu Feb 25 16:11:52 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5033106566C; Thu, 25 Feb 2010 16:11:52 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4AB08FC16; Thu, 25 Feb 2010 16:11:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1PGBq9s061778; Thu, 25 Feb 2010 16:11:52 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1PGBqdS061776; Thu, 25 Feb 2010 16:11:52 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002251611.o1PGBqdS061776@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 25 Feb 2010 16:11:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204321 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 16:11:52 -0000 Author: luigi Date: Thu Feb 25 16:11:51 2010 New Revision: 204321 URL: http://svn.freebsd.org/changeset/base/204321 Log: support for scanning an entire bucket. This is used when draining idle queues and scheduler instances from dummynet. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.h Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.h Thu Feb 25 16:00:52 2010 (r204320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.h Thu Feb 25 16:11:51 2010 (r204321) @@ -133,6 +133,11 @@ int heap_scan(struct dn_heap *, int (*)( * removal of the object from the heap and the end of the * scan, respectively. * + * dn_ht_scan_bucket() is similar to dn_ht_scan(), except that it scans + * only the specific bucket of the table. The bucket is a in-out + * parameter and return a valid bucket number if the original + * is invalid. + * * A combination of flags can be used to modify the operation * of the dn_ht_find(), and of the callbacks: * @@ -163,6 +168,7 @@ void dn_ht_free(struct dn_ht *, int flag void *dn_ht_find(struct dn_ht *, uintptr_t, int, void *); int dn_ht_scan(struct dn_ht *, int (*)(void *, void *), void *); +int dn_ht_scan_bucket(struct dn_ht *, int * , int (*)(void *, void *), void *); int dn_ht_entries(struct dn_ht *); enum { /* flags values. From owner-svn-src-user@FreeBSD.ORG Thu Feb 25 16:14:09 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9371106564A; Thu, 25 Feb 2010 16:14:09 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8B038FC08; Thu, 25 Feb 2010 16:14:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1PGE9PV062320; Thu, 25 Feb 2010 16:14:09 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1PGE8nc062319; Thu, 25 Feb 2010 16:14:08 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002251614.o1PGE8nc062319@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 25 Feb 2010 16:14:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204322 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 16:14:09 -0000 Author: luigi Date: Thu Feb 25 16:14:07 2010 New Revision: 204322 URL: http://svn.freebsd.org/changeset/base/204322 Log: support for draining idle scheduler and queues. On passing, merge in the conditional parts for building ipfw and dummynet under linux and windows. The differences are small and non intrusive, and it makes no sense to keep them out of the tree. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Thu Feb 25 16:11:51 2010 (r204321) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Thu Feb 25 16:14:07 2010 (r204322) @@ -50,7 +50,10 @@ MALLOC_DECLARE(M_DUMMYNET); #ifndef FREE_PKT #define FREE_PKT(m) m_freem(m) #endif + +#ifndef __linux__ #define div64(a, b) ((int64_t)(a) / (int64_t)(b)) +#endif #define DN_LOCK_INIT() do { \ mtx_init(&dn_cfg.uh_mtx, "dn_uh", NULL, MTX_DEF); \ @@ -135,6 +138,12 @@ struct dn_parms { struct dn_fsk_head fsu; /* list of unlinked flowsets */ struct dn_alg_head schedlist; /* list of algorithms */ + /* Store the fs/sch to scan when draining. The value is the + * bucket number of the hash table + **/ + int drain_fs; + int drain_sch; + /* if the upper half is busy doing something long, * can set the busy flag and we will enqueue packets in * a queue for later processing. @@ -152,8 +161,14 @@ struct dn_parms { * bh_mtx protects all other structures which may be * modified upon packet arrivals */ +#if defined( __linux__ ) || defined( _WIN32 ) + spinlock_t uh_mtx; + spinlock_t bh_mtx; +#else struct mtx uh_mtx; struct mtx bh_mtx; +#endif + #endif /* _KERNEL */ }; @@ -191,6 +206,10 @@ struct dn_fsk { /* kernel side of a flow struct dn_schk *sched; /* Sched we are linked to */ SLIST_ENTRY(dn_fsk) sch_chain; /* list of fsk attached to sched */ + /* bucket index used by drain routine to drain queues for this + * flowset + */ + int drain_bucket; /* Parameter realted to RED / GRED */ /* original values are in dn_fs*/ int w_q ; /* queue weight (scaled) */ @@ -253,6 +272,11 @@ struct dn_schk { struct dn_fsk_head fsk_list; /* all fsk linked to me */ struct dn_fsk *fs; /* Flowset for !MULTIQUEUE */ + /* bucket index used by the drain routine to drain the scheduler + * instance for this flowset. + */ + int drain_bucket; + /* Hash table of all instances (through sch.sched_mask) * or single instance if no mask. Always valid. */ @@ -275,8 +299,41 @@ struct dn_sch_inst { int64_t credit; /* bits I can transmit (more or less). */ uint64_t sched_time; /* time link was scheduled in ready_heap */ uint64_t idle_time; /* start of scheduler instance idle time */ + + /* q_count is the number of queues that this instance is using. + * The counter is incremented or decremented when + * a reference from the queue is created or deleted. + * It is used to make sure that a scheduler instance can be safely + * deleted by the drain routine. See notes below. + */ + int q_count; + }; +/* + * NOTE about object drain. + * The system will automatically (XXX check when) drain queues and + * scheduler instances when they are idle. + * A queue is idle when it has no packets; an instance is idle when + * it is not in the evheap heap, and the corresponding delay line is empty. + * A queue can be safely deleted when it is idle because of the scheduler + * function xxx_free_queue() will remove any references to it. + * An instance can be only deleted when no queues reference it. To be sure + * of that, a counter (q_count) stores the number of queues that are pointing + * to the instance. + * + * XXX + * Order of scan: + * - take all flowset in a bucket for the flowset hash table + * - take all queues in a bucket for the flowset + * - increment the queue bucket + * - scan next flowset bucket + * Nothing is done if a bucket contains no entries. + * + * The same schema is used for sceduler instances + */ + + /* kernel-side flags. Linux has DN_DELETE in fcntl.h */ enum { @@ -321,4 +378,8 @@ int copy_data_helper_compat(void *_o, vo int dn_compat_calc_size(struct dn_parms dn_cfg); int do_config(void *p, int l); +/* function to drain idle object */ +void dn_drain_scheduler(void); +void dn_drain_queue(void); + #endif /* _IP_DN_PRIVATE_H */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Thu Feb 25 16:11:51 2010 (r204321) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Thu Feb 25 16:14:07 2010 (r204322) @@ -35,6 +35,12 @@ #ifdef _KERNEL +#ifndef SYSBEGIN +#define SYSBEGIN(x) +#endif +#ifndef SYSEND +#define SYSEND +#endif /* Return values from ipfw_chk() */ enum { @@ -201,8 +207,13 @@ struct ip_fw_chain { struct ip_fw **map; /* array of rule ptrs to ease lookup */ LIST_HEAD(nat_list, cfg_nat) nat; /* list of nat entries */ struct radix_node_head *tables[IPFW_TABLES_MAX]; +#if defined( __linux__ ) || defined( _WIN32 ) + spinlock_t rwmtx; + spinlock_t uh_lock; +#else struct rwlock rwmtx; struct rwlock uh_lock; /* lock for upper half */ +#endif uint32_t id; /* ruleset id */ }; From owner-svn-src-user@FreeBSD.ORG Thu Feb 25 16:39:29 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B6EA1065673; Thu, 25 Feb 2010 16:39:29 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B67B8FC17; Thu, 25 Feb 2010 16:39:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1PGdSMf076132; Thu, 25 Feb 2010 16:39:28 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1PGdSkp076129; Thu, 25 Feb 2010 16:39:28 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002251639.o1PGdSkp076129@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 25 Feb 2010 16:39:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204323 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 16:39:29 -0000 Author: luigi Date: Thu Feb 25 16:39:28 2010 New Revision: 204323 URL: http://svn.freebsd.org/changeset/base/204323 Log: add function dn_ht_scan_bucket() Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Thu Feb 25 16:14:07 2010 (r204322) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Thu Feb 25 16:39:28 2010 (r204323) @@ -471,3 +471,39 @@ dn_ht_scan(struct dn_ht *ht, int (*fn)(v } return found; } + +/* + * Similar to dn_ht_scan(), except thah the scan is performed only + * in the bucket 'bucket'. The function returns a correct bucket number if + * the original is invalid + */ +int +dn_ht_scan_bucket(struct dn_ht *ht, int *bucket, int (*fn)(void *, void *), + void *arg) +{ + int i, ret, found = 0; + void **curp, *cur, *next; + + if (ht == NULL || fn == NULL) + return 0; + if (*bucket >= ht->buckets) + *bucket = 0; + i = *bucket; + + curp = &ht->ht[i]; + while ( (cur = *curp) != NULL) { + next = *(void **)((char *)cur + ht->ofs); + ret = fn(cur, arg); + if (ret & DNHT_SCAN_DEL) { + found++; + ht->entries--; + *curp = next; + } else { + curp = (void **)((char *)cur + ht->ofs); + } + if (ret & DNHT_SCAN_END) + return found; + } + return found; +} + From owner-svn-src-user@FreeBSD.ORG Thu Feb 25 16:40:08 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B66F7106564A; Thu, 25 Feb 2010 16:40:08 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A55F48FC0A; Thu, 25 Feb 2010 16:40:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1PGe8kR076827; Thu, 25 Feb 2010 16:40:08 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1PGe8U8076824; Thu, 25 Feb 2010 16:40:08 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002251640.o1PGe8U8076824@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 25 Feb 2010 16:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204324 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 16:40:08 -0000 Author: luigi Date: Thu Feb 25 16:40:08 2010 New Revision: 204324 URL: http://svn.freebsd.org/changeset/base/204324 Log: add code to drain idle queues and schedulers Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Thu Feb 25 16:39:28 2010 (r204323) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Thu Feb 25 16:40:08 2010 (r204324) @@ -540,6 +540,9 @@ dummynet_task(void *context, int pending transmit_event(&q, (struct delay_line *)p, dn_cfg.curr_time); } } + dn_drain_scheduler(); + dn_drain_queue(); + DN_BH_WUNLOCK(); dn_reschedule(); if (q.head != NULL) @@ -741,7 +744,11 @@ dummynet_io(struct mbuf **m0, int dir, s m = serve_sched(NULL, si, dn_cfg.curr_time); /* optimization -- pass it back to ipfw for immediate send */ - if (dn_cfg.io_fast && m == *m0 && (dir & PROTO_LAYER2) == 0 ) { + /* XXX Don't call dummynet_send() if scheduler return the packet + * just enqueued. This avoid a lock order reversal. + * + */ + if (/*dn_cfg.io_fast &&*/ m == *m0 && (dir & PROTO_LAYER2) == 0 ) { /* fast io */ io_pkt_fast++; if (m->m_nextpkt != NULL) { Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Thu Feb 25 16:39:28 2010 (r204323) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Thu Feb 25 16:40:08 2010 (r204324) @@ -76,16 +76,6 @@ static struct callout dn_timeout; static struct task dn_task; static struct taskqueue *dn_tq = NULL; -/* - * XXX max_qlen is used as a temporary measure to store the - * max size of 'struct dn_queue' plus scheduler-specific extensions. - * This is used to determine how much space is needed on a - * getsockopt() to copy queues up. - * Eventually this h should go away as we only want to copy the - * basic dn_queue. - */ -static int max_qlen = 0; - static void dummynet(void * __unused unused) { @@ -309,6 +299,7 @@ q_new(uintptr_t key, int flags, void *ar q->ni.fid = *(struct ipfw_flow_id *)key; q->fs = fs; q->_si = template->_si; + q->_si->q_count++; if (fs->sched->fp->new_queue) fs->sched->fp->new_queue(q); @@ -330,6 +321,7 @@ dn_delete_queue(struct dn_queue *q, int /* notify the parent scheduler that the queue is going away */ if (fs && fs->sched->fp->free_queue) fs->sched->fp->free_queue(q); + q->_si->q_count--; q->_si = NULL; if (flags & DN_DESTROY) { if (q->mq.head) @@ -576,6 +568,7 @@ fsk_new(uintptr_t key, int flags, void * if (fs) { set_oid(&fs->fs.oid, DN_FS, sizeof(fs->fs)); dn_cfg.fsk_count++; + fs->drain_bucket = 0; SLIST_INSERT_HEAD(&dn_cfg.fsu, fs, sch_chain); } return fs; @@ -707,6 +700,7 @@ schk_new(uintptr_t key, int flags, void SLIST_INIT(&s->fsk_list); /* initialize the hash table or create the single instance */ s->fp = a->fp; /* si_new needs this */ + s->drain_bucket = 0; if (s->sch.flags & DN_HAVE_MASK) { s->siht = dn_ht_init(NULL, s->sch.buckets, offsetof(struct dn_sch_inst, si_next), @@ -796,19 +790,43 @@ copy_obj(char **start, char *end, void * if (o->type == DN_LINK) { /* Adjust burst parameter for link */ struct dn_link *l = (struct dn_link *)*start; + /* XXX marta: check what is meant here, div64 or what */ l->burst = div64(l->burst, 8 * hz); } *start += o->len; return 0; } +/* Specific function to copy a queue. + * It copies only the common part of a queue, and correctly set + * the length + */ +static int +copy_obj_q(char **start, char *end, void *_o, const char *msg, int i) +{ + struct dn_id *o = _o; + int have = end - *start; + int len = sizeof(struct dn_queue); + + if (have < len || o->len == 0 || o->type != DN_QUEUE) { + D("ERROR type %d %s %d have %d need %d", + o->type, msg, i, have, len); + return 1; + } + ND("type %d %s %d len %d", o->type, msg, i, len); + bcopy(_o, *start, len); + ((struct dn_id*)(*start))->len = len; + *start += len; + return 0; +} + static int copy_q_cb(void *obj, void *arg) { struct dn_queue *q = obj; struct copy_args *a = arg; struct dn_flow *ni = (struct dn_flow *)(*a->start); - if (copy_obj(a->start, a->end, &q->ni, "queue", -1)) + if (copy_obj_q(a->start, a->end, &q->ni, "queue", -1)) return DNHT_SCAN_END; ni->oid.type = DN_FLOW; /* override the DN_QUEUE */ ni->oid.id = si_hash((uintptr_t)&ni->fid, 0, NULL); @@ -1679,8 +1697,6 @@ compute_space(struct dn_id *cmd, int *to * - ipfw queue show * (NF * dn_fs) all flowset * (NQ * dn_queue) all queues - * I use 'max_qlen' instead of sizeof(dn_queue) because - * a queue can be of variable size, so use the max queue size. */ switch (cmd->subtype) { default: @@ -1690,7 +1706,7 @@ compute_space(struct dn_id *cmd, int *to x = DN_C_LINK | DN_C_SCH | DN_C_FLOW; need += dn_cfg.schk_count * (sizeof(struct dn_fs) + profile_size) / 2; - need += dn_cfg.si_count * max_qlen; + need += dn_cfg.si_count * sizeof(struct dn_queue); need += dn_cfg.fsk_count * sizeof(uint32_t); break; case DN_SCH: /* sched show */ @@ -1719,7 +1735,7 @@ compute_space(struct dn_id *cmd, int *to } /* XXX queue space might be variable */ if (x & DN_C_QUEUE) - need += dn_cfg.queue_count * max_qlen; + need += dn_cfg.queue_count * sizeof(struct dn_queue); if (x & DN_C_FLOW) need += dn_cfg.si_count * (sizeof(struct dn_flow)); return need; @@ -1836,6 +1852,105 @@ dummynet_get(struct sockopt *sopt, void return error; } +/* Callback called on scheduler instance to delete it if idle */ +static int +drain_scheduler_cb(void *_si, void *arg) +{ + struct dn_sch_inst *si = _si; + + if ((si->kflags & DN_ACTIVE) || si->dline.mq.head != NULL) + return 0; + + if (si->sched->fp->flags & DN_MULTIQUEUE) { + if (si->q_count == 0) + return si_destroy(si, NULL); + else + return 0; + } else { /* !DN_MULTIQUEUE */ + if ((si+1)->ni.length == 0) + return si_destroy(si, NULL); + else + return 0; + } + return 0; /* unreachable */ +} + +/* Callback called on scheduler to check if it has instances */ +static int +drain_scheduler_sch_cb(void *_s, void *arg) +{ + struct dn_schk *s = _s; + + if (s->sch.flags & DN_HAVE_MASK) { + dn_ht_scan_bucket(s->siht, &s->drain_bucket, + drain_scheduler_cb, NULL); + s->drain_bucket++; + } else { + if (s->siht) { + if (drain_scheduler_cb(s->siht, NULL) == DNHT_SCAN_DEL) + s->siht = NULL; + } + } + return 0; +} + +/* Called every tick, try to delete a 'bucket' of scheduler */ +void +dn_drain_scheduler(void) +{ + dn_ht_scan_bucket(dn_cfg.schedhash, &dn_cfg.drain_sch, + drain_scheduler_sch_cb, NULL); + dn_cfg.drain_sch++; +} + +/* Callback called on queue to delete if it is idle */ +static int +drain_queue_cb(void *_q, void *arg) +{ + struct dn_queue *q = _q; + + if (q->ni.length == 0) { + dn_delete_queue(q, DN_DESTROY); + return DNHT_SCAN_DEL; /* queue is deleted */ + } + + return 0; /* queue isn't deleted */ +} + +/* Callback called on flowset used to check if it has queues */ +static int +drain_queue_fs_cb(void *_fs, void *arg) +{ + struct dn_fsk *fs = _fs; + + if (fs->fs.flags & DN_QHT_HASH) { + /* Flowset has a hash table for queues */ + dn_ht_scan_bucket(fs->qht, &fs->drain_bucket, + drain_queue_cb, NULL); + fs->drain_bucket++; + } + else { + /* No hash table for this flowset, null the pointer + * if the queue is deleted + */ + if (fs->qht) { + if (drain_queue_cb(fs->qht, NULL) == DNHT_SCAN_DEL) + fs->qht = NULL; + } + } + return 0; +} + +/* Called every tick, try to delete a 'bucket' of queue */ +void +dn_drain_queue(void) +{ + /* scan a bucket of flowset */ + dn_ht_scan_bucket(dn_cfg.fshash, &dn_cfg.drain_fs, + drain_queue_fs_cb, NULL); + dn_cfg.drain_fs++; +} + /* * Handler for the various dummynet socket options */ @@ -1930,6 +2045,10 @@ ip_dn_init(void) offsetof(struct dn_fsk, fsk_next), fsk_hash, fsk_match, fsk_new); + /* bucket index to drain object */ + dn_cfg.drain_fs = 0; + dn_cfg.drain_sch = 0; + heap_init(&dn_cfg.evheap, 16, offsetof(struct dn_id, id)); SLIST_INIT(&dn_cfg.fsu); SLIST_INIT(&dn_cfg.schedlist); @@ -2000,17 +2119,11 @@ static int load_dn_sched(struct dn_alg *d) { struct dn_alg *s; - int q_len = 0; if (d == NULL) return 1; /* error */ ip_dn_init(); /* just in case, we need the lock */ - /* check the max queue lenght */ - q_len = sizeof(struct dn_queue) + d->q_datalen; - if (max_qlen <= q_len) { - max_qlen = q_len; - } /* Check that mandatory funcs exists */ if (d->enqueue == NULL || d->dequeue == NULL) { D("missing enqueue or dequeue for %s", d->name); From owner-svn-src-user@FreeBSD.ORG Thu Feb 25 20:54:14 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEDD01065673; Thu, 25 Feb 2010 20:54:14 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E4568FC1B; Thu, 25 Feb 2010 20:54:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1PKsEpx009638; Thu, 25 Feb 2010 20:54:14 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1PKsEA1009636; Thu, 25 Feb 2010 20:54:14 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002252054.o1PKsEA1009636@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 25 Feb 2010 20:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204330 - user/luigi/ipfw3-head/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 20:54:14 -0000 Author: luigi Date: Thu Feb 25 20:54:14 2010 New Revision: 204330 URL: http://svn.freebsd.org/changeset/base/204330 Log: print number of active queues Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Thu Feb 25 20:24:19 2010 (r204329) +++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Thu Feb 25 20:54:14 2010 (r204330) @@ -321,9 +321,9 @@ list_pipes(struct dn_id *oid, struct dn_ case DN_SCH: { struct dn_sch *s = (struct dn_sch *)oid; flush_buf(buf); - printf(" sched %d type %s flags 0x%x %d buckets\n", + printf(" sched %d type %s flags 0x%x %d buckets %d active\n", s->sched_nr, - s->name, s->flags, s->buckets); + s->name, s->flags, s->buckets, s->oid.id); if (s->flags & DN_HAVE_MASK) print_mask(&s->sched_mask); } From owner-svn-src-user@FreeBSD.ORG Thu Feb 25 20:54:54 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EACF106566B; Thu, 25 Feb 2010 20:54:54 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4FF8FC0A; Thu, 25 Feb 2010 20:54:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1PKssCc010333; Thu, 25 Feb 2010 20:54:54 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1PKssYK010331; Thu, 25 Feb 2010 20:54:54 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002252054.o1PKssYK010331@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 25 Feb 2010 20:54:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204331 - user/luigi/ipfw3-head/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 20:54:54 -0000 Author: luigi Date: Thu Feb 25 20:54:54 2010 New Revision: 204331 URL: http://svn.freebsd.org/changeset/base/204331 Log: implement 'ipfw sysctl ...' Modified: user/luigi/ipfw3-head/sbin/ipfw/main.c Modified: user/luigi/ipfw3-head/sbin/ipfw/main.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/main.c Thu Feb 25 20:54:14 2010 (r204330) +++ user/luigi/ipfw3-head/sbin/ipfw/main.c Thu Feb 25 20:54:54 2010 (r204331) @@ -230,15 +230,29 @@ ipfw_main(int oldac, char **oldav) co.do_force = !isatty(STDIN_FILENO); #ifdef EMULATE_SYSCTL /* sysctl emulation */ - if ( ac == 3 && !strcmp(av[1], "sysctl")) { - int err = 0; - if (index(av[2], '=') == NULL) { - sysctl_w32(SYSCTLGET, NULL, NULL, 0); + if ( ac >= 2 && !strcmp(av[1], "sysctl")) { + char *s; + int i; + + if (ac != 3) { + printf( "sysctl emulation usage:\n" + " ipfw sysctl name[=value]\n" + " ipfw sysctl -a\n"); + return 0; + } + s = index(av[2], '=')) { + if (s == NULL) { + s = !strcmp(av[2], "-a") ? NULL : av[2]; + sysctlbyname(s, NULL, NULL, NULL, 0); } else { /* ipfw sysctl x.y.z=value */ /* assume an INT value, will extend later */ - int i; - i = strtol(oldav[4], NULL, 10); - sysctl_w32(SYSCTLSET, oldav[2], &i, sizeof(int)); + if (s[1] == '\0') { + printf("ipfw sysctl: missing value\n\n"); + return 0; + } + *s = '\0'; + i = strtol(s+1, NULL, 0); + sysctlbyname(av[2], NULL, NULL, &i, sizeof(int)); } return 0; } From owner-svn-src-user@FreeBSD.ORG Fri Feb 26 07:22:02 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05C6A106564A; Fri, 26 Feb 2010 07:22:02 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E885F8FC15; Fri, 26 Feb 2010 07:22:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1Q7M1us069012; Fri, 26 Feb 2010 07:22:01 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1Q7M13N069008; Fri, 26 Feb 2010 07:22:01 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002260722.o1Q7M13N069008@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 26 Feb 2010 07:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204349 - in user/luigi/ipfw3-head: sbin/ipfw sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2010 07:22:02 -0000 Author: luigi Date: Fri Feb 26 07:22:01 2010 New Revision: 204349 URL: http://svn.freebsd.org/changeset/base/204349 Log: diff reduction Modified: user/luigi/ipfw3-head/sbin/ipfw/main.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Modified: user/luigi/ipfw3-head/sbin/ipfw/main.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/main.c Fri Feb 26 07:08:44 2010 (r204348) +++ user/luigi/ipfw3-head/sbin/ipfw/main.c Fri Feb 26 07:22:01 2010 (r204349) @@ -240,7 +240,7 @@ ipfw_main(int oldac, char **oldav) " ipfw sysctl -a\n"); return 0; } - s = index(av[2], '=')) { + s = index(av[2], '='); if (s == NULL) { s = !strcmp(av[2], "-a") ? NULL : av[2]; sysctlbyname(s, NULL, NULL, NULL, 0); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Fri Feb 26 07:08:44 2010 (r204348) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Fri Feb 26 07:22:01 2010 (r204349) @@ -790,8 +790,13 @@ copy_obj(char **start, char *end, void * if (o->type == DN_LINK) { /* Adjust burst parameter for link */ struct dn_link *l = (struct dn_link *)*start; - /* XXX marta: check what is meant here, div64 or what */ l->burst = div64(l->burst, 8 * hz); + } else if (o->type == DN_SCH) { + /* Set id->id to the number of instances */ + struct dn_schk *s = _o; + struct dn_id *id = (struct dn_id *)(*start); + id->id = (s->sch.flags & DN_HAVE_MASK) ? + dn_ht_entries(s->siht) : (s->siht ? 1 : 0); } *start += o->len; return 0; @@ -964,6 +969,7 @@ copy_data_helper(void *_o, void *_arg) if (copy_obj(a->start, a->end, &s->sch, "sched", s->sch.sched_nr)) return DNHT_SCAN_END; + /* list all attached flowsets */ if (copy_fsk_list(a, s, 0)) return DNHT_SCAN_END; @@ -1600,7 +1606,7 @@ do_config(void *p, int l) * handler and return */ case DN_SYSCTL_SET: - err = kesysctl_set_w32(p); + err = kesysctl_emu_set(p, l); return err; #endif case DN_CMD_CONFIG: /* simply a header */ @@ -1748,9 +1754,9 @@ compute_space(struct dn_id *cmd, int *to int dummynet_get(struct sockopt *sopt, void **compat) { - int have, i, need, error = 0; + int have, i, need, error; char *start = NULL, *buf; - size_t sopt_valsize = 0; + size_t sopt_valsize; struct dn_id cmd; struct copy_args a; @@ -1758,21 +1764,16 @@ dummynet_get(struct sockopt *sopt, void sopt_valsize = sopt->sopt_valsize; if (!compat) { error = sooptcopyin(sopt, &cmd, sizeof(cmd), sizeof(cmd)); -#ifdef EMULATE_SYSCTL - /* sysctl emulation. - * if we recognize the command, jump to the correct - * handler and return - */ - if (cmd.type == DN_SYSCTL_GET) { - //jump to sysctl handler - error = kesysctl_get_w32(sopt); - return error; - } -#endif - sopt->sopt_valsize = sopt_valsize; if (error) return error; + sopt->sopt_valsize = sopt_valsize; +#ifdef EMULATE_SYSCTL + /* sysctl emulation. */ + if (cmd.type == DN_SYSCTL_GET) + return kesysctl_emu_get(sopt); +#endif } else { + error = 0; cmd.type = DN_CMD_GET; cmd.len = sizeof(struct dn_id); cmd.subtype = DN_GET_COMPAT; @@ -1822,8 +1823,8 @@ dummynet_get(struct sockopt *sopt, void sopt->sopt_valsize = sopt_valsize; a.type = cmd.subtype; if (compat == NULL) { - bcopy(&cmd, start, sizeof(cmd)); - buf = start + sizeof(cmd); + bcopy(&cmd, start, sizeof(cmd)); + buf = start + sizeof(cmd); } else buf = start; a.start = &buf; @@ -1843,11 +1844,9 @@ dummynet_get(struct sockopt *sopt, void *compat = start; sopt->sopt_valsize = buf - start; /* free() is done by ip_dummynet_compat() */ - return 0; - } - else { - error = sooptcopyout(sopt, start, buf - start); - free(start, M_DUMMYNET); + } else { + error = sooptcopyout(sopt, start, buf - start); + free(start, M_DUMMYNET); } return error; } Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Fri Feb 26 07:08:44 2010 (r204348) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Fri Feb 26 07:22:01 2010 (r204349) @@ -142,6 +142,9 @@ ipfw_nat_cfg_t *ipfw_nat_get_cfg_ptr; ipfw_nat_cfg_t *ipfw_nat_get_log_ptr; #ifdef SYSCTL_NODE +uint32_t dummy_def = IPFW_DEFAULT_RULE; +uint32_t dummy_tables_max = IPFW_TABLES_MAX; + SYSCTL_NODE(_net_inet_ip, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall"); SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, one_pass, CTLFLAG_RW | CTLFLAG_SECURE3, &VNET_NAME(fw_one_pass), 0, @@ -155,11 +158,9 @@ SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUT SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, verbose_limit, CTLFLAG_RW, &VNET_NAME(verbose_limit), 0, "Set upper limit of matches of ipfw rules logged"); -uint32_t dummy_def = IPFW_DEFAULT_RULE; SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, default_rule, CTLFLAG_RD, &dummy_def, 0, "The default/max possible rule number."); -uint32_t dummy_tables_max = IPFW_TABLES_MAX; SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, tables_max, CTLFLAG_RD, &dummy_tables_max, 0, "The maximum number of tables."); From owner-svn-src-user@FreeBSD.ORG Fri Feb 26 07:22:12 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1405010656A8; Fri, 26 Feb 2010 07:22:08 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E744C8FC12; Fri, 26 Feb 2010 07:22:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1Q7M7bi069085; Fri, 26 Feb 2010 07:22:07 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1Q7M7b6069079; Fri, 26 Feb 2010 07:22:07 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201002260722.o1Q7M7b6069079@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 26 Feb 2010 07:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204350 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2010 07:22:12 -0000 Author: edwin Date: Fri Feb 26 07:22:07 2010 New Revision: 204350 URL: http://svn.freebsd.org/changeset/base/204350 Log: Be able to handle national versions of first, second, third, fourth, fifth and last. Modified: user/edwin/calendar/calendar.1 user/edwin/calendar/calendar.h user/edwin/calendar/io.c user/edwin/calendar/locale.c user/edwin/calendar/parsedata.c Modified: user/edwin/calendar/calendar.1 ============================================================================== --- user/edwin/calendar/calendar.1 Fri Feb 26 07:22:01 2010 (r204349) +++ user/edwin/calendar/calendar.1 Fri Feb 26 07:22:07 2010 (r204350) @@ -112,6 +112,10 @@ To handle calendars in your national cod .Dq LANG= in the calendar file as early as possible. .Pp +To handle the local name of sequences, you can specify them as: +.Dq SEQUENCE= +in the calendar file as early as possible. +.Pp The names of the following special days are recognized: .Bl -tag -width 123456789012345 -compact .It Easter Modified: user/edwin/calendar/calendar.h ============================================================================== --- user/edwin/calendar/calendar.h Fri Feb 26 07:22:01 2010 (r204349) +++ user/edwin/calendar/calendar.h Fri Feb 26 07:22:07 2010 (r204350) @@ -146,16 +146,19 @@ struct fixs { int len; }; +extern const char *days[]; +extern const char *fdays[]; +extern const char *fmonths[]; +extern const char *months[]; +extern const char *sequences[]; extern struct fixs fndays[8]; /* full national days names */ -extern struct fixs ndays[8]; /* short national days names */ extern struct fixs fnmonths[13]; /* full national months names */ +extern struct fixs ndays[8]; /* short national days names */ extern struct fixs nmonths[13]; /* short national month names */ -extern const char *months[]; -extern const char *fmonths[]; -extern const char *days[]; -extern const char *fdays[]; +extern struct fixs nsequences[10]; void setnnames(void); +void setnsequences(char *); /* day.c */ extern const struct tm tm0; Modified: user/edwin/calendar/io.c ============================================================================== --- user/edwin/calendar/io.c Fri Feb 26 07:22:01 2010 (r204349) +++ user/edwin/calendar/io.c Fri Feb 26 07:22:07 2010 (r204350) @@ -152,6 +152,10 @@ cal(void) REPLACE("SepEquinox=", 11, nsepequinox); REPLACE("JunSolstice=", 12, njunsolstice); REPLACE("DecSolstice=", 12, ndecsolstice); + if (strncmp(buf, "SEQUENCE=", 9) == 0) { + setnsequences(buf + 9); + continue; + } /* * If the line starts with a tab, the data has to be Modified: user/edwin/calendar/locale.c ============================================================================== --- user/edwin/calendar/locale.c Fri Feb 26 07:22:01 2010 (r204349) +++ user/edwin/calendar/locale.c Fri Feb 26 07:22:07 2010 (r204350) @@ -62,10 +62,15 @@ const char *months[] = { "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL, }; +const char *sequences[] = { + "First", "Second", "Third", "Fourth", "Fifth", "Last" +}; + struct fixs fndays[8]; /* full national days names */ struct fixs ndays[8]; /* short national days names */ struct fixs fnmonths[13]; /* full national months names */ struct fixs nmonths[13]; /* short national month names */ +struct fixs nsequences[10]; /* national sequence names */ void @@ -129,3 +134,35 @@ setnnames(void) fnmonths[i].len = strlen(buf); } } + +void +setnsequences(char *seq) +{ + int i; + char *p; + + p = seq; + for (i = 0; i < 5; i++) { + nsequences[i].name = p; + if ((p = strchr(p, ' ')) == NULL) { + for (i = 0; i < 5; i++) { + nsequences[i].name = NULL; + nsequences[i].len = -1; + return; + } + + } + *p = '\0'; + p++; + } + nsequences[i].name = p; + + for (i = 0; i < 5; i++) { + nsequences[i].name = strdup(nsequences[i].name); + nsequences[i].len = nsequences[i + 1].name - nsequences[i].name; + } + nsequences[i].name = strdup(nsequences[i].name); + nsequences[i].len = strlen(nsequences[i].name); + + return; +} Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Fri Feb 26 07:22:01 2010 (r204349) +++ user/edwin/calendar/parsedata.c Fri Feb 26 07:22:07 2010 (r204350) @@ -880,18 +880,26 @@ isonlydigits(char *s, int nostar) static int indextooffset(char *s) { - if (strcasecmp(s, "first") == 0) - return (1); - if (strcasecmp(s, "second") == 0) - return (2); - if (strcasecmp(s, "third") == 0) - return (3); - if (strcasecmp(s, "fourth") == 0) - return (4); - if (strcasecmp(s, "fifth") == 0) - return (5); - if (strcasecmp(s, "last") == 0) - return (-1); + int i; + struct fixs *n; + + for (i = 0; i < 6; i++) { + if (strcasecmp(s, sequences[i]) == 0) { + if (i == 5) + return (-1); + return (i + 1); + } + } + for (i = 0; i < 6; i++) { + n = nsequences + i; + if (n->len == -1) + continue; + if (strncasecmp(s, n->name, n->len) == 0) { + if (i == 5) + return (-1); + return (i + 1); + } + } return (0); } From owner-svn-src-user@FreeBSD.ORG Fri Feb 26 12:40:02 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03E83106564A; Fri, 26 Feb 2010 12:40:02 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E61308FC0C; Fri, 26 Feb 2010 12:40:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1QCe1AY041202; Fri, 26 Feb 2010 12:40:01 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1QCe1Zm041194; Fri, 26 Feb 2010 12:40:01 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002261240.o1QCe1Zm041194@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 26 Feb 2010 12:40:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204357 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2010 12:40:02 -0000 Author: luigi Date: Fri Feb 26 12:40:01 2010 New Revision: 204357 URL: http://svn.freebsd.org/changeset/base/204357 Log: diff reduction Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Fri Feb 26 12:31:16 2010 (r204356) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_heap.c Fri Feb 26 12:40:01 2010 (r204357) @@ -316,7 +316,7 @@ heap_free(struct dn_heap *h) */ struct dn_ht { - int buckets; /* how many buckets */ + int buckets; /* how many buckets, really buckets - 1*/ int entries; /* how many entries */ int ofs; /* offset of link field */ uint32_t (*hash)(uintptr_t, int, void *arg); @@ -338,13 +338,52 @@ dn_ht_init(struct dn_ht *ht, int buckets { int l; - // printf("%s buckets %d ofs %d\n", __FUNCTION__, buckets, ofs); + /* + * Notes about rounding bucket size to a power of two. + * Given the original bucket size, we compute the nearest lower and + * higher power of two, minus 1 (respectively b_min and b_max) because + * this value will be used to do an AND with the index returned + * by hash function. + * To choice between these two values, the original bucket size is + * compared with b_min. If the original size is greater than 4/3 b_min, + * we round the bucket size to b_max, else to b_min. + * This ratio try to round to the nearest power of two, advantaging + * the greater size if the different between two power is relatively + * big. + * Rounding the bucket size to a power of two avoid the use of + * module when calculating the correct bucket. + * The ht->buckets variable store the bucket size - 1 to simply + * do an AND between the index returned by hash function and ht->bucket + * instead of a module. + */ + int b_min; /* min buckets */ + int b_max; /* max buckets */ + int b_ori; /* original buckets */ + if (h == NULL || match == NULL) { printf("--- missing hash or match function"); return NULL; } if (buckets < 1 || buckets > 65536) return NULL; + + b_ori = buckets; + /* calculate next power of 2, - 1*/ + buckets |= buckets >> 1; + buckets |= buckets >> 2; + buckets |= buckets >> 4; + buckets |= buckets >> 8; + buckets |= buckets >> 16; + + b_max = buckets; /* Next power */ + b_min = buckets >> 1; /* Previous power */ + + /* Calculate the 'nearest' bucket size */ + if (b_min * 4000 / 3000 < b_ori) + buckets = b_max; + else + buckets = b_min; + if (ht) { /* see if we can reuse */ if (buckets <= ht->buckets) { ht->buckets = buckets; @@ -357,7 +396,10 @@ dn_ht_init(struct dn_ht *ht, int buckets } } if (ht == NULL) { - l = sizeof(*ht) + buckets * sizeof(void **); + /* Allocate buckets + 1 entries because buckets is use to + * do the AND with the index returned by hash function + */ + l = sizeof(*ht) + (buckets + 1) * sizeof(void **); ht = malloc(l, M_DN_HEAP, M_NOWAIT | M_ZERO); } if (ht) { @@ -408,9 +450,8 @@ dn_ht_find(struct dn_ht *ht, uintptr_t k if (ht == NULL) /* easy on an empty hash */ return NULL; i = (ht->buckets == 1) ? 0 : - (ht->hash(key, flags, arg) % ht->buckets); - // printf("%s key %p in bucket %d entries %d\n", - // __FUNCTION__, (void *)key, i, ht->entries); + (ht->hash(key, flags, arg) & ht->buckets); + for (pp = &ht->ht[i]; (p = *pp); pp = (void **)((char *)p + ht->ofs)) { if (flags & DNHT_MATCH_PTR) { if (key == (uintptr_t)p) @@ -449,16 +490,14 @@ dn_ht_scan(struct dn_ht *ht, int (*fn)(v int i, ret, found = 0; void **curp, *cur, *next; - // printf("%p ht %p fn %p\n", __FUNCTION__, ht, fn); if (ht == NULL || fn == NULL) return 0; - for (i = 0; i < ht->buckets; i++) { + for (i = 0; i <= ht->buckets; i++) { curp = &ht->ht[i]; while ( (cur = *curp) != NULL) { next = *(void **)((char *)cur + ht->ofs); ret = fn(cur, arg); if (ret & DNHT_SCAN_DEL) { - // printf("element %p removed\n", cur); found++; ht->entries--; *curp = next; @@ -486,7 +525,7 @@ dn_ht_scan_bucket(struct dn_ht *ht, int if (ht == NULL || fn == NULL) return 0; - if (*bucket >= ht->buckets) + if (*bucket > ht->buckets) *bucket = 0; i = *bucket; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Fri Feb 26 12:31:16 2010 (r204356) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Fri Feb 26 12:40:01 2010 (r204357) @@ -58,7 +58,7 @@ typedef unsigned long bitmap; * and the bitmap ops. Some machines have ffs */ #if defined(_WIN32) -static int fls(unsigned long n) +int fls(unsigned int n) { int i = 0; for (i = 0; n > 0; n >>= 1, i++) Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Fri Feb 26 12:31:16 2010 (r204356) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Fri Feb 26 12:40:01 2010 (r204357) @@ -93,6 +93,9 @@ MALLOC_DEFINE(M_DUMMYNET, "dummynet", "d extern void (*bridge_dn_p)(struct mbuf *, struct ifnet *); #ifdef SYSCTL_NODE + +SYSBEGIN(f4) + SYSCTL_DECL(_net_inet); SYSCTL_DECL(_net_inet_ip); SYSCTL_NODE(_net_inet_ip, OID_AUTO, dummynet, CTLFLAG_RW, 0, "Dummynet"); @@ -151,6 +154,9 @@ SYSCTL_ULONG(_net_inet_ip_dummynet, OID_ SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_drop, CTLFLAG_RD, &io_pkt_drop, 0, "Number of packets dropped by dummynet."); + +SYSEND + #endif static void dummynet_send(struct mbuf *); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Fri Feb 26 12:31:16 2010 (r204356) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Fri Feb 26 12:40:01 2010 (r204357) @@ -145,6 +145,8 @@ ipfw_nat_cfg_t *ipfw_nat_get_log_ptr; uint32_t dummy_def = IPFW_DEFAULT_RULE; uint32_t dummy_tables_max = IPFW_TABLES_MAX; +SYSBEGIN(f3) + SYSCTL_NODE(_net_inet_ip, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall"); SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, one_pass, CTLFLAG_RW | CTLFLAG_SECURE3, &VNET_NAME(fw_one_pass), 0, @@ -180,6 +182,8 @@ SYSCTL_VNET_INT(_net_inet6_ip6_fw, OID_A "Deny packets with unknown IPv6 Extension Headers"); #endif /* INET6 */ +SYSEND + #endif /* SYSCTL_NODE */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c Fri Feb 26 12:31:16 2010 (r204356) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c Fri Feb 26 12:40:01 2010 (r204357) @@ -187,6 +187,9 @@ static VNET_DEFINE(u_int32_t, dyn_max); #define V_dyn_max VNET(dyn_max) #ifdef SYSCTL_NODE + +SYSBEGIN(f2) + SYSCTL_DECL(_net_inet_ip_fw); SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, dyn_buckets, CTLFLAG_RW, &VNET_NAME(dyn_buckets), 0, @@ -221,6 +224,9 @@ SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUT SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, dyn_keepalive, CTLFLAG_RW, &VNET_NAME(dyn_keepalive), 0, "Enable keepalives for dyn. rules"); + +SYSEND + #endif /* SYSCTL_NODE */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Fri Feb 26 12:31:16 2010 (r204356) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Fri Feb 26 12:40:01 2010 (r204357) @@ -77,6 +77,9 @@ int ipfw_chg_hook(SYSCTL_HANDLER_ARGS); static int ipfw_divert(struct mbuf **, int, struct ipfw_rule_ref *, int); #ifdef SYSCTL_NODE + +SYSBEGIN(f1) + SYSCTL_DECL(_net_inet_ip_fw); SYSCTL_VNET_PROC(_net_inet_ip_fw, OID_AUTO, enable, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE3, &VNET_NAME(fw_enable), 0, @@ -87,6 +90,9 @@ SYSCTL_VNET_PROC(_net_inet6_ip6_fw, OID_ CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE3, &VNET_NAME(fw6_enable), 0, ipfw_chg_hook, "I", "Enable ipfw+6"); #endif /* INET6 */ + +SYSEND + #endif /* SYSCTL_NODE */ /* @@ -94,7 +100,7 @@ SYSCTL_VNET_PROC(_net_inet6_ip6_fw, OID_ * dummynet, divert, netgraph or other modules. * The packet may be consumed. */ -static int +int ipfw_check_hook(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir, struct inpcb *inp) { Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Fri Feb 26 12:31:16 2010 (r204356) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Fri Feb 26 12:40:01 2010 (r204357) @@ -35,6 +35,12 @@ #ifdef _KERNEL +/* + * For platforms that do not have SYSCTL support, we wrap the + * SYSCTL_* into a function (one per file) to collect the values + * into an array at module initialization. The wrapping macros, + * SYSBEGIN() and SYSEND, are empty in the default case. + */ #ifndef SYSBEGIN #define SYSBEGIN(x) #endif @@ -126,8 +132,12 @@ enum { /* wrapper for freeing a packet, in case we need to do more work */ #ifndef FREE_PKT +#if defined(__linux__) || defined(_WIN32) +#define FREE_PKT(m) netisr_dispatch(-1, m) +#else #define FREE_PKT(m) m_freem(m) #endif +#endif /* !FREE_PKT */ /* * Function definitions. @@ -253,6 +263,10 @@ int ipfw_ctl(struct sockopt *sopt); int ipfw_chk(struct ip_fw_args *args); void ipfw_reap_rules(struct ip_fw *head); +/* In ip_fw_pfil */ +int ipfw_check_hook(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir, + struct inpcb *inp); + /* In ip_fw_table.c */ struct radix_node; int ipfw_lookup_table(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 00:37:06 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAC3C106566C; Sat, 27 Feb 2010 00:37:06 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B08A78FC15; Sat, 27 Feb 2010 00:37:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R0b6Ug000538; Sat, 27 Feb 2010 00:37:06 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R0b6En000537; Sat, 27 Feb 2010 00:37:06 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270037.o1R0b6En000537@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 00:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204380 - user/jmallett X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 00:37:06 -0000 Author: jmallett Date: Sat Feb 27 00:37:06 2010 New Revision: 204380 URL: http://svn.freebsd.org/changeset/base/204380 Log: Branch for my Cavium Octeon work. Added: user/jmallett/ - copied from r204379, head/ Directory Properties: user/jmallett/octeon/ (props changed) From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 01:16:35 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26DFF1065672; Sat, 27 Feb 2010 01:16:35 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1677A8FC1E; Sat, 27 Feb 2010 01:16:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R1GYJQ009212; Sat, 27 Feb 2010 01:16:34 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R1GY7O009210; Sat, 27 Feb 2010 01:16:34 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270116.o1R1GY7O009210@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 01:16:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204381 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 01:16:35 -0000 Author: jmallett Date: Sat Feb 27 01:16:34 2010 New Revision: 204381 URL: http://svn.freebsd.org/changeset/base/204381 Log: Temporarily disable RGMII. Adjust CF root. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Feb 27 00:37:06 2010 (r204380) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Feb 27 01:16:34 2010 (r204381) @@ -67,14 +67,14 @@ device ether device md device uart nodevice uart_ns8250 -device rgmii +#device rgmii #options VERBOSE_SYSINIT # # Use the following for Compact Flash file-system device cf -options ROOTDEVNAME = \"ufs:cf0s2a\" # Unmask if compact flash is needed as RFS +options ROOTDEVNAME=\"ufs:cf0s1\" # # Use the following for RFS in mem-device From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 01:17:24 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62E2B1065676; Sat, 27 Feb 2010 01:17:24 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 527E48FC17; Sat, 27 Feb 2010 01:17:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R1HOwS009450; Sat, 27 Feb 2010 01:17:24 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R1HOHP009448; Sat, 27 Feb 2010 01:17:24 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270117.o1R1HOHP009448@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 01:17:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204382 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 01:17:24 -0000 Author: jmallett Date: Sat Feb 27 01:17:24 2010 New Revision: 204382 URL: http://svn.freebsd.org/changeset/base/204382 Log: Fix octeon_board_real() for the Portwell CAM-0100 on my desk. Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c Sat Feb 27 01:16:34 2010 (r204381) +++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c Sat Feb 27 01:17:24 2010 (r204382) @@ -873,8 +873,9 @@ int octeon_chip_rev_major = 0, octeon_ch static octeon_boot_descriptor_t *app_desc_ptr; static cvmx_bootinfo_t *cvmx_desc_ptr; -#define OCTEON_BOARD_TYPE_NONE 0 -#define OCTEON_BOARD_TYPE_SIM 1 +#define OCTEON_BOARD_TYPE_NONE 0 +#define OCTEON_BOARD_TYPE_SIM 1 +#define OCTEON_BOARD_TYPE_CN3010_EVB_HS5 11 #define OCTEON_CLOCK_MIN (100 * 1000 * 1000) #define OCTEON_CLOCK_MAX (800 * 1000 * 1000) @@ -886,11 +887,23 @@ static cvmx_bootinfo_t *cvmx_desc_ptr; int octeon_board_real(void) { - if ((octeon_board_type == OCTEON_BOARD_TYPE_NONE) || - (octeon_board_type == OCTEON_BOARD_TYPE_SIM) || - !octeon_board_rev_major) + switch (octeon_board_type) { + case OCTEON_BOARD_TYPE_NONE: + case OCTEON_BOARD_TYPE_SIM: return 0; - return 1; + case OCTEON_BOARD_TYPE_CN3010_EVB_HS5: + /* + * XXX + * The CAM-0100 identifies itself as type 11, revision 0.0, + * despite its being rather real. Disable the revision check + * for type 11. + */ + return 1; + default: + if (octeon_board_rev_major == 0) + return 0; + return 1; + } } static void From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 03:29:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED5401065670; Sat, 27 Feb 2010 03:29:28 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2AFB8FC15; Sat, 27 Feb 2010 03:29:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R3TS4N038737; Sat, 27 Feb 2010 03:29:28 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R3TSFb038733; Sat, 27 Feb 2010 03:29:28 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270329.o1R3TSFb038733@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 03:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204386 - user/jmallett/octeon/gnu/usr.bin/binutils/ld X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 03:29:29 -0000 Author: jmallett Date: Sat Feb 27 03:29:28 2010 New Revision: 204386 URL: http://svn.freebsd.org/changeset/base/204386 Log: Build n32 emulations. Added: user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh (contents, props changed) user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh (contents, props changed) Modified: user/jmallett/octeon/gnu/usr.bin/binutils/ld/Makefile.mips Modified: user/jmallett/octeon/gnu/usr.bin/binutils/ld/Makefile.mips ============================================================================== --- user/jmallett/octeon/gnu/usr.bin/binutils/ld/Makefile.mips Sat Feb 27 02:20:38 2010 (r204385) +++ user/jmallett/octeon/gnu/usr.bin/binutils/ld/Makefile.mips Sat Feb 27 03:29:28 2010 (r204386) @@ -10,7 +10,9 @@ NATIVE_EMULATION=elf${_sz}btsmip_fbsd NATIVE_EMULATION=elf${_sz}ltsmip_fbsd .endif -MIPS_ABIS=elf32btsmip_fbsd elf32ltsmip_fbsd elf64btsmip_fbsd elf64ltsmip_fbsd +MIPS_ABIS+=elf32btsmip_fbsd elf32ltsmip_fbsd +MIPS_ABIS+=elf32btsmipn32_fbsd elf32ltsmipn32_fbsd +MIPS_ABIS+=elf64btsmip_fbsd elf64ltsmip_fbsd .for abi in ${MIPS_ABIS} #.if (${abi} != ${NATIVE_EMULATION}) EMS+= ${abi} Added: user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh Sat Feb 27 03:29:28 2010 (r204386) @@ -0,0 +1,4 @@ +# $FreeBSD: head/gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh 185923 2008-12-11 08:18:45Z imp $ +. ${srcdir}/emulparams/elf32btsmipn32.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Added: user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh Sat Feb 27 03:29:28 2010 (r204386) @@ -0,0 +1,4 @@ +# $FreeBSD: head/gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh 185923 2008-12-11 08:18:45Z imp $ +. ${srcdir}/emulparams/elf32ltsmipn32.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 03:30:19 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D5971065677; Sat, 27 Feb 2010 03:30:19 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D8108FC2D; Sat, 27 Feb 2010 03:30:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R3UJAk038946; Sat, 27 Feb 2010 03:30:19 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R3UJkV038943; Sat, 27 Feb 2010 03:30:19 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270330.o1R3UJkV038943@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 03:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204387 - user/jmallett/octeon/sys/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 03:30:19 -0000 Author: jmallett Date: Sat Feb 27 03:30:19 2010 New Revision: 204387 URL: http://svn.freebsd.org/changeset/base/204387 Log: Actually link at KERNLOADADDR in n32 and n64 (or is tht o64?) binaries. Modified: user/jmallett/octeon/sys/conf/ldscript.mips.octeon1.64 user/jmallett/octeon/sys/conf/ldscript.mips.octeon1.n32 Modified: user/jmallett/octeon/sys/conf/ldscript.mips.octeon1.64 ============================================================================== --- user/jmallett/octeon/sys/conf/ldscript.mips.octeon1.64 Sat Feb 27 03:29:28 2010 (r204386) +++ user/jmallett/octeon/sys/conf/ldscript.mips.octeon1.64 Sat Feb 27 03:30:19 2010 (r204387) @@ -10,6 +10,7 @@ PHDRS { } SECTIONS { + . = KERNLOADADDR + SIZEOF_HEADERS; .text _start : { *(.text) Modified: user/jmallett/octeon/sys/conf/ldscript.mips.octeon1.n32 ============================================================================== --- user/jmallett/octeon/sys/conf/ldscript.mips.octeon1.n32 Sat Feb 27 03:29:28 2010 (r204386) +++ user/jmallett/octeon/sys/conf/ldscript.mips.octeon1.n32 Sat Feb 27 03:30:19 2010 (r204387) @@ -6,6 +6,7 @@ ENTRY(_start) PROVIDE (_DYNAMIC = 0); SECTIONS { + . = KERNLOADADDR + SIZEOF_HEADERS; .text . : { *(.text) From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 03:30:48 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F683106566B; Sat, 27 Feb 2010 03:30:48 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F42B8FC19; Sat, 27 Feb 2010 03:30:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R3UmOG039079; Sat, 27 Feb 2010 03:30:48 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R3UmCo039077; Sat, 27 Feb 2010 03:30:48 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270330.o1R3UmCo039077@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 03:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204388 - user/jmallett/octeon/sys/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 03:30:48 -0000 Author: jmallett Date: Sat Feb 27 03:30:48 2010 New Revision: 204388 URL: http://svn.freebsd.org/changeset/base/204388 Log: Specify n32 emulation if TARGET_N32 is set. Modified: user/jmallett/octeon/sys/conf/Makefile.mips Modified: user/jmallett/octeon/sys/conf/Makefile.mips ============================================================================== --- user/jmallett/octeon/sys/conf/Makefile.mips Sat Feb 27 03:30:19 2010 (r204387) +++ user/jmallett/octeon/sys/conf/Makefile.mips Sat Feb 27 03:30:48 2010 (r204388) @@ -58,6 +58,10 @@ HACK_EXTRA_FLAGS+=-EB -Wl,-EB SYSTEM_LD+=-m elf64btsmip_fbsd HACK_EXTRA_FLAGS+=-Wl,-m,elf64btsmip_fbsd .endif +.if defined(TARGET_N32) +SYSTEM_LD+=-m elf32btsmipn32_fbsd +HACK_EXTRA_FLAGS+=-Wl,-m,elf32btsmipn32_fbsd +.endif .else CFLAGS+=-EL SYSTEM_LD+=-EL @@ -68,6 +72,10 @@ HACK_EXTRA_FLAGS+=-EL -Wl,-EL SYSTEM_LD+=-m elf64ltsmip_fbsd HACK_EXTRA_FLAGS+=-Wl,-m,elf64ltsmip_fbsd .endif +.if defined(TARGET_N32) +SYSTEM_LD+=-m elf32ltsmipn32_fbsd +HACK_EXTRA_FLAGS+=-Wl,-m,elf32ltsmipn32_fbsd +.endif .endif From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 03:33:32 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21A55106566C; Sat, 27 Feb 2010 03:33:32 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 114978FC2E; Sat, 27 Feb 2010 03:33:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R3XVEI039723; Sat, 27 Feb 2010 03:33:31 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R3XVJb039720; Sat, 27 Feb 2010 03:33:31 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270333.o1R3XVJb039720@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 03:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204389 - in user/jmallett/octeon/sys/mips: include mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 03:33:32 -0000 Author: jmallett Date: Sat Feb 27 03:33:31 2010 New Revision: 204389 URL: http://svn.freebsd.org/changeset/base/204389 Log: Check for __mips_n32, not ISA_MIPS32, on Octeon to tell whether we have longer-than-pointer bus addresses. It's the ABI that matters (or at least it's more like the ABI than the ISA that matters.) Modified: user/jmallett/octeon/sys/mips/include/_bus.h user/jmallett/octeon/sys/mips/mips/bus_space_generic.c Modified: user/jmallett/octeon/sys/mips/include/_bus.h ============================================================================== --- user/jmallett/octeon/sys/mips/include/_bus.h Sat Feb 27 03:30:48 2010 (r204388) +++ user/jmallett/octeon/sys/mips/include/_bus.h Sat Feb 27 03:33:31 2010 (r204389) @@ -35,10 +35,10 @@ * Bus address and size types */ #include "opt_cputype.h" -#if !(defined(TARGET_OCTEON) && defined(ISA_MIPS32)) -typedef uintptr_t bus_addr_t; -#else +#if defined(TARGET_OCTEON) && defined(__mips_n32) typedef uint64_t bus_addr_t; +#else +typedef uintptr_t bus_addr_t; #endif typedef uintptr_t bus_size_t; Modified: user/jmallett/octeon/sys/mips/mips/bus_space_generic.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/bus_space_generic.c Sat Feb 27 03:30:48 2010 (r204388) +++ user/jmallett/octeon/sys/mips/mips/bus_space_generic.c Sat Feb 27 03:33:31 2010 (r204389) @@ -198,7 +198,7 @@ static struct bus_space generic_space = /* Ultra-gross kludge */ #include "opt_cputype.h" -#if defined(TARGET_OCTEON) && defined(ISA_MIPS32) +#if defined(TARGET_OCTEON) && defined(__mips_n32) #include #define rd8(a) oct_read8(a) #define rd16(a) oct_read16(a) From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 03:35:35 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28CFB106566C; Sat, 27 Feb 2010 03:35:35 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F25498FC0A; Sat, 27 Feb 2010 03:35:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R3ZYLt040213; Sat, 27 Feb 2010 03:35:34 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R3ZYFV040211; Sat, 27 Feb 2010 03:35:34 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270335.o1R3ZYFV040211@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 03:35:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204390 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 03:35:35 -0000 Author: jmallett Date: Sat Feb 27 03:35:34 2010 New Revision: 204390 URL: http://svn.freebsd.org/changeset/base/204390 Log: Fix casts for n32 and add a comment as to why this code can't really work as intended with a true o32 kernel. Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Sat Feb 27 03:33:31 2010 (r204389) +++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Sat Feb 27 03:35:34 2010 (r204390) @@ -94,19 +94,19 @@ extern struct pcpu *cpuid_to_pcpu[]; static inline void oct_write64 (uint64_t csr_addr, uint64_t val64) { - uint64_t *ptr = (uint64_t *) csr_addr; + uint64_t *ptr = (uint64_t *)(intptr_t)csr_addr; *ptr = val64; } static inline void oct_write64_int64 (uint64_t csr_addr, int64_t val64i) { - int64_t *ptr = (int64_t *) csr_addr; + int64_t *ptr = (int64_t *)(intptr_t)csr_addr; *ptr = val64i; } static inline void oct_write8_x8 (uint64_t csr_addr, uint8_t val8) { - uint64_t *ptr = (uint64_t *) csr_addr; + uint64_t *ptr = (uint64_t *)(intptr_t)csr_addr; *ptr = (uint64_t) val8; } @@ -127,32 +127,32 @@ static inline void oct_write32 (uint64_t static inline uint8_t oct_read8 (uint64_t csr_addr) { - uint8_t *ptr = (uint8_t *) csr_addr; + uint8_t *ptr = (uint8_t *)(intptr_t)csr_addr; return (*ptr); } static inline uint8_t oct_read16 (uint64_t csr_addr) { - uint16_t *ptr = (uint16_t *) csr_addr; + uint16_t *ptr = (uint16_t *)(intptr_t)csr_addr; return (*ptr); } static inline uint32_t oct_read32 (uint64_t csr_addr) { - uint32_t *ptr = (uint32_t *) csr_addr; + uint32_t *ptr = (uint32_t *)(intptr_t)csr_addr; return (*ptr); } static inline uint64_t oct_read64 (uint64_t csr_addr) { - uint64_t *ptr = (uint64_t *) csr_addr; + uint64_t *ptr = (uint64_t *)(intptr_t)csr_addr; return (*ptr); } static inline int32_t oct_readint32 (uint64_t csr_addr) { - int32_t *ptr = (int32_t *) csr_addr; + int32_t *ptr = (int32_t *)(intptr_t)csr_addr; return (*ptr); } @@ -161,6 +161,14 @@ static inline int32_t oct_readint32 (uin #else +/* + * XXX + * These cannot possibly work unless the exception handlers in an o32 kernel + * are careful to not trash the upper 32 bits of saved/restored registers, or + * actually save and restore them as 64-bit quantities, which seems possible + * but is quite ugly. + */ + /* ABI o32 */ From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 03:38:39 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63EA91065701; Sat, 27 Feb 2010 03:38:39 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51BF48FC12; Sat, 27 Feb 2010 03:38:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R3cdKH040960; Sat, 27 Feb 2010 03:38:39 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R3cd04040906; Sat, 27 Feb 2010 03:38:39 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270338.o1R3cd04040906@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 03:38:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204391 - in user/jmallett/octeon/sys: ddb mips/mips ufs/ffs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 03:38:39 -0000 Author: jmallett Date: Sat Feb 27 03:38:38 2010 New Revision: 204391 URL: http://svn.freebsd.org/changeset/base/204391 Log: Make ddb commands take an address as an intptr_t, not a db_expr_t. It is possible to have 32-bit pointers and 64-bit registers and thus a 64-bit db_expr_t. Likewise make casts between pointers and register_t go through intptr_t to be sure to sign extend properly, since register_t may be larger. Modified: user/jmallett/octeon/sys/ddb/db_break.c user/jmallett/octeon/sys/ddb/db_capture.c user/jmallett/octeon/sys/ddb/db_command.c user/jmallett/octeon/sys/ddb/db_examine.c user/jmallett/octeon/sys/ddb/db_main.c user/jmallett/octeon/sys/ddb/db_print.c user/jmallett/octeon/sys/ddb/db_ps.c user/jmallett/octeon/sys/ddb/db_run.c user/jmallett/octeon/sys/ddb/db_script.c user/jmallett/octeon/sys/ddb/db_sym.c user/jmallett/octeon/sys/ddb/db_textdump.c user/jmallett/octeon/sys/ddb/db_thread.c user/jmallett/octeon/sys/ddb/db_variables.c user/jmallett/octeon/sys/ddb/db_watch.c user/jmallett/octeon/sys/ddb/db_write_cmd.c user/jmallett/octeon/sys/ddb/ddb.h user/jmallett/octeon/sys/mips/mips/db_interface.c user/jmallett/octeon/sys/mips/mips/db_trace.c user/jmallett/octeon/sys/mips/mips/pm_machdep.c user/jmallett/octeon/sys/mips/mips/stack_machdep.c user/jmallett/octeon/sys/mips/mips/trap.c user/jmallett/octeon/sys/mips/mips/vm_machdep.c user/jmallett/octeon/sys/ufs/ffs/ffs_softdep.c Modified: user/jmallett/octeon/sys/ddb/db_break.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_break.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_break.c Sat Feb 27 03:38:38 2010 (r204391) @@ -281,7 +281,7 @@ db_list_breakpoints() /*ARGSUSED*/ void db_delete_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -293,7 +293,7 @@ db_delete_cmd(addr, have_addr, count, mo /*ARGSUSED*/ void db_breakpoint_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -307,7 +307,7 @@ db_breakpoint_cmd(addr, have_addr, count /* list breakpoints */ void db_listbreak_cmd(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; + intptr_t dummy1; boolean_t dummy2; db_expr_t dummy3; char * dummy4; Modified: user/jmallett/octeon/sys/ddb/db_capture.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_capture.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_capture.c Sat Feb 27 03:38:38 2010 (r204391) @@ -331,7 +331,7 @@ db_capture_usage(void) } void -db_capture_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, +db_capture_cmd(intptr_t addr, boolean_t have_addr, db_expr_t count, char *modif) { int t; Modified: user/jmallett/octeon/sys/ddb/db_command.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_command.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_command.c Sat Feb 27 03:38:38 2010 (r204391) @@ -539,7 +539,7 @@ typedef db_expr_t __db_f(db_expr_t, db_e static __inline int db_fncall_generic(db_expr_t addr, db_expr_t *rv, int nargs, db_expr_t args[]) { - __db_f *f = (__db_f *)addr; + __db_f *f = (__db_f *)(intptr_t)addr; if (nargs > 10) { db_printf("Too many arguments (max 10)\n"); @@ -552,7 +552,7 @@ db_fncall_generic(db_expr_t addr, db_exp static void db_fncall(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; + intptr_t dummy1; boolean_t dummy2; db_expr_t dummy3; char * dummy4; @@ -602,7 +602,7 @@ db_fncall(dummy1, dummy2, dummy3, dummy4 } static void -db_halt(db_expr_t dummy, boolean_t dummy2, db_expr_t dummy3, char *dummy4) +db_halt(intptr_t dummy, boolean_t dummy2, db_expr_t dummy3, char *dummy4) { cpu_halt(); @@ -610,7 +610,7 @@ db_halt(db_expr_t dummy, boolean_t dummy static void db_kill(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; + intptr_t dummy1; boolean_t dummy2; db_expr_t dummy3; char * dummy4; @@ -663,7 +663,7 @@ out: static void db_reset(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; + intptr_t dummy1; boolean_t dummy2; db_expr_t dummy3; char * dummy4; @@ -674,7 +674,7 @@ db_reset(dummy1, dummy2, dummy3, dummy4) static void db_watchdog(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; + intptr_t dummy1; boolean_t dummy2; db_expr_t dummy3; char * dummy4; @@ -691,7 +691,7 @@ db_watchdog(dummy1, dummy2, dummy3, dumm } static void -db_gdb(db_expr_t dummy1, boolean_t dummy2, db_expr_t dummy3, char *dummy4) +db_gdb(intptr_t dummy1, boolean_t dummy2, db_expr_t dummy3, char *dummy4) { if (kdb_dbbe_select("gdb") != 0) @@ -701,9 +701,11 @@ db_gdb(db_expr_t dummy1, boolean_t dummy } static void -db_stack_trace(db_expr_t tid, boolean_t hastid, db_expr_t count, char *modif) +db_stack_trace(intptr_t addr, boolean_t hasaddr, db_expr_t count, char *modif) { struct thread *td; + boolean_t hastid; + db_expr_t tid; db_expr_t radix; pid_t pid; int t; @@ -747,7 +749,7 @@ db_stack_trace(db_expr_t tid, boolean_t } static void -db_stack_trace_all(db_expr_t dummy, boolean_t dummy2, db_expr_t dummy3, +db_stack_trace_all(intptr_t dummy, boolean_t dummy2, db_expr_t dummy3, char *dummy4) { struct proc *p; Modified: user/jmallett/octeon/sys/ddb/db_examine.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_examine.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_examine.c Sat Feb 27 03:38:38 2010 (r204391) @@ -53,7 +53,7 @@ static void db_search(db_addr_t, int, db /*ARGSUSED*/ void db_examine_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -198,7 +198,7 @@ static char db_print_format = 'x'; /*ARGSUSED*/ void db_print_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -256,7 +256,7 @@ db_print_loc_and_inst(loc) */ void db_search_cmd(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; + intptr_t dummy1; boolean_t dummy2; db_expr_t dummy3; char * dummy4; Modified: user/jmallett/octeon/sys/ddb/db_main.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_main.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_main.c Sat Feb 27 03:38:38 2010 (r204391) @@ -156,7 +156,7 @@ X_db_symbol_values(db_symtab_t *symtab, if (namep != NULL) *namep = (const char*)lval.name; if (valp != NULL) - *valp = (db_expr_t)lval.value; + *valp = (db_expr_t)(intptr_t)lval.value; } else { if (namep != NULL) *namep = (const char *)symtab->private + Modified: user/jmallett/octeon/sys/ddb/db_print.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_print.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_print.c Sat Feb 27 03:38:38 2010 (r204391) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include void -db_show_regs(db_expr_t _1, boolean_t _2, db_expr_t _3, char *_4) +db_show_regs(intptr_t _1, boolean_t _2, db_expr_t _3, char *_4) { struct db_variable *regp; db_expr_t value, offset; Modified: user/jmallett/octeon/sys/ddb/db_ps.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_ps.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_ps.c Sat Feb 27 03:38:38 2010 (r204391) @@ -75,7 +75,7 @@ DB_SHOW_ALL_COMMAND(procs, db_procs_cmd) * characters. */ void -db_ps(db_expr_t addr, boolean_t hasaddr, db_expr_t count, char *modif) +db_ps(intptr_t addr, boolean_t hasaddr, db_expr_t count, char *modif) { volatile struct proc *p, *pp; volatile struct thread *td; Modified: user/jmallett/octeon/sys/ddb/db_run.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_run.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_run.c Sat Feb 27 03:38:38 2010 (r204391) @@ -302,7 +302,7 @@ extern int db_cmd_loop_done; /*ARGSUSED*/ void db_single_step_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -329,7 +329,7 @@ db_single_step_cmd(addr, have_addr, coun /*ARGSUSED*/ void db_trace_until_call_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -351,7 +351,7 @@ db_trace_until_call_cmd(addr, have_addr, /*ARGSUSED*/ void db_trace_until_matching_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -375,7 +375,7 @@ db_trace_until_matching_cmd(addr, have_a /*ARGSUSED*/ void db_continue_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; Modified: user/jmallett/octeon/sys/ddb/db_script.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_script.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_script.c Sat Feb 27 03:38:38 2010 (r204391) @@ -339,7 +339,7 @@ db_script_kdbenter(const char *eventname * List scripts and their contents. */ void -db_scripts_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, +db_scripts_cmd(intptr_t addr, boolean_t have_addr, db_expr_t count, char *modif) { int i; @@ -357,7 +357,7 @@ db_scripts_cmd(db_expr_t addr, boolean_t * Execute a script. */ void -db_run_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif) +db_run_cmd(intptr_t addr, boolean_t have_addr, db_expr_t count, char *modif) { int t; @@ -381,7 +381,7 @@ db_run_cmd(db_expr_t addr, boolean_t hav * we do not wish to use db_lex's token processing. */ void -db_script_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, +db_script_cmd(intptr_t addr, boolean_t have_addr, db_expr_t count, char *modif) { char *buf, scriptname[DB_MAXSCRIPTNAME]; @@ -427,7 +427,7 @@ db_script_cmd(db_expr_t addr, boolean_t * Remove a named script. */ void -db_unscript_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, +db_unscript_cmd(intptr_t addr, boolean_t have_addr, db_expr_t count, char *modif) { int error, t; Modified: user/jmallett/octeon/sys/ddb/db_sym.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_sym.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_sym.c Sat Feb 27 03:38:38 2010 (r204391) @@ -394,7 +394,7 @@ db_search_symbol( val, strategy, offp) { register unsigned int diff; - size_t newdiff; + db_expr_t newdiff; register int i; c_db_sym_t ret = C_DB_SYM_NULL, sym; Modified: user/jmallett/octeon/sys/ddb/db_textdump.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_textdump.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_textdump.c Sat Feb 27 03:38:38 2010 (r204391) @@ -503,7 +503,7 @@ db_textdump_usage(void) } void -db_textdump_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, +db_textdump_cmd(intptr_t addr, boolean_t have_addr, db_expr_t count, char *modif) { int t; Modified: user/jmallett/octeon/sys/ddb/db_thread.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_thread.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_thread.c Sat Feb 27 03:38:38 2010 (r204391) @@ -52,9 +52,11 @@ db_print_thread(void) } void -db_set_thread(db_expr_t tid, boolean_t hastid, db_expr_t cnt, char *mod) +db_set_thread(intptr_t addr, boolean_t hasaddr, db_expr_t cnt, char *mod) { struct thread *thr; + boolean_t hastid; + db_expr_t tid; db_expr_t radix; int err; @@ -88,7 +90,7 @@ db_set_thread(db_expr_t tid, boolean_t h } void -db_show_threads(db_expr_t addr, boolean_t hasaddr, db_expr_t cnt, char *mod) +db_show_threads(intptr_t addr, boolean_t hasaddr, db_expr_t cnt, char *mod) { jmp_buf jb; void *prev_jb; @@ -141,7 +143,7 @@ hex2dec(db_expr_t expr) * process. Otherwise, we treat the addr as a pointer to a thread. */ struct thread * -db_lookup_thread(db_expr_t addr, boolean_t check_pid) +db_lookup_thread(intptr_t addr, boolean_t check_pid) { struct thread *td; db_expr_t decaddr; @@ -178,7 +180,7 @@ db_lookup_thread(db_expr_t addr, boolean * If that fails we treat the addr as a pointer to a process. */ struct proc * -db_lookup_proc(db_expr_t addr) +db_lookup_proc(intptr_t addr) { db_expr_t decaddr; struct proc *p; Modified: user/jmallett/octeon/sys/ddb/db_variables.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_variables.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_variables.c Sat Feb 27 03:38:38 2010 (r204391) @@ -128,7 +128,7 @@ db_write_variable(struct db_variable *vp } void -db_set_cmd(db_expr_t dummy1, boolean_t dummy2, db_expr_t dummy3, char *dummy4) +db_set_cmd(intptr_t dummy1, boolean_t dummy2, db_expr_t dummy3, char *dummy4) { struct db_variable *vp; db_expr_t value; Modified: user/jmallett/octeon/sys/ddb/db_watch.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_watch.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_watch.c Sat Feb 27 03:38:38 2010 (r204391) @@ -190,7 +190,7 @@ db_list_watchpoints() /*ARGSUSED*/ void db_deletewatch_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -202,7 +202,7 @@ db_deletewatch_cmd(addr, have_addr, coun /*ARGSUSED*/ void db_watchpoint_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -296,7 +296,7 @@ db_find_watchpoint(map, addr, regs) /*ARGSUSED*/ void db_deletehwatch_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; @@ -315,7 +315,7 @@ db_deletehwatch_cmd(addr, have_addr, cou /*ARGSUSED*/ void db_hwatchpoint_cmd(addr, have_addr, count, modif) - db_expr_t addr; + intptr_t addr; boolean_t have_addr; db_expr_t count; char * modif; Modified: user/jmallett/octeon/sys/ddb/db_write_cmd.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_write_cmd.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/db_write_cmd.c Sat Feb 27 03:38:38 2010 (r204391) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); /*ARGSUSED*/ void db_write_cmd(address, have_addr, count, modif) - db_expr_t address; + intptr_t address; boolean_t have_addr; db_expr_t count; char * modif; Modified: user/jmallett/octeon/sys/ddb/ddb.h ============================================================================== --- user/jmallett/octeon/sys/ddb/ddb.h Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ddb/ddb.h Sat Feb 27 03:38:38 2010 (r204391) @@ -94,7 +94,7 @@ extern struct command_table db_show_all_ /* * Type signature for a function implementing a ddb command. */ -typedef void db_cmdfcn_t(db_expr_t addr, boolean_t have_addr, db_expr_t count, +typedef void db_cmdfcn_t(intptr_t addr, boolean_t have_addr, db_expr_t count, char *modif); /* @@ -149,7 +149,7 @@ SYSUNINIT(__CONCAT(_name,_suffix), SI_SU static db_cmdfcn_t _func; \ _DB_SET(_suffix, _name, _func, list, _flag, _more); \ static void \ -_func(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif) +_func(intptr_t addr, boolean_t have_addr, db_expr_t count, char *modif) /* common idom provided for backwards compatibility */ #define DB_FUNC(_name, _func, list, _flag, _more) \ @@ -190,13 +190,13 @@ void db_error(const char *s); int db_expression(db_expr_t *valuep); int db_get_variable(db_expr_t *valuep); void db_iprintf(const char *,...) __printflike(1, 2); -struct proc *db_lookup_proc(db_expr_t addr); -struct thread *db_lookup_thread(db_expr_t addr, boolean_t check_pid); +struct proc *db_lookup_proc(intptr_t addr); +struct thread *db_lookup_thread(intptr_t addr, boolean_t check_pid); struct vm_map *db_map_addr(vm_offset_t); boolean_t db_map_current(struct vm_map *); boolean_t db_map_equal(struct vm_map *, struct vm_map *); -int db_md_set_watchpoint(db_expr_t addr, db_expr_t size); -int db_md_clr_watchpoint(db_expr_t addr, db_expr_t size); +int db_md_set_watchpoint(intptr_t addr, db_expr_t size); +int db_md_clr_watchpoint(intptr_t addr, db_expr_t size); void db_md_list_watchpoints(void); void db_print_loc_and_inst(db_addr_t loc); void db_print_thread(void); Modified: user/jmallett/octeon/sys/mips/mips/db_interface.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/db_interface.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/mips/mips/db_interface.c Sat Feb 27 03:38:38 2010 (r204391) @@ -120,7 +120,7 @@ db_frame(struct db_variable *vp, db_expr if (kdb_frame == NULL) return (0); - reg = (int *)((uintptr_t)kdb_frame + (db_expr_t)vp->valuep); + reg = (int *)((uintptr_t)kdb_frame + (size_t)(intptr_t)vp->valuep); if (op == DB_VAR_GET) *valuep = *reg; else Modified: user/jmallett/octeon/sys/mips/mips/db_trace.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/db_trace.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/mips/mips/db_trace.c Sat Feb 27 03:38:38 2010 (r204391) @@ -266,27 +266,27 @@ loop: mask |= (1 << i.IType.rt); switch (i.IType.rt) { case 4:/* a0 */ - args[0] = kdbpeek((int *)(sp + (short)i.IType.imm)); + args[0] = kdbpeek((int *)((intptr_t)sp + (short)i.IType.imm)); valid_args[0] = 1; break; case 5:/* a1 */ - args[1] = kdbpeek((int *)(sp + (short)i.IType.imm)); + args[1] = kdbpeek((int *)((intptr_t)sp + (short)i.IType.imm)); valid_args[1] = 1; break; case 6:/* a2 */ - args[2] = kdbpeek((int *)(sp + (short)i.IType.imm)); + args[2] = kdbpeek((int *)((intptr_t)sp + (short)i.IType.imm)); valid_args[2] = 1; break; case 7:/* a3 */ - args[3] = kdbpeek((int *)(sp + (short)i.IType.imm)); + args[3] = kdbpeek((int *)((intptr_t)sp + (short)i.IType.imm)); valid_args[3] = 1; break; case 31: /* ra */ - ra = kdbpeek((int *)(sp + (short)i.IType.imm)); + ra = kdbpeek((int *)((intptr_t)sp + (short)i.IType.imm)); } break; @@ -300,27 +300,27 @@ loop: mask |= (1 << i.IType.rt); switch (i.IType.rt) { case 4:/* a0 */ - args[0] = kdbpeekD((int *)(sp + (short)i.IType.imm)); + args[0] = kdbpeekD((int *)((intptr_t)sp + (short)i.IType.imm)); valid_args[0] = 1; break; case 5:/* a1 */ - args[1] = kdbpeekD((int *)(sp + (short)i.IType.imm)); + args[1] = kdbpeekD((int *)((intptr_t)sp + (short)i.IType.imm)); valid_args[1] = 1; break; case 6:/* a2 */ - args[2] = kdbpeekD((int *)(sp + (short)i.IType.imm)); + args[2] = kdbpeekD((int *)((intptr_t)sp + (short)i.IType.imm)); valid_args[2] = 1; break; case 7:/* a3 */ - args[3] = kdbpeekD((int *)(sp + (short)i.IType.imm)); + args[3] = kdbpeekD((int *)((intptr_t)sp + (short)i.IType.imm)); valid_args[3] = 1; break; case 31: /* ra */ - ra = kdbpeekD((int *)(sp + (short)i.IType.imm)); + ra = kdbpeekD((int *)((intptr_t)sp + (short)i.IType.imm)); } break; @@ -366,7 +366,7 @@ finish: int -db_md_set_watchpoint(db_expr_t addr, db_expr_t size) +db_md_set_watchpoint(intptr_t addr, db_expr_t size) { return(0); @@ -374,7 +374,7 @@ db_md_set_watchpoint(db_expr_t addr, db_ int -db_md_clr_watchpoint( db_expr_t addr, db_expr_t size) +db_md_clr_watchpoint(intptr_t addr, db_expr_t size) { return(0); @@ -400,8 +400,8 @@ db_trace_thread(struct thread *thr, int struct pcb *ctx; if (thr == curthread) { - sp = (register_t)__builtin_frame_address(0); - ra = (register_t)__builtin_return_address(0); + sp = (register_t)(intptr_t)__builtin_frame_address(0); + ra = (register_t)(intptr_t)__builtin_return_address(0); __asm __volatile( "jal 99f\n" Modified: user/jmallett/octeon/sys/mips/mips/pm_machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/pm_machdep.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/mips/mips/pm_machdep.c Sat Feb 27 03:38:38 2010 (r204391) @@ -140,16 +140,16 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, /* Build the argument list for the signal handler. */ regs->a0 = sig; - regs->a2 = (register_t)&sfp->sf_uc; + regs->a2 = (register_t)(intptr_t)&sfp->sf_uc; if (SIGISMEMBER(psp->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ - regs->a1 = (register_t)&sfp->sf_si; + regs->a1 = (register_t)(intptr_t)&sfp->sf_si; /* sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; */ /* fill siginfo structure */ sf.sf_si.si_signo = sig; sf.sf_si.si_code = ksi->ksi_code; - sf.sf_si.si_addr = (void*)regs->badvaddr; + sf.sf_si.si_addr = (void*)(intptr_t)regs->badvaddr; } else { /* Old FreeBSD-style arguments. */ regs->a1 = ksi->ksi_code; @@ -172,13 +172,13 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigexit(td, SIGILL); } - regs->pc = (register_t) catcher; - regs->t9 = (register_t) catcher; - regs->sp = (register_t) sfp; + regs->pc = (register_t)(intptr_t)catcher; + regs->t9 = (register_t)(intptr_t)catcher; + regs->sp = (register_t)(intptr_t)sfp; /* * Signal trampoline code is at base of user stack. */ - regs->ra = (register_t) PS_STRINGS - *(p->p_sysent->sv_szsigcode); + regs->ra = (register_t)(intptr_t)PS_STRINGS - *(p->p_sysent->sv_szsigcode); PROC_LOCK(p); mtx_lock(&psp->ps_mtx); } @@ -231,12 +231,12 @@ sigreturn(struct thread *td, struct sigr if (ucp->uc_mcontext.mc_regs[ZERO] != UCONTEXT_MAGIC) { printf("sigreturn: pid %d, ucp %p\n", td->td_proc->p_pid, ucp); printf(" old sp %p ra %p pc %p\n", - (void *)regs->sp, (void *)regs->ra, (void *)regs->pc); + (void *)(intptr_t)regs->sp, (void *)(intptr_t)regs->ra, (void *)(intptr_t)regs->pc); printf(" new sp %p ra %p pc %p z %p\n", - (void *)ucp->uc_mcontext.mc_regs[SP], - (void *)ucp->uc_mcontext.mc_regs[RA], - (void *)ucp->uc_mcontext.mc_regs[PC], - (void *)ucp->uc_mcontext.mc_regs[ZERO]); + (void *)(intptr_t)ucp->uc_mcontext.mc_regs[SP], + (void *)(intptr_t)ucp->uc_mcontext.mc_regs[RA], + (void *)(intptr_t)ucp->uc_mcontext.mc_regs[PC], + (void *)(intptr_t)ucp->uc_mcontext.mc_regs[ZERO]); return EINVAL; } /* #endif */ Modified: user/jmallett/octeon/sys/mips/mips/stack_machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/stack_machdep.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/mips/mips/stack_machdep.c Sat Feb 27 03:38:38 2010 (r204391) @@ -43,7 +43,7 @@ static u_register_t stack_register_fetch(u_register_t sp, u_register_t stack_pos) { u_register_t * stack = - ((u_register_t *)sp + stack_pos/sizeof(u_register_t)); + ((u_register_t *)(intptr_t)sp + (size_t)stack_pos/sizeof(u_register_t)); return *stack; } @@ -59,10 +59,10 @@ stack_capture(struct stack *st, u_regist for (;;) { stacksize = 0; - if (pc <= (u_register_t)btext) + if (pc <= (u_register_t)(intptr_t)btext) break; - for (i = pc; i >= (u_register_t)btext; i -= sizeof (insn)) { - bcopy((void *)i, &insn, sizeof insn); + for (i = pc; i >= (u_register_t)(intptr_t)btext; i -= sizeof (insn)) { + bcopy((void *)(intptr_t)i, &insn, sizeof insn); switch (insn.IType.op) { case OP_ADDI: case OP_ADDIU: @@ -88,13 +88,13 @@ stack_capture(struct stack *st, u_regist break; for (i = pc; !ra; i += sizeof (insn)) { - bcopy((void *)i, &insn, sizeof insn); + bcopy((void *)(intptr_t)i, &insn, sizeof insn); switch (insn.IType.op) { case OP_SPECIAL: if((insn.RType.func == OP_JR)) { - if (ra >= (u_register_t)btext) + if (ra >= (u_register_t)(intptr_t)btext) break; if (insn.RType.rs != RA) break; Modified: user/jmallett/octeon/sys/mips/mips/trap.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/trap.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/mips/mips/trap.c Sat Feb 27 03:38:38 2010 (r204391) @@ -290,7 +290,7 @@ trap(struct trapframe *trapframe) int access_type; ksiginfo_t ksi; char *msg = NULL; - register_t addr = 0; + intptr_t addr = 0; trapdebug_enter(trapframe, 0); @@ -682,7 +682,7 @@ dofault: nargs = callp->sy_narg; if (nargs > nsaved) { - i = copyin((caddr_t)(locr0->sp + + i = copyin((caddr_t)(intptr_t)(locr0->sp + 4 * sizeof(register_t)), (caddr_t)&args[nsaved], (u_int)(nargs - nsaved) * sizeof(register_t)); if (i) { @@ -773,7 +773,8 @@ dofault: case T_BREAK + T_USER: { - uintptr_t va, instr; + intptr_t va; + uint32_t instr; /* compute address of break instruction */ va = trapframe->pc; @@ -806,7 +807,7 @@ dofault: case T_IWATCH + T_USER: case T_DWATCH + T_USER: { - uintptr_t va; + intptr_t va; /* compute address of trapped instruction */ va = trapframe->pc; @@ -820,7 +821,8 @@ dofault: case T_TRAP + T_USER: { - uintptr_t va, instr; + intptr_t va; + uint32_t instr; struct trapframe *locr0 = td->td_frame; /* compute address of trap instruction */ @@ -1169,38 +1171,38 @@ log_frame_dump(struct trapframe *frame) { log(LOG_ERR, "Trapframe Register Dump:\n"); log(LOG_ERR, "\tzero: %p\tat: %p\tv0: %p\tv1: %p\n", - (void *)0, (void *)frame->ast, (void *)frame->v0, (void *)frame->v1); + (void *)(intptr_t)0, (void *)(intptr_t)frame->ast, (void *)(intptr_t)frame->v0, (void *)(intptr_t)frame->v1); log(LOG_ERR, "\ta0: %p\ta1: %p\ta2: %p\ta3: %p\n", - (void *)frame->a0, (void *)frame->a1, (void *)frame->a2, (void *)frame->a3); + (void *)(intptr_t)frame->a0, (void *)(intptr_t)frame->a1, (void *)(intptr_t)frame->a2, (void *)(intptr_t)frame->a3); log(LOG_ERR, "\tt0: %p\tt1: %p\tt2: %p\tt3: %p\n", - (void *)frame->t0, (void *)frame->t1, (void *)frame->t2, (void *)frame->t3); + (void *)(intptr_t)frame->t0, (void *)(intptr_t)frame->t1, (void *)(intptr_t)frame->t2, (void *)(intptr_t)frame->t3); log(LOG_ERR, "\tt4: %p\tt5: %p\tt6: %p\tt7: %p\n", - (void *)frame->t4, (void *)frame->t5, (void *)frame->t6, (void *)frame->t7); + (void *)(intptr_t)frame->t4, (void *)(intptr_t)frame->t5, (void *)(intptr_t)frame->t6, (void *)(intptr_t)frame->t7); log(LOG_ERR, "\tt8: %p\tt9: %p\ts0: %p\ts1: %p\n", - (void *)frame->t8, (void *)frame->t9, (void *)frame->s0, (void *)frame->s1); + (void *)(intptr_t)frame->t8, (void *)(intptr_t)frame->t9, (void *)(intptr_t)frame->s0, (void *)(intptr_t)frame->s1); log(LOG_ERR, "\ts2: %p\ts3: %p\ts4: %p\ts5: %p\n", - (void *)frame->s2, (void *)frame->s3, (void *)frame->s4, (void *)frame->s5); + (void *)(intptr_t)frame->s2, (void *)(intptr_t)frame->s3, (void *)(intptr_t)frame->s4, (void *)(intptr_t)frame->s5); log(LOG_ERR, "\ts6: %p\ts7: %p\tk0: %p\tk1: %p\n", - (void *)frame->s6, (void *)frame->s7, (void *)frame->k0, (void *)frame->k1); + (void *)(intptr_t)frame->s6, (void *)(intptr_t)frame->s7, (void *)(intptr_t)frame->k0, (void *)(intptr_t)frame->k1); log(LOG_ERR, "\tgp: %p\tsp: %p\ts8: %p\tra: %p\n", - (void *)frame->gp, (void *)frame->sp, (void *)frame->s8, (void *)frame->ra); + (void *)(intptr_t)frame->gp, (void *)(intptr_t)frame->sp, (void *)(intptr_t)frame->s8, (void *)(intptr_t)frame->ra); log(LOG_ERR, "\tsr: %p\tmullo: %p\tmulhi: %p\tbadvaddr: %p\n", - (void *)frame->sr, (void *)frame->mullo, (void *)frame->mulhi, (void *)frame->badvaddr); + (void *)(intptr_t)frame->sr, (void *)(intptr_t)frame->mullo, (void *)(intptr_t)frame->mulhi, (void *)(intptr_t)frame->badvaddr); #ifdef IC_REG log(LOG_ERR, "\tcause: %p\tpc: %p\tic: %p\n", - (void *)frame->cause, (void *)frame->pc, (void *)frame->ic); + (void *)(intptr_t)frame->cause, (void *)(intptr_t)frame->pc, (void *)(intptr_t)frame->ic); #else log(LOG_ERR, "\tcause: %p\tpc: %p\n", - (void *)frame->cause, (void *)frame->pc); + (void *)(intptr_t)frame->cause, (void *)(intptr_t)frame->pc); #endif } @@ -1210,38 +1212,38 @@ trap_frame_dump(struct trapframe *frame) { printf("Trapframe Register Dump:\n"); printf("\tzero: %p\tat: %p\tv0: %p\tv1: %p\n", - (void *)0, (void *)frame->ast, (void *)frame->v0, (void *)frame->v1); + (void *)(intptr_t)0, (void *)(intptr_t)frame->ast, (void *)(intptr_t)frame->v0, (void *)(intptr_t)frame->v1); printf("\ta0: %p\ta1: %p\ta2: %p\ta3: %p\n", - (void *)frame->a0, (void *)frame->a1, (void *)frame->a2, (void *)frame->a3); + (void *)(intptr_t)frame->a0, (void *)(intptr_t)frame->a1, (void *)(intptr_t)frame->a2, (void *)(intptr_t)frame->a3); printf("\tt0: %p\tt1: %p\tt2: %p\tt3: %p\n", - (void *)frame->t0, (void *)frame->t1, (void *)frame->t2, (void *)frame->t3); + (void *)(intptr_t)frame->t0, (void *)(intptr_t)frame->t1, (void *)(intptr_t)frame->t2, (void *)(intptr_t)frame->t3); printf("\tt4: %p\tt5: %p\tt6: %p\tt7: %p\n", - (void *)frame->t4, (void *)frame->t5, (void *)frame->t6, (void *)frame->t7); + (void *)(intptr_t)frame->t4, (void *)(intptr_t)frame->t5, (void *)(intptr_t)frame->t6, (void *)(intptr_t)frame->t7); printf("\tt8: %p\tt9: %p\ts0: %p\ts1: %p\n", - (void *)frame->t8, (void *)frame->t9, (void *)frame->s0, (void *)frame->s1); + (void *)(intptr_t)frame->t8, (void *)(intptr_t)frame->t9, (void *)(intptr_t)frame->s0, (void *)(intptr_t)frame->s1); printf("\ts2: %p\ts3: %p\ts4: %p\ts5: %p\n", - (void *)frame->s2, (void *)frame->s3, (void *)frame->s4, (void *)frame->s5); + (void *)(intptr_t)frame->s2, (void *)(intptr_t)frame->s3, (void *)(intptr_t)frame->s4, (void *)(intptr_t)frame->s5); printf("\ts6: %p\ts7: %p\tk0: %p\tk1: %p\n", - (void *)frame->s6, (void *)frame->s7, (void *)frame->k0, (void *)frame->k1); + (void *)(intptr_t)frame->s6, (void *)(intptr_t)frame->s7, (void *)(intptr_t)frame->k0, (void *)(intptr_t)frame->k1); printf("\tgp: %p\tsp: %p\ts8: %p\tra: %p\n", - (void *)frame->gp, (void *)frame->sp, (void *)frame->s8, (void *)frame->ra); + (void *)(intptr_t)frame->gp, (void *)(intptr_t)frame->sp, (void *)(intptr_t)frame->s8, (void *)(intptr_t)frame->ra); printf("\tsr: %p\tmullo: %p\tmulhi: %p\tbadvaddr: %p\n", - (void *)frame->sr, (void *)frame->mullo, (void *)frame->mulhi, (void *)frame->badvaddr); + (void *)(intptr_t)frame->sr, (void *)(intptr_t)frame->mullo, (void *)(intptr_t)frame->mulhi, (void *)(intptr_t)frame->badvaddr); #ifdef IC_REG printf("\tcause: %p\tpc: %p\tic: %p\n", - (void *)frame->cause, (void *)frame->pc, (void *)frame->ic); + (void *)(intptr_t)frame->cause, (void *)(intptr_t)frame->pc, (void *)(intptr_t)frame->ic); #else printf("\tcause: %p\tpc: %p\n", - (void *)frame->cause, (void *)frame->pc); + (void *)(intptr_t)frame->cause, (void *)(intptr_t)frame->pc); #endif } @@ -1299,9 +1301,9 @@ log_bad_page_fault(char *msg, struct tra log(LOG_ERR, "%s: pid %d (%s), uid %d: pc %p got a %s fault at %p\n", msg, p->p_pid, p->p_comm, p->p_ucred ? p->p_ucred->cr_uid : -1, - (void *)pc, + (void *)(intptr_t)pc, read_or_write, - (void *)frame->badvaddr); + (void *)(intptr_t)frame->badvaddr); /* log registers in trap frame */ log_frame_dump(frame); @@ -1314,19 +1316,19 @@ log_bad_page_fault(char *msg, struct tra */ if (!(pc & 3) && (pc != frame->badvaddr) && (trap_type != T_BUS_ERR_IFETCH) && - useracc((caddr_t)pc, sizeof(int) * 4, VM_PROT_READ)) { + useracc((caddr_t)(intptr_t)pc, sizeof(int) * 4, VM_PROT_READ)) { /* dump page table entry for faulting instruction */ log(LOG_ERR, "Page table info for pc address %p: pde = %p, pte = 0x%lx\n", - (void *)pc, *pdep, ptep ? *ptep : 0); + (void *)(intptr_t)pc, *pdep, ptep ? *ptep : 0); - addr = (unsigned int *)pc; + addr = (unsigned int *)(intptr_t)pc; log(LOG_ERR, "Dumping 4 words starting at pc address %p: \n", addr); log(LOG_ERR, "%08x %08x %08x %08x\n", addr[0], addr[1], addr[2], addr[3]); } else { log(LOG_ERR, "pc address %p is inaccessible, pde = 0x%p, pte = 0x%lx\n", - (void *)pc, *pdep, ptep ? *ptep : 0); + (void *)(intptr_t)pc, *pdep, ptep ? *ptep : 0); } /* panic("Bad trap");*/ } @@ -1339,7 +1341,7 @@ static int mips_unaligned_load_store(struct trapframe *frame, register_t addr, register_t pc) { register_t *reg = (register_t *) frame; - u_int32_t inst = *((u_int32_t *) pc); + u_int32_t inst = *((u_int32_t *)(intptr_t)pc); u_int32_t value_msb, value; int access_type = 0; @@ -1436,8 +1438,8 @@ emulate_unaligned_access(struct trapfram frame->pc += 4; log(LOG_INFO, "Unaligned %s: pc=%p, badvaddr=%p\n", - access_name[access_type - 1], (void *)pc, - (void *)frame->badvaddr); + access_name[access_type - 1], (void *)(intptr_t)pc, + (void *)(intptr_t)frame->badvaddr); } } return access_type; Modified: user/jmallett/octeon/sys/mips/mips/vm_machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/vm_machdep.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/mips/mips/vm_machdep.c Sat Feb 27 03:38:38 2010 (r204391) @@ -145,13 +145,13 @@ cpu_fork(register struct thread *td1,reg if (td1 == PCPU_GET(fpcurthread)) MipsSaveCurFPState(td1); - pcb2->pcb_context[PCB_REG_RA] = (register_t)fork_trampoline; + pcb2->pcb_context[PCB_REG_RA] = (register_t)(intptr_t)fork_trampoline; /* Make sp 64-bit aligned */ pcb2->pcb_context[PCB_REG_SP] = (register_t)(((vm_offset_t)td2->td_pcb & ~(sizeof(__int64_t) - 1)) - STAND_FRAME_SIZE); - pcb2->pcb_context[PCB_REG_S0] = (register_t)fork_return; - pcb2->pcb_context[PCB_REG_S1] = (register_t)td2; - pcb2->pcb_context[PCB_REG_S2] = (register_t)td2->td_frame; + pcb2->pcb_context[PCB_REG_S0] = (register_t)(intptr_t)fork_return; + pcb2->pcb_context[PCB_REG_S1] = (register_t)(intptr_t)td2; + pcb2->pcb_context[PCB_REG_S2] = (register_t)(intptr_t)td2->td_frame; pcb2->pcb_context[PCB_REG_SR] = SR_INT_MASK & mips_rd_status(); /* * FREEBSD_DEVELOPERS_FIXME: @@ -182,8 +182,8 @@ cpu_set_fork_handler(struct thread *td, * Note that the trap frame follows the args, so the function * is really called like this: func(arg, frame); */ - td->td_pcb->pcb_context[PCB_REG_S0] = (register_t) func; - td->td_pcb->pcb_context[PCB_REG_S1] = (register_t) arg; + td->td_pcb->pcb_context[PCB_REG_S0] = (register_t)(intptr_t)func; + td->td_pcb->pcb_context[PCB_REG_S1] = (register_t)(intptr_t)arg; } void @@ -352,13 +352,13 @@ cpu_set_upcall(struct thread *td, struct * Set registers for trampoline to user mode. */ - pcb2->pcb_context[PCB_REG_RA] = (register_t)fork_trampoline; + pcb2->pcb_context[PCB_REG_RA] = (register_t)(intptr_t)fork_trampoline; /* Make sp 64-bit aligned */ pcb2->pcb_context[PCB_REG_SP] = (register_t)(((vm_offset_t)td->td_pcb & ~(sizeof(__int64_t) - 1)) - STAND_FRAME_SIZE); - pcb2->pcb_context[PCB_REG_S0] = (register_t)fork_return; - pcb2->pcb_context[PCB_REG_S1] = (register_t)td; - pcb2->pcb_context[PCB_REG_S2] = (register_t)td->td_frame; + pcb2->pcb_context[PCB_REG_S0] = (register_t)(intptr_t)fork_return; + pcb2->pcb_context[PCB_REG_S1] = (register_t)(intptr_t)td; + pcb2->pcb_context[PCB_REG_S2] = (register_t)(intptr_t)td->td_frame; /* Dont set IE bit in SR. sched lock release will take care of it */ pcb2->pcb_context[PCB_REG_SR] = SR_INT_MASK & mips_rd_status(); @@ -401,7 +401,7 @@ cpu_set_upcall_kse(struct thread *td, vo * byte aligned[for compatibility with 64-bit CPUs] * in ``See MIPS Run'' by D. Sweetman, p. 269 * align stack */ - sp = ((register_t)(stack->ss_sp + stack->ss_size) & ~0x7) - + sp = ((register_t)(intptr_t)(stack->ss_sp + stack->ss_size) & ~0x7) - STAND_FRAME_SIZE; /* @@ -410,14 +410,14 @@ cpu_set_upcall_kse(struct thread *td, vo */ tf = td->td_frame; bzero(tf, sizeof(struct trapframe)); - tf->sp = (register_t)sp; - tf->pc = (register_t)entry; + tf->sp = sp; + tf->pc = (register_t)(intptr_t)entry; /* * MIPS ABI requires T9 to be the same as PC * in subroutine entry point */ - tf->t9 = (register_t)entry; - tf->a0 = (register_t)arg; + tf->t9 = (register_t)(intptr_t)entry; + tf->a0 = (register_t)(intptr_t)arg; /* * Keep interrupt mask @@ -447,7 +447,7 @@ kvtop(void *addr) va = pmap_kextract((vm_offset_t)addr); if (va == 0) panic("kvtop: zero page frame"); - return((int)va); + return((intptr_t)va); } /* @@ -594,10 +594,10 @@ cpu_throw(struct thread *old, struct thr #include #define DB_PRINT_REG(ptr, regname) \ - db_printf(" %-12s 0x%lx\n", #regname, (long)((ptr)->regname)) + db_printf(" %-12s %p\n", #regname, (void *)(intptr_t)((ptr)->regname)) #define DB_PRINT_REG_ARRAY(ptr, arrname, regname) \ - db_printf(" %-12s 0x%lx\n", #regname, (long)((ptr)->arrname[regname])) + db_printf(" %-12s %p\n", #regname, (void *)(intptr_t)((ptr)->arrname[regname])) static void dump_trapframe(struct trapframe *trapframe) Modified: user/jmallett/octeon/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- user/jmallett/octeon/sys/ufs/ffs/ffs_softdep.c Sat Feb 27 03:35:34 2010 (r204390) +++ user/jmallett/octeon/sys/ufs/ffs/ffs_softdep.c Sat Feb 27 03:38:38 2010 (r204391) @@ -1161,7 +1161,7 @@ retry_flush: LIST_HEAD(pagedep_hashhead, pagedep) *pagedep_hashtbl; u_long pagedep_hash; /* size of hash table - 1 */ #define PAGEDEP_HASH(mp, inum, lbn) \ - (&pagedep_hashtbl[((((register_t)(mp)) >> 13) + (inum) + (lbn)) & \ + (&pagedep_hashtbl[((((uintptr_t)(mp)) >> 13) + (inum) + (lbn)) & \ pagedep_hash]) static int @@ -1245,7 +1245,7 @@ LIST_HEAD(inodedep_hashhead, inodedep) * static u_long inodedep_hash; /* size of hash table - 1 */ static long num_inodedep; /* number of inodedep allocated */ #define INODEDEP_HASH(fs, inum) \ - (&inodedep_hashtbl[((((register_t)(fs)) >> 13) + (inum)) & inodedep_hash]) + (&inodedep_hashtbl[((((uintptr_t)(fs)) >> 13) + (inum)) & inodedep_hash]) static int inodedep_find(inodedephd, fs, inum, inodedeppp) @@ -1333,7 +1333,7 @@ inodedep_lookup(mp, inum, flags, inodede LIST_HEAD(newblk_hashhead, newblk) *newblk_hashtbl; u_long newblk_hash; /* size of hash table - 1 */ #define NEWBLK_HASH(fs, inum) \ - (&newblk_hashtbl[((((register_t)(fs)) >> 13) + (inum)) & newblk_hash]) + (&newblk_hashtbl[((((uintptr_t)(fs)) >> 13) + (inum)) & newblk_hash]) static int newblk_find(newblkhd, fs, newblkno, newblkpp) From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 03:55:08 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A020B106566B; Sat, 27 Feb 2010 03:55:08 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 900208FC14; Sat, 27 Feb 2010 03:55:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R3t84X044633; Sat, 27 Feb 2010 03:55:08 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R3t8UV044631; Sat, 27 Feb 2010 03:55:08 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270355.o1R3t8UV044631@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 03:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204393 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 03:55:08 -0000 Author: jmallett Date: Sat Feb 27 03:55:08 2010 New Revision: 204393 URL: http://svn.freebsd.org/changeset/base/204393 Log: Use the elaborate address loading in n32, not o32. n32 doesn't have 64-bit pointers so we need to load a 64-bit address into a temporary register and use that in the ld or sd instruction. Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Sat Feb 27 03:47:22 2010 (r204392) +++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Sat Feb 27 03:55:08 2010 (r204393) @@ -90,7 +90,7 @@ extern struct pcpu *cpuid_to_pcpu[]; #define OCTEON_SYNCW __asm __volatile (".word 0x10f" : : ) #define OCTEON_SYNCWS __asm __volatile (".word 0x14f" : : ) -#if defined(__mips_n32) || defined(__mips_n64) +#if defined(__mips_n64) static inline void oct_write64 (uint64_t csr_addr, uint64_t val64) { @@ -158,7 +158,7 @@ static inline int32_t oct_readint32 (uin -#else +#elif defined(__mips_n32) /* @@ -169,9 +169,6 @@ static inline int32_t oct_readint32 (uin * but is quite ugly. */ -/* ABI o32 */ - - /* * Read/write functions */ From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 03:56:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 515AA106564A; Sat, 27 Feb 2010 03:56:13 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 417C28FC17; Sat, 27 Feb 2010 03:56:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R3uDhH044897; Sat, 27 Feb 2010 03:56:13 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R3uDHe044895; Sat, 27 Feb 2010 03:56:13 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270356.o1R3uDHe044895@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 03:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204394 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 03:56:13 -0000 Author: jmallett Date: Sat Feb 27 03:56:12 2010 New Revision: 204394 URL: http://svn.freebsd.org/changeset/base/204394 Log: o) Correct the ISA and -march values for Octeon -- it's not MIPS32. o) Switch to using the n32 ABI. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Feb 27 03:55:08 2010 (r204393) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Feb 27 03:56:12 2010 (r204394) @@ -24,16 +24,18 @@ ident OCTEON1 # Don't build any modules yet. makeoptions MODULES_OVERRIDE="" makeoptions TARGET_BIG_ENDIAN=defined -makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1.32 +makeoptions TARGET_N32=defined +makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1.n32 -makeoptions KERNLOADADDR=0x81000000 +makeoptions KERNLOADADDR=0xffffffff81000000 include "../cavium/std.octeon1" hints "OCTEON1.hints" #Default places to look for devices. makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -options ISA_MIPS32 +options ISA_MIPS64 +makeoptions ARCH_FLAGS="-march=mips64 -mabi=n32" options DDB options KDB From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 04:33:24 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8122B106564A; Sat, 27 Feb 2010 04:33:24 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 711038FC12; Sat, 27 Feb 2010 04:33:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R4XOB4053190; Sat, 27 Feb 2010 04:33:24 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R4XOQv053188; Sat, 27 Feb 2010 04:33:24 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270433.o1R4XOQv053188@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 04:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204396 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 04:33:24 -0000 Author: jmallett Date: Sat Feb 27 04:33:24 2010 New Revision: 204396 URL: http://svn.freebsd.org/changeset/base/204396 Log: Add back RGMII. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Feb 27 04:02:40 2010 (r204395) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Feb 27 04:33:24 2010 (r204396) @@ -69,7 +69,7 @@ device ether device md device uart nodevice uart_ns8250 -#device rgmii +device rgmii #options VERBOSE_SYSINIT From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 05:45:32 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 885A4106564A; Sat, 27 Feb 2010 05:45:32 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 783D68FC16; Sat, 27 Feb 2010 05:45:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R5jWIT068953; Sat, 27 Feb 2010 05:45:32 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R5jWeK068951; Sat, 27 Feb 2010 05:45:32 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270545.o1R5jWeK068951@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 05:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204398 - user/jmallett/octeon/sys/ddb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 05:45:32 -0000 Author: jmallett Date: Sat Feb 27 05:45:32 2010 New Revision: 204398 URL: http://svn.freebsd.org/changeset/base/204398 Log: Hackishly arrange to print registers at their full width. Modified: user/jmallett/octeon/sys/ddb/db_print.c Modified: user/jmallett/octeon/sys/ddb/db_print.c ============================================================================== --- user/jmallett/octeon/sys/ddb/db_print.c Sat Feb 27 05:41:23 2010 (r204397) +++ user/jmallett/octeon/sys/ddb/db_print.c Sat Feb 27 05:45:32 2010 (r204398) @@ -56,7 +56,11 @@ db_show_regs(intptr_t _1, boolean_t _2, for (regp = db_regs; regp < db_eregs; regp++) { if (!db_read_variable(regp, &value)) continue; - db_printf("%-12s%#10lr", regp->name, (unsigned long)value); +#if 0 /* XXX n32 MIPS has 32-bit longs, 64-bit regs and GCC won't take %llr */ + db_printf("%-12s%#18llr", regp->name, (unsigned long long)value); +#else + db_printf("%-12s%#18llx", regp->name, (unsigned long long)value); +#endif db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset); if (name != NULL && offset <= (unsigned long)db_maxoff && offset != value) { From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 05:46:40 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F0AB106564A; Sat, 27 Feb 2010 05:46:40 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E8458FC0A; Sat, 27 Feb 2010 05:46:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R5keBM069226; Sat, 27 Feb 2010 05:46:40 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R5ke8l069222; Sat, 27 Feb 2010 05:46:40 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270546.o1R5ke8l069222@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 05:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204399 - in user/jmallett/octeon/sys/mips: include mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 05:46:40 -0000 Author: jmallett Date: Sat Feb 27 05:46:40 2010 New Revision: 204399 URL: http://svn.freebsd.org/changeset/base/204399 Log: o) Make struct trapdebug use register-width members. o) Make trap, which returns the new PC, return a register_t. o) Add the two universal cache coherency attributes. Modified: user/jmallett/octeon/sys/mips/include/cpuregs.h user/jmallett/octeon/sys/mips/include/trap.h user/jmallett/octeon/sys/mips/mips/trap.c Modified: user/jmallett/octeon/sys/mips/include/cpuregs.h ============================================================================== --- user/jmallett/octeon/sys/mips/include/cpuregs.h Sat Feb 27 05:45:32 2010 (r204398) +++ user/jmallett/octeon/sys/mips/include/cpuregs.h Sat Feb 27 05:46:40 2010 (r204399) @@ -96,6 +96,9 @@ #define MIPS3_VA_TO_CINDEX(x) \ ((unsigned)(x) & 0xffffff | MIPS_KSEG0_START) +#define MIPS_XKPHYS_CCA_UC 0x02 /* Uncached. */ +#define MIPS_XKPHYS_CCA_CNC 0x03 /* Cacheable non-coherent. */ + #define MIPS_PHYS_TO_XKPHYS(cca,x) \ ((0x2ULL << 62) | ((unsigned long long)(cca) << 59) | (x)) #define MIPS_XKPHYS_TO_PHYS(x) ((x) & 0x0effffffffffffffULL) Modified: user/jmallett/octeon/sys/mips/include/trap.h ============================================================================== --- user/jmallett/octeon/sys/mips/include/trap.h Sat Feb 27 05:45:32 2010 (r204398) +++ user/jmallett/octeon/sys/mips/include/trap.h Sat Feb 27 05:46:40 2010 (r204399) @@ -74,13 +74,13 @@ #if !defined(SMP) && (defined(DDB) || defined(DEBUG)) struct trapdebug { /* trap history buffer for debugging */ - u_int status; - u_int cause; - u_int vadr; - u_int pc; - u_int ra; - u_int sp; - u_int code; + register_t status; + register_t cause; + register_t vadr; + register_t pc; + register_t ra; + register_t sp; + register_t code; }; #define trapdebug_enter(x, cd) { \ @@ -117,7 +117,7 @@ void MipsUserGenException(void); void MipsUserIntr(void); void MipsUserTLBInvalidException(void); -u_int trap(struct trapframe *); +register_t trap(struct trapframe *); #ifndef LOCORE /* XXX */ int check_address(void *); Modified: user/jmallett/octeon/sys/mips/mips/trap.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/trap.c Sat Feb 27 05:45:32 2010 (r204398) +++ user/jmallett/octeon/sys/mips/mips/trap.c Sat Feb 27 05:46:40 2010 (r204399) @@ -274,7 +274,7 @@ extern char *syscallnames[]; * In the case of a kernel trap, we return the pc where to resume if * p->p_addr->u_pcb.pcb_onfault is set, otherwise, return old pc. */ -u_int +register_t trap(struct trapframe *trapframe) { int type, usermode; @@ -1001,11 +1001,11 @@ trapDump(char *msg) if (trp->cause == 0) break; - printf("%s: ADR %x PC %x CR %x SR %x\n", + printf("%s: ADR %jx PC %jx CR %jx SR %jx\n", trap_type[(trp->cause & CR_EXC_CODE) >> CR_EXC_CODE_SHIFT], - trp->vadr, trp->pc, trp->cause, trp->status); + (intmax_t)trp->vadr, (intmax_t)trp->pc, (intmax_t)trp->cause, (intmax_t)trp->status); - printf(" RA %x SP %x code %d\n", trp->ra, trp->sp, trp->code); + printf(" RA %jx SP %jx code %d\n", (intmax_t)trp->ra, (intmax_t)trp->sp, (int)trp->code); } restoreintr(s); } From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 05:55:04 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6036B106566B; Sat, 27 Feb 2010 05:55:04 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 501878FC13; Sat, 27 Feb 2010 05:55:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R5t47u071106; Sat, 27 Feb 2010 05:55:04 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R5t4HU071104; Sat, 27 Feb 2010 05:55:04 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270555.o1R5t4HU071104@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 05:55:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204400 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 05:55:04 -0000 Author: jmallett Date: Sat Feb 27 05:55:04 2010 New Revision: 204400 URL: http://svn.freebsd.org/changeset/base/204400 Log: Fix test for address size. Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Sat Feb 27 05:46:40 2010 (r204399) +++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Sat Feb 27 05:55:04 2010 (r204400) @@ -594,7 +594,7 @@ typedef enum { /* PTR_SIZE == sizeof(uint32_t) */ -#ifdef ISA_MIPS32 +#ifdef __mips_n32 #define mipsx_addr_size uint32_t // u_int64 #define MIPSX_ADDR_SIZE_KSEGX_BIT_SHIFT 30 // 62 #define MIPSX_ADDR_SIZE_KSEGX_MASK_REMOVED 0x1fffffff // 0x1fffffff From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 06:28:23 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18BCD1065670; Sat, 27 Feb 2010 06:28:23 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 085118FC12; Sat, 27 Feb 2010 06:28:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1R6SMjl078418; Sat, 27 Feb 2010 06:28:22 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R6SMVE078416; Sat, 27 Feb 2010 06:28:22 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002270628.o1R6SMVE078416@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 06:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204401 - user/jmallett/octeon/sys/mips/cavium/dev/rgmii X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 06:28:23 -0000 Author: jmallett Date: Sat Feb 27 06:28:22 2010 New Revision: 204401 URL: http://svn.freebsd.org/changeset/base/204401 Log: o) Since typestr is always NULL don't bother printing it. o) Don't mask off the low byte of chipid -- some of the case statements are unreachable if you do that. This fixes crashes on the CAM-0100 from trying to enumerate a 4th port that isn't there. Modified: user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c Modified: user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c Sat Feb 27 05:55:04 2010 (r204400) +++ user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c Sat Feb 27 06:28:22 2010 (r204401) @@ -136,7 +136,9 @@ struct rgmx_softc_dev { u_int idx; u_char ieee[6]; +#if 0 char const * typestr; /* printable name of the interface. */ +#endif u_short txb_size; /* size of TX buffer, in bytes */ /* Transmission buffer management. */ @@ -350,7 +352,9 @@ static int octeon_rgmx_init_ifnet (struc ether_ifattach(sc->ifp, sc->ieee); /* Print additional info when attached. */ +#if 0 device_printf(sc->sc_dev, "type %s, full duplex\n", sc->typestr); +#endif return (0); } @@ -2181,7 +2185,7 @@ static int octeon_has_4ports (void) u_int chipid; int retcode = 1; - chipid = octeon_get_chipid() & 0xffffff00; + chipid = octeon_get_chipid(); switch (chipid) { case OCTEON_CN31XX_CHIP: From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 14:05:47 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15A7A1065670; Sat, 27 Feb 2010 14:05:47 +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 E3B268FC12; Sat, 27 Feb 2010 14:05:46 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 6C59C46B4C; Sat, 27 Feb 2010 09:05:46 -0500 (EST) Date: Sat, 27 Feb 2010 14:05:46 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Juli Mallett In-Reply-To: <201002270338.o1R3cd04040906@svn.freebsd.org> Message-ID: References: <201002270338.o1R3cd04040906@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: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r204391 - in user/jmallett/octeon/sys: ddb mips/mips ufs/ffs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 14:05:47 -0000 On Sat, 27 Feb 2010, Juli Mallett wrote: > Make ddb commands take an address as an intptr_t, not a db_expr_t. It is > possible to have 32-bit pointers and 64-bit registers and thus a 64-bit > db_expr_t. Possibly a db_ptr_t is called for, if we're going to differentiate the two more formally? Robert From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 15:26:06 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A45021065674 for ; Sat, 27 Feb 2010 15:26:06 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qy0-f194.google.com (mail-qy0-f194.google.com [209.85.221.194]) by mx1.freebsd.org (Postfix) with ESMTP id 54CBB8FC13 for ; Sat, 27 Feb 2010 15:26:06 +0000 (UTC) Received: by qyk32 with SMTP id 32so648424qyk.28 for ; Sat, 27 Feb 2010 07:26:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=dX6nO4nmn5BNxFGOfjqUcdIfKAinNgoKZFzwQ/+MTLw=; b=oZ2wrV/vl5vC+1ySgJsZ4wmGMqYpcSJyS1N2rIXP+DsGHsd7nY3UmsjSbcwxEb+vZP RAc2OZxyDgQTsOQ0+l57/VpdH3YVfX9bYIRTLfxujOYT0dS2ww52ZfLvhWFoD4kjHElW 5T669a5brCEJutCLylM43xroAQJXZw1WUUxTs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=QrAlTY/iVFjcsb0oqOYIO60sZmpZHn/EJt97Tk5Sebc34nZ2Gxt+iBxNCmA8jnh3We DL41UzYB/2sdpqJW2yNH0qFcBWot4tCgdGzhNlVXmFkuCwJwrxWiTEVEdmMeoTCest8I 51VcKKdWIOgDiSbmtJtlqd2KCPtxENuzd/gXs= Received: by 10.224.86.141 with SMTP id s13mr1061765qal.130.1267282905862; Sat, 27 Feb 2010 07:01:45 -0800 (PST) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net [24.63.226.98]) by mx.google.com with ESMTPS id 4sm3265669qwe.46.2010.02.27.07.01.44 (version=SSLv3 cipher=RC4-MD5); Sat, 27 Feb 2010 07:01:44 -0800 (PST) Date: Sat, 27 Feb 2010 10:01:34 -0500 From: Alexander Kabaev To: Juli Mallett Message-ID: <20100227100134.52899b18@kan.dnsalias.net> In-Reply-To: <201002270338.o1R3cd04040906@svn.freebsd.org> References: <201002270338.o1R3cd04040906@svn.freebsd.org> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.6; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/HUf=YwsF/5VBA.z6/CZK+7q"; protocol="application/pgp-signature" Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r204391 - in user/jmallett/octeon/sys: ddb mips/mips ufs/ffs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 15:26:06 -0000 --Sig_/HUf=YwsF/5VBA.z6/CZK+7q Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 27 Feb 2010 03:38:38 +0000 (UTC) Juli Mallett wrote: > Make ddb commands take an address as an intptr_t, not a db_expr_t. > It is possible to have 32-bit pointers and 64-bit registers and thus > a 64-bit db_expr_t. > =20 This is a step back, imho. Can you redefine db_expr_t to be of appropriate size instead? --=20 Alexander Kabaev --Sig_/HUf=YwsF/5VBA.z6/CZK+7q Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iD8DBQFLiTPXQ6z1jMm+XZYRAjbaAJkBwokkwSI2u2ArTKW7dQd9cYa1PQCfRpM3 OHEgoL60BgPyaxh1C6WnaCU= =t1gf -----END PGP SIGNATURE----- --Sig_/HUf=YwsF/5VBA.z6/CZK+7q-- From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 18:37:43 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F6DF106566C for ; Sat, 27 Feb 2010 18:37:43 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.159]) by mx1.freebsd.org (Postfix) with ESMTP id 20E818FC12 for ; Sat, 27 Feb 2010 18:37:42 +0000 (UTC) Received: by fg-out-1718.google.com with SMTP id 19so826446fgg.13 for ; Sat, 27 Feb 2010 10:37:34 -0800 (PST) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.102.196.33 with SMTP id t33mr1738201muf.2.1267294002089; Sat, 27 Feb 2010 10:06:42 -0800 (PST) In-Reply-To: <20100227100134.52899b18@kan.dnsalias.net> References: <201002270338.o1R3cd04040906@svn.freebsd.org> <20100227100134.52899b18@kan.dnsalias.net> From: Juli Mallett Date: Sat, 27 Feb 2010 10:06:22 -0800 X-Google-Sender-Auth: cd7dc7fa9663becb Message-ID: To: Alexander Kabaev Content-Type: text/plain; charset=ISO-8859-1 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r204391 - in user/jmallett/octeon/sys: ddb mips/mips ufs/ffs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 18:37:43 -0000 On Sat, Feb 27, 2010 at 07:01, Alexander Kabaev wrote: > On Sat, 27 Feb 2010 03:38:38 +0000 (UTC) > Juli Mallett wrote: > >> Make ddb commands take an address as an intptr_t, not a db_expr_t. >> It is possible to have 32-bit pointers and 64-bit registers and thus >> a 64-bit db_expr_t. >> > > This is a step back, imho. Can you redefine db_expr_t to be of > appropriate size instead? I'm not thrilled with it and wouldn't commit it to the main tree. db_expr_t is register/expression sized, though, so for an n32 kernel* it is right for it to be bigger than a pointer. Being able to view and modify only the low 32-bits of registers just because pointers are 32 bits is demonstrably incorrect. I think using db_addr_t makes some sense, assuming there are no sign-extension problems from its being unsigned. *: Whether having an n32 kernel makes sense would be a reasonable question to ask. An n32 loader and an n64 kernel (assuming support for running all kinds of binaries in userland) should be good enough to cover the case where having an n64 kernel is undesirable but an n32 kernel is desirable, which is where the bootloader is incapable of loading ELF64 properly (we could also support o64, but there are bugs with o64 in the toolchain that we'd have to fix.) I'm spending effort on an n32 kernel right now because I was having more trouble getting a bootable n64 kernel together than an n32 one. Juli. From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 19:43:14 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA1B8106566C; Sat, 27 Feb 2010 19:43:14 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EAD28FC15; Sat, 27 Feb 2010 19:43:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1RJhEQu055098; Sat, 27 Feb 2010 19:43:14 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1RJhEtD055094; Sat, 27 Feb 2010 19:43:14 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002271943.o1RJhEtD055094@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 19:43:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204428 - in user/jmallett/octeon: contrib/gcc/config/mips gnu/usr.bin/binutils/ld share/mk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 19:43:14 -0000 Author: jmallett Date: Sat Feb 27 19:43:14 2010 New Revision: 204428 URL: http://svn.freebsd.org/changeset/base/204428 Log: o) Add ABI-related defines used by libgcc to determine things like float size, fixing libgcc build for n32. o) Default to n32, hackishly. Modified: user/jmallett/octeon/contrib/gcc/config/mips/freebsd.h user/jmallett/octeon/gnu/usr.bin/binutils/ld/Makefile.mips user/jmallett/octeon/share/mk/bsd.cpu.mk Modified: user/jmallett/octeon/contrib/gcc/config/mips/freebsd.h ============================================================================== --- user/jmallett/octeon/contrib/gcc/config/mips/freebsd.h Sat Feb 27 19:02:21 2010 (r204427) +++ user/jmallett/octeon/contrib/gcc/config/mips/freebsd.h Sat Feb 27 19:43:14 2010 (r204428) @@ -170,14 +170,21 @@ Boston, MA 02110-1301, USA. */ \ if (mips_abi == ABI_EABI) \ builtin_define ("__mips_eabi"); \ - else if (mips_abi == ABI_N32) \ + else if (mips_abi == ABI_N32) { \ + builtin_define ("_ABIN32=2"); \ + builtin_define ("_MIPS_SIM=_ABIN32"); \ builtin_define ("__mips_n32"); \ - else if (mips_abi == ABI_64) \ + } else if (mips_abi == ABI_64) { \ + builtin_define ("_ABI64=3"); \ + builtin_define ("_MIPS_SIM=_ABI64"); \ builtin_define ("__mips_n64"); \ - else if (mips_abi == ABI_O64) \ + } else if (mips_abi == ABI_O64) \ builtin_define ("__mips_o64"); \ - else \ + else { \ + builtin_define ("_ABIO32=1"); \ + builtin_define ("_MIPS_SIM=_ABIO32"); \ builtin_define ("__mips_o32"); \ + } \ \ if (TARGET_ABICALLS) \ builtin_define ("__ABICALLS__"); \ Modified: user/jmallett/octeon/gnu/usr.bin/binutils/ld/Makefile.mips ============================================================================== --- user/jmallett/octeon/gnu/usr.bin/binutils/ld/Makefile.mips Sat Feb 27 19:02:21 2010 (r204427) +++ user/jmallett/octeon/gnu/usr.bin/binutils/ld/Makefile.mips Sat Feb 27 19:43:14 2010 (r204428) @@ -5,9 +5,9 @@ # of mipsel and mips. _sz?=32 .if defined(TARGET_BIG_ENDIAN) -NATIVE_EMULATION=elf${_sz}btsmip_fbsd +NATIVE_EMULATION=elf${_sz}btsmipn32_fbsd .else -NATIVE_EMULATION=elf${_sz}ltsmip_fbsd +NATIVE_EMULATION=elf${_sz}ltsmipn32_fbsd .endif MIPS_ABIS+=elf32btsmip_fbsd elf32ltsmip_fbsd Modified: user/jmallett/octeon/share/mk/bsd.cpu.mk ============================================================================== --- user/jmallett/octeon/share/mk/bsd.cpu.mk Sat Feb 27 19:02:21 2010 (r204427) +++ user/jmallett/octeon/share/mk/bsd.cpu.mk Sat Feb 27 19:43:14 2010 (r204428) @@ -208,6 +208,8 @@ LD += -EB CFLAGS += -EL LD += -EL . endif +# XXX What if 64-bit? Need TARGET_ABI? +CFLAGS += -mabi=n32 CFLAGS += -msoft-float -G0 -mno-dsp -mabicalls .endif From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 19:44:45 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20BF5106566C; Sat, 27 Feb 2010 19:44:45 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10F748FC1A; Sat, 27 Feb 2010 19:44:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1RJiikQ055469; Sat, 27 Feb 2010 19:44:44 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1RJii6F055467; Sat, 27 Feb 2010 19:44:44 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201002271944.o1RJii6F055467@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Feb 2010 19:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204429 - user/jmallett/octeon/sys/mips/mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 19:44:45 -0000 Author: jmallett Date: Sat Feb 27 19:44:44 2010 New Revision: 204429 URL: http://svn.freebsd.org/changeset/base/204429 Log: Make hackish check for whether something is a kernel address more like right by not comparing signed quantities. Modified: user/jmallett/octeon/sys/mips/mips/db_trace.c Modified: user/jmallett/octeon/sys/mips/mips/db_trace.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/db_trace.c Sat Feb 27 19:43:14 2010 (r204428) +++ user/jmallett/octeon/sys/mips/mips/db_trace.c Sat Feb 27 19:44:44 2010 (r204429) @@ -140,7 +140,7 @@ loop: } /* check for bad SP: could foul up next frame */ /*XXX MIPS64 bad: this hard-coded SP is lame */ - if (sp & 3 || sp < 0x80000000) { + if (sp & 3 || (uintptr_t)sp < 0x80000000u) { (*printfn) ("SP 0x%x: not in kernel\n", sp); ra = 0; subr = 0; From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 20:56:14 2010 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F34301065670; Sat, 27 Feb 2010 20:56:13 +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 AFB3A8FC19; Sat, 27 Feb 2010 20:56:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o1RKqp5R023946; Sat, 27 Feb 2010 13:52:51 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 27 Feb 2010 13:53:03 -0700 (MST) Message-Id: <20100227.135303.123339447223509500.imp@bsdimp.com> To: jmallett@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <201002270330.o1R3UmCo039077@svn.freebsd.org> References: <201002270330.o1R3UmCo039077@svn.freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.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-user@FreeBSD.org Subject: Re: svn commit: r204388 - user/jmallett/octeon/sys/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 20:56:14 -0000 In message: <201002270330.o1R3UmCo039077@svn.freebsd.org> Juli Mallett writes: : Author: jmallett : Date: Sat Feb 27 03:30:48 2010 : New Revision: 204388 : URL: http://svn.freebsd.org/changeset/base/204388 : : Log: : Specify n32 emulation if TARGET_N32 is set. : : Modified: : user/jmallett/octeon/sys/conf/Makefile.mips : : Modified: user/jmallett/octeon/sys/conf/Makefile.mips : ============================================================================== : --- user/jmallett/octeon/sys/conf/Makefile.mips Sat Feb 27 03:30:19 2010 (r204387) : +++ user/jmallett/octeon/sys/conf/Makefile.mips Sat Feb 27 03:30:48 2010 (r204388) : @@ -58,6 +58,10 @@ HACK_EXTRA_FLAGS+=-EB -Wl,-EB : SYSTEM_LD+=-m elf64btsmip_fbsd : HACK_EXTRA_FLAGS+=-Wl,-m,elf64btsmip_fbsd : .endif : +.if defined(TARGET_N32) : +SYSTEM_LD+=-m elf32btsmipn32_fbsd : +HACK_EXTRA_FLAGS+=-Wl,-m,elf32btsmipn32_fbsd : +.endif : .else : CFLAGS+=-EL : SYSTEM_LD+=-EL : @@ -68,6 +72,10 @@ HACK_EXTRA_FLAGS+=-EL -Wl,-EL : SYSTEM_LD+=-m elf64ltsmip_fbsd : HACK_EXTRA_FLAGS+=-Wl,-m,elf64ltsmip_fbsd : .endif : +.if defined(TARGET_N32) : +SYSTEM_LD+=-m elf32ltsmipn32_fbsd : +HACK_EXTRA_FLAGS+=-Wl,-m,elf32ltsmipn32_fbsd : +.endif : .endif You do know I plan on eliminating this whole section with my TBEMD merge, right? Warner From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 21:03:27 2010 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8C66106566B; Sat, 27 Feb 2010 21:03:27 +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 6A1E88FC13; Sat, 27 Feb 2010 21:03:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o1RKwNko024055; Sat, 27 Feb 2010 13:58:23 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 27 Feb 2010 13:58:36 -0700 (MST) Message-Id: <20100227.135836.886429907132150964.imp@bsdimp.com> To: jmallett@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <201002270555.o1R5t4HU071104@svn.freebsd.org> References: <201002270555.o1R5t4HU071104@svn.freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.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-user@FreeBSD.org Subject: Re: svn commit: r204400 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 21:03:27 -0000 In message: <201002270555.o1R5t4HU071104@svn.freebsd.org> Juli Mallett writes: : Author: jmallett : Date: Sat Feb 27 05:55:04 2010 : New Revision: 204400 : URL: http://svn.freebsd.org/changeset/base/204400 : : Log: : Fix test for address size. : : Modified: : user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h : : Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h : ============================================================================== : --- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Sat Feb 27 05:46:40 2010 (r204399) : +++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h Sat Feb 27 05:55:04 2010 (r204400) : @@ -594,7 +594,7 @@ typedef enum { : : /* PTR_SIZE == sizeof(uint32_t) */ : : -#ifdef ISA_MIPS32 : +#ifdef __mips_n32 The ISA_MIPS32 define was used for the weird o32-but-really-64-bit hack in too many places :( : #define mipsx_addr_size uint32_t // u_int64 : #define MIPSX_ADDR_SIZE_KSEGX_BIT_SHIFT 30 // 62 : #define MIPSX_ADDR_SIZE_KSEGX_MASK_REMOVED 0x1fffffff // 0x1fffffff : From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 21:03:28 2010 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 309D01065674; Sat, 27 Feb 2010 21:03:28 +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 E58838FC14; Sat, 27 Feb 2010 21:03:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o1RKub0U024054; Sat, 27 Feb 2010 13:56:37 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 27 Feb 2010 13:56:50 -0700 (MST) Message-Id: <20100227.135650.321689433999139524.imp@bsdimp.com> To: jmallett@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <201002270356.o1R3uDHe044895@svn.freebsd.org> References: <201002270356.o1R3uDHe044895@svn.freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.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-user@FreeBSD.org Subject: Re: svn commit: r204394 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 21:03:28 -0000 In message: <201002270356.o1R3uDHe044895@svn.freebsd.org> Juli Mallett writes: : Author: jmallett : Date: Sat Feb 27 03:56:12 2010 : New Revision: 204394 : URL: http://svn.freebsd.org/changeset/base/204394 : : Log: : o) Correct the ISA and -march values for Octeon -- it's not MIPS32. : o) Switch to using the n32 ABI. : : Modified: : user/jmallett/octeon/sys/mips/conf/OCTEON1-32 : : Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 : ============================================================================== : --- user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Feb 27 03:55:08 2010 (r204393) : +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Feb 27 03:56:12 2010 (r204394) : @@ -24,16 +24,18 @@ ident OCTEON1 : # Don't build any modules yet. : makeoptions MODULES_OVERRIDE="" : makeoptions TARGET_BIG_ENDIAN=defined : -makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1.32 : +makeoptions TARGET_N32=defined : +makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1.n32 : : -makeoptions KERNLOADADDR=0x81000000 : +makeoptions KERNLOADADDR=0xffffffff81000000 : include "../cavium/std.octeon1" : : hints "OCTEON1.hints" #Default places to look for devices. : : makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols : : -options ISA_MIPS32 : +options ISA_MIPS64 This likely has some bad ripple effects... : +makeoptions ARCH_FLAGS="-march=mips64 -mabi=n32" This should have been -march=octeon :) : options DDB : options KDB From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 21:03:28 2010 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C869E106564A; Sat, 27 Feb 2010 21:03:28 +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 6D5DE8FC18; Sat, 27 Feb 2010 21:03:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o1RKsttR023998; Sat, 27 Feb 2010 13:54:55 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 27 Feb 2010 13:55:08 -0700 (MST) Message-Id: <20100227.135508.999284356098972095.imp@bsdimp.com> To: jmallett@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <201002270333.o1R3XVJb039720@svn.freebsd.org> References: <201002270333.o1R3XVJb039720@svn.freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.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-user@FreeBSD.org Subject: Re: svn commit: r204389 - in user/jmallett/octeon/sys/mips: include mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 21:03:28 -0000 In message: <201002270333.o1R3XVJb039720@svn.freebsd.org> Juli Mallett writes: : Author: jmallett : Date: Sat Feb 27 03:33:31 2010 : New Revision: 204389 : URL: http://svn.freebsd.org/changeset/base/204389 : : Log: : Check for __mips_n32, not ISA_MIPS32, on Octeon to tell whether we have : longer-than-pointer bus addresses. It's the ABI that matters (or at least : it's more like the ABI than the ISA that matters.) : : Modified: : user/jmallett/octeon/sys/mips/include/_bus.h : user/jmallett/octeon/sys/mips/mips/bus_space_generic.c : : Modified: user/jmallett/octeon/sys/mips/include/_bus.h : ============================================================================== : --- user/jmallett/octeon/sys/mips/include/_bus.h Sat Feb 27 03:30:48 2010 (r204388) : +++ user/jmallett/octeon/sys/mips/include/_bus.h Sat Feb 27 03:33:31 2010 (r204389) : @@ -35,10 +35,10 @@ : * Bus address and size types : */ : #include "opt_cputype.h" : -#if !(defined(TARGET_OCTEON) && defined(ISA_MIPS32)) : -typedef uintptr_t bus_addr_t; : -#else : +#if defined(TARGET_OCTEON) && defined(__mips_n32) : typedef uint64_t bus_addr_t; : +#else : +typedef uintptr_t bus_addr_t; : #endif : typedef uintptr_t bus_size_t; I'm starting to think that we need this to be subport specific... : Modified: user/jmallett/octeon/sys/mips/mips/bus_space_generic.c : ============================================================================== : --- user/jmallett/octeon/sys/mips/mips/bus_space_generic.c Sat Feb 27 03:30:48 2010 (r204388) : +++ user/jmallett/octeon/sys/mips/mips/bus_space_generic.c Sat Feb 27 03:33:31 2010 (r204389) : @@ -198,7 +198,7 @@ static struct bus_space generic_space = : : /* Ultra-gross kludge */ : #include "opt_cputype.h" : -#if defined(TARGET_OCTEON) && defined(ISA_MIPS32) : +#if defined(TARGET_OCTEON) && defined(__mips_n32) : #include : #define rd8(a) oct_read8(a) : #define rd16(a) oct_read16(a) this doesn't seem quite right... This kludge is also likely to go away in the future... Warner From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 21:10:40 2010 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30E4C1065673; Sat, 27 Feb 2010 21:10:40 +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 CF0AA8FC1B; Sat, 27 Feb 2010 21:10:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o1RL8BBx024131; Sat, 27 Feb 2010 14:08:11 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 27 Feb 2010 14:08:24 -0700 (MST) Message-Id: <20100227.140824.1098872334883620606.imp@bsdimp.com> To: jmallett@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <201002271943.o1RJhEtD055094@svn.freebsd.org> References: <201002271943.o1RJhEtD055094@svn.freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.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-user@FreeBSD.org Subject: Re: svn commit: r204428 - in user/jmallett/octeon: contrib/gcc/config/mips gnu/usr.bin/binutils/ld share/mk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 21:10:40 -0000 In message: <201002271943.o1RJhEtD055094@svn.freebsd.org> Juli Mallett writes: : +# XXX What if 64-bit? Need TARGET_ABI? !banner NO No more TARGET_FOO kludges. Warner From owner-svn-src-user@FreeBSD.ORG Sat Feb 27 21:10:40 2010 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0E4D106566B; Sat, 27 Feb 2010 21:10:40 +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 935D58FC0C; Sat, 27 Feb 2010 21:10:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o1RL64Vd024128; Sat, 27 Feb 2010 14:06:08 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 27 Feb 2010 14:06:17 -0700 (MST) Message-Id: <20100227.140617.295937982770209745.imp@bsdimp.com> To: jmallett@FreeBSD.org From: "M. Warner Losh" In-Reply-To: References: <201002270338.o1R3cd04040906@svn.freebsd.org> <20100227100134.52899b18@kan.dnsalias.net> X-Mailer: Mew version 6.3 on Emacs 22.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, kabaev@gmail.com, svn-src-user@FreeBSD.org Subject: Re: svn commit: r204391 - in user/jmallett/octeon/sys: ddb mips/mips ufs/ffs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 21:10:41 -0000 In message: Juli Mallett writes: : On Sat, Feb 27, 2010 at 07:01, Alexander Kabaev wrote: : > On Sat, 27 Feb 2010 03:38:38 +0000 (UTC) : > Juli Mallett wrote: : > : >> Make ddb commands take an address as an intptr_t, not a db_expr_t. : >> It is possible to have 32-bit pointers and 64-bit registers and thus : >> a 64-bit db_expr_t. : >> : > : > This is a step back, imho. Can you redefine db_expr_t to be of : > appropriate size instead? : : I'm not thrilled with it and wouldn't commit it to the main tree. : db_expr_t is register/expression sized, though, so for an n32 kernel* : it is right for it to be bigger than a pointer. Being able to view : and modify only the low 32-bits of registers just because pointers are : 32 bits is demonstrably incorrect. I think using db_addr_t makes some : sense, assuming there are no sign-extension problems from its being : unsigned. n32 is an odd-ball ABI. the pointers are stored as 32-bit, but the registers are 64-bit and through the magic of signed extension, things work.... : *: Whether having an n32 kernel makes sense would be a reasonable : question to ask. An n32 loader and an n64 kernel (assuming support : for running all kinds of binaries in userland) should be good enough : to cover the case where having an n64 kernel is undesirable but an n32 : kernel is desirable, which is where the bootloader is incapable of : loading ELF64 properly (we could also support o64, but there are bugs : with o64 in the toolchain that we'd have to fix.) I'm spending effort : on an n32 kernel right now because I was having more trouble getting a : bootable n64 kernel together than an n32 one. I'm not sure that an n32 kernel makes sense, in the long run. o64 doesn't make sense. n64 is really the only kernel that makes sense. It gets rid of lots of kludges and doesn't introduce its own set... o32 kernel for the mips32 ABIs is correct (since it doesn't have 64-bit registers). Warner