Avoid that checkpatch reports the following warning:
WARNING: static const char * array should probably be static const char * const
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5654 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Address the following checkpatch warning:
char * array declaration might be better as static const
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5649 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Avoid 64-bit modulo computations since these result in undefined symbol
errors on 32-bit systems (__moddi3 / __umoddi3). Support sizes >= 2**32
bytes on 32-bit systems.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5629 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Convert three more *(__be16 *)p = cpu_to_be16(v) statements into
put_unaligned_be16(v, p) since the latter is easier to read. Also
convert one "cmd->dev" into "dev" expression. This patch does not
change any functionality.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5626 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Make vdisk_exec_inquiry() easier to read by moving the code
for the implementation of each VPD page into a separate function.
This patch does not change any functionality.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5620 d57e44dd-8a1f-0410-8b47-8ef2f437770f
With CONFIG_BUG=y both BUG() and BUG_ON(1) halt the system. However,
with CONFIG_BUG=n BUG() halts the system but BUG_ON(1) not. To avoid
such subtleties, change BUG_ON(1) into BUG().
See also patch Josh Triplett, "bug: Make BUG() always stop the machine",
7 April 2014 (commit ID a4b5d580e07875f9be29f62a57c67fbbdbb40ba2).
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5618 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Remove the code after BUG() statements to avoid that smatch
complains about unreachable code. Hide the spin_unlock() statements
before BUG() statements for static analysis tools to avoid that
sparse complains about locking imbalances.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5617 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Loops with locking statements and also lock and unlock
statements guarded by an if-statement trigger false positive
warnings when analyzing the SCST code with smatch and/or sparse.
Hence exclude such code from static analysis.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5616 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Avoid that the following compiler warning is reported when compiling
iscsi-scst:
chap.c: In function 'chap_rand':
chap.c:348:5: warning: ignoring return value of 'read', declared with attribute warn_unused_result [-Wunused-result]
(void)read(fd, &r, sizeof(r));
^
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5614 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Avoid that smatch reports the following warning:
scst_init_session() info: loop could be replaced with if statement.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5613 d57e44dd-8a1f-0410-8b47-8ef2f437770f
SCST rejects removal of an access control group with one or more
sessions with error code -EBUSY. Make it easy to change this
behavior into forcibly closing sessions when an access control
group is removed.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5608 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Retry sending XFER_RDY, data and response frames if the network
driver reports that sending failed (-ENOMEM) instead of reporting
a kernel warning (WARN_ON(1)). If sending XFER_RDY or data frames
failed for another reason, report this to the initiator as a
write error (ASC = 03; ASCQ = 00 which stands for PERIPHERAL
DEVICE WRITE FAULT). If sending a response frame failed with
another error code than -ENOMEM, do not send a response.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5607 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This patch ensures that exch_done() gets called if an fcst
callback returns SCST_TGT_RES_FATAL_ERROR.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5606 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Avoid that this function returns an uninitialized buffer to the
initiator if buffer_size < 8. Detected by Coverity.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5602 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Avoid that building scst with W=1 triggers compiler warnings about
variables that are set but not used. See also the documentation of
the gcc compiler flag -Wunused-but-set-variable.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5600 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The cpus_*() functions were deprecated via patch "cpumask:
introduce new API, without changing anything" (November 2008,
commit ID 2d3854a37e8b). Hence switch from the cpus_*() API to
the cpumask_*() API.
This patch has the intended side effect of not adding the "[key]"
property to cpumask sysfs attributes that contain the default
cpumask. The current code namely reads uninitialized bits on
systems where nr_cpu_ids < NR_CPUS because cpus_equal() compares
more bits than those that were set by cpumask_copy().
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5596 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Make sure that the definition of swap() is guarded by
"#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)" only instead
of "#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)" and
"#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)".
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5592 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Move all management commands from scst_delayed_mgmt_cmd_list to the
active command list during resume instead of only the first one.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5589 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Add support for 32-bit LUN numbers. As soon as the patches that add
64-bit LUN support are upstream this patch will also make 64-bit
LUN support available in scst_local.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5588 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The datatype of scsi_device.lun will be changed from u32 into u64
in the near future. Update SCST accordingly. These changes have
been implemented such that these are compatible with 32-bit and
64-bit LUNs.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5587 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Make the code slightly easier to read by introducing temporary
variables for the expressions 'tgt_dev->sess' and 'sess->tgt->tgtt'.
This patch does not change any functionality.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5586 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Avoid that building scst with W=1 triggers compiler warnings about
variables that are set but not used. See also the documentation of
the gcc compiler flag -Wunused-but-set-variable.
This patch does not change any functionality.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5585 d57e44dd-8a1f-0410-8b47-8ef2f437770f