Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Aug 2005 14:40:17 +0200
From:      des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=)
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Mikhail Teterin <mi+mx@aldan.algebra.com>, questions@FreeBSD.org, standards@FreeBSD.org
Subject:   Re: very big files on cd9660 file system
Message-ID:  <86y86qrxzi.fsf@xps.des.no>
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 %2B0200")
References:  <200508191942.26723.mi%2Bmx@aldan.algebra.com> <20050820142802.E60211@delplex.bde.org> <863boytdbi.fsf@xps.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
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 '='.

--=-=-=--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86y86qrxzi.fsf>