mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
- scst_user docs updated
- Added notification about device change in fileio_tgt git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@700 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -829,6 +829,20 @@ SCST_USER_FLUSH_CACHE returns 0 on success or -1 in case of error,
|
||||
and errno is set appropriately.
|
||||
|
||||
|
||||
7. SCST_USER_DEVICE_CAPACITY_CHANGED
|
||||
|
||||
SCST_USER_DEVICE_CAPACITY_CHANGED - queues CAPACITY DATA HAS CHANGED
|
||||
Unit Attention or corresponding Asynchronous Event to the corresponding
|
||||
virtual device. It will notify remote initiators, connected to the
|
||||
device, and allow them to automatically refresh new device size. You
|
||||
should use SCST_USER_DEVICE_CAPACITY_CHANGED after resize of the device.
|
||||
|
||||
SCST_USER_DEVICE_CAPACITY_CHANGED doesn't have any parameters.
|
||||
|
||||
SCST_USER_DEVICE_CAPACITY_CHANGED returns 0 on success or -1 in case of
|
||||
error, and errno is set appropriately.
|
||||
|
||||
|
||||
IV. Commands processing flow example.
|
||||
|
||||
As the example consider a simple synchronous VTL, which serves one
|
||||
|
||||
@@ -125,14 +125,18 @@ static inline void set_cmd_error_status(struct scst_user_scsi_cmd_reply_exec *re
|
||||
|
||||
static int set_sense(uint8_t *buffer, int len, int key, int asc, int ascq)
|
||||
{
|
||||
int res = 14;
|
||||
int res = SCST_STANDARD_SENSE_LEN;
|
||||
|
||||
EXTRACHECKS_BUG_ON(len < res);
|
||||
|
||||
memset(buffer, 0, res);
|
||||
|
||||
buffer[0] = 0x70; /* Error Code */
|
||||
buffer[2] = key; /* Sense Key */
|
||||
buffer[7] = 0x0a; /* Additional Sense Length */
|
||||
buffer[12] = asc; /* ASC */
|
||||
buffer[13] = ascq; /* ASCQ */
|
||||
|
||||
TRACE_BUFFER("Sense set", buffer, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -189,6 +189,28 @@ out:
|
||||
return;
|
||||
}
|
||||
|
||||
void sigusr1_handler(int signo)
|
||||
{
|
||||
int res;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
TRACE_MGMT_DBG("%s", "Capacity data changed...");
|
||||
|
||||
res = ioctl(dev.scst_usr_fd, SCST_USER_DEVICE_CAPACITY_CHANGED, NULL);
|
||||
if (res != 0) {
|
||||
res = errno;
|
||||
PRINT_ERROR("Capacity data changed failed: %s", strerror(res));
|
||||
goto out;
|
||||
}
|
||||
|
||||
TRACE_DBG("%s", "Capacity data changed done.");
|
||||
|
||||
out:
|
||||
TRACE_EXIT();
|
||||
return;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int res = 0;
|
||||
@@ -480,6 +502,19 @@ int main(int argc, char **argv)
|
||||
pthread_t thread[threads];
|
||||
int i, j, rc;
|
||||
void *rc1;
|
||||
struct sigaction act;
|
||||
|
||||
memset(&act, 0, sizeof(act));
|
||||
act.sa_handler = sigusr1_handler;
|
||||
act.sa_flags = SA_RESTART;
|
||||
sigemptyset(&act.sa_mask);
|
||||
res = sigaction(SIGUSR1, &act, NULL);
|
||||
if (res != 0) {
|
||||
res = errno;
|
||||
PRINT_ERROR("sigaction() failed: %s",
|
||||
strerror(res));
|
||||
/* don't do anything */
|
||||
}
|
||||
|
||||
for(i = 0; i < threads; i++) {
|
||||
rc = pthread_create(&thread[i], NULL, main_loop, &dev);
|
||||
@@ -492,8 +527,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (flush_interval != 0) {
|
||||
struct sigaction act;
|
||||
|
||||
memset(&act, 0, sizeof(act));
|
||||
act.sa_handler = sigalrm_handler;
|
||||
act.sa_flags = SA_RESTART;
|
||||
|
||||
Reference in New Issue
Block a user