add kernel version check for I_BDEV

As I_BDEV cannot be used in GKI build before
kernel version 5.15, so add kernel version
check when use I_BDEV.

Change-Id: I7f02b64434559d4a1e00a2c8ea6b38bb1288957b
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2252790
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
yanyh2 2022-04-26 10:46:35 +08:00 committed by Yonghua Yan
parent 9089c000c8
commit 15eec6a42c

View file

@ -216,7 +216,11 @@ int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
blksize = 2048;
blkbits = 11;
} else if (S_ISBLK(inode->i_mode)) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
blksize = bdev_logical_block_size(inode->i_bdev);
#else
blksize = bdev_logical_block_size(I_BDEV(inode));
#endif
blkbits = blksize_bits(blksize);
} else {
blksize = 512;