lkml.org 
[lkml]   [1996]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subjectmounting any session on XA discs (try2) !
Date
Hi,

sorry to waste your bandwidth, but I've made a small oversight
in last patch (forgot to turn back on user space in some return
conditions).
Here is proper patch :

daniela# mount -t iso9660 -o ro,session=2 /dev/hdb /cdrom


diff -u -r linux-2.0.0.orig/fs/isofs/inode.c linux-2.0.0/fs/isofs/inode.c
--- linux-2.0.0.orig/fs/isofs/inode.c Fri May 31 12:46:26 1996
+++ linux-2.0.0/fs/isofs/inode.c Thu Jun 20 19:11:34 1996
@@ -5,6 +5,7 @@
* 1992, 1993, 1994 Eric Youngdale Modified for ISO9660 filesystem.
* 1994 Eberhard Moenkeberg - multi session handling.
* 1995 Mark Dobie - allow mounting of some weird VideoCDs and PhotoCDs.
+ * 1996 Mario Mikocevic (Mozgy) - allow mounting any session on XA discs.
*
*/

@@ -64,6 +65,7 @@
unsigned char check;
unsigned char conversion;
unsigned int blocksize;
+ unsigned int session;
mode_t mode;
gid_t gid;
uid_t uid;
@@ -80,6 +82,7 @@
popt->check = 's'; /* default: strict */
popt->conversion = 'b'; /* default: no conversion */
popt->blocksize = 1024;
+ popt->session = CDROM_LEADOUT;
popt->mode = S_IRUGO;
popt->gid = 0;
popt->uid = 0;
@@ -125,6 +128,7 @@
else if (value &&
(!strcmp(this_char,"block") ||
!strcmp(this_char,"mode") ||
+ !strcmp(this_char,"session") ||
!strcmp(this_char,"uid") ||
!strcmp(this_char,"gid"))) {
char * vpnt = value;
@@ -143,6 +147,10 @@
&& ivalue != 2048) return 0;
popt->blocksize = ivalue;
break;
+ case 's':
+ popt->session = ivalue;
+ printk(KERN_DEBUG "Got XA session %d request.\n", popt->session);
+ break;
case 'u':
popt->uid = ivalue;
break;
@@ -159,6 +167,7 @@
return 1;
}

+#if 0
/*
* look if the driver can tell the multi session redirection value
*/
@@ -181,18 +190,77 @@
CDROMMULTISESSION,
(unsigned long) &ms_info);
set_fs(USER_DS);
-#if 0
- printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i);
+ printk(KERN_DEBUG "isofs.inode: CDROMMULTISESSION: rc=%d\n",i);
if (i==0)
{
- printk("isofs.inode: XA disk: %s\n", ms_info.xa_flag ? "yes":"no");
- printk("isofs.inode: vol_desc_start = %d\n", ms_info.addr.lba);
+ printk(KERN_DEBUG "isofs.inode: XA disk: %s\n", ms_info.xa_flag ? "yes":"no");
+ printk(KERN_DEBUG "isofs.inode: vol_desc_start = %d\n", ms_info.addr.lba);
}
-#endif 0
if ((i==0)&&(ms_info.xa_flag)) vol_desc_start=ms_info.addr.lba;
}
return vol_desc_start;
}
+#endif 0
+
+/*
+ * let's try to get address of requested session
+ * if disc is XA disc
+ */
+static unsigned int isofs_get_XA_session( kdev_t dev, unsigned int sess_num )
+{
+ struct cdrom_multisession ms_info;
+ struct cdrom_tochdr tochdr;
+ struct cdrom_tocentry tocentry;
+ unsigned int vol_desc_start;
+ struct inode inode_fake;
+ extern struct file_operations * get_blkfops( unsigned int );
+ int i;
+
+ vol_desc_start = 0;
+ if ( sess_num < 1 )
+ sess_num = 1;
+ if ( get_blkfops( MAJOR( dev ) )->ioctl != NULL ) {
+ inode_fake.i_rdev = dev;
+ ms_info.addr_format = CDROM_LBA;
+ tocentry.cdte_format = CDROM_LBA;
+ set_fs( KERNEL_DS );
+ i = get_blkfops( MAJOR( dev ) )->ioctl( &inode_fake,
+ NULL,
+ CDROMREADTOCHDR,
+ (unsigned long) &tochdr );
+ if ( i ) {
+ set_fs( USER_DS );
+ return vol_desc_start;
+ }
+ if ( ( tochdr.cdth_trk1 < sess_num ) && ( sess_num != CDROM_LEADOUT ) )
+ sess_num = tochdr.cdth_trk1;
+ tocentry.cdte_track = sess_num ;
+ i = get_blkfops( MAJOR( dev ) )->ioctl( &inode_fake,
+ NULL,
+ CDROMREADTOCENTRY,
+ (unsigned long) &tocentry );
+ if ( i ) {
+ set_fs( USER_DS );
+ return vol_desc_start;
+ }
+ i = get_blkfops( MAJOR( dev ) )->ioctl( &inode_fake,
+ NULL,
+ CDROMMULTISESSION,
+ (unsigned long) &ms_info );
+ set_fs( USER_DS );
+ printk( KERN_DEBUG "isofs.inode: CDROMMULTISESSION: rc=%d\n", i );
+ if ( i == 0 )
+ printk( KERN_DEBUG "isofs.inode: XA disk: %s\n", ms_info.xa_flag ? "yes" : "no" );
+ if ( i == 0 ) {
+ if ( ( ms_info.xa_flag ) && ( sess_num == CDROM_LEADOUT ) )
+ vol_desc_start = ms_info.addr.lba;
+ else if ( sess_num != CDROM_LEADOUT )
+ vol_desc_start = tocentry.cdte_addr.lba;
+ }
+ }
+ printk( KERN_DEBUG "isofs.inode: vol_desc_start = %d\n", vol_desc_start );
+ return vol_desc_start;
+}

struct super_block *isofs_read_super(struct super_block *s,void *data,
int silent)
@@ -231,6 +299,7 @@
printk("unhide = %c\n", opt.unhide);
printk("conversion = %c\n", opt.conversion);
printk("blocksize = %d\n", opt.blocksize);
+ printk("session = %d\n", opt.session);
printk("gid = %d\n", opt.gid);
printk("uid = %d\n", opt.uid);
#endif
@@ -249,7 +318,12 @@

s->u.isofs_sb.s_high_sierra = high_sierra = 0; /* default is iso9660 */

- vol_desc_start = isofs_get_last_session(dev);
+/*
+ * old call
+ * vol_desc_start = isofs_get_last_session(dev);
+ */
+
+ vol_desc_start = isofs_get_XA_session(dev,opt.session);

for (iso_blknum = vol_desc_start+16;
iso_blknum < vol_desc_start+100; iso_blknum++) {
--
pozdrav by mozgy <--- croatian for hello

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Mario Mikocevic Mozgy ~ Mario.Mikocevic@fer.hr ~ irc_nick Mozz ~
~ Stj. Rozankovica 36. ~ mozgy@zems.fer.hr ~ ~
~ 44000 Sisak ~ mozgy@srce.hr ~ HP48 is my ~
~ CROATIA ~ MVSRCE::MOZGY ~ finest hobby ~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.030 / U:1.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site