From owner-svn-src-head@FreeBSD.ORG Thu Feb 26 19:34:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48D0C1065741; Thu, 26 Feb 2009 19:34:04 +0000 (UTC) (envelope-from owner-svn-src-all@freebsd.org) Received: from forwards3.yandex.ru (forwards3.yandex.ru [213.180.223.174]) by mx1.freebsd.org (Postfix) with ESMTP id CFE598FC19; Thu, 26 Feb 2009 19:34:03 +0000 (UTC) (envelope-from owner-svn-src-all@freebsd.org) Received: from mxfront64.yandex.ru (mxfront64.yandex.ru [213.180.223.3]) by forwards3.yandex.ru (Yandex) with ESMTP id 03AF81B32D8; Thu, 26 Feb 2009 22:33:06 +0300 (MSK) Received: from mx2.freebsd.org ([69.147.83.53]:56270 "EHLO mx2.freebsd.org" smtp-auth: TLS-CIPHER: TLS-PEER-CN1: ) by mail.yandex.ru with ESMTP id S17090136AbZBZMfB for (+ 2 others); Thu, 26 Feb 2009 15:35:01 +0300 X-Yandex-TimeMark: 1235651701 X-Yandex-Spam: 2 X-Yandex-Front: mxfront64 Received: from hub.freebsd.org (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id C58AE1A797A; Thu, 26 Feb 2009 12:33:56 +0000 (UTC) (envelope-from owner-svn-src-all@freebsd.org) Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 03F3910656F2; Thu, 26 Feb 2009 12:33:56 +0000 (UTC) (envelope-from owner-svn-src-all@freebsd.org) Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E8F710656F3; Thu, 26 Feb 2009 12:33:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CA1F8FC0A; Thu, 26 Feb 2009 12:33:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1QCXCwa027746; Thu, 26 Feb 2009 12:33:12 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1QCXCc6027745; Thu, 26 Feb 2009 12:33:12 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200902261233.n1QCXCc6027745@svn.freebsd.org> From: Andriy Gapon Date: Thu, 26 Feb 2009 12:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Sender: owner-svn-src-all@freebsd.org Errors-To: owner-svn-src-all@freebsd.org Cc: Subject: svn commit: r189068 - head/sys/fs/udf X-BeenThere: svn-src-head@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Feb 2009 19:34:07 -0000 Author: avg Date: Thu Feb 26 12:33:12 2009 New Revision: 189068 URL: http://svn.freebsd.org/changeset/base/189068 Log: udf_read: correctly read data from files with data embedded into fentry, ... as opposed to files with data in extents. Some UDF authoring tools produce this type of file for sufficiently small data files. Approved by: jhb (mentor) Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Thu Feb 26 12:33:02 2009 (r189067) +++ head/sys/fs/udf/udf_vnops.c Thu Feb 26 12:33:12 2009 (r189068) @@ -419,6 +419,14 @@ udf_print(struct vop_print_args *ap) #define blkoff(udfmp, loc) ((loc) & (udfmp)->bmask) #define lblktosize(udfmp, blk) ((blk) << (udfmp)->bshift) +static inline int +is_data_in_fentry(const struct udf_node *node) +{ + const struct file_entry *fentry = node->fentry; + + return ((le16toh(fentry->icbtag.flags) & 0x7) == 3); +} + static int udf_read(struct vop_read_args *ap) { @@ -426,7 +434,9 @@ udf_read(struct vop_read_args *ap) struct uio *uio = ap->a_uio; struct udf_node *node = VTON(vp); struct udf_mnt *udfmp; + struct file_entry *fentry; struct buf *bp; + uint8_t *data; daddr_t lbn, rablock; off_t diff, fsize; int error = 0; @@ -436,6 +446,22 @@ udf_read(struct vop_read_args *ap) return (0); if (uio->uio_offset < 0) return (EINVAL); + + if (is_data_in_fentry(node)) { + fentry = node->fentry; + data = &fentry->data[le32toh(fentry->l_ea)]; + fsize = le32toh(fentry->l_ad); + + n = uio->uio_resid; + diff = fsize - uio->uio_offset; + if (diff <= 0) + return (0); + if (diff < n) + n = diff; + error = uiomove(data + uio->uio_offset, (int)n, uio); + return (error); + } + fsize = le64toh(node->fentry->inf_len); udfmp = node->udfmp; do { _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"