Re: [PATCH 6/7] isofs: stop using ioctl_by_bdev
From: Jan Kara
Date: Thu Apr 23 2020 - 07:03:53 EST
On Thu 23-04-20 09:12:23, Christoph Hellwig wrote:
> Instead just call the CD-ROM layer functionality directly, and turn the
> hot mess in isofs_get_last_session into remotely readable code.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
One comment below...
> ---
> fs/isofs/inode.c | 54 +++++++++++++++++++++++-------------------------
> 1 file changed, 26 insertions(+), 28 deletions(-)
>
> diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
> index 62c0462dc89f..fc48923a9b6c 100644
> --- a/fs/isofs/inode.c
> +++ b/fs/isofs/inode.c
> @@ -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)
> {
> - struct cdrom_multisession ms_info;
> - unsigned int vol_desc_start;
> - struct block_device *bdev = sb->s_bdev;
> - int i;
> + struct cdrom_device_info *cdi = disk_to_cdi(sb->s_bdev->bd_disk);
> + unsigned int vol_desc_start = 0;
>
> - vol_desc_start=0;
> - ms_info.addr_format=CDROM_LBA;
> if (session > 0) {
> - struct cdrom_tocentry Te;
> - Te.cdte_track=session;
> - Te.cdte_format=CDROM_LBA;
> - i = ioctl_by_bdev(bdev, CDROMREADTOCENTRY, (unsigned long) &Te);
> - if (!i) {
> + struct cdrom_tocentry te;
> +
> + if (!cdi)
> + return -EINVAL;
There's no error handling in the caller and this function actually returns
unsigned int... So I believe you need to return 0 here to maintain previous
behavior (however suspicious it may be)?
Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR