From owner-freebsd-questions@FreeBSD.ORG Thu Aug 25 12:40:23 2005 Return-Path: X-Original-To: questions@FreeBSD.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B75B816A41F; Thu, 25 Aug 2005 12:40:23 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 38E5B43D45; Thu, 25 Aug 2005 12:40:23 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 5A2B66194; Thu, 25 Aug 2005 14:40:06 +0200 (CEST) Received: from xps.des.no (des.no [80.203.228.37]) by tim.des.no (Postfix) with ESMTP id 3B39C60FE; Thu, 25 Aug 2005 14:40:06 +0200 (CEST) Received: by xps.des.no (Postfix, from userid 1001) id 5C99F33CA7; Thu, 25 Aug 2005 14:40:17 +0200 (CEST) To: Bruce Evans References: <200508191942.26723.mi+mx@aldan.algebra.com> <20050820142802.E60211@delplex.bde.org> <863boytdbi.fsf@xps.des.no> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Thu, 25 Aug 2005 14:40:17 +0200 In-Reply-To: <863boytdbi.fsf@xps.des.no> (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav's?= message of "Thu, 25 Aug 2005 14:23:45 +0200") Message-ID: <86y86qrxzi.fsf@xps.des.no> User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Tests: ALL_TRUSTED,AWL,BAYES_00 X-Spam-Learn: ham X-Spam-Score: -5.2/3.0 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on tim.des.no Cc: Mikhail Teterin , questions@FreeBSD.org, standards@FreeBSD.org Subject: Re: very big files on cd9660 file system X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2005 12:40:24 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable The attached patch should make the isonum functions in iso.h much clearer. It also gets rid of the optimizated versions; I trust the compiler to take care of that. The inode number situation can be improved by dividing the byte offset of the directory entry by a suitable number guaranteed not to be larger than the size in bytes of any directory entry, e.g. 32 (IIUC, a directory entry contains at least 33 bytes of metadata and padding in addition to the file name) DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=iso9660.diff Index: sys/isofs/cd9660/iso.h =================================================================== RCS file: /home/ncvs/src/sys/isofs/cd9660/iso.h,v retrieving revision 1.30 diff -u -r1.30 iso.h --- sys/isofs/cd9660/iso.h 14 Mar 2005 13:22:41 -0000 1.30 +++ sys/isofs/cd9660/iso.h 25 Aug 2005 12:33:44 -0000 @@ -277,79 +277,65 @@ * outside the kernel. Thus we don't hide them here. */ -static __inline int isonum_711(u_char *); -static __inline int -isonum_711(p) - u_char *p; +/* + * 7xy + * x -> 1 = 8 bits, 2 = 16 bits, 3 = 32 bits + * y -> 1 = little-endian, 2 = big-endian, 3 = both (le then be) + */ + +static __inline uint8_t +isonum_711(unsigned char *p) { - return *p; + return p[0]; } -static __inline int isonum_712(char *); -static __inline int -isonum_712(p) - char *p; +static __inline uint8_t +isonum_712(unsigned char *p) { - return *p; + return p[0]; } -#ifndef UNALIGNED_ACCESS - -static __inline int isonum_723(u_char *); -static __inline int -isonum_723(p) - u_char *p; +static __inline uint8_t +isonum_713(unsigned char *p) { - return *p|(p[1] << 8); + return p[0]; } -static __inline int isonum_733(u_char *); -static __inline int -isonum_733(p) - u_char *p; +static __inline uint16_t +isonum_721(unsigned char *p) { - return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24); + return (p[0] | p[1] << 8); } -#else /* UNALIGNED_ACCESS */ - -#if BYTE_ORDER == LITTLE_ENDIAN - -static __inline int -isonum_723(p) - u_char *p +static __inline uint16_t +isonum_722(unsigned char *p) { - return *(u_int16t *)p; + return (p[1] | p[0] << 8); } -static __inline int -isonum_733(p) - u_char *p; +static __inline uint16_t +isonum_723(unsigned char *p) { - return *(u_int32t *)p; + return (p[0] | p[1] << 8); } -#endif - -#if BYTE_ORDER == BIG_ENDIAN - -static __inline int -isonum_723(p) - u_char *p +static __inline uint32_t +isonum_731(unsigned char *p) { - return *(u_int16t *)(p + 2); + return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24); } -static __inline int -isonum_733(p) - u_char *p; +static __inline uint32_t +isonum_732(unsigned char *p) { - return *(u_int32t *)(p + 4); + return (p[3] | p[2] << 8 | p[1] << 16 | p[0] << 24); } -#endif - -#endif /* UNALIGNED_ACCESS */ +static __inline uint32_t +isonum_733(unsigned char *p) +{ + return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24); +} /* * Associated files have a leading '='. --=-=-=--