From owner-svn-src-stable@FreeBSD.ORG Tue Sep 3 05:20:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 78DFDA40; Tue, 3 Sep 2013 05:20:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 66E962511; Tue, 3 Sep 2013 05:20:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r835Kh8d038411; Tue, 3 Sep 2013 05:20:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r835KhCQ038410; Tue, 3 Sep 2013 05:20:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201309030520.r835KhCQ038410@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Sep 2013 05:20:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255168 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Sep 2013 05:20:43 -0000 Author: kib Date: Tue Sep 3 05:20:42 2013 New Revision: 255168 URL: http://svnweb.freebsd.org/changeset/base/255168 Log: MFC r254945: When allocating a pbuf for the cluster write, do not sleep waiting for the available pbuf when passed vnode is backing md(4). Other i/o directed to the same md device might already hold pbufs, and then we could deadlock since only our progress can free a pbuf needed for wakeup. Modified: stable/9/sys/kern/vfs_cluster.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_cluster.c ============================================================================== --- stable/9/sys/kern/vfs_cluster.c Tue Sep 3 02:28:31 2013 (r255167) +++ stable/9/sys/kern/vfs_cluster.c Tue Sep 3 05:20:42 2013 (r255168) @@ -846,7 +846,9 @@ cluster_wbuild_gb(struct vnode *vp, long (tbp->b_bcount != tbp->b_bufsize) || (tbp->b_bcount != size) || (len == 1) || - ((bp = getpbuf(&cluster_pbuf_freecnt)) == NULL)) { + ((bp = (vp->v_vflag & VV_MD) != 0 ? + trypbuf(&cluster_pbuf_freecnt) : + getpbuf(&cluster_pbuf_freecnt)) == NULL)) { totalwritten += tbp->b_bufsize; bawrite(tbp); ++start_lbn; From owner-svn-src-stable@FreeBSD.ORG Tue Sep 3 16:29:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5797A15D; Tue, 3 Sep 2013 16:29:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 36DD8299B; Tue, 3 Sep 2013 16:29:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r83GTH1p050016; Tue, 3 Sep 2013 16:29:17 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r83GTEOR049959; Tue, 3 Sep 2013 16:29:14 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201309031629.r83GTEOR049959@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 3 Sep 2013 16:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255183 - in stable/9/sys: conf fs/ext2fs modules/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Sep 2013 16:29:17 -0000 Author: pfg Date: Tue Sep 3 16:29:14 2013 New Revision: 255183 URL: http://svnweb.freebsd.org/changeset/base/255183 Log: Add read-only support for extents in ext2fs. Basic support for extents was implemented by Zheng Liu as part of his Google Summer of Code in 2010. This support is read-only at this time. In addition to extents we also support the huge_file extension for read-only purposes. This works nicely with the additional support for birthtime/nanosec timestamps and dir_index that have been added lately. The implementation may not work for all ext4 filesystems as it doesn't support some features that are being enabled by default on recent linux like flex_bg. Nevertheless, the feature should be very useful for migration or simple access in filesystems that have been converted from ext2/3 or don't use incompatible features. Special thanks to Zheng Liu for his dedication and continued work to support ext2 in FreeBSD. Submitted by: Zheng Liu (lz@) Reviewed by: Mike Ma, Christoph Mallon (previous version) Sponsored by: Google Inc. Added: stable/9/sys/fs/ext2fs/ext2_extents.c - copied unchanged from r254260, head/sys/fs/ext2fs/ext2_extents.c stable/9/sys/fs/ext2fs/ext2_extents.h - copied unchanged from r254260, head/sys/fs/ext2fs/ext2_extents.h Modified: stable/9/sys/conf/files stable/9/sys/fs/ext2fs/ext2_bmap.c stable/9/sys/fs/ext2fs/ext2_dinode.h stable/9/sys/fs/ext2fs/ext2_extern.h stable/9/sys/fs/ext2fs/ext2_inode_cnv.c stable/9/sys/fs/ext2fs/ext2_subr.c stable/9/sys/fs/ext2fs/ext2_vfsops.c stable/9/sys/fs/ext2fs/ext2_vnops.c stable/9/sys/fs/ext2fs/ext2fs.h stable/9/sys/fs/ext2fs/inode.h stable/9/sys/modules/ext2fs/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/conf/files Tue Sep 3 16:29:14 2013 (r255183) @@ -2375,6 +2375,7 @@ geom/zero/g_zero.c optional geom_zero fs/ext2fs/ext2_alloc.c optional ext2fs fs/ext2fs/ext2_balloc.c optional ext2fs fs/ext2fs/ext2_bmap.c optional ext2fs +fs/ext2fs/ext2_extents.c optional ext2fs fs/ext2fs/ext2_inode.c optional ext2fs fs/ext2fs/ext2_inode_cnv.c optional ext2fs fs/ext2fs/ext2_hash.c optional ext2fs Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_bmap.c Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/fs/ext2fs/ext2_bmap.c Tue Sep 3 16:29:14 2013 (r255183) @@ -46,10 +46,14 @@ #include #include +#include #include +#include #include #include +static int ext4_bmapext(struct vnode *, int32_t, int64_t *, int *, int *); + /* * Bmap converts the logical block number of a file to its physical block * number on the disk. The conversion is done by using the logical block @@ -58,7 +62,7 @@ int ext2_bmap(struct vop_bmap_args *ap) { - int32_t blkno; + int64_t blkno; int error; /* @@ -70,13 +74,57 @@ ext2_bmap(struct vop_bmap_args *ap) if (ap->a_bnp == NULL) return (0); - error = ext2_bmaparray(ap->a_vp, ap->a_bn, &blkno, - ap->a_runp, ap->a_runb); + if (VTOI(ap->a_vp)->i_flags & EXT4_EXTENTS) + error = ext4_bmapext(ap->a_vp, ap->a_bn, &blkno, + ap->a_runp, ap->a_runb); + else + error = ext2_bmaparray(ap->a_vp, ap->a_bn, &blkno, + ap->a_runp, ap->a_runb); *ap->a_bnp = blkno; return (error); } /* + * This function converts the logical block number of a file to + * its physical block number on the disk within ext4 extents. + */ +static int +ext4_bmapext(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb) +{ + struct inode *ip; + struct m_ext2fs *fs; + struct ext4_extent *ep; + struct ext4_extent_path path; + daddr_t lbn; + + ip = VTOI(vp); + fs = ip->i_e2fs; + lbn = bn; + + /* + * TODO: need to implement read ahead to improve the performance. + */ + if (runp != NULL) + *runp = 0; + + if (runb != NULL) + *runb = 0; + + ext4_ext_find_extent(fs, ip, lbn, &path); + ep = path.ep_ext; + if (ep == NULL) + return (EIO); + + *bnp = fsbtodb(fs, lbn - ep->e_blk + + (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32)); + + if (*bnp == 0) + *bnp = -1; + + return (0); +} + +/* * Indirect blocks are now on the vnode for the file. They are given negative * logical block numbers. Indirect blocks are addressed by the negative * address of the first data block to which they point. Double indirect blocks @@ -91,7 +139,7 @@ ext2_bmap(struct vop_bmap_args *ap) */ int -ext2_bmaparray(struct vnode *vp, int32_t bn, int32_t *bnp, int *runp, int *runb) +ext2_bmaparray(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb) { struct inode *ip; struct buf *bp; Modified: stable/9/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_dinode.h Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/fs/ext2fs/ext2_dinode.h Tue Sep 3 16:29:14 2013 (r255183) @@ -79,6 +79,8 @@ #define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \ EXT2F_ROCOMPAT_EXTRA_ISIZE)) +#define E2DI_HAS_HUGE_FILE(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \ + EXT2F_ROCOMPAT_HUGE_FILE)) /* * Constants relative to the data blocks Copied: stable/9/sys/fs/ext2fs/ext2_extents.c (from r254260, head/sys/fs/ext2fs/ext2_extents.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/fs/ext2fs/ext2_extents.c Tue Sep 3 16:29:14 2013 (r255183, copy of r254260, head/sys/fs/ext2fs/ext2_extents.c) @@ -0,0 +1,177 @@ +/*- + * Copyright (c) 2010 Zheng Liu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +static void ext4_ext_binsearch_index(struct inode *ip, struct ext4_extent_path + *path, daddr_t lbn) +{ + struct ext4_extent_header *ehp = path->ep_header; + struct ext4_extent_index *l, *r, *m; + + l = (struct ext4_extent_index *)(char *)(ehp + 1); + r = (struct ext4_extent_index *)(char *)(ehp + 1) + ehp->eh_ecount - 1; + while (l <= r) { + m = l + (r - l) / 2; + if (lbn < m->ei_blk) + r = m - 1; + else + l = m + 1; + } + + path->ep_index = l - 1; +} + +static void +ext4_ext_binsearch(struct inode *ip, struct ext4_extent_path *path, daddr_t lbn) +{ + struct ext4_extent_header *ehp = path->ep_header; + struct ext4_extent *l, *r, *m; + + if (ehp->eh_ecount == 0) + return; + + l = (struct ext4_extent *)(char *)(ehp + 1); + r = (struct ext4_extent *)(char *)(ehp + 1) + ehp->eh_ecount - 1; + while (l <= r) { + m = l + (r - l) / 2; + if (lbn < m->e_blk) + r = m - 1; + else + l = m + 1; + } + + path->ep_ext = l - 1; +} + +/* + * Find a block in ext4 extent cache. + */ +int +ext4_ext_in_cache(struct inode *ip, daddr_t lbn, struct ext4_extent *ep) +{ + struct ext4_extent_cache *ecp; + int ret = EXT4_EXT_CACHE_NO; + + ecp = &ip->i_ext_cache; + + /* cache is invalid */ + if (ecp->ec_type == EXT4_EXT_CACHE_NO) + return (ret); + + if (lbn >= ecp->ec_blk && lbn < ecp->ec_blk + ecp->ec_len) { + ep->e_blk = ecp->ec_blk; + ep->e_start_lo = ecp->ec_start & 0xffffffff; + ep->e_start_hi = ecp->ec_start >> 32 & 0xffff; + ep->e_len = ecp->ec_len; + ret = ecp->ec_type; + } + return (ret); +} + +/* + * Put an ext4_extent structure in ext4 cache. + */ +void +ext4_ext_put_cache(struct inode *ip, struct ext4_extent *ep, int type) +{ + struct ext4_extent_cache *ecp; + + ecp = &ip->i_ext_cache; + ecp->ec_type = type; + ecp->ec_blk = ep->e_blk; + ecp->ec_len = ep->e_len; + ecp->ec_start = (daddr_t)ep->e_start_hi << 32 | ep->e_start_lo; +} + +/* + * Find an extent. + */ +struct ext4_extent_path * +ext4_ext_find_extent(struct m_ext2fs *fs, struct inode *ip, + daddr_t lbn, struct ext4_extent_path *path) +{ + struct vnode *vp; + struct ext4_extent_header *ehp; + uint16_t i; + int error, size; + daddr_t nblk; + + vp = ITOV(ip); + ehp = (struct ext4_extent_header *)(char *)ip->i_db; + + if (ehp->eh_magic != EXT4_EXT_MAGIC) + return (NULL); + + path->ep_header = ehp; + + for (i = ehp->eh_depth; i != 0; --i) { + ext4_ext_binsearch_index(ip, path, lbn); + path->ep_depth = 0; + path->ep_ext = NULL; + + nblk = (daddr_t)path->ep_index->ei_leaf_hi << 32 | + path->ep_index->ei_leaf_lo; + size = blksize(fs, ip, nblk); + if (path->ep_bp != NULL) { + brelse(path->ep_bp); + path->ep_bp = NULL; + } + error = bread(ip->i_devvp, fsbtodb(fs, nblk), size, NOCRED, + &path->ep_bp); + if (error) { + brelse(path->ep_bp); + path->ep_bp = NULL; + return (NULL); + } + ehp = (struct ext4_extent_header *)path->ep_bp->b_data; + path->ep_header = ehp; + } + + path->ep_depth = i; + path->ep_ext = NULL; + path->ep_index = NULL; + + ext4_ext_binsearch(ip, path, lbn); + return (path); +} Copied: stable/9/sys/fs/ext2fs/ext2_extents.h (from r254260, head/sys/fs/ext2fs/ext2_extents.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/fs/ext2fs/ext2_extents.h Tue Sep 3 16:29:14 2013 (r255183, copy of r254260, head/sys/fs/ext2fs/ext2_extents.h) @@ -0,0 +1,99 @@ +/*- + * Copyright (c) 2012, 2010 Zheng Liu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _FS_EXT2FS_EXT2_EXTENTS_H_ +#define _FS_EXT2FS_EXT2_EXTENTS_H_ + +#include + +#define EXT4_EXT_MAGIC 0xf30a + +#define EXT4_EXT_CACHE_NO 0 +#define EXT4_EXT_CACHE_GAP 1 +#define EXT4_EXT_CACHE_IN 2 + +/* + * Ext4 file system extent on disk. + */ +struct ext4_extent { + uint32_t e_blk; /* first logical block */ + uint16_t e_len; /* number of blocks */ + uint16_t e_start_hi; /* high 16 bits of physical block */ + uint32_t e_start_lo; /* low 32 bits of physical block */ +}; + +/* + * Extent index on disk. + */ +struct ext4_extent_index { + uint32_t ei_blk; /* indexes logical blocks */ + uint32_t ei_leaf_lo; /* points to physical block of the + * next level */ + uint16_t ei_leaf_hi; /* high 16 bits of physical block */ + uint16_t ei_unused; +}; + +/* + * Extent tree header. + */ +struct ext4_extent_header { + uint16_t eh_magic; /* magic number: 0xf30a */ + uint16_t eh_ecount; /* number of valid entries */ + uint16_t eh_max; /* capacity of store in entries */ + uint16_t eh_depth; /* the depth of extent tree */ + uint32_t eh_gen; /* generation of extent tree */ +}; + +/* + * Save cached extent. + */ +struct ext4_extent_cache { + daddr_t ec_start; /* extent start */ + uint32_t ec_blk; /* logical block */ + uint32_t ec_len; + uint32_t ec_type; +}; + +/* + * Save path to some extent. + */ +struct ext4_extent_path { + uint16_t ep_depth; + struct buf *ep_bp; + struct ext4_extent *ep_ext; + struct ext4_extent_index *ep_index; + struct ext4_extent_header *ep_header; +}; + +struct inode; +struct m_ext2fs; +int ext4_ext_in_cache(struct inode *, daddr_t, struct ext4_extent *); +void ext4_ext_put_cache(struct inode *, struct ext4_extent *, int); +struct ext4_extent_path *ext4_ext_find_extent(struct m_ext2fs *fs, + struct inode *, daddr_t, struct ext4_extent_path *); + +#endif /* !_FS_EXT2FS_EXT2_EXTENTS_H_ */ Modified: stable/9/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_extern.h Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/fs/ext2fs/ext2_extern.h Tue Sep 3 16:29:14 2013 (r255183) @@ -57,7 +57,7 @@ int ext2_blkatoff(struct vnode *, off_t, void ext2_blkfree(struct inode *, int32_t, long); int32_t ext2_blkpref(struct inode *, e2fs_lbn_t, int, int32_t *, int32_t); int ext2_bmap(struct vop_bmap_args *); -int ext2_bmaparray(struct vnode *, int32_t, int32_t *, int *, int *); +int ext2_bmaparray(struct vnode *, int32_t, int64_t *, int *, int *); void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int); void ext2_dirbad(struct inode *ip, doff_t offset, char *how); void ext2_ei2i(struct ext2fs_dinode *, struct inode *); Modified: stable/9/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Tue Sep 3 16:29:14 2013 (r255183) @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -44,22 +45,34 @@ void ext2_print_inode(struct inode *in) { int i; + struct ext4_extent_header *ehp; + struct ext4_extent *ep; printf( "Inode: %5d", in->i_number); printf( /* "Inode: %5d" */ " Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n", "n/a", in->i_mode, in->i_flags, in->i_gen); - printf( "User: %5lu Group: %5lu Size: %lu\n", - (unsigned long)in->i_uid, (unsigned long)in->i_gid, - (unsigned long)in->i_size); - printf( "Links: %3d Blockcount: %d\n", - in->i_nlink, in->i_blocks); + printf("User: %5u Group: %5u Size: %ju\n", + in->i_uid, in->i_gid, (uintmax_t)in->i_size); + printf("Links: %3d Blockcount: %ju\n", + in->i_nlink, (uintmax_t)in->i_blocks); printf( "ctime: 0x%x", in->i_ctime); printf( "atime: 0x%x", in->i_atime); printf( "mtime: 0x%x", in->i_mtime); - printf( "BLOCKS: "); - for(i=0; i < (in->i_blocks <= 24 ? ((in->i_blocks+1)/2): 12); i++) - printf("%d ", in->i_db[i]); + if (E2DI_HAS_XTIME(in)) + printf("crtime %#x ", in->i_birthtime); + printf("BLOCKS:"); + for (i = 0; i < (in->i_blocks <= 24 ? (in->i_blocks + 1) / 2 : 12); i++) + printf(" %d", in->i_db[i]); + printf("\n"); + printf("Extents:\n"); + ehp = (struct ext4_extent_header *)in->i_db; + printf("Header (magic 0x%x entries %d max %d depth %d gen %d)\n", + ehp->eh_magic, ehp->eh_ecount, ehp->eh_max, ehp->eh_depth, + ehp->eh_gen); + ep = (struct ext4_extent *)(char *)(ehp + 1); + printf("Index (blk %d len %d start_lo %d start_hi %d)\n", ep->e_blk, + ep->e_len, ep->e_start_lo, ep->e_start_hi); printf("\n"); } @@ -96,6 +109,11 @@ ext2_ei2i(struct ext2fs_dinode *ei, stru ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0; ip->i_flags |= (ei->e2di_flags & EXT2_NODUMP) ? UF_NODUMP : 0; ip->i_blocks = ei->e2di_nblock; + if (E2DI_HAS_HUGE_FILE(ip)) { + ip->i_blocks |= (uint64_t)ei->e2di_nblock_high << 32; + if (ei->e2di_flags & EXT4_HUGE_FILE) + ip->i_blocks = fsbtodb(ip->i_e2fs, ip->i_blocks); + } ip->i_gen = ei->e2di_gen; ip->i_uid = ei->e2di_uid; ip->i_gid = ei->e2di_gid; @@ -138,7 +156,8 @@ ext2_i2ei(struct inode *ip, struct ext2f ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0; ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0; ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP: 0; - ei->e2di_nblock = ip->i_blocks; + ei->e2di_nblock = ip->i_blocks & 0xffffffff; + ei->e2di_nblock_high = ip->i_blocks >> 32 & 0xffff; ei->e2di_gen = ip->i_gen; ei->e2di_uid = ip->i_uid; ei->e2di_gid = ip->i_gid; Modified: stable/9/sys/fs/ext2fs/ext2_subr.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_subr.c Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/fs/ext2fs/ext2_subr.c Tue Sep 3 16:29:14 2013 (r255183) @@ -50,10 +50,11 @@ #include #include #include - -#ifdef KDB +#include #include +#include +#ifdef KDB void ext2_checkoverlap(struct buf *, struct inode *); #endif @@ -70,21 +71,63 @@ ext2_blkatoff(struct vnode *vp, off_t of struct buf *bp; e2fs_lbn_t lbn; int bsize, error; + daddr_t newblk; + struct ext4_extent *ep; + struct ext4_extent_path path; ip = VTOI(vp); fs = ip->i_e2fs; lbn = lblkno(fs, offset); bsize = blksize(fs, ip, lbn); - *bpp = NULL; - if ((error = bread(vp, lbn, bsize, NOCRED, &bp)) != 0) { + + /* + * The EXT4_EXTENTS requires special treatment, otherwise we can + * fall back to the normal path. + */ + if (!(ip->i_flags & EXT4_EXTENTS)) + goto normal; + + memset(&path, 0, sizeof(path)); + if (ext4_ext_find_extent(fs, ip, lbn, &path) == NULL) + goto normal; + ep = path.ep_ext; + if (ep == NULL) + goto normal; + + newblk = lbn - ep->e_blk + + (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32); + + if (path.ep_bp != NULL) { + brelse(path.ep_bp); + path.ep_bp = NULL; + } + error = bread(ip->i_devvp, fsbtodb(fs, newblk), bsize, NOCRED, &bp); + if (error != 0) { brelse(bp); return (error); } if (res) *res = (char *)bp->b_data + blkoff(fs, offset); + /* + * If EXT4_EXTENTS is enabled we would get a wrong offset so + * reset b_offset here. + */ + bp->b_offset = lbn * bsize; *bpp = bp; return (0); + +normal: + if (*bpp == NULL) { + if ((error = bread(vp, lbn, bsize, NOCRED, &bp)) != 0) { + brelse(bp); + return (error); + } + if (res) + *res = (char *)bp->b_data + blkoff(fs, offset); + *bpp = bp; + } + return (0); } #ifdef KDB Modified: stable/9/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vfsops.c Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/fs/ext2fs/ext2_vfsops.c Tue Sep 3 16:29:14 2013 (r255183) @@ -397,9 +397,11 @@ compute_sb_data(struct vnode *devvp, str if (es->e2fs_rev == E2FS_REV0 || !EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_LARGEFILE)) fs->e2fs_maxfilesize = 0x7fffffff; - else - fs->e2fs_maxfilesize = 0x7fffffffffffffff; - + else { + fs->e2fs_maxfilesize = 0xffffffffffff; + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_HUGE_FILE)) + fs->e2fs_maxfilesize = 0x7fffffffffffffff; + } if (es->e4fs_flags & E2FS_UNSIGNED_HASH) { fs->e2fs_uhash = 3; } else if ((es->e4fs_flags & E2FS_SIGNED_HASH) == 0) { @@ -970,8 +972,12 @@ ext2_vget(struct mount *mp, ino_t ino, i * Now we want to make sure that block pointers for unused * blocks are zeroed out - ext2_balloc depends on this * although for regular files and directories only + * + * If EXT4_EXTENTS flag is enabled, unused blocks aren't + * zeroed out because we could corrupt the extent tree. */ - if(S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode)) { + if (!(ip->i_flags & EXT4_EXTENTS) && + (S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode))) { used_blocks = (ip->i_size+fs->e2fs_bsize-1) / fs->e2fs_bsize; for (i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) ip->i_db[i] = 0; Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vnops.c Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/fs/ext2fs/ext2_vnops.c Tue Sep 3 16:29:14 2013 (r255183) @@ -86,6 +86,8 @@ static int ext2_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *); static void ext2_itimes_locked(struct vnode *); +static int ext4_ext_read(struct vop_read_args *); +static int ext2_ind_read(struct vop_read_args *); static vop_access_t ext2_access; static int ext2_chmod(struct vnode *, int, struct ucred *, struct thread *); @@ -1333,7 +1335,7 @@ ext2_strategy(struct vop_strategy_args * struct vnode *vp = ap->a_vp; struct inode *ip; struct bufobj *bo; - int32_t blkno; + int64_t blkno; int error; ip = VTOI(vp); @@ -1613,6 +1615,29 @@ ext2_read(struct vop_read_args *ap) { struct vnode *vp; struct inode *ip; + int error; + + vp = ap->a_vp; + ip = VTOI(vp); + + /*EXT4_EXT_LOCK(ip);*/ + if (ip->i_flags & EXT4_EXTENTS) + error = ext4_ext_read(ap); + else + error = ext2_ind_read(ap); + /*EXT4_EXT_UNLOCK(ip);*/ + return (error); +} + + +/* + * Vnode op for reading. + */ +static int +ext2_ind_read(struct vop_read_args *ap) +{ + struct vnode *vp; + struct inode *ip; struct uio *uio; struct m_ext2fs *fs; struct buf *bp; @@ -1763,6 +1788,107 @@ ext2_ioctl(struct vop_ioctl_args *ap) } /* + * this function handles ext4 extents block mapping + */ +static int +ext4_ext_read(struct vop_read_args *ap) +{ + struct vnode *vp; + struct inode *ip; + struct uio *uio; + struct m_ext2fs *fs; + struct buf *bp; + struct ext4_extent nex, *ep; + struct ext4_extent_path path; + daddr_t lbn, newblk; + off_t bytesinfile; + int cache_type; + ssize_t orig_resid; + int error; + long size, xfersize, blkoffset; + + vp = ap->a_vp; + ip = VTOI(vp); + uio = ap->a_uio; + memset(&path, 0, sizeof(path)); + + orig_resid = uio->uio_resid; + KASSERT(orig_resid >= 0, ("%s: uio->uio_resid < 0", __func__)); + if (orig_resid == 0) + return (0); + KASSERT(uio->uio_offset >= 0, ("%s: uio->uio_offset < 0", __func__)); + fs = ip->i_e2fs; + if (uio->uio_offset < ip->i_size && uio->uio_offset >= fs->e2fs_maxfilesize) + return (EOVERFLOW); + + while (uio->uio_resid > 0) { + if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0) + break; + lbn = lblkno(fs, uio->uio_offset); + size = blksize(fs, ip, lbn); + blkoffset = blkoff(fs, uio->uio_offset); + + xfersize = fs->e2fs_fsize - blkoffset; + xfersize = MIN(xfersize, uio->uio_resid); + xfersize = MIN(xfersize, bytesinfile); + + /* get block from ext4 extent cache */ + cache_type = ext4_ext_in_cache(ip, lbn, &nex); + switch (cache_type) { + case EXT4_EXT_CACHE_NO: + ext4_ext_find_extent(fs, ip, lbn, &path); + ep = path.ep_ext; + if (ep == NULL) + return (EIO); + + ext4_ext_put_cache(ip, ep, EXT4_EXT_CACHE_IN); + + newblk = lbn - ep->e_blk + (ep->e_start_lo | + (daddr_t)ep->e_start_hi << 32); + + if (path.ep_bp != NULL) { + brelse(path.ep_bp); + path.ep_bp = NULL; + } + break; + + case EXT4_EXT_CACHE_GAP: + /* block has not been allocated yet */ + return (0); + + case EXT4_EXT_CACHE_IN: + newblk = lbn - nex.e_blk + (nex.e_start_lo | + (daddr_t)nex.e_start_hi << 32); + break; + + default: + panic("%s: invalid cache type", __func__); + } + + error = bread(ip->i_devvp, fsbtodb(fs, newblk), size, NOCRED, &bp); + if (error) { + brelse(bp); + return (error); + } + + size -= bp->b_resid; + if (size < xfersize) { + if (size == 0) { + bqrelse(bp); + break; + } + xfersize = size; + } + error = uiomove(bp->b_data + blkoffset, (int)xfersize, uio); + bqrelse(bp); + if (error) + return (error); + } + + return (0); +} + +/* * Vnode op for writing. */ static int Modified: stable/9/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2fs.h Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/fs/ext2fs/ext2fs.h Tue Sep 3 16:29:14 2013 (r255183) @@ -201,12 +201,18 @@ struct csum { * - EXT2F_ROCOMPAT_SPARSESUPER * - EXT2F_ROCOMPAT_LARGEFILE * - EXT2F_INCOMPAT_FTYPE + * + * We partially (read-only) support the following EXT4 features: + * - EXT2F_ROCOMPAT_HUGE_FILE + * - EXT2F_ROCOMPAT_EXTRA_ISIZE + * - EXT2F_INCOMPAT_EXTENTS */ #define EXT2F_COMPAT_SUPP 0x0000 #define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \ EXT2F_ROCOMPAT_LARGEFILE | \ EXT2F_ROCOMPAT_EXTRA_ISIZE) -#define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE +#define EXT2F_INCOMPAT_SUPP (EXT2F_INCOMPAT_FTYPE | \ + EXT2F_INCOMPAT_EXTENTS) /* Assume that user mode programs are passing in an ext2fs superblock, not * a kernel struct super_block. This will allow us to call the feature-test Modified: stable/9/sys/fs/ext2fs/inode.h ============================================================================== --- stable/9/sys/fs/ext2fs/inode.h Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/fs/ext2fs/inode.h Tue Sep 3 16:29:14 2013 (r255183) @@ -38,9 +38,13 @@ #ifndef _FS_EXT2FS_INODE_H_ #define _FS_EXT2FS_INODE_H_ +#include #include +#include #include +#include + /* * This must agree with the definition in . */ @@ -86,7 +90,10 @@ struct inode { /* Fields from struct dinode in UFS. */ uint16_t i_mode; /* IFMT, permissions; see below. */ int16_t i_nlink; /* File link count. */ + uint32_t i_uid; /* File owner. */ + uint32_t i_gid; /* File group. */ uint64_t i_size; /* File byte count. */ + uint64_t i_blocks; /* Blocks actually held. */ int32_t i_atime; /* Last access time. */ int32_t i_mtime; /* Last modified time. */ int32_t i_ctime; /* Last inode change time. */ @@ -95,13 +102,12 @@ struct inode { int32_t i_atimensec; /* Last access time. */ int32_t i_ctimensec; /* Last inode change time. */ int32_t i_birthnsec; /* Inode creation time. */ + uint32_t i_gen; /* Generation number. */ + uint32_t i_flags; /* Status flags (chflags). */ uint32_t i_db[NDADDR]; /* Direct disk blocks. */ uint32_t i_ib[NIADDR]; /* Indirect disk blocks. */ - uint32_t i_flags; /* Status flags (chflags). */ - uint32_t i_blocks; /* Blocks actually held. */ - uint32_t i_gen; /* Generation number. */ - uint32_t i_uid; /* File owner. */ - uint32_t i_gid; /* File group. */ + + struct ext4_extent_cache i_ext_cache; /* cache for ext4 extent */ }; /* Modified: stable/9/sys/modules/ext2fs/Makefile ============================================================================== --- stable/9/sys/modules/ext2fs/Makefile Tue Sep 3 16:15:28 2013 (r255182) +++ stable/9/sys/modules/ext2fs/Makefile Tue Sep 3 16:29:14 2013 (r255183) @@ -3,8 +3,8 @@ .PATH: ${.CURDIR}/../../fs/ext2fs KMOD= ext2fs SRCS= opt_ddb.h opt_directio.h opt_quota.h opt_suiddir.h vnode_if.h \ - ext2_alloc.c ext2_balloc.c ext2_bmap.c ext2_hash.c ext2_htree.c \ - ext2_inode.c ext2_inode_cnv.c ext2_lookup.c ext2_subr.c ext2_vfsops.c \ - ext2_vnops.c + ext2_alloc.c ext2_balloc.c ext2_bmap.c ext2_extents.c ext2_hash.c \ + ext2_htree.c ext2_inode.c ext2_inode_cnv.c ext2_lookup.c ext2_subr.c \ + ext2_vfsops.c ext2_vnops.c .include From owner-svn-src-stable@FreeBSD.ORG Tue Sep 3 16:41:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 462F98E9 for ; Tue, 3 Sep 2013 16:41:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm49-vm3.bullet.mail.bf1.yahoo.com (nm49-vm3.bullet.mail.bf1.yahoo.com [216.109.115.190]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 996FE2BCA for ; Tue, 3 Sep 2013 16:41:58 +0000 (UTC) Received: from [98.139.212.150] by nm49.bullet.mail.bf1.yahoo.com with NNFMP; 03 Sep 2013 16:36:34 -0000 Received: from [98.139.213.11] by tm7.bullet.mail.bf1.yahoo.com with NNFMP; 03 Sep 2013 16:36:34 -0000 Received: from [127.0.0.1] by smtp111.mail.bf1.yahoo.com with NNFMP; 03 Sep 2013 16:36:34 -0000 X-Yahoo-Newman-Id: 405708.4926.bm@smtp111.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: q2hMYDgVM1lxeM981Db5zggUD8o9egrF5NZ7jkxRiIhsUOu 4vkd0nx19kWUGId3tmviafb7BilQpZgmDt.MKBTOpJc5A8LBYrvl7d0jgKAq aYCsPrVfukyzCiFvZ6pZ66uMyHoHSdlB4OWGIsaBBtGadRdzApV2drie53p4 hGGTphvk2dq_oq9FuTP3NgmncS635HgN1y.vbvxMJKAsj4OA_du_nL5kfS2q RY6i_y9gqVtSk9XzEK4jXHHhKeOX97HczfOES6qr2kHGK4.R8xbxKu6Wq7Qs XhGOVlC8_q0Bwu0huTMrldORp3zAOezxWoEcpXpwXodBnTpbJknwfiYi_5m1 VJAOyR9yttI6AGz0TQsGrgWRJYJ_xWU0O5BdcewIZx9PEzICr.i_h3SE1CGe zh1ZzC8FN4ov2SwUHPbVrd.EK3UMF9GMOsFQ7lUEexdZpUs2xeveJljlU_RG h9nsaNCd2gKas37Pfdn2zgIjqrUtZeFPto5gIIxZOTD3rPfwoAFDn3betcPD FwpywXS7BBhTb_GcwXzkgGAyoDJlzgzz5Qe5Dh2efwT_8qlEt6n_Ptq_kGW7 lTlDvz2AZ1xuopIXvwyVZhlE2OiK7lG5GhFMGwoRaiHmGN6e8EA4CR0HNZuR Ehl_A63EmV1VXxMzM6e6ve6jKWz0- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with ) by smtp111.mail.bf1.yahoo.com with SMTP; 03 Sep 2013 09:36:34 -0700 PDT Message-ID: <52261010.60003@FreeBSD.org> Date: Tue, 03 Sep 2013 11:36:32 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130809 Thunderbird/17.0.8 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r255183 - in stable/9/sys: conf fs/ext2fs modules/ext2fs References: <201309031629.r83GTEOR049959@svn.freebsd.org> In-Reply-To: <201309031629.r83GTEOR049959@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Sep 2013 16:41:59 -0000 forgot to mention in the commit log, this is MFC r254260 (it can be deduced from the revision number in the copied files though) Pedro. On 03.09.2013 11:29, Pedro F. Giffuni wrote: > Author: pfg > Date: Tue Sep 3 16:29:14 2013 > New Revision: 255183 > URL: http://svnweb.freebsd.org/changeset/base/255183 > > Log: > Add read-only support for extents in ext2fs. > > Basic support for extents was implemented by Zheng Liu as part > of his Google Summer of Code in 2010. This support is read-only > at this time. > > In addition to extents we also support the huge_file extension > for read-only purposes. This works nicely with the additional > support for birthtime/nanosec timestamps and dir_index that > have been added lately. > > The implementation may not work for all ext4 filesystems as > it doesn't support some features that are being enabled by > default on recent linux like flex_bg. Nevertheless, the feature > should be very useful for migration or simple access in > filesystems that have been converted from ext2/3 or don't use > incompatible features. > > Special thanks to Zheng Liu for his dedication and continued > work to support ext2 in FreeBSD. > > Submitted by: Zheng Liu (lz@) > Reviewed by: Mike Ma, Christoph Mallon (previous version) > Sponsored by: Google Inc. > > Added: > stable/9/sys/fs/ext2fs/ext2_extents.c > - copied unchanged from r254260, head/sys/fs/ext2fs/ext2_extents.c > stable/9/sys/fs/ext2fs/ext2_extents.h > - copied unchanged from r254260, head/sys/fs/ext2fs/ext2_extents.h > Modified: > stable/9/sys/conf/files > stable/9/sys/fs/ext2fs/ext2_bmap.c > stable/9/sys/fs/ext2fs/ext2_dinode.h > stable/9/sys/fs/ext2fs/ext2_extern.h > stable/9/sys/fs/ext2fs/ext2_inode_cnv.c > stable/9/sys/fs/ext2fs/ext2_subr.c > stable/9/sys/fs/ext2fs/ext2_vfsops.c > stable/9/sys/fs/ext2fs/ext2_vnops.c > stable/9/sys/fs/ext2fs/ext2fs.h > stable/9/sys/fs/ext2fs/inode.h > stable/9/sys/modules/ext2fs/Makefile > Directory Properties: > stable/9/sys/ (props changed) > stable/9/sys/conf/ (props changed) > stable/9/sys/fs/ (props changed) > stable/9/sys/modules/ (props changed) > > Modified: stable/9/sys/conf/files > ============================================================================== > --- stable/9/sys/conf/files Tue Sep 3 16:15:28 2013 (r255182) > +++ stable/9/sys/conf/files Tue Sep 3 16:29:14 2013 (r255183) > @@ -2375,6 +2375,7 @@ geom/zero/g_zero.c optional geom_zero > fs/ext2fs/ext2_alloc.c optional ext2fs > fs/ext2fs/ext2_balloc.c optional ext2fs > fs/ext2fs/ext2_bmap.c optional ext2fs > +fs/ext2fs/ext2_extents.c optional ext2fs > fs/ext2fs/ext2_inode.c optional ext2fs > fs/ext2fs/ext2_inode_cnv.c optional ext2fs > fs/ext2fs/ext2_hash.c optional ext2fs > > From owner-svn-src-stable@FreeBSD.ORG Tue Sep 3 18:46:13 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BAA70BA7; Tue, 3 Sep 2013 18:46:13 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 970612E63; Tue, 3 Sep 2013 18:46:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r83IkDAH034570; Tue, 3 Sep 2013 18:46:13 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r83IkBAX034559; Tue, 3 Sep 2013 18:46:11 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201309031846.r83IkBAX034559@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 3 Sep 2013 18:46:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255188 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Sep 2013 18:46:13 -0000 Author: pfg Date: Tue Sep 3 18:46:11 2013 New Revision: 255188 URL: http://svnweb.freebsd.org/changeset/base/255188 Log: Add read-only support for extents in ext2fs. Basic support for extents was implemented by Zheng Liu as part of his Google Summer of Code in 2010. This support is read-only at this time. In addition to extents we also support the huge_file extension for read-only purposes. This works nicely with the additional support for birthtime/nanosec timestamps and dir_index that have been added lately. The implementation may not work for all ext4 filesystems as it doesn't support some features that are being enabled by default on recent linux like flex_bg. Nevertheless, the feature should be very useful for migration or simple access in filesystems that have been converted from ext2/3 or don't use incompatible features. Special thanks to Zheng Liu for his dedication and continued work to support ext2 in FreeBSD. Submitted by: Zheng Liu (lz@) Reviewed by: Mike Ma, Christoph Mallon (previous version) Sponsored by: Google Inc. Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/ext2fs/ext2_balloc.c stable/9/sys/fs/ext2fs/ext2_bmap.c stable/9/sys/fs/ext2fs/ext2_extern.h stable/9/sys/fs/ext2fs/ext2_inode.c stable/9/sys/fs/ext2fs/ext2_subr.c stable/9/sys/fs/ext2fs/ext2_vnops.c stable/9/sys/fs/ext2fs/inode.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_alloc.c Tue Sep 3 18:31:23 2013 (r255187) +++ stable/9/sys/fs/ext2fs/ext2_alloc.c Tue Sep 3 18:46:11 2013 (r255188) @@ -80,8 +80,8 @@ static daddr_t ext2_mapsearch(struct m_ * available block is located. */ int -ext2_alloc(struct inode *ip, int32_t lbn, int32_t bpref, int size, - struct ucred *cred, int32_t *bnp) +ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size, + struct ucred *cred, e4fs_daddr_t *bnp) { struct m_ext2fs *fs; struct ext2mount *ump; @@ -166,7 +166,8 @@ ext2_reallocblks(struct vop_reallocblks_ struct cluster_save *buflist; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; e2fs_lbn_t start_lbn, end_lbn; - int32_t soff, newblk, blkno; + int soff; + e2fs_daddr_t newblk, blkno; int i, len, start_lvl, end_lvl, pref, ssize; if (doreallocblks == 0) @@ -250,7 +251,7 @@ ext2_reallocblks(struct vop_reallocblks_ /* * Search the block map looking for an allocation of the desired size. */ - if ((newblk = (int32_t)ext2_hashalloc(ip, dtog(fs, pref), pref, + if ((newblk = (e2fs_daddr_t)ext2_hashalloc(ip, dtog(fs, pref), pref, len, ext2_clusteralloc)) == 0){ EXT2_UNLOCK(ump); goto fail; @@ -550,9 +551,9 @@ ext2_dirpref(struct inode *pip) * of the above. Then, blocknr tells us the number of the block * that will hold the pointer */ -int32_t -ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, int32_t *bap, - int32_t blocknr) +e4fs_daddr_t +ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, e2fs_daddr_t *bap, + e2fs_daddr_t blocknr) { int tmp; mtx_assert(EXT2_MTX(ip->i_ump), MA_OWNED); @@ -575,7 +576,7 @@ ext2_blkpref(struct inode *ip, e2fs_lbn_ follow the rule that a block should be allocated near its inode */ return blocknr ? blocknr : - (int32_t)(ip->i_block_group * + (e2fs_daddr_t)(ip->i_block_group * EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) + ip->i_e2fs->e2fs->e2fs_first_dblock; } @@ -963,7 +964,7 @@ gotit: * */ void -ext2_blkfree(struct inode *ip, int32_t bno, long size) +ext2_blkfree(struct inode *ip, e4fs_daddr_t bno, long size) { struct m_ext2fs *fs; struct buf *bp; Modified: stable/9/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_balloc.c Tue Sep 3 18:31:23 2013 (r255187) +++ stable/9/sys/fs/ext2fs/ext2_balloc.c Tue Sep 3 18:46:11 2013 (r255188) @@ -65,8 +65,8 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t struct buf *bp, *nbp; struct vnode *vp = ITOV(ip); struct indir indirs[NIADDR + 2]; - uint32_t nb, newb; - int32_t *bap, pref; + e4fs_daddr_t nb, newb; + e2fs_daddr_t *bap, pref; int osize, nsize, num, i, error; *bpp = NULL; @@ -195,7 +195,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t brelse(bp); return (error); } - bap = (int32_t *)bp->b_data; + bap = (e2fs_daddr_t *)bp->b_data; nb = bap[indirs[i].in_off]; if (i == num) break; Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_bmap.c Tue Sep 3 18:31:23 2013 (r255187) +++ stable/9/sys/fs/ext2fs/ext2_bmap.c Tue Sep 3 18:46:11 2013 (r255188) @@ -62,7 +62,7 @@ static int ext4_bmapext(struct vnode *, int ext2_bmap(struct vop_bmap_args *ap) { - int64_t blkno; + daddr_t blkno; int error; /* @@ -139,7 +139,7 @@ ext4_bmapext(struct vnode *vp, int32_t b */ int -ext2_bmaparray(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb) +ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, int *runp, int *runb) { struct inode *ip; struct buf *bp; @@ -182,7 +182,7 @@ ext2_bmaparray(struct vnode *vp, int32_t if (*bnp == 0) { *bnp = -1; } else if (runp) { - int32_t bnb = bn; + daddr_t bnb = bn; for (++bn; bn < NDADDR && *runp < maxrun && is_sequential(ump, ip->i_db[bn - 1], ip->i_db[bn]); ++bn, ++*runp); @@ -190,7 +190,7 @@ ext2_bmaparray(struct vnode *vp, int32_t if (runb && (bn > 0)) { for (--bn; (bn >= 0) && (*runb < maxrun) && is_sequential(ump, ip->i_db[bn], - ip->i_db[bn+1]); + ip->i_db[bn + 1]); --bn, ++*runb); } } @@ -239,19 +239,20 @@ ext2_bmaparray(struct vnode *vp, int32_t } } - daddr = ((int32_t *)bp->b_data)[ap->in_off]; + daddr = ((e2fs_daddr_t *)bp->b_data)[ap->in_off]; if (num == 1 && daddr && runp) { for (bn = ap->in_off + 1; bn < MNINDIR(ump) && *runp < maxrun && is_sequential(ump, - ((int32_t *)bp->b_data)[bn - 1], - ((int32_t *)bp->b_data)[bn]); + ((e2fs_daddr_t *)bp->b_data)[bn - 1], + ((e2fs_daddr_t *)bp->b_data)[bn]); ++bn, ++*runp); bn = ap->in_off; if (runb && bn) { for (--bn; bn >= 0 && *runb < maxrun && - is_sequential(ump, ((int32_t *)bp->b_data)[bn], - ((int32_t *)bp->b_data)[bn+1]); + is_sequential(ump, + ((e2fs_daddr_t *)bp->b_data)[bn], + ((e2fs_daddr_t *)bp->b_data)[bn + 1]); --bn, ++*runb); } } @@ -287,7 +288,7 @@ ext2_bmaparray(struct vnode *vp, int32_t * once with the offset into the page itself. */ int -ext2_getlbns(struct vnode *vp, int32_t bn, struct indir *ap, int *nump) +ext2_getlbns(struct vnode *vp, daddr_t bn, struct indir *ap, int *nump) { long blockcnt; e2fs_lbn_t metalbn, realbn; Modified: stable/9/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_extern.h Tue Sep 3 18:31:23 2013 (r255187) +++ stable/9/sys/fs/ext2fs/ext2_extern.h Tue Sep 3 18:46:11 2013 (r255188) @@ -49,24 +49,24 @@ struct vfsconf; struct vnode; int ext2_add_entry(struct vnode *, struct ext2fs_direct_2 *); -int ext2_alloc(struct inode *, - int32_t, int32_t, int, struct ucred *, int32_t *); +int ext2_alloc(struct inode *, daddr_t, e4fs_daddr_t, int, + struct ucred *, e4fs_daddr_t *); int ext2_balloc(struct inode *, e2fs_lbn_t, int, struct ucred *, struct buf **, int); int ext2_blkatoff(struct vnode *, off_t, char **, struct buf **); -void ext2_blkfree(struct inode *, int32_t, long); -int32_t ext2_blkpref(struct inode *, e2fs_lbn_t, int, int32_t *, int32_t); +void ext2_blkfree(struct inode *, e4fs_daddr_t, long); +e4fs_daddr_t ext2_blkpref(struct inode *, e2fs_lbn_t, int, e2fs_daddr_t *, + e2fs_daddr_t); int ext2_bmap(struct vop_bmap_args *); -int ext2_bmaparray(struct vnode *, int32_t, int64_t *, int *, int *); +int ext2_bmaparray(struct vnode *, daddr_t, daddr_t *, int *, int *); void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int); void ext2_dirbad(struct inode *ip, doff_t offset, char *how); void ext2_ei2i(struct ext2fs_dinode *, struct inode *); -int ext2_getlbns(struct vnode *, int32_t, struct indir *, int *); +int ext2_getlbns(struct vnode *, daddr_t, struct indir *, int *); void ext2_i2ei(struct inode *, struct ext2fs_dinode *); void ext2_itimes(struct vnode *vp); int ext2_reallocblks(struct vop_reallocblks_args *); int ext2_reclaim(struct vop_reclaim_args *); -void ext2_setblock(struct m_ext2fs *, u_char *, int32_t); int ext2_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *); int ext2_update(struct vnode *, int); int ext2_valloc(struct vnode *, int, struct ucred *, struct vnode **); Modified: stable/9/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode.c Tue Sep 3 18:31:23 2013 (r255187) +++ stable/9/sys/fs/ext2fs/ext2_inode.c Tue Sep 3 18:46:11 2013 (r255188) @@ -53,8 +53,8 @@ #include #include -static int ext2_indirtrunc(struct inode *, int32_t, int32_t, int32_t, int, - long *); +static int ext2_indirtrunc(struct inode *, daddr_t, daddr_t, + daddr_t, int, e4fs_daddr_t *); /* * Update the access, modified, and inode change times as specified by the @@ -118,7 +118,7 @@ ext2_truncate(struct vnode *vp, off_t le struct m_ext2fs *fs; struct buf *bp; int offset, size, level; - long count, nblocks, blocksreleased = 0; + e4fs_daddr_t count, nblocks, blocksreleased = 0; int error, i, allerror; off_t osize; @@ -355,16 +355,16 @@ done: */ static int -ext2_indirtrunc(struct inode *ip, int32_t lbn, int32_t dbn, int32_t lastbn, - int level, long *countp) +ext2_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, + daddr_t lastbn, int level, e4fs_daddr_t *countp) { struct buf *bp; struct m_ext2fs *fs = ip->i_e2fs; struct vnode *vp; - int32_t *bap, *copy, nb, nlbn, last; - long blkcount, factor; - int i, nblocks, blocksreleased = 0; - int error = 0, allerror = 0; + e2fs_daddr_t *bap, *copy; + int i, nblocks, error = 0, allerror = 0; + e2fs_lbn_t nb, nlbn, last; + e4fs_daddr_t blkcount, factor, blocksreleased = 0; /* * Calculate index in current block of last @@ -404,11 +404,11 @@ ext2_indirtrunc(struct inode *ip, int32_ return (error); } - bap = (int32_t *)bp->b_data; + bap = (e2fs_daddr_t *)bp->b_data; copy = malloc(fs->e2fs_bsize, M_TEMP, M_WAITOK); bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->e2fs_bsize); bzero((caddr_t)&bap[last + 1], - (u_int)(NINDIR(fs) - (last + 1)) * sizeof(int32_t)); + (NINDIR(fs) - (last + 1)) * sizeof(e2fs_daddr_t)); if (last == -1) bp->b_flags |= B_INVAL; if (DOINGASYNC(vp)) { Modified: stable/9/sys/fs/ext2fs/ext2_subr.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_subr.c Tue Sep 3 18:31:23 2013 (r255187) +++ stable/9/sys/fs/ext2fs/ext2_subr.c Tue Sep 3 18:46:11 2013 (r255188) @@ -135,7 +135,7 @@ void ext2_checkoverlap(struct buf *bp, struct inode *ip) { struct buf *ebp, *ep; - int32_t start, last; + e4fs_daddr_t start, last; struct vnode *vp; ebp = &buf[nbuf]; @@ -150,10 +150,10 @@ ext2_checkoverlap(struct buf *bp, struct ep->b_blkno + btodb(ep->b_bcount) <= start) continue; vprint("Disk overlap", vp); - (void)printf("\tstart %d, end %d overlap start %lld, end %ld\n", - start, last, (long long)ep->b_blkno, - (long)(ep->b_blkno + btodb(ep->b_bcount) - 1)); - panic("Disk buffer overlap"); + printf("\tstart %jd, end %jd overlap start %jd, end %jd\n", + (intmax_t)start, (intmax_t)last, (intmax_t)ep->b_blkno, + (intmax_t)(ep->b_blkno + btodb(ep->b_bcount) - 1)); + panic("ext2_checkoverlap: Disk buffer overlap"); } } #endif /* KDB */ Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vnops.c Tue Sep 3 18:31:23 2013 (r255187) +++ stable/9/sys/fs/ext2fs/ext2_vnops.c Tue Sep 3 18:46:11 2013 (r255188) @@ -1335,7 +1335,7 @@ ext2_strategy(struct vop_strategy_args * struct vnode *vp = ap->a_vp; struct inode *ip; struct bufobj *bo; - int64_t blkno; + daddr_t blkno; int error; ip = VTOI(vp); Modified: stable/9/sys/fs/ext2fs/inode.h ============================================================================== --- stable/9/sys/fs/ext2fs/inode.h Tue Sep 3 18:31:23 2013 (r255187) +++ stable/9/sys/fs/ext2fs/inode.h Tue Sep 3 18:46:11 2013 (r255188) @@ -54,9 +54,11 @@ #define NIADDR 3 /* Indirect addresses in inode. */ /* - * The size of physical and logical block numbers and time fields in UFS. + * The size of physical and logical block numbers in EXT2FS. */ -typedef int32_t e2fs_lbn_t; +typedef uint32_t e2fs_daddr_t; +typedef int64_t e2fs_lbn_t; +typedef int64_t e4fs_daddr_t; /* * The inode is used to describe each active (or recently active) file in the From owner-svn-src-stable@FreeBSD.ORG Tue Sep 3 23:17:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BE6E637A; Tue, 3 Sep 2013 23:17:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 91D802436; Tue, 3 Sep 2013 23:17:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r83NHIN7092026; Tue, 3 Sep 2013 23:17:18 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r83NHIMO092025; Tue, 3 Sep 2013 23:17:18 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201309032317.r83NHIMO092025@svn.freebsd.org> From: Mark Johnston Date: Tue, 3 Sep 2013 23:17:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255196 - stable/9/usr.bin/ldd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Sep 2013 23:17:18 -0000 Author: markj Date: Tue Sep 3 23:17:18 2013 New Revision: 255196 URL: http://svnweb.freebsd.org/changeset/base/255196 Log: MFC r254018: Pass variables prefixed with both LD_ and LD_32_ to the run-time linker. This prevents unintentional execution of programs when running ldd(1) on 32-bit Linux binaries. Modified: stable/9/usr.bin/ldd/ldd.c Directory Properties: stable/9/usr.bin/ldd/ (props changed) Modified: stable/9/usr.bin/ldd/ldd.c ============================================================================== --- stable/9/usr.bin/ldd/ldd.c Tue Sep 3 22:33:06 2013 (r255195) +++ stable/9/usr.bin/ldd/ldd.c Tue Sep 3 23:17:18 2013 (r255196) @@ -49,12 +49,6 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -#ifdef COMPAT_32BIT -#define LD_ "LD_32_" -#else -#define LD_ "LD_" -#endif - /* * 32-bit ELF data structures can only be used if the system header[s] declare * them. There is no official macro for determining whether they are declared, @@ -64,6 +58,16 @@ __FBSDID("$FreeBSD$"); #define ELF32_SUPPORTED #endif +#define LDD_SETENV(name, value, overwrite) do { \ + setenv("LD_" name, value, overwrite); \ + setenv("LD_32_" name, value, overwrite); \ +} while (0) + +#define LDD_UNSETENV(name) do { \ + unsetenv("LD_" name); \ + unsetenv("LD_32_" name); \ +} while (0) + static int is_executable(const char *fname, int fd, int *is_shlib, int *type); static void usage(void); @@ -82,7 +86,7 @@ execldd32(char *file, char *fmt1, char * char *argv[8]; int i, rval, status; - unsetenv(LD_ "TRACE_LOADED_OBJECTS"); + LDD_UNSETENV("TRACE_LOADED_OBJECTS"); rval = 0; i = 0; argv[i++] = strdup(_PATH_LDD32); @@ -121,7 +125,7 @@ execldd32(char *file, char *fmt1, char * } while (i--) free(argv[i]); - setenv(LD_ "TRACE_LOADED_OBJECTS", "yes", 1); + LDD_SETENV("TRACE_LOADED_OBJECTS", "yes", 1); return (rval); } #endif @@ -210,15 +214,15 @@ main(int argc, char *argv[]) } /* ld.so magic */ - setenv(LD_ "TRACE_LOADED_OBJECTS", "yes", 1); + LDD_SETENV("TRACE_LOADED_OBJECTS", "yes", 1); if (fmt1 != NULL) - setenv(LD_ "TRACE_LOADED_OBJECTS_FMT1", fmt1, 1); + LDD_SETENV("TRACE_LOADED_OBJECTS_FMT1", fmt1, 1); if (fmt2 != NULL) - setenv(LD_ "TRACE_LOADED_OBJECTS_FMT2", fmt2, 1); + LDD_SETENV("TRACE_LOADED_OBJECTS_FMT2", fmt2, 1); - setenv(LD_ "TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1); + LDD_SETENV("TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1); if (aflag) - setenv(LD_ "TRACE_LOADED_OBJECTS_ALL", "1", 1); + LDD_SETENV("TRACE_LOADED_OBJECTS_ALL", "1", 1); else if (fmt1 == NULL && fmt2 == NULL) /* Default formats */ printf("%s:\n", *argv); From owner-svn-src-stable@FreeBSD.ORG Tue Sep 3 23:20:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 879AC621; Tue, 3 Sep 2013 23:20:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5A2B2247B; Tue, 3 Sep 2013 23:20:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r83NK4x9093069; Tue, 3 Sep 2013 23:20:04 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r83NK4EV093068; Tue, 3 Sep 2013 23:20:04 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201309032320.r83NK4EV093068@svn.freebsd.org> From: Mark Johnston Date: Tue, 3 Sep 2013 23:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255197 - stable/8/usr.bin/ldd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Sep 2013 23:20:04 -0000 Author: markj Date: Tue Sep 3 23:20:03 2013 New Revision: 255197 URL: http://svnweb.freebsd.org/changeset/base/255197 Log: MFC r254018: Pass variables prefixed with both LD_ and LD_32_ to the run-time linker. This prevents unintentional execution of programs when running ldd(1) on 32-bit Linux binaries. Modified: stable/8/usr.bin/ldd/ldd.c Directory Properties: stable/8/usr.bin/ldd/ (props changed) Modified: stable/8/usr.bin/ldd/ldd.c ============================================================================== --- stable/8/usr.bin/ldd/ldd.c Tue Sep 3 23:17:18 2013 (r255196) +++ stable/8/usr.bin/ldd/ldd.c Tue Sep 3 23:20:03 2013 (r255197) @@ -49,12 +49,6 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -#ifdef COMPAT_32BIT -#define LD_ "LD_32_" -#else -#define LD_ "LD_" -#endif - /* * 32-bit ELF data structures can only be used if the system header[s] declare * them. There is no official macro for determining whether they are declared, @@ -64,6 +58,16 @@ __FBSDID("$FreeBSD$"); #define ELF32_SUPPORTED #endif +#define LDD_SETENV(name, value, overwrite) do { \ + setenv("LD_" name, value, overwrite); \ + setenv("LD_32_" name, value, overwrite); \ +} while (0) + +#define LDD_UNSETENV(name) do { \ + unsetenv("LD_" name); \ + unsetenv("LD_32_" name); \ +} while (0) + static int is_executable(const char *fname, int fd, int *is_shlib, int *type); static void usage(void); @@ -82,7 +86,7 @@ execldd32(char *file, char *fmt1, char * char *argv[8]; int i, rval, status; - unsetenv(LD_ "TRACE_LOADED_OBJECTS"); + LDD_UNSETENV("TRACE_LOADED_OBJECTS"); rval = 0; i = 0; argv[i++] = strdup(_PATH_LDD32); @@ -121,7 +125,7 @@ execldd32(char *file, char *fmt1, char * } while (i--) free(argv[i]); - setenv(LD_ "TRACE_LOADED_OBJECTS", "yes", 1); + LDD_SETENV("TRACE_LOADED_OBJECTS", "yes", 1); return (rval); } #endif @@ -210,15 +214,15 @@ main(int argc, char *argv[]) } /* ld.so magic */ - setenv(LD_ "TRACE_LOADED_OBJECTS", "yes", 1); + LDD_SETENV("TRACE_LOADED_OBJECTS", "yes", 1); if (fmt1 != NULL) - setenv(LD_ "TRACE_LOADED_OBJECTS_FMT1", fmt1, 1); + LDD_SETENV("TRACE_LOADED_OBJECTS_FMT1", fmt1, 1); if (fmt2 != NULL) - setenv(LD_ "TRACE_LOADED_OBJECTS_FMT2", fmt2, 1); + LDD_SETENV("TRACE_LOADED_OBJECTS_FMT2", fmt2, 1); - setenv(LD_ "TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1); + LDD_SETENV("TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1); if (aflag) - setenv(LD_ "TRACE_LOADED_OBJECTS_ALL", "1", 1); + LDD_SETENV("TRACE_LOADED_OBJECTS_ALL", "1", 1); else if (fmt1 == NULL && fmt2 == NULL) /* Default formats */ printf("%s:\n", *argv); From owner-svn-src-stable@FreeBSD.ORG Thu Sep 5 06:58:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C604EC3F; Thu, 5 Sep 2013 06:58:50 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 986DA2FB9; Thu, 5 Sep 2013 06:58:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r856woNk098175; Thu, 5 Sep 2013 06:58:50 GMT (envelope-from erwin@svn.freebsd.org) Received: (from erwin@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r856woYO098172; Thu, 5 Sep 2013 06:58:50 GMT (envelope-from erwin@svn.freebsd.org) Message-Id: <201309050658.r856woYO098172@svn.freebsd.org> From: Erwin Lansing Date: Thu, 5 Sep 2013 06:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255233 - in stable/9/usr.bin: dig host nslookup X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 06:58:50 -0000 Author: erwin Date: Thu Sep 5 06:58:49 2013 New Revision: 255233 URL: http://svnweb.freebsd.org/changeset/base/255233 Log: MFC r255056 Reduce WARNS to 0 for dig, host, and nslookup to make them compile with the optional WITH_BIND_SIGCHASE. Submitted by: Andre Albsmeier Approved by: delphij (mentor, implicit) Sponsored by: DK Hostmaster A/S Modified: stable/9/usr.bin/dig/Makefile stable/9/usr.bin/host/Makefile stable/9/usr.bin/nslookup/Makefile Directory Properties: stable/9/usr.bin/dig/ (props changed) stable/9/usr.bin/host/ (props changed) stable/9/usr.bin/nslookup/ (props changed) Modified: stable/9/usr.bin/dig/Makefile ============================================================================== --- stable/9/usr.bin/dig/Makefile Thu Sep 5 05:51:15 2013 (r255232) +++ stable/9/usr.bin/dig/Makefile Thu Sep 5 06:58:49 2013 (r255233) @@ -20,7 +20,7 @@ CFLAGS+= -DWITH_IDN -I/usr/local/include CFLAGS+= -L/usr/local/lib -lidnkit -R/usr/local/lib -liconv .endif -WARNS?= 1 +WARNS?= 0 DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} Modified: stable/9/usr.bin/host/Makefile ============================================================================== --- stable/9/usr.bin/host/Makefile Thu Sep 5 05:51:15 2013 (r255232) +++ stable/9/usr.bin/host/Makefile Thu Sep 5 06:58:49 2013 (r255233) @@ -15,7 +15,7 @@ SRCS+= dighost.c host.c CFLAGS+= -I${SRCDIR}/include CFLAGS+= -I${BIND_DIR}/lib/isc/${ISC_ATOMIC_ARCH}/include -WARNS?= 1 +WARNS?= 0 DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} Modified: stable/9/usr.bin/nslookup/Makefile ============================================================================== --- stable/9/usr.bin/nslookup/Makefile Thu Sep 5 05:51:15 2013 (r255232) +++ stable/9/usr.bin/nslookup/Makefile Thu Sep 5 06:58:49 2013 (r255233) @@ -18,7 +18,7 @@ CFLAGS+= -I${BIND_DIR}/lib/isc/${ISC_ATO DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} ${LIBEDIT} LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} ${LIBEDIT} -WARNS?= 1 +WARNS?= 0 MANFILTER= sed -e "s@^host \[server\]@\\\fBhost\\\fR \\\fI[server]\\\fR@" From owner-svn-src-stable@FreeBSD.ORG Thu Sep 5 15:50:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 636198D0; Thu, 5 Sep 2013 15:50:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 512E82B58; Thu, 5 Sep 2013 15:50:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r85FoZKZ018227; Thu, 5 Sep 2013 15:50:35 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r85FoYlT018223; Thu, 5 Sep 2013 15:50:34 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201309051550.r85FoYlT018223@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 5 Sep 2013 15:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255252 - in stable/9/contrib: gcc gcc/doc gcclibs/libcpp gcclibs/libcpp/include X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 15:50:35 -0000 Author: pfg Date: Thu Sep 5 15:50:34 2013 New Revision: 255252 URL: http://svnweb.freebsd.org/changeset/base/255252 Log: MFC r254326: Add support for the GCC binary integer constants extension. This is required to build the i965 backend with newer versions of mesa. Original patch from Joerg Wunsch in GCC Bug 23479, under the GPLv2; also taken from there in OpenBSD. Obtained from: gcc 4.3 (rev. 125346; GPLv2) Modified: stable/9/contrib/gcc/ChangeLog.gcc43 stable/9/contrib/gcc/doc/extend.texi stable/9/contrib/gcclibs/libcpp/expr.c stable/9/contrib/gcclibs/libcpp/include/cpplib.h Directory Properties: stable/9/contrib/gcc/ (props changed) stable/9/contrib/gcclibs/ (props changed) Modified: stable/9/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/9/contrib/gcc/ChangeLog.gcc43 Thu Sep 5 15:49:51 2013 (r255251) +++ stable/9/contrib/gcc/ChangeLog.gcc43 Thu Sep 5 15:50:34 2013 (r255252) @@ -1,3 +1,9 @@ +2007-06-05 Joerg Wunsch (r23479) + + PR preprocessor/23479 + * doc/extend.texi: Document the 0b-prefixed binary integer + constant extension. + 2007-05-01 Dwarakanath Rajagopal (r124341) * doc/invoke.texi: Fix typo, 'AMD Family 10h core' instead of Modified: stable/9/contrib/gcc/doc/extend.texi ============================================================================== --- stable/9/contrib/gcc/doc/extend.texi Thu Sep 5 15:49:51 2013 (r255251) +++ stable/9/contrib/gcc/doc/extend.texi Thu Sep 5 15:50:34 2013 (r255252) @@ -81,6 +81,7 @@ extensions, accepted by GCC in C89 mode * Pragmas:: Pragmas accepted by GCC. * Unnamed Fields:: Unnamed struct/union fields within structs/unions. * Thread-Local:: Per-thread variables. +* Binary constants:: Binary constants using the @samp{0b} prefix. @end menu @node Statement Exprs @@ -10424,6 +10425,28 @@ Non-@code{static} members shall not be @ @end quotation @end itemize +@node Binary constants +@section Binary constants using the @samp{0b} prefix +@cindex Binary constants using the @samp{0b} prefix + +Integer constants can be written as binary constants, consisting of a +sequence of @samp{0} and @samp{1} digits, prefixed by @samp{0b} or +@samp{0B}. This is particularly useful in environments that operate a +lot on the bit-level (like microcontrollers). + +The following statements are identical: + +@smallexample +i = 42; +i = 0x2a; +i = 052; +i = 0b101010; +@end smallexample + +The type of these constants follows the same rules as for octal or +hexadecimal integer constants, so suffixes like @samp{L} or @samp{UL} +can be applied. + @node C++ Extensions @chapter Extensions to the C++ Language @cindex extensions, C++ language Modified: stable/9/contrib/gcclibs/libcpp/expr.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/expr.c Thu Sep 5 15:49:51 2013 (r255251) +++ stable/9/contrib/gcclibs/libcpp/expr.c Thu Sep 5 15:50:34 2013 (r255252) @@ -188,6 +188,11 @@ cpp_classify_number (cpp_reader *pfile, radix = 16; str++; } + else if ((*str == 'b' || *str == 'B') && (str[1] == '0' || str[1] == '1')) + { + radix = 2; + str++; + } } /* Now scan for a well-formed integer or float. */ @@ -226,10 +231,22 @@ cpp_classify_number (cpp_reader *pfile, radix = 10; if (max_digit >= radix) - SYNTAX_ERROR2 ("invalid digit \"%c\" in octal constant", '0' + max_digit); + { + if (radix == 2) + SYNTAX_ERROR2 ("invalid digit \"%c\" in binary constant", '0' + max_digit); + else + SYNTAX_ERROR2 ("invalid digit \"%c\" in octal constant", '0' + max_digit); + } if (float_flag != NOT_FLOAT) { + if (radix == 2) + { + cpp_error (pfile, CPP_DL_ERROR, + "invalid prefix \"0b\" for floating constant"); + return CPP_N_INVALID; + } + if (radix == 16 && CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, c99)) cpp_error (pfile, CPP_DL_PEDWARN, "use of C99 hexadecimal floating constant"); @@ -321,11 +338,16 @@ cpp_classify_number (cpp_reader *pfile, if ((result & CPP_N_IMAGINARY) && CPP_PEDANTIC (pfile)) cpp_error (pfile, CPP_DL_PEDWARN, "imaginary constants are a GCC extension"); + if (radix == 2 && CPP_PEDANTIC (pfile)) + cpp_error (pfile, CPP_DL_PEDWARN, + "binary constants are a GCC extension"); if (radix == 10) result |= CPP_N_DECIMAL; else if (radix == 16) result |= CPP_N_HEX; + else if (radix == 2) + result |= CPP_N_BINARY; else result |= CPP_N_OCTAL; @@ -376,6 +398,11 @@ cpp_interpret_integer (cpp_reader *pfile base = 16; p += 2; } + else if ((type & CPP_N_RADIX) == CPP_N_BINARY) + { + base = 2; + p += 2; + } /* We can add a digit to numbers strictly less than this without needing the precision and slowness of double integers. */ @@ -431,12 +458,25 @@ static cpp_num append_digit (cpp_num num, int digit, int base, size_t precision) { cpp_num result; - unsigned int shift = 3 + (base == 16); + unsigned int shift; bool overflow; cpp_num_part add_high, add_low; - /* Multiply by 8 or 16. Catching this overflow here means we don't + /* Multiply by 2, 8 or 16. Catching this overflow here means we don't need to worry about add_high overflowing. */ + switch (base) + { + case 2: + shift = 1; + break; + + case 16: + shift = 4; + break; + + default: + shift = 3; + } overflow = !!(num.high >> (PART_PRECISION - shift)); result.high = num.high << shift; result.low = num.low << shift; Modified: stable/9/contrib/gcclibs/libcpp/include/cpplib.h ============================================================================== --- stable/9/contrib/gcclibs/libcpp/include/cpplib.h Thu Sep 5 15:49:51 2013 (r255251) +++ stable/9/contrib/gcclibs/libcpp/include/cpplib.h Thu Sep 5 15:50:34 2013 (r255252) @@ -745,6 +745,7 @@ struct cpp_num #define CPP_N_DECIMAL 0x0100 #define CPP_N_HEX 0x0200 #define CPP_N_OCTAL 0x0400 +#define CPP_N_BINARY 0x0800 #define CPP_N_UNSIGNED 0x1000 /* Properties. */ #define CPP_N_IMAGINARY 0x2000 From owner-svn-src-stable@FreeBSD.ORG Thu Sep 5 15:53:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6FB28B9F for ; Thu, 5 Sep 2013 15:53:07 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm50.bullet.mail.bf1.yahoo.com (nm50.bullet.mail.bf1.yahoo.com [216.109.114.67]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 043782BAF for ; Thu, 5 Sep 2013 15:53:06 +0000 (UTC) Received: from [98.139.212.146] by nm50.bullet.mail.bf1.yahoo.com with NNFMP; 05 Sep 2013 15:53:04 -0000 Received: from [68.142.230.70] by tm3.bullet.mail.bf1.yahoo.com with NNFMP; 05 Sep 2013 15:53:04 -0000 Received: from [127.0.0.1] by smtp227.mail.bf1.yahoo.com with NNFMP; 05 Sep 2013 15:53:04 -0000 X-Yahoo-Newman-Id: 210995.31536.bm@smtp227.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 4t72IVMVM1nhINZyNpmaCbEL7_IEJBytsVBJCNPt0RJqiJE Ne.3FqE95hkB68f5sJVIkz9tklEbjqkaDUNkgVc2VoPvJwu2QT8AzwQyC4La b_992Oz5dGQDG3lN2axvx5MEXdBVM4aQLbh0CU6kZhgMuinPPmB3d33bdWHO jsL4fwhA5qtNbrOcz6GDBt9ZAaTrTnymYUvSRHh6xTX6qOFcqiDAgcfmMFse 0BdVglGCOoIIW_uUKWy8haJpeojdHhzbfQN68KCb9o948gZTqxrU.70iTkAw 1DQPDa4qtF3kYUYVrcZpRLIjLSP5y7dIA.XV3H13KlVLA0RIONCIohPHkT9Z RnhmpZIQlDeFioqbyCummj3EfWNGwIwTkF5.oHIvor4xs_VEjnhqBpQeTmCR aJpIJ7vM17SXwtscGLsvnGMSEVw573YAnVi0weCABpSs5vVCtkmd.w6wMPh4 7vtk6yvnRMHFZJODOlE7YEsw41ouKFeFrJVerNtba99mKzohka7g8BuAPsVc B6_Zq82j2BqtDJtgQMb3O0Kx_0ScByFZOAU.OEGNoIGnUBSXfQLXfG5q13wu PcUgH.abZSrn67mRaFkSpEAIBJlK6IBlcNtCFPy_hhVANDQoYHKMfgSMZ.gk - X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with ) by smtp227.mail.bf1.yahoo.com with SMTP; 05 Sep 2013 15:53:04 +0000 UTC Message-ID: <5228A8DE.6080005@FreeBSD.org> Date: Thu, 05 Sep 2013 10:53:02 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130809 Thunderbird/17.0.8 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r255252 - in stable/9/contrib: gcc gcc/doc gcclibs/libcpp gcclibs/libcpp/include References: <201309051550.r85FoYlT018223@svn.freebsd.org> In-Reply-To: <201309051550.r85FoYlT018223@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 15:53:07 -0000 On 05.09.2013 10:50, Pedro F. Giffuni wrote: > Author: pfg > Date: Thu Sep 5 15:50:34 2013 > New Revision: 255252 > URL: http://svnweb.freebsd.org/changeset/base/255252 > > Log: > MFC r254326: > Copy-paste error: s/254326/255107/ From owner-svn-src-stable@FreeBSD.ORG Thu Sep 5 19:25:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 62466E6B; Thu, 5 Sep 2013 19:25:37 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 359632AD9; Thu, 5 Sep 2013 19:25:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r85JPbe9048525; Thu, 5 Sep 2013 19:25:37 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r85JPblK048524; Thu, 5 Sep 2013 19:25:37 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <201309051925.r85JPblK048524@svn.freebsd.org> From: Joerg Wunsch Date: Thu, 5 Sep 2013 19:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255262 - stable/9/sys/dev/fdc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 19:25:37 -0000 Author: joerg Date: Thu Sep 5 19:25:36 2013 New Revision: 255262 URL: http://svnweb.freebsd.org/changeset/base/255262 Log: Merge r254809 and r254937 from head: . Fix the "2step" feature (i.e. 360 KiB floppies in 1200 MiB drives) . Fix the FDOPT_NOERROR option Modified: stable/9/sys/dev/fdc/fdc.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/fdc/fdc.c ============================================================================== --- stable/9/sys/dev/fdc/fdc.c Thu Sep 5 19:02:03 2013 (r255261) +++ stable/9/sys/dev/fdc/fdc.c Thu Sep 5 19:25:36 2013 (r255262) @@ -528,7 +528,8 @@ fdc_reset(struct fdc_data *fdc) if (fdc_cmd(fdc, 4, I8207X_CONFIG, 0, - 0x40 | /* Enable Implied Seek */ + /* 0x40 | */ /* Enable Implied Seek - + * breaks 2step! */ 0x10 | /* Polling disabled */ (fifo_threshold - 1), /* Fifo threshold */ 0x00, /* Precomp track */ @@ -760,10 +761,13 @@ fdc_worker(struct fdc_data *fdc) int i, nsect; int st0, st3, cyl, mfm, steptrac, cylinder, descyl, sec; int head; + int override_error; static int need_recal; struct fdc_readid *idp; struct fd_formb *finfo; + override_error = 0; + /* Have we exhausted our retries ? */ bp = fdc->bp; fd = fdc->fd; @@ -922,14 +926,8 @@ fdc_worker(struct fdc_data *fdc) /* * SEEK to where we want to be - * - * Enhanced controllers do implied seeks for read&write as long as - * we do not need multiple steps per track. */ - if (cylinder != fd->track && ( - fdc->fdct != FDC_ENHANCED || - descyl != cylinder || - (bp->bio_cmd & (BIO_RDID|BIO_FMT)))) { + if (cylinder != fd->track) { retry_line = __LINE__; if (fdc_cmd(fdc, 3, NE7CMD_SEEK, fd->fdsu, descyl, 0)) return (1); @@ -1095,7 +1093,10 @@ fdc_worker(struct fdc_data *fdc) fdc->status[3], fdc->status[4], fdc->status[5]); } retry_line = __LINE__; - return (1); + if (fd->options & FDOPT_NOERROR) + override_error = 1; + else + return (1); } /* All OK */ switch(bp->bio_cmd) { @@ -1116,10 +1117,16 @@ fdc_worker(struct fdc_data *fdc) bp->bio_resid -= fd->fd_iosize; bp->bio_completed += fd->fd_iosize; fd->fd_ioptr += fd->fd_iosize; - /* Since we managed to get something done, reset the retry */ - fdc->retry = 0; - if (bp->bio_resid > 0) - return (0); + if (override_error) { + if ((debugflags & 4)) + printf("FDOPT_NOERROR: returning bad data\n"); + } else { + /* Since we managed to get something done, + * reset the retry */ + fdc->retry = 0; + if (bp->bio_resid > 0) + return (0); + } break; case BIO_FMT: break; @@ -1411,6 +1418,7 @@ fd_access(struct g_provider *pp, int r, ae = e + pp->ace; if (ar == 0 && aw == 0 && ae == 0) { + fd->options &= ~(FDOPT_NORETRY | FDOPT_NOERRLOG | FDOPT_NOERROR); device_unbusy(fd->dev); return (0); } From owner-svn-src-stable@FreeBSD.ORG Thu Sep 5 20:34:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B4E6E8CF; Thu, 5 Sep 2013 20:34:58 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8778C2EBF; Thu, 5 Sep 2013 20:34:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r85KYwcE090552; Thu, 5 Sep 2013 20:34:58 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r85KYwfN090551; Thu, 5 Sep 2013 20:34:58 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <201309052034.r85KYwfN090551@svn.freebsd.org> From: Joerg Wunsch Date: Thu, 5 Sep 2013 20:34:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255264 - stable/8/sys/dev/fdc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 20:34:58 -0000 Author: joerg Date: Thu Sep 5 20:34:58 2013 New Revision: 255264 URL: http://svnweb.freebsd.org/changeset/base/255264 Log: Merged r254809 and 254937 from head: . Fix "2step" feature (i.e. 360 KiB media in 1200 KiB drives) . Fix FDOPT_NOERROR option Modified: stable/8/sys/dev/fdc/fdc.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/fdc/fdc.c ============================================================================== --- stable/8/sys/dev/fdc/fdc.c Thu Sep 5 20:18:59 2013 (r255263) +++ stable/8/sys/dev/fdc/fdc.c Thu Sep 5 20:34:58 2013 (r255264) @@ -528,7 +528,8 @@ fdc_reset(struct fdc_data *fdc) if (fdc_cmd(fdc, 4, I8207X_CONFIG, 0, - 0x40 | /* Enable Implied Seek */ + /* 0x40 | */ /* Enable Implied Seek - + * breaks 2step! */ 0x10 | /* Polling disabled */ (fifo_threshold - 1), /* Fifo threshold */ 0x00, /* Precomp track */ @@ -760,10 +761,13 @@ fdc_worker(struct fdc_data *fdc) int i, nsect; int st0, st3, cyl, mfm, steptrac, cylinder, descyl, sec; int head; + int override_error; static int need_recal; struct fdc_readid *idp; struct fd_formb *finfo; + override_error = 0; + /* Have we exhausted our retries ? */ bp = fdc->bp; fd = fdc->fd; @@ -924,14 +928,8 @@ fdc_worker(struct fdc_data *fdc) /* * SEEK to where we want to be - * - * Enhanced controllers do implied seeks for read&write as long as - * we do not need multiple steps per track. */ - if (cylinder != fd->track && ( - fdc->fdct != FDC_ENHANCED || - descyl != cylinder || - (bp->bio_cmd & (BIO_RDID|BIO_FMT)))) { + if (cylinder != fd->track) { retry_line = __LINE__; if (fdc_cmd(fdc, 3, NE7CMD_SEEK, fd->fdsu, descyl, 0)) return (1); @@ -1101,7 +1099,10 @@ fdc_worker(struct fdc_data *fdc) fdc->status[3], fdc->status[4], fdc->status[5]); } retry_line = __LINE__; - return (1); + if (fd->options & FDOPT_NOERROR) + override_error = 1; + else + return (1); } /* All OK */ switch(bp->bio_cmd) { @@ -1122,10 +1123,16 @@ fdc_worker(struct fdc_data *fdc) bp->bio_resid -= fd->fd_iosize; bp->bio_completed += fd->fd_iosize; fd->fd_ioptr += fd->fd_iosize; - /* Since we managed to get something done, reset the retry */ - fdc->retry = 0; - if (bp->bio_resid > 0) - return (0); + if (override_error) { + if ((debugflags & 4)) + printf("FDOPT_NOERROR: returning bad data\n"); + } else { + /* Since we managed to get something done, + * reset the retry */ + fdc->retry = 0; + if (bp->bio_resid > 0) + return (0); + } break; case BIO_FMT: break; @@ -1417,6 +1424,7 @@ fd_access(struct g_provider *pp, int r, ae = e + pp->ace; if (ar == 0 && aw == 0 && ae == 0) { + fd->options &= ~(FDOPT_NORETRY | FDOPT_NOERRLOG | FDOPT_NOERROR); device_unbusy(fd->dev); return (0); } From owner-svn-src-stable@FreeBSD.ORG Fri Sep 6 12:45:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A8229B49; Fri, 6 Sep 2013 12:45:09 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8543A27BF; Fri, 6 Sep 2013 12:45:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r86Cj9a8071732; Fri, 6 Sep 2013 12:45:09 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r86Cj9jA071731; Fri, 6 Sep 2013 12:45:09 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201309061245.r86Cj9jA071731@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 6 Sep 2013 12:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255299 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Sep 2013 12:45:09 -0000 Author: jilles Date: Fri Sep 6 12:45:08 2013 New Revision: 255299 URL: http://svnweb.freebsd.org/changeset/base/255299 Log: Partial MFC of r248534: Implement SOCK_CLOEXEC and SOCK_NONBLOCK in kernel. SOCK_CLOEXEC and SOCK_NONBLOCK can be OR'ed in socket() and socketpair()'s type parameter. The numerical values for SOCK_CLOEXEC and SOCK_NONBLOCK are as in NetBSD. The SOCK_* flags are not passed to MAC because this may cause incorrect failures and can be done later via fcntl() anyway. On the other hand, audit is expected to cope with the new flags. This commit does not add the constants to as in r248534 because this would lead to various newly compiled software not working on old kernels. It only serves to help 10.x binaries and prepare for a possible full MFC (if third-party software starts to insist on SOCK_CLOEXEC and SOCK_NONBLOCK). MSG_CMSG_CLOEXEC from r248534 is not merged here because it changes a KPI/KBI. No mergeinfo because the rest of r248534 is missing. Modified: stable/9/sys/kern/uipc_syscalls.c Modified: stable/9/sys/kern/uipc_syscalls.c ============================================================================== --- stable/9/sys/kern/uipc_syscalls.c Fri Sep 6 10:40:38 2013 (r255298) +++ stable/9/sys/kern/uipc_syscalls.c Fri Sep 6 12:45:08 2013 (r255299) @@ -96,6 +96,13 @@ __FBSDID("$FreeBSD$"); #endif /* SCTP */ #endif /* INET || INET6 */ +/* + * Creation flags, OR'ed into socket() and socketpair() type argument. + * For stable/9, these are supported but not exposed in the header file. + */ +#define SOCK_CLOEXEC 0x10000000 +#define SOCK_NONBLOCK 0x20000000 + static int sendit(struct thread *td, int s, struct msghdr *mp, int flags); static int recvit(struct thread *td, int s, struct msghdr *mp, void *namelenp); @@ -183,26 +190,41 @@ sys_socket(td, uap) struct filedesc *fdp; struct socket *so; struct file *fp; - int fd, error; + int fd, error, type, oflag, fflag; AUDIT_ARG_SOCKET(uap->domain, uap->type, uap->protocol); + + type = uap->type; + oflag = 0; + fflag = 0; + if ((type & SOCK_CLOEXEC) != 0) { + type &= ~SOCK_CLOEXEC; + oflag |= O_CLOEXEC; + } + if ((type & SOCK_NONBLOCK) != 0) { + type &= ~SOCK_NONBLOCK; + fflag |= FNONBLOCK; + } + #ifdef MAC - error = mac_socket_check_create(td->td_ucred, uap->domain, uap->type, + error = mac_socket_check_create(td->td_ucred, uap->domain, type, uap->protocol); if (error) return (error); #endif fdp = td->td_proc->p_fd; - error = falloc(td, &fp, &fd, 0); + error = falloc(td, &fp, &fd, oflag); if (error) return (error); /* An extra reference on `fp' has been held for us by falloc(). */ - error = socreate(uap->domain, &so, uap->type, uap->protocol, + error = socreate(uap->domain, &so, type, uap->protocol, td->td_ucred, td); if (error) { fdclose(fdp, fp, fd, td); } else { - finit(fp, FREAD | FWRITE, DTYPE_SOCKET, so, &socketops); + finit(fp, FREAD | FWRITE | fflag, DTYPE_SOCKET, so, &socketops); + if ((fflag & FNONBLOCK) != 0) + (void) fo_ioctl(fp, FIONBIO, &fflag, td->td_ucred, td); td->td_retval[0] = fd; } fdrop(fp, td); @@ -606,9 +628,20 @@ kern_socketpair(struct thread *td, int d struct filedesc *fdp = td->td_proc->p_fd; struct file *fp1, *fp2; struct socket *so1, *so2; - int fd, error; + int fd, error, oflag, fflag; AUDIT_ARG_SOCKET(domain, type, protocol); + + oflag = 0; + fflag = 0; + if ((type & SOCK_CLOEXEC) != 0) { + type &= ~SOCK_CLOEXEC; + oflag |= O_CLOEXEC; + } + if ((type & SOCK_NONBLOCK) != 0) { + type &= ~SOCK_NONBLOCK; + fflag |= FNONBLOCK; + } #ifdef MAC /* We might want to have a separate check for socket pairs. */ error = mac_socket_check_create(td->td_ucred, domain, type, @@ -623,12 +656,12 @@ kern_socketpair(struct thread *td, int d if (error) goto free1; /* On success extra reference to `fp1' and 'fp2' is set by falloc. */ - error = falloc(td, &fp1, &fd, 0); + error = falloc(td, &fp1, &fd, oflag); if (error) goto free2; rsv[0] = fd; fp1->f_data = so1; /* so1 already has ref count */ - error = falloc(td, &fp2, &fd, 0); + error = falloc(td, &fp2, &fd, oflag); if (error) goto free3; fp2->f_data = so2; /* so2 already has ref count */ @@ -644,8 +677,14 @@ kern_socketpair(struct thread *td, int d if (error) goto free4; } - finit(fp1, FREAD | FWRITE, DTYPE_SOCKET, fp1->f_data, &socketops); - finit(fp2, FREAD | FWRITE, DTYPE_SOCKET, fp2->f_data, &socketops); + finit(fp1, FREAD | FWRITE | fflag, DTYPE_SOCKET, fp1->f_data, + &socketops); + finit(fp2, FREAD | FWRITE | fflag, DTYPE_SOCKET, fp2->f_data, + &socketops); + if ((fflag & FNONBLOCK) != 0) { + (void) fo_ioctl(fp1, FIONBIO, &fflag, td->td_ucred, td); + (void) fo_ioctl(fp2, FIONBIO, &fflag, td->td_ucred, td); + } fdrop(fp1, td); fdrop(fp2, td); return (0); From owner-svn-src-stable@FreeBSD.ORG Fri Sep 6 15:17:25 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C1472F6B; Fri, 6 Sep 2013 15:17:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AE1CE2693; Fri, 6 Sep 2013 15:17:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r86FHPo1065463; Fri, 6 Sep 2013 15:17:25 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r86FHPpJ065462; Fri, 6 Sep 2013 15:17:25 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201309061517.r86FHPpJ065462@svn.freebsd.org> From: Dimitry Andric Date: Fri, 6 Sep 2013 15:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255306 - stable/9/include X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Sep 2013 15:17:25 -0000 Author: dim Date: Fri Sep 6 15:17:25 2013 New Revision: 255306 URL: http://svnweb.freebsd.org/changeset/base/255306 Log: MFC r245428: Add CLOCK_PROCESS_CPUTIME_ID to , to synchronize the CLOCK_* values with those in . Otherwise, if a program includes before , the CLOCK_PROCESS_CPUTIME_ID macro never gets defined. Reviewed by: davidxu Modified: stable/9/include/time.h Directory Properties: stable/9/include/ (props changed) Modified: stable/9/include/time.h ============================================================================== --- stable/9/include/time.h Fri Sep 6 14:34:20 2013 (r255305) +++ stable/9/include/time.h Fri Sep 6 15:17:25 2013 (r255306) @@ -112,6 +112,7 @@ typedef __pid_t pid_t; #define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ #define CLOCK_SECOND 13 /* FreeBSD-specific. */ #define CLOCK_THREAD_CPUTIME_ID 14 +#define CLOCK_PROCESS_CPUTIME_ID 15 #endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */ #if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 From owner-svn-src-stable@FreeBSD.ORG Sat Sep 7 06:38:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9CA5E900; Sat, 7 Sep 2013 06:38:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 896C62E1A; Sat, 7 Sep 2013 06:38:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r876cZao033053; Sat, 7 Sep 2013 06:38:35 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r876cZ73033038; Sat, 7 Sep 2013 06:38:35 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201309070638.r876cZ73033038@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 7 Sep 2013 06:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255345 - in stable/9/sys: dev/usb netgraph/bluetooth/drivers/ubt X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2013 06:38:35 -0000 Author: hselasky Date: Sat Sep 7 06:38:34 2013 New Revision: 255345 URL: http://svnweb.freebsd.org/changeset/base/255345 Log: MFC r255090 and r255128: PR: kern/181728 Modified: stable/9/sys/dev/usb/usbdevs stable/9/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usbdevs ============================================================================== --- stable/9/sys/dev/usb/usbdevs Sat Sep 7 05:44:53 2013 (r255344) +++ stable/9/sys/dev/usb/usbdevs Sat Sep 7 06:38:34 2013 (r255345) @@ -515,11 +515,13 @@ vendor USR 0x0baf U.S. Robotics vendor AMBIT 0x0bb2 Ambit Microsystems vendor HTC 0x0bb4 HTC vendor REALTEK 0x0bda Realtek +vendor ERICSSON2 0x0bdb Ericsson vendor MEI 0x0bed MEI vendor ADDONICS2 0x0bf6 Addonics Technology vendor FSC 0x0bf8 Fujitsu Siemens Computers vendor AGATE 0x0c08 Agate Technologies vendor DMI 0x0c0b DMI +vendor CANYON 0x0c10 Canyon vendor ICOM 0x0c26 Icom Inc. vendor GNOTOMETRICS 0x0c33 GN Otometrics vendor CHICONY2 0x0c45 Chicony Modified: stable/9/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c ============================================================================== --- stable/9/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Sat Sep 7 05:44:53 2013 (r255344) +++ stable/9/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Sat Sep 7 06:38:34 2013 (r255345) @@ -404,6 +404,67 @@ static const STRUCT_USB_HOST_ID ubt_devs USB_IFACE_CLASS(UICLASS_VENDOR), USB_IFACE_SUBCLASS(UDSUBCLASS_RF), USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) }, + + /* Apple-specific (Broadcom) devices */ + { USB_VENDOR(USB_VENDOR_APPLE), + USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(UDSUBCLASS_RF), + USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) }, + + /* Foxconn - Hon Hai */ + { USB_VENDOR(USB_VENDOR_FOXCONN), + USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(UDSUBCLASS_RF), + USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) }, + + /* MediaTek MT76x0E */ + { USB_VPI(USB_VENDOR_MEDIATEK, 0x763f, 0) }, + + /* Broadcom SoftSailing reporting vendor specific */ + { USB_VPI(USB_VENDOR_BROADCOM, 0x21e1, 0) }, + + /* Apple MacBookPro 7,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x8213, 0) }, + + /* Apple iMac11,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x8215, 0) }, + + /* Apple MacBookPro6,2 */ + { USB_VPI(USB_VENDOR_APPLE, 0x8218, 0) }, + + /* Apple MacBookAir3,1, MacBookAir3,2 */ + { USB_VPI(USB_VENDOR_APPLE, 0x821b, 0) }, + + /* Apple MacBookAir4,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x821f, 0) }, + + /* MacBookAir6,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x828f, 0) }, + + /* Apple MacBookPro8,2 */ + { USB_VPI(USB_VENDOR_APPLE, 0x821a, 0) }, + + /* Apple MacMini5,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x8281, 0) }, + + /* Bluetooth Ultraport Module from IBM */ + { USB_VPI(USB_VENDOR_TDK, 0x030a, 0) }, + + /* ALPS Modules with non-standard ID */ + { USB_VPI(USB_VENDOR_ALPS, 0x3001, 0) }, + { USB_VPI(USB_VENDOR_ALPS, 0x3002, 0) }, + + { USB_VPI(USB_VENDOR_ERICSSON2, 0x1002, 0) }, + + /* Canyon CN-BTU1 with HID interfaces */ + { USB_VPI(USB_VENDOR_CANYON, 0x0000, 0) }, + + /* Broadcom BCM20702A0 */ + { USB_VPI(USB_VENDOR_ASUS, 0x17b5, 0) }, + { USB_VPI(USB_VENDOR_ASUS, 0x17cb, 0) }, + { USB_VPI(USB_VENDOR_LITEON, 0x2003, 0) }, + { USB_VPI(USB_VENDOR_FOXCONN, 0xe042, 0) }, + { USB_VPI(USB_VENDOR_DELL, 0x8197, 0) }, }; /* From owner-svn-src-stable@FreeBSD.ORG Sat Sep 7 06:41:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4B144A4E; Sat, 7 Sep 2013 06:41:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 375592E52; Sat, 7 Sep 2013 06:41:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r876fNcf035941; Sat, 7 Sep 2013 06:41:23 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r876fMFp035939; Sat, 7 Sep 2013 06:41:22 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201309070641.r876fMFp035939@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 7 Sep 2013 06:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255346 - in stable/8/sys: dev/usb netgraph/bluetooth/drivers/ubt X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2013 06:41:23 -0000 Author: hselasky Date: Sat Sep 7 06:41:22 2013 New Revision: 255346 URL: http://svnweb.freebsd.org/changeset/base/255346 Log: MFC r255090 and r255128: Add more USB IDs. PR: kern/181728 Modified: stable/8/sys/dev/usb/usbdevs stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) stable/8/sys/netgraph/ (props changed) Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Sat Sep 7 06:38:34 2013 (r255345) +++ stable/8/sys/dev/usb/usbdevs Sat Sep 7 06:41:22 2013 (r255346) @@ -514,11 +514,13 @@ vendor USR 0x0baf U.S. Robotics vendor AMBIT 0x0bb2 Ambit Microsystems vendor HTC 0x0bb4 HTC vendor REALTEK 0x0bda Realtek +vendor ERICSSON2 0x0bdb Ericsson vendor MEI 0x0bed MEI vendor ADDONICS2 0x0bf6 Addonics Technology vendor FSC 0x0bf8 Fujitsu Siemens Computers vendor AGATE 0x0c08 Agate Technologies vendor DMI 0x0c0b DMI +vendor CANYON 0x0c10 Canyon vendor ICOM 0x0c26 Icom Inc. vendor GNOTOMETRICS 0x0c33 GN Otometrics vendor CHICONY2 0x0c45 Chicony Modified: stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c ============================================================================== --- stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Sat Sep 7 06:38:34 2013 (r255345) +++ stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Sat Sep 7 06:41:22 2013 (r255346) @@ -404,6 +404,67 @@ static const STRUCT_USB_HOST_ID ubt_devs USB_IFACE_CLASS(UICLASS_VENDOR), USB_IFACE_SUBCLASS(UDSUBCLASS_RF), USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) }, + + /* Apple-specific (Broadcom) devices */ + { USB_VENDOR(USB_VENDOR_APPLE), + USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(UDSUBCLASS_RF), + USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) }, + + /* Foxconn - Hon Hai */ + { USB_VENDOR(USB_VENDOR_FOXCONN), + USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(UDSUBCLASS_RF), + USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) }, + + /* MediaTek MT76x0E */ + { USB_VPI(USB_VENDOR_MEDIATEK, 0x763f, 0) }, + + /* Broadcom SoftSailing reporting vendor specific */ + { USB_VPI(USB_VENDOR_BROADCOM, 0x21e1, 0) }, + + /* Apple MacBookPro 7,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x8213, 0) }, + + /* Apple iMac11,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x8215, 0) }, + + /* Apple MacBookPro6,2 */ + { USB_VPI(USB_VENDOR_APPLE, 0x8218, 0) }, + + /* Apple MacBookAir3,1, MacBookAir3,2 */ + { USB_VPI(USB_VENDOR_APPLE, 0x821b, 0) }, + + /* Apple MacBookAir4,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x821f, 0) }, + + /* MacBookAir6,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x828f, 0) }, + + /* Apple MacBookPro8,2 */ + { USB_VPI(USB_VENDOR_APPLE, 0x821a, 0) }, + + /* Apple MacMini5,1 */ + { USB_VPI(USB_VENDOR_APPLE, 0x8281, 0) }, + + /* Bluetooth Ultraport Module from IBM */ + { USB_VPI(USB_VENDOR_TDK, 0x030a, 0) }, + + /* ALPS Modules with non-standard ID */ + { USB_VPI(USB_VENDOR_ALPS, 0x3001, 0) }, + { USB_VPI(USB_VENDOR_ALPS, 0x3002, 0) }, + + { USB_VPI(USB_VENDOR_ERICSSON2, 0x1002, 0) }, + + /* Canyon CN-BTU1 with HID interfaces */ + { USB_VPI(USB_VENDOR_CANYON, 0x0000, 0) }, + + /* Broadcom BCM20702A0 */ + { USB_VPI(USB_VENDOR_ASUS, 0x17b5, 0) }, + { USB_VPI(USB_VENDOR_ASUS, 0x17cb, 0) }, + { USB_VPI(USB_VENDOR_LITEON, 0x2003, 0) }, + { USB_VPI(USB_VENDOR_FOXCONN, 0xe042, 0) }, + { USB_VPI(USB_VENDOR_DELL, 0x8197, 0) }, }; /*