示例#1
0
/*
 *	isofs_find_entry()
 *
 * finds an entry in the specified directory with the wanted name. It
 * returns the inode number of the found entry, or 0 on error.
 */
static unsigned long
isofs_find_entry(struct inode *dir, struct dentry *dentry,
	unsigned long *block_rv, unsigned long* offset_rv,
	char * tmpname, struct iso_directory_record * tmpde)
{
	unsigned long bufsize = ISOFS_BUFFER_SIZE(dir);
	unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
	unsigned long block, f_pos, offset, block_saved, offset_saved;
	struct buffer_head * bh = NULL;
	struct isofs_sb_info *sbi = ISOFS_SB(dir->i_sb);

	if (!ISOFS_I(dir)->i_first_extent)
		return 0;
  
	f_pos = 0;
	offset = 0;
	block = 0;

	while (f_pos < dir->i_size) {
		struct iso_directory_record * de;
		int de_len, match, i, dlen;
		char *dpnt;

		if (!bh) {
			bh = isofs_bread(dir, block);
			if (!bh)
				return 0;
		}

		de = (struct iso_directory_record *) (bh->b_data + offset);

		de_len = *(unsigned char *) de;
		if (!de_len) {
			brelse(bh);
			bh = NULL;
			f_pos = (f_pos + ISOFS_BLOCK_SIZE) & ~(ISOFS_BLOCK_SIZE - 1);
			block = f_pos >> bufbits;
			offset = 0;
			continue;
		}

		block_saved = bh->b_blocknr;
		offset_saved = offset;
		offset += de_len;
		f_pos += de_len;

		/* Make sure we have a full directory entry */
		if (offset >= bufsize) {
			int slop = bufsize - offset + de_len;
			memcpy(tmpde, de, slop);
			offset &= bufsize - 1;
			block++;
			brelse(bh);
			bh = NULL;
			if (offset) {
				bh = isofs_bread(dir, block);
				if (!bh)
					return 0;
				memcpy((void *) tmpde + slop, bh->b_data, offset);
			}
			de = tmpde;
		}

		dlen = de->name_len[0];
		dpnt = de->name;

		if (sbi->s_rock &&
		    ((i = get_rock_ridge_filename(de, tmpname, dir)))) {
			dlen = i; 	/* possibly -1 */
			dpnt = tmpname;
#ifdef CONFIG_JOLIET
		} else if (sbi->s_joliet_level) {
			dlen = get_joliet_filename(de, tmpname, dir);
			dpnt = tmpname;
#endif
		} else if (sbi->s_mapping == 'a') {
			dlen = get_acorn_filename(de, tmpname, dir);
			dpnt = tmpname;
		} else if (sbi->s_mapping == 'n') {
			dlen = isofs_name_translate(de, tmpname, dir);
			dpnt = tmpname;
		}

		/*
		 * Skip hidden or associated files unless unhide is set 
		 */
		match = 0;
		if (dlen > 0 &&
		    (!(de->flags[-sbi->s_high_sierra] & 5)
		     || sbi->s_unhide == 'y'))
		{
			match = (isofs_cmp(dentry,dpnt,dlen) == 0);
		}
		if (match) {
			isofs_normalize_block_and_offset(de,
							 &block_saved,
							 &offset_saved);
                        *block_rv = block_saved;
                        *offset_rv = offset_saved;
			if (bh) brelse(bh);
			return 1;
		}
	}
示例#2
0
/*
 * Read data of @inode from @block_start to @block_end and uncompress
 * to one zisofs block. Store the data in the @pages array with @pcount
 * entries. Start storing at offset @poffset of the first page.
 */
static loff_t zisofs_uncompress_block(struct inode *inode, loff_t block_start,
				      loff_t block_end, int pcount,
				      struct page **pages, unsigned poffset,
				      int *errp)
{
	unsigned int zisofs_block_shift = ISOFS_I(inode)->i_format_parm[1];
	unsigned int bufsize = ISOFS_BUFFER_SIZE(inode);
	unsigned int bufshift = ISOFS_BUFFER_BITS(inode);
	unsigned int bufmask = bufsize - 1;
	int i, block_size = block_end - block_start;
	z_stream stream = { .total_out = 0,
			    .avail_in = 0,
			    .avail_out = 0, };
	int zerr;
	int needblocks = (block_size + (block_start & bufmask) + bufmask)
				>> bufshift;
	int haveblocks;
	blkcnt_t blocknum;
	struct buffer_head *bhs[needblocks + 1];
	int curbh, curpage;

	if (block_size > deflateBound(1UL << zisofs_block_shift)) {
		*errp = -EIO;
		return 0;
	}
	/* Empty block? */
	if (block_size == 0) {
		for ( i = 0 ; i < pcount ; i++ ) {
			if (!pages[i])
				continue;
			memset(page_address(pages[i]), 0, PAGE_SIZE);
			flush_dcache_page(pages[i]);
			SetPageUptodate(pages[i]);
		}
		return ((loff_t)pcount) << PAGE_SHIFT;
	}

	/* Because zlib is not thread-safe, do all the I/O at the top. */
	blocknum = block_start >> bufshift;
	memset(bhs, 0, (needblocks + 1) * sizeof(struct buffer_head *));
	haveblocks = isofs_get_blocks(inode, blocknum, bhs, needblocks);
	ll_rw_block(REQ_OP_READ, 0, haveblocks, bhs);

	curbh = 0;
	curpage = 0;
	/*
	 * First block is special since it may be fractional.  We also wait for
	 * it before grabbing the zlib mutex; odds are that the subsequent
	 * blocks are going to come in in short order so we don't hold the zlib
	 * mutex longer than necessary.
	 */

	if (!bhs[0])
		goto b_eio;

	wait_on_buffer(bhs[0]);
	if (!buffer_uptodate(bhs[0])) {
		*errp = -EIO;
		goto b_eio;
	}

	stream.workspace = zisofs_zlib_workspace;
	mutex_lock(&zisofs_zlib_lock);
		
	zerr = zlib_inflateInit(&stream);
	if (zerr != Z_OK) {
		if (zerr == Z_MEM_ERROR)
			*errp = -ENOMEM;
		else
			*errp = -EIO;
		printk(KERN_DEBUG "zisofs: zisofs_inflateInit returned %d\n",
			       zerr);
		goto z_eio;
	}

	while (curpage < pcount && curbh < haveblocks &&
	       zerr != Z_STREAM_END) {
		if (!stream.avail_out) {
			if (pages[curpage]) {
				stream.next_out = page_address(pages[curpage])
						+ poffset;
				stream.avail_out = PAGE_SIZE - poffset;
				poffset = 0;
			} else {
				stream.next_out = (void *)&zisofs_sink_page;
				stream.avail_out = PAGE_SIZE;
			}
		}
		if (!stream.avail_in) {
			wait_on_buffer(bhs[curbh]);
			if (!buffer_uptodate(bhs[curbh])) {
				*errp = -EIO;
				break;
			}
			stream.next_in  = bhs[curbh]->b_data +
						(block_start & bufmask);
			stream.avail_in = min_t(unsigned, bufsize -
						(block_start & bufmask),
						block_size);
			block_size -= stream.avail_in;
			block_start = 0;
		}

		while (stream.avail_out && stream.avail_in) {
			zerr = zlib_inflate(&stream, Z_SYNC_FLUSH);
			if (zerr == Z_BUF_ERROR && stream.avail_in == 0)
				break;
			if (zerr == Z_STREAM_END)
				break;
			if (zerr != Z_OK) {
				/* EOF, error, or trying to read beyond end of input */
				if (zerr == Z_MEM_ERROR)
					*errp = -ENOMEM;
				else {
					printk(KERN_DEBUG
					       "zisofs: zisofs_inflate returned"
					       " %d, inode = %lu,"
					       " page idx = %d, bh idx = %d,"
					       " avail_in = %ld,"
					       " avail_out = %ld\n",
					       zerr, inode->i_ino, curpage,
					       curbh, stream.avail_in,
					       stream.avail_out);
					*errp = -EIO;
				}
				goto inflate_out;
			}
		}

		if (!stream.avail_out) {
			/* This page completed */
			if (pages[curpage]) {
				flush_dcache_page(pages[curpage]);
				SetPageUptodate(pages[curpage]);
			}
			curpage++;
		}
		if (!stream.avail_in)
			curbh++;
	}
inflate_out:
	zlib_inflateEnd(&stream);

z_eio:
	mutex_unlock(&zisofs_zlib_lock);

b_eio:
	for (i = 0; i < haveblocks; i++)
		brelse(bhs[i]);
	return stream.total_out;
}
示例#3
0
/*
 *	isofs_find_entry()
 *
 * finds an entry in the specified directory with the wanted name. It
 * returns the cache buffer in which the entry was found, and the entry
 * itself (as an inode number). It does NOT read the inode of the
 * entry - you'll have to do that yourself if you want to.
 */
static struct buffer_head *
isofs_find_entry(struct inode *dir, struct dentry *dentry, unsigned long *ino)
{
	unsigned long bufsize = ISOFS_BUFFER_SIZE(dir);
	unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
	unsigned int block, i, f_pos, offset, 
		inode_number = 0; /* shut gcc up */
	struct buffer_head * bh , * retval = NULL;
	unsigned int old_offset;
	int dlen, match;
	char * dpnt;
	unsigned char *page = NULL;
	struct iso_directory_record * de = NULL; /* shut gcc up */
	char de_not_in_buf = 0;	  /* true if de is in kmalloc'd memory */
	char c;

	*ino = 0;
	if (!dir) return NULL;
	
	if (!(block = dir->u.isofs_i.i_first_extent)) return NULL;
  
	f_pos = 0;

	offset = f_pos & (bufsize - 1);
	block = isofs_bmap(dir,f_pos >> bufbits);

	if (!block || !(bh = bread(dir->i_dev,block,bufsize))) return NULL;

	while (f_pos < dir->i_size) {

		/* if de is in kmalloc'd memory, do not point to the
                   next de, instead we will move to the next sector */
		if(!de_not_in_buf) {
			de = (struct iso_directory_record *) 
				(bh->b_data + offset);
		}
		inode_number = (block << bufbits) + (offset & (bufsize - 1));

		/* If byte is zero, or we had to fetch this de past
		   the end of the buffer, this is the end of file, or
		   time to move to the next sector. Usually 2048 byte
		   boundaries. */
		
		if (*((unsigned char *) de) == 0 || de_not_in_buf) {
			if(de_not_in_buf) {
				/* [email protected]: Since we slopped
                                   past the end of the last buffer, we
                                   must start some way into the new
                                   one */
				de_not_in_buf = 0;
				kfree(de);
				f_pos += offset;
			}
			else { 
				offset = 0;
				f_pos = ((f_pos & ~(ISOFS_BLOCK_SIZE - 1))
					 + ISOFS_BLOCK_SIZE);
			}
			brelse(bh);
			bh = NULL;

			if (f_pos >= dir->i_size) 
				break;

			block = isofs_bmap(dir,f_pos>>bufbits);
			if (!block || !(bh = bread(dir->i_dev,block,bufsize)))
				break;

			continue; /* Will kick out if past end of directory */
		}

		old_offset = offset;
		offset += *((unsigned char *) de);
		f_pos += *((unsigned char *) de);

		/* [email protected]: new code to handle case where the
		   directory entry spans two blocks.  Usually 1024
		   byte boundaries */
		if (offset >= bufsize) {
			struct buffer_head *bh_next;

			/* [email protected]: read the next block, and
                           copy the split de into a newly kmalloc'd
                           buffer */
			block = isofs_bmap(dir,f_pos>>bufbits);
			if (!block || 
			    !(bh_next = bread(dir->i_dev,block,bufsize)))
				break;
			
			de = (struct iso_directory_record *)
				kmalloc(offset - old_offset, GFP_KERNEL);
			memcpy((char *)de, bh->b_data + old_offset, 
			       bufsize - old_offset);
			memcpy((char *)de + bufsize - old_offset,
			       bh_next->b_data, offset - bufsize);
			brelse(bh_next);
			de_not_in_buf = 1;
			offset -= bufsize;
		}
		dlen = de->name_len[0];
		dpnt = de->name;

		if (dir->i_sb->u.isofs_sb.s_rock ||
		    dir->i_sb->u.isofs_sb.s_joliet_level || 
		    dir->i_sb->u.isofs_sb.s_mapping == 'n' ||
		    dir->i_sb->u.isofs_sb.s_mapping == 'a') {
			if (! page) {
				page = (unsigned char *)
					__get_free_page(GFP_KERNEL);
				if (!page) break;
			}
		}
		if (dir->i_sb->u.isofs_sb.s_rock &&
		    ((i = get_rock_ridge_filename(de, page, dir)))) {
			dlen = i;
			dpnt = page;
#ifdef CONFIG_JOLIET
		} else if (dir->i_sb->u.isofs_sb.s_joliet_level) {
			dlen = get_joliet_filename(de, dir, page);
			dpnt = page;
#endif
		} else if (dir->i_sb->u.isofs_sb.s_mapping == 'a') {
			dlen = get_acorn_filename(de, page, dir);
			dpnt = page;
		} else if (dir->i_sb->u.isofs_sb.s_mapping == 'n') {
			for (i = 0; i < dlen; i++) {
				c = dpnt[i];
				/* lower case */
				if (c >= 'A' && c <= 'Z') c |= 0x20;
				if (c == ';' && i == dlen-2 && dpnt[i+1] == '1') {
					dlen -= 2;
					break;
				}
				if (c == ';') c = '.';
				page[i] = c;
			}
			/* This allows us to match with and without
			 * a trailing period. */
			if(page[dlen-1] == '.' && dentry->d_name.len == dlen-1)
				dlen--;
			dpnt = page;
		}
		/*
		 * Skip hidden or associated files unless unhide is set 
		 */
		match = 0;
		if ((!(de->flags[-dir->i_sb->u.isofs_sb.s_high_sierra] & 5)
		    || dir->i_sb->u.isofs_sb.s_unhide == 'y') && dlen)
		{
			match = (isofs_cmp(dentry,dpnt,dlen) == 0);
		}
		if (match) {
			if(inode_number == -1) {
				/* Should only happen for the '..' entry */
				inode_number = 
					isofs_lookup_grandparent(dir,
					   find_rock_ridge_relocation(de,dir));
			}
			*ino = inode_number;
			retval = bh;
			bh = NULL;
			break;
		}
	}
	if (page) free_page((unsigned long) page);
	if (bh) brelse(bh);
	if(de_not_in_buf) 
		kfree(de);
	return retval;
}
示例#4
0
/*
 *	isofs_find_entry()
 *
 * finds an entry in the specified directory with the wanted name. It
 * returns the cache buffer in which the entry was found, and the entry
 * itself (as an inode number). It does NOT read the inode of the
 * entry - you'll have to do that yourself if you want to.
 */
static struct buffer_head * isofs_find_entry(struct inode * dir,
	const char * name, int namelen, unsigned long * ino, unsigned long * ino_back)
{
	unsigned long bufsize = ISOFS_BUFFER_SIZE(dir);
	unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
	unsigned int block, i, f_pos, offset, inode_number;
	struct buffer_head * bh;
	void * cpnt = NULL;
	unsigned int old_offset;
	unsigned int backlink;
	int dlen, rrflag, match;
	char * dpnt;
	struct iso_directory_record * de;
	char c;

	*ino = 0;
	if (!dir) return NULL;
	
	if (!(block = dir->u.isofs_i.i_first_extent)) return NULL;
  
	f_pos = 0;

	offset = f_pos & (bufsize - 1);
	block = isofs_bmap(dir,f_pos >> bufbits);

	if (!block || !(bh = bread(dir->i_dev,block,bufsize))) return NULL;
  
	while (f_pos < dir->i_size) {
		de = (struct iso_directory_record *) (bh->b_data + offset);
		backlink = dir->i_ino;
		inode_number = (block << bufbits) + (offset & (bufsize - 1));

		/* If byte is zero, this is the end of file, or time to move to
		   the next sector. Usually 2048 byte boundaries. */
		
		if (*((unsigned char *) de) == 0) {
			brelse(bh);
			offset = 0;
			f_pos = ((f_pos & ~(ISOFS_BLOCK_SIZE - 1))
				 + ISOFS_BLOCK_SIZE);
			block = isofs_bmap(dir,f_pos>>bufbits);
			if (!block || !(bh = bread(dir->i_dev,block,bufsize)))
				return 0;
			continue; /* Will kick out if past end of directory */
		}

		old_offset = offset;
		offset += *((unsigned char *) de);
		f_pos += *((unsigned char *) de);

		/* Handle case where the directory entry spans two blocks.
		   Usually 1024 byte boundaries */
		if (offset >= bufsize) {
		        unsigned int frag1;
			frag1 = bufsize - old_offset;
			cpnt = kmalloc(*((unsigned char *) de),GFP_KERNEL);
			if (!cpnt) return 0;
			memcpy(cpnt, bh->b_data + old_offset, frag1);

			de = (struct iso_directory_record *) cpnt;
			brelse(bh);
			offset = f_pos & (bufsize - 1);
			block = isofs_bmap(dir,f_pos>>bufbits);
			if (!block || !(bh = bread(dir->i_dev,block,bufsize))) {
			        kfree(cpnt);
				return 0;
			};
			memcpy((char *)cpnt+frag1, bh->b_data, offset);
		}
示例#5
0
int isofs_lookup_grandparent(struct inode * parent, int extent)
{
	unsigned long bufsize = ISOFS_BUFFER_SIZE(parent);
	unsigned char bufbits = ISOFS_BUFFER_BITS(parent);
	unsigned int block,offset;
	int parent_dir, inode_number;
	int old_offset;
	void * cpnt = NULL;
	int result;
	int directory_size;
	struct buffer_head * bh;
	struct iso_directory_record * de;
	
	offset = 0;
	block = extent << (ISOFS_BLOCK_BITS - bufbits);
	if (!(bh = bread(parent->i_dev, block, bufsize)))  return -1;
	
	while (1 == 1) {
		de = (struct iso_directory_record *) (bh->b_data + offset);
		if (*((unsigned char *) de) == 0) 
		{
			brelse(bh);
			return -1;
		}
		
		offset += *((unsigned char *) de);

		if (offset >= bufsize) 
		{
			printk(".. Directory not in first block"
			       " of directory.\n");
			brelse(bh);
			return -1;
		}
		
		if (de->name_len[0] == 1 && de->name[0] == 1) 
		{
			parent_dir = find_rock_ridge_relocation(de, parent);
			directory_size = isonum_733 (de->size);
			brelse(bh);
			break;
		}
	}
#ifdef DEBUG
	printk("Parent dir:%x\n",parent_dir);
#endif
	/* Now we know the extent where the parent dir starts on. */
	
	result = -1;

	offset = 0;
	block = parent_dir << (ISOFS_BLOCK_BITS - bufbits);
	if (!block || !(bh = bread(parent->i_dev,block, bufsize)))
		return -1;
	
	for(;;)
	{
		de = (struct iso_directory_record *) (bh->b_data + offset);
		inode_number = (block << bufbits)+(offset & (bufsize - 1));
		
		/* If the length byte is zero, we should move on to the next
		   CDROM sector.  If we are at the end of the directory, we
		   kick out of the while loop. */
		
		if (*((unsigned char *) de) == 0) 
		{
			brelse(bh);
			offset = 0;
			block++;
			directory_size -= bufsize;
			if(directory_size < 0) return -1;
			if((block & 1) && (ISOFS_BLOCK_BITS - bufbits))
			  return -1;
			if (!block
			    || !(bh = bread(parent->i_dev,block, bufsize)))
				return -1;
			continue;
		}
		
		/* Make sure that the entire directory record is in the current
		   bh block.  If not, we malloc a buffer, and put the two
		   halves together, so that we can cleanly read the block.  */

		old_offset = offset;
		offset += *((unsigned char *) de);

		if (offset >= bufsize)
		{
 		        unsigned int frag1;
 			frag1 = bufsize - old_offset;
 			cpnt = kmalloc(*((unsigned char *) de),GFP_KERNEL);
 			memcpy(cpnt, bh->b_data + old_offset, frag1);
 			de = (struct iso_directory_record *) ((char *)cpnt);
			brelse(bh);
			offset -= bufsize;
 			directory_size -= bufsize;
			if(directory_size < 0) return -1;
			block++;
			if(!(bh = bread(parent->i_dev,block,bufsize))) {
 			        kfree(cpnt);
				return -1;
			};
 			memcpy((char *)cpnt+frag1, bh->b_data, offset);
		}
		
		if (find_rock_ridge_relocation(de, parent) == extent){
			result = inode_number;
			goto out;
		}
		
		if (cpnt) {
			kfree(cpnt);
			cpnt = NULL;
		}
	}

	/* We go here for any condition we cannot handle.
	   We also drop through to here at the end of the directory. */

 out:
	if (cpnt) {
	        kfree(cpnt);
		cpnt = NULL;
	}
	brelse(bh);
#ifdef DEBUG
	printk("Resultant Inode %d\n",result);
#endif
	return result;
}
示例#6
0
void isofs_read_inode(struct inode * inode)
{
	unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
	struct buffer_head * bh;
	struct iso_directory_record * raw_inode;
	unsigned char *pnt = NULL;
	void *cpnt = NULL;
	int high_sierra;
	int block;
	int i;

	block = inode->i_ino >> ISOFS_BUFFER_BITS(inode);
	if (!(bh=bread(inode->i_dev,block, bufsize))) {
	  printk("unable to read i-node block");
	  goto fail;
	}
	
	pnt = ((unsigned char *) bh->b_data
	       + (inode->i_ino & (bufsize - 1)));
	raw_inode = ((struct iso_directory_record *) pnt);
	high_sierra = inode->i_sb->u.isofs_sb.s_high_sierra;

	if ((inode->i_ino & (bufsize - 1)) + *pnt > bufsize){
	        int frag1, offset;

		offset = (inode->i_ino & (bufsize - 1));
		frag1 = bufsize - offset;
	        cpnt = kmalloc(*pnt,GFP_KERNEL);
		if (cpnt == NULL) {
			printk(KERN_INFO "NoMem ISO inode %lu\n",inode->i_ino);
			brelse(bh);
			goto fail;
		}
		memcpy(cpnt, bh->b_data + offset, frag1);
		brelse(bh);
		if (!(bh = bread(inode->i_dev,++block, bufsize))) {
			kfree(cpnt);
			printk("unable to read i-node block");
			goto fail;
		}
		offset += *pnt - bufsize;
		memcpy((char *)cpnt+frag1, bh->b_data, offset);
		pnt = ((unsigned char *) cpnt);
		raw_inode = ((struct iso_directory_record *) pnt);
	}

	inode->i_mode = S_IRUGO; /* Everybody gets to read the file. */
	inode->i_nlink = 1;
	
	if (raw_inode->flags[-high_sierra] & 2) {
		inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR;
		inode->i_nlink = 1; /* Set to 1.  We know there are 2, but
				       the find utility tries to optimize
				       if it is 2, and it screws up.  It is
				       easier to give 1 which tells find to
				       do it the hard way. */
	} else {
		inode->i_mode = S_IRUGO; /* Everybody gets to read the file. */
		inode->i_nlink = 1;
	        inode->i_mode |= S_IFREG;
/* If there are no periods in the name, then set the execute permission bit */
		for(i=0; i< raw_inode->name_len[0]; i++)
			if(raw_inode->name[i]=='.' || raw_inode->name[i]==';')
				break;
		if(i == raw_inode->name_len[0] || raw_inode->name[i] == ';') 
			inode->i_mode |= S_IXUGO; /* execute permission */
	}
	inode->i_uid = inode->i_sb->u.isofs_sb.s_uid;
	inode->i_gid = inode->i_sb->u.isofs_sb.s_gid;
	inode->i_size = isonum_733 (raw_inode->size);

	/* There are defective discs out there - we do this to protect
	   ourselves.  A cdrom will never contain more than 700Mb */
	if((inode->i_size < 0 || inode->i_size > 700000000) &&
	    inode->i_sb->u.isofs_sb.s_cruft == 'n') {
	  printk("Warning: defective cdrom.  Enabling \"cruft\" mount option.\n");
	  inode->i_sb->u.isofs_sb.s_cruft = 'y';
	}

/* Some dipshit decided to store some other bit of information in the high
   byte of the file length.  Catch this and holler.  WARNING: this will make
   it impossible for a file to be > 16Mb on the CDROM!!!*/

	if(inode->i_sb->u.isofs_sb.s_cruft == 'y' && 
	   inode->i_size & 0xff000000){
/*	  printk("Illegal format on cdrom.  Pester manufacturer.\n"); */
	  inode->i_size &= 0x00ffffff;
	}
	
	if (raw_inode->interleave[0]) {
		printk("Interleaved files not (yet) supported.\n");
		inode->i_size = 0;
	}

	/* I have no idea what file_unit_size is used for, so
	   we will flag it for now */
	if(raw_inode->file_unit_size[0] != 0){
		printk("File unit size != 0 for ISO file (%ld).\n",inode->i_ino);
	}

	/* I have no idea what other flag bits are used for, so
	   we will flag it for now */
	if((raw_inode->flags[-high_sierra] & ~2)!= 0){
		printk("Unusual flag settings for ISO file (%ld %x).\n",
		       inode->i_ino, raw_inode->flags[-high_sierra]);
	}

#ifdef DEBUG
	printk("Get inode %d: %d %d: %d\n",inode->i_ino, block, 
	       ((int)pnt) & 0x3ff, inode->i_size);
#endif
	
	inode->i_mtime = inode->i_atime = inode->i_ctime = 
	  iso_date(raw_inode->date, high_sierra);

	inode->u.isofs_i.i_first_extent = 
	  (isonum_733 (raw_inode->extent) + 
	   isonum_711 (raw_inode->ext_attr_length)) << 
		(ISOFS_BLOCK_BITS - ISOFS_BUFFER_BITS(inode));
	
	inode->u.isofs_i.i_backlink = 0xffffffff; /* Will be used for previous directory */
	switch (inode->i_sb->u.isofs_sb.s_conversion){
	case 'a':
	  inode->u.isofs_i.i_file_format = ISOFS_FILE_UNKNOWN; /* File type */
	  break;
	case 'b':
	  inode->u.isofs_i.i_file_format = ISOFS_FILE_BINARY; /* File type */
	  break;
	case 't':
	  inode->u.isofs_i.i_file_format = ISOFS_FILE_TEXT; /* File type */
	  break;
	case 'm':
	  inode->u.isofs_i.i_file_format = ISOFS_FILE_TEXT_M; /* File type */
	  break;
	}

/* Now test for possible Rock Ridge extensions which will override some of
   these numbers in the inode structure. */

	if (!high_sierra)
	  parse_rock_ridge_inode(raw_inode, inode);
	
#ifdef DEBUG
	printk("Inode: %x extent: %x\n",inode->i_ino, inode->u.isofs_i.i_first_extent);
#endif
	brelse(bh);
	
	inode->i_op = NULL;

	/* A volume number of 0 is nonsense.  Disable checking if we see
	   this */
	if (inode->i_sb->u.isofs_sb.s_cruft == 'n' && 
	    isonum_723 (raw_inode->volume_sequence_number) == 0) {
	  printk("Warning: defective cdrom.  Enabling \"cruft\" mount option.\n");
	  inode->i_sb->u.isofs_sb.s_cruft = 'y';
	}

	if (inode->i_sb->u.isofs_sb.s_cruft != 'y' && 
	    isonum_723 (raw_inode->volume_sequence_number) != 1) {
		printk("Multi volume CD somehow got mounted.\n");
	} else {
	  if (S_ISREG(inode->i_mode))
	    inode->i_op = &isofs_file_inode_operations;
	  else if (S_ISDIR(inode->i_mode))
	    inode->i_op = &isofs_dir_inode_operations;
	  else if (S_ISLNK(inode->i_mode))
	    inode->i_op = &isofs_symlink_inode_operations;
	  else if (S_ISCHR(inode->i_mode))
	    inode->i_op = &chrdev_inode_operations;
	  else if (S_ISBLK(inode->i_mode))
	    inode->i_op = &blkdev_inode_operations;
	  else if (S_ISFIFO(inode->i_mode))
	    init_fifo(inode);
	}
	if (cpnt) {
		kfree (cpnt);
		cpnt = NULL;
	}
	return;
      fail:
	/* With a data error we return this information */
	inode->i_mtime = inode->i_atime = inode->i_ctime = 0;
	inode->u.isofs_i.i_first_extent = 0;
	inode->u.isofs_i.i_backlink = 0xffffffff;
	inode->i_size = 0;
	inode->i_nlink = 1;
	inode->i_uid = inode->i_gid = 0;
	inode->i_mode = S_IFREG;  /*Regular file, no one gets to read*/
	inode->i_op = NULL;
	return;
}