hfs: stop using ioctl_by_bdev

Instead just call the CDROM layer functionality directly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2020-05-08 10:18:28 +02:00 committed by Jens Axboe
parent 1cd925d583
commit af00423a3d

View File

@ -32,29 +32,35 @@
static int hfs_get_last_session(struct super_block *sb, static int hfs_get_last_session(struct super_block *sb,
sector_t *start, sector_t *size) sector_t *start, sector_t *size)
{ {
struct cdrom_multisession ms_info; struct cdrom_device_info *cdi = disk_to_cdi(sb->s_bdev->bd_disk);
struct cdrom_tocentry te;
int res;
/* default values */ /* default values */
*start = 0; *start = 0;
*size = i_size_read(sb->s_bdev->bd_inode) >> 9; *size = i_size_read(sb->s_bdev->bd_inode) >> 9;
if (HFS_SB(sb)->session >= 0) { if (HFS_SB(sb)->session >= 0) {
struct cdrom_tocentry te;
if (!cdi)
return -EINVAL;
te.cdte_track = HFS_SB(sb)->session; te.cdte_track = HFS_SB(sb)->session;
te.cdte_format = CDROM_LBA; te.cdte_format = CDROM_LBA;
res = ioctl_by_bdev(sb->s_bdev, CDROMREADTOCENTRY, (unsigned long)&te); if (cdrom_read_tocentry(cdi, &te) ||
if (!res && (te.cdte_ctrl & CDROM_DATA_TRACK) == 4) { (te.cdte_ctrl & CDROM_DATA_TRACK) != 4) {
*start = (sector_t)te.cdte_addr.lba << 2; pr_err("invalid session number or type of track\n");
return 0; return -EINVAL;
} }
pr_err("invalid session number or type of track\n");
return -EINVAL; *start = (sector_t)te.cdte_addr.lba << 2;
} else if (cdi) {
struct cdrom_multisession ms_info;
ms_info.addr_format = CDROM_LBA;
if (cdrom_multisession(cdi, &ms_info) == 0 && ms_info.xa_flag)
*start = (sector_t)ms_info.addr.lba << 2;
} }
ms_info.addr_format = CDROM_LBA;
res = ioctl_by_bdev(sb->s_bdev, CDROMMULTISESSION, (unsigned long)&ms_info);
if (!res && ms_info.xa_flag)
*start = (sector_t)ms_info.addr.lba << 2;
return 0; return 0;
} }