Subject: Re: File > 2G on a dvd
To: Martin Husemann <martin@duskware.de>
From: Rhialto <rhialto@azenomei.knuffel.net>
List: current-users
Date: 11/29/2004 23:22:14
On Mon 29 Nov 2004 at 09:56:41 +0100, Martin Husemann wrote:
> On Mon, Nov 29, 2004 at 12:08:07AM +0100, Rhialto wrote:
> > 1a) some bug in cd9660 in 1.6.2 that was fixed in 2.0
> 
> Yes, we changed the interpretation of the 32bits for size from signed
> to unsigned.

Yes, I see this diff that seems to be the relevant one:

diff -u /mnt/usr/src/sys/isofs/cd9660/cd9660_node.h /usr/src/sys/fs/cd9660/cd9660_node.h
--- /mnt/usr/src/sys/isofs/cd9660/cd9660_node.h	2001-09-15 22:36:36.000000000 +0200
+++ /usr/src/sys/fs/cd9660/cd9660_node.h	2004-06-22 11:02:45.000000000 +0200
@@ -90,9 +86,9 @@
    doff_t	i_offset;	/* offset of free space in directory */
    ino_t	i_ino;		/* inode number of found directory */
 
-	long iso_extent;	/* extent of file */
-	long i_size;
-	long iso_start;		/* actual start of data of file (may be different */
+	unsigned long iso_extent;	/* extent of file */
+	unsigned long i_size;
+	unsigned long iso_start;		/* actual start of data of file (may be different */
		/* from iso_extent, if file has extended attributes) */
    ISO_RRIP_INODE  inode;
 };

The i_size is set like this in cd9660_vfsops.c:

    ip->i_size = isonum_733(isodir->size);

iso.h defines isonum_733() so:

/* 7.3.3: unsigned both-endian (little, then big) 32-bit value */
static __inline int
#if __STDC__
isonum_733(u_char *p)
#else
isonum_733(p)
    u_char *p;
#endif
{
...

Unfortunately here the comment does not match the code. I expect that
there is still going to be sign extension here, and the Alpha will still
see the file size as negative (unsigned long is bigger than signed int,
so sign extension will occur).

(one kernel build later)

Indeed. I need to change isonum_733() to unsigned int (maybe even
u_int32_t, and maybe also all other isonum_7xx() functions).

(one kernel build later)

Yes, the file looks ok now on the Alpha too:

-r--r--r--  1 root  wheel  2149588992 Oct 30 13:23 FOO

Since I read that 2.0 is now final, this looks like it's going to be for
2.1.

-Olaf.
-- 
                           -- Ceterum censeo "authored[1]" delendum esse.
___ Olaf 'Rhialto' Seibert -- [1] Ugly English neologism[2].
\X/ rhialto/at/xs4all.nl   -- [2] For lawyers whose English/Latin is below par.