From: <vl...@us...> - 2008-04-21 15:04:21
|
Revision: 346 http://scst.svn.sourceforge.net/scst/?rev=346&view=rev Author: vlnb Date: 2008-04-21 08:04:10 -0700 (Mon, 21 Apr 2008) Log Message: ----------- Added possibility to create virtual removable devices Modified Paths: -------------- trunk/scst/README trunk/scst/src/dev_handlers/scst_vdisk.c Modified: trunk/scst/README =================================================================== --- trunk/scst/README 2008-04-21 10:45:22 UTC (rev 345) +++ trunk/scst/README 2008-04-21 15:04:10 UTC (rev 346) @@ -466,7 +466,10 @@ This mode works ideally with high-end storage HBAs and for applications that either do not need caching between application and disk or need the large block throughput. See also below. - + + - REMOVABLE - with this flag set the device is reported to remote + initiators as removable. + * "close NAME" - closes device "NAME". * "change NAME [PATH]" - changes a virtual CD in the VDISK CDROM. Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2008-04-21 10:45:22 UTC (rev 345) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2008-04-21 15:04:10 UTC (rev 346) @@ -188,6 +188,7 @@ unsigned int nullio:1; unsigned int blockio:1; unsigned int cdrom_empty:1; + unsigned int removable:1; int virt_id; char name[16+1]; /* Name of virtual device, must be <= SCSI Model + 1 */ @@ -1094,7 +1095,7 @@ memset(buf, 0, sizeof(buf)); buf[0] = cmd->dev->handler->type; /* type dev */ - if (buf[0] == TYPE_ROM) + if ((buf[0] == TYPE_ROM) || virt_dev->removable) buf[1] = 0x80; /* removable */ /* Vital Product */ if (cmd->cdb[1] & EVPD) { @@ -2559,6 +2560,10 @@ seq_printf(seq, "BIO "); c += 4; } + if (virt_dev->removable) { + seq_printf(seq, "RM "); + c += 4; + } while (c < 16) { seq_printf(seq, " "); c++; @@ -2577,7 +2582,7 @@ char buf[128]; int i, j; - i = snprintf(buf, sizeof(buf), "Registering virtual %s device %s", + i = snprintf(buf, sizeof(buf), "Registering virtual %s device %s ", type, virt_dev->name); j = i; @@ -2600,6 +2605,14 @@ i += snprintf(&buf[i], sizeof(buf) - i, "%sNULLIO", (j == i) ? "(" : ", "); + if (virt_dev->blockio) + i += snprintf(&buf[i], sizeof(buf) - i, "%sBLOCKIO", + (j == i) ? "(" : ", "); + + if (virt_dev->removable) + i += snprintf(&buf[i], sizeof(buf) - i, "%sREMOVABLE", + (j == i) ? "(" : ", "); + if (j == i) PRINT_INFO("%s", buf); else @@ -2759,6 +2772,10 @@ p += 7; virt_dev->blockio = 1; TRACE_DBG("%s", "BLOCKIO"); + } else if (!strncmp("REMOVABLE", p, 9)) { + p += 9; + virt_dev->removable = 1; + TRACE_DBG("%s", "REMOVABLE"); } else { PRINT_ERROR("Unknown flag \"%s\"", p); res = -EINVAL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |