Fix returning changeable values for caching mode page

Reported by Consus <consus@gmx.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5982 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2015-01-21 04:20:53 +00:00
parent 7a18672a83
commit eb824e0038

View File

@@ -3854,9 +3854,10 @@ static int vdisk_caching_pg(unsigned char *p, int pcontrol,
if (!virt_dev->nv_cache && vdev_saved_mode_pages_enabled)
caching_pg[0] |= 0x80;
memcpy(p, caching_pg, sizeof(caching_pg));
switch (pcontrol) {
case 0: /* current */
memcpy(p, caching_pg, sizeof(caching_pg));
p[2] |= (virt_dev->wt_flag || virt_dev->nv_cache) ? 0 : WCE;
break;
case 1: /* changeable */
@@ -3865,11 +3866,9 @@ static int vdisk_caching_pg(unsigned char *p, int pcontrol,
p[2] |= WCE;
break;
case 2: /* default */
memcpy(p, caching_pg, sizeof(caching_pg));
p[2] |= (DEF_WRITE_THROUGH || virt_dev->nv_cache) ? 0 : WCE;
break;
case 3: /* saved */
memcpy(p, caching_pg, sizeof(caching_pg));
p[2] |= (virt_dev->wt_flag_saved || virt_dev->nv_cache) ? 0 : WCE;
break;
default: