Commit 11aa40a0 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

isofs: stop using ioctl_by_bdev

Instead just call the CDROM layer functionality directly, and turn the
hot mess in isofs_get_last_session into remotely readable code.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f252fa33
...@@ -544,43 +544,41 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root) ...@@ -544,43 +544,41 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root)
static unsigned int isofs_get_last_session(struct super_block *sb, s32 session) static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
{ {
struct cdrom_multisession ms_info; struct cdrom_device_info *cdi = disk_to_cdi(sb->s_bdev->bd_disk);
unsigned int vol_desc_start; unsigned int vol_desc_start = 0;
struct block_device *bdev = sb->s_bdev;
int i;
vol_desc_start=0;
ms_info.addr_format=CDROM_LBA;
if (session > 0) { if (session > 0) {
struct cdrom_tocentry Te; struct cdrom_tocentry te;
Te.cdte_track=session;
Te.cdte_format=CDROM_LBA; if (!cdi)
i = ioctl_by_bdev(bdev, CDROMREADTOCENTRY, (unsigned long) &Te); return 0;
if (!i) {
te.cdte_track = session;
te.cdte_format = CDROM_LBA;
if (cdrom_read_tocentry(cdi, &te) == 0) {
printk(KERN_DEBUG "ISOFS: Session %d start %d type %d\n", printk(KERN_DEBUG "ISOFS: Session %d start %d type %d\n",
session, Te.cdte_addr.lba, session, te.cdte_addr.lba,
Te.cdte_ctrl&CDROM_DATA_TRACK); te.cdte_ctrl & CDROM_DATA_TRACK);
if ((Te.cdte_ctrl&CDROM_DATA_TRACK) == 4) if ((te.cdte_ctrl & CDROM_DATA_TRACK) == 4)
return Te.cdte_addr.lba; return te.cdte_addr.lba;
} }
printk(KERN_ERR "ISOFS: Invalid session number or type of track\n"); printk(KERN_ERR "ISOFS: Invalid session number or type of track\n");
} }
i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info);
if (session > 0) if (cdi) {
printk(KERN_ERR "ISOFS: Invalid session number\n"); struct cdrom_multisession ms_info;
#if 0
printk(KERN_DEBUG "isofs.inode: CDROMMULTISESSION: rc=%d\n",i); ms_info.addr_format = CDROM_LBA;
if (i==0) { if (cdrom_multisession(cdi, &ms_info) == 0) {
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
if (i==0)
#if WE_OBEY_THE_WRITTEN_STANDARDS #if WE_OBEY_THE_WRITTEN_STANDARDS
if (ms_info.xa_flag) /* necessary for a valid ms_info.addr */ /* necessary for a valid ms_info.addr */
if (ms_info.xa_flag)
#endif #endif
vol_desc_start=ms_info.addr.lba; vol_desc_start = ms_info.addr.lba;
}
}
return vol_desc_start; return vol_desc_start;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment