scst_vdisk: Kernel v4.4 build fix

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6697 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2015-11-18 22:10:33 +00:00
parent 1c349edbc0
commit 337fe08a72
+12 -6
View File
@@ -1407,6 +1407,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev)
struct inode *inode;
struct file *fd;
struct blk_integrity *bi;
const char *bi_profile_name;
TRACE_ENTRY();
@@ -1430,9 +1431,14 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev)
goto out_no_bi;
}
TRACE_DBG("BI name %s", bi->name);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
bi_profile_name = bi->name;
#else
bi_profile_name = bi->profile->name;
#endif
TRACE_DBG("BI name %s", bi_profile_name);
if (!strcmp(bi->name, "T10-DIF-TYPE1-CRC")) {
if (!strcmp(bi_profile_name, "T10-DIF-TYPE1-CRC")) {
dev->dev_dif_ip_not_supported = 1;
if (virt_dev->dif_type != 1) {
PRINT_ERROR("Integrity type mismatch, %d expected, "
@@ -1441,7 +1447,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev)
res = -EINVAL;
goto out_close;
}
} else if (!strcmp(bi->name, "T10-DIF-TYPE1-IP")) {
} else if (!strcmp(bi_profile_name, "T10-DIF-TYPE1-IP")) {
if (virt_dev->dif_type != 1) {
PRINT_ERROR("Integrity type mismatch, %d expected, "
"but block device has 1 (dev %s)",
@@ -1449,7 +1455,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev)
res = -EINVAL;
goto out_close;
}
} else if (!strcmp(bi->name, "T10-DIF-TYPE3-CRC")) {
} else if (!strcmp(bi_profile_name, "T10-DIF-TYPE3-CRC")) {
dev->dev_dif_ip_not_supported = 1;
if (virt_dev->dif_type != 3) {
PRINT_ERROR("Integrity type mismatch, %d expected, "
@@ -1458,7 +1464,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev)
res = -EINVAL;
goto out_close;
}
} else if (!strcmp(bi->name, "T10-DIF-TYPE3-IP")) {
} else if (!strcmp(bi_profile_name, "T10-DIF-TYPE3-IP")) {
if (virt_dev->dif_type != 3) {
PRINT_ERROR("Integrity type mismatch, %d expected, "
"but block device has 3 (dev %s)",
@@ -1468,7 +1474,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev)
}
} else {
PRINT_ERROR("Unable to understand integrity name %s"
"(dev %s)", bi->name, dev->virt_name);
"(dev %s)", bi_profile_name, dev->virt_name);
res = -EINVAL;
goto out_close;
}