patch-2.3.20 linux/fs/isofs/inode.c

Next file: linux/fs/ncpfs/Config.in
Previous file: linux/fs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.19/linux/fs/isofs/inode.c linux/fs/isofs/inode.c
@@ -446,6 +446,14 @@
       inode_fake.i_rdev=dev;
       init_waitqueue_head(&inode_fake.i_wait);
       ms_info.addr_format=CDROM_LBA;
+      /* If a minor device was explicitly opened, set session to the
+       * minor number. For instance, if /dev/hdc1 is mounted, session
+       * 1 on the CD-ROM is selected. CD_PART_MAX gives access to
+       * a max of 64 sessions on IDE. SCSI drives must still use
+       * the session option to mount.
+       */
+      if ((MINOR(dev) % CD_PART_MAX) && (MAJOR(dev) != SCSI_CDROM_MAJOR))
+		session = MINOR(dev) % CD_PART_MAX;
       set_fs(KERNEL_DS);
       if(session >= 0 && session <= 99) {
 	      struct cdrom_tocentry Te;
@@ -1042,6 +1050,7 @@
 	struct buffer_head * bh = NULL;
 	int block = 0;
 	int i = 0;
+	int more_entries = 0;
 	void *cpnt;
 	struct iso_directory_record * raw_inode;
 
@@ -1062,7 +1071,6 @@
 				goto out_noread;
 		}
 		pnt = ((unsigned char *) bh->b_data + offset);
-		raw_inode = ((struct iso_directory_record *) pnt);
 		/*
 		 * Note: this is invariant even if the record
 		 * spans buffers and must be copied ...
@@ -1074,6 +1082,7 @@
 			ino = (ino & ~(ISOFS_BLOCK_SIZE - 1)) + ISOFS_BLOCK_SIZE;
 			continue;
 		}
+		raw_inode = ((struct iso_directory_record *) pnt);
 
 		/* Check whether the raw inode spans the buffer ... */	
 		if (offset + reclen > bufsize){
@@ -1095,13 +1104,15 @@
 		inode->i_size += isonum_733 (raw_inode->size);
 		if(i == 1) inode->u.isofs_i.i_next_section_ino = ino;
 
+		more_entries = raw_inode->flags[-high_sierra] & 0x80;
+
 		ino += reclen;
 		if (cpnt)
 			kfree (cpnt);
 		i++;
 		if(i > 100)
 			goto out_toomany;
-	} while(raw_inode->flags[-high_sierra] & 0x80);
+	} while(more_entries);
 out:
 	brelse(bh);
 	return 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)