* [RESEND] last missing patch in the cdrom ioctl_by_bdev removal series
@ 2020-05-08 8:18 Christoph Hellwig
2020-05-08 8:18 ` [PATCH] hfs: stop using ioctl_by_bdev Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2020-05-08 8:18 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-fsdevel
Hi Jens,
can you pick up this patch, which is the last missing one in converting
file systems away from using ioctl_by_bdev for CDROM information access?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] hfs: stop using ioctl_by_bdev
2020-05-08 8:18 [RESEND] last missing patch in the cdrom ioctl_by_bdev removal series Christoph Hellwig
@ 2020-05-08 8:18 ` Christoph Hellwig
2020-05-08 15:42 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2020-05-08 8:18 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-fsdevel
Instead just call the CDROM layer functionality directly.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/hfs/mdb.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c
index 460281b1299eb..cdf0edeeb2781 100644
--- a/fs/hfs/mdb.c
+++ b/fs/hfs/mdb.c
@@ -32,29 +32,35 @@
static int hfs_get_last_session(struct super_block *sb,
sector_t *start, sector_t *size)
{
- struct cdrom_multisession ms_info;
- struct cdrom_tocentry te;
- int res;
+ struct cdrom_device_info *cdi = disk_to_cdi(sb->s_bdev->bd_disk);
/* default values */
*start = 0;
*size = i_size_read(sb->s_bdev->bd_inode) >> 9;
if (HFS_SB(sb)->session >= 0) {
+ struct cdrom_tocentry te;
+
+ if (!cdi)
+ return -EINVAL;
+
te.cdte_track = HFS_SB(sb)->session;
te.cdte_format = CDROM_LBA;
- res = ioctl_by_bdev(sb->s_bdev, CDROMREADTOCENTRY, (unsigned long)&te);
- if (!res && (te.cdte_ctrl & CDROM_DATA_TRACK) == 4) {
- *start = (sector_t)te.cdte_addr.lba << 2;
- return 0;
+ if (cdrom_read_tocentry(cdi, &te) ||
+ (te.cdte_ctrl & CDROM_DATA_TRACK) != 4) {
+ pr_err("invalid session number or type of track\n");
+ 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;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hfs: stop using ioctl_by_bdev
2020-05-08 8:18 ` [PATCH] hfs: stop using ioctl_by_bdev Christoph Hellwig
@ 2020-05-08 15:42 ` Jens Axboe
0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2020-05-08 15:42 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block, linux-fsdevel
On 5/8/20 2:18 AM, Christoph Hellwig wrote:
> Instead just call the CDROM layer functionality directly.
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-08 15:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 8:18 [RESEND] last missing patch in the cdrom ioctl_by_bdev removal series Christoph Hellwig
2020-05-08 8:18 ` [PATCH] hfs: stop using ioctl_by_bdev Christoph Hellwig
2020-05-08 15:42 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).