* Changing it don't forget to change SCST_FIO_REV in scst_vdisk.c
* and FIO_REV in usr/fileio/common.h as well.
*/
-#define SCST_VERSION_CODE 0x01000100
-#define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d)
-#define SCST_VERSION_STRING "1.0.1"
-#define SCST_INTERFACE_VERSION SCST_VERSION_STRING "$Revision$" SCST_CONST_VERSION
+#define SCST_VERSION_CODE 0x01000100
+#define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d)
+#define SCST_VERSION_STRING "1.0.1"
+#define SCST_INTERFACE_VERSION \
+ SCST_VERSION_STRING "$Revision$" SCST_CONST_VERSION
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
typedef _Bool bool;
typedef enum dma_data_direction scst_data_direction;
enum scst_cdb_flags {
- SCST_TRANSFER_LEN_TYPE_FIXED = 0x01, /* must be equviv 1 (FIXED_BIT in cdb) */
+ /* SCST_TRANSFER_LEN_TYPE_FIXED must be equiv 1 (FIXED_BIT in cdb) */
+ SCST_TRANSFER_LEN_TYPE_FIXED = 0x01,
SCST_SMALL_TIMEOUT = 0x02,
SCST_LONG_TIMEOUT = 0x04,
SCST_UNKNOWN_LENGTH = 0x08,
* Returns:
* - SCST_EXEC_COMPLETED - the cmd is done, go to other ones
* - SCST_EXEC_NEED_THREAD - thread context is required to execute
- * the command. Exec() will be called again in the thread context.
- * - SCST_EXEC_NOT_COMPLETED - the cmd should be sent to SCSI mid-level.
+ * the command. Exec() will be called again in the thread context.
+ * - SCST_EXEC_NOT_COMPLETED - the cmd should be sent to SCSI
+ * mid-level.
*
* Pay attention to "atomic" attribute of the cmd, which can be get
* by scst_cmd_atomic(): it is true if the function called in the
* exec_sync flag and should consider to setup dedicated threads by
* setting threads_num > 0.
*
- * !! If this function is implemented, scst_check_local_events() shall !!
- * !! be called inside it just before the actual command's execution. !!
+ * !! If this function is implemented, scst_check_local_events() !!
+ * !! shall be called inside it just before the actual command's !!
+ * !! execution. !!
*
* OPTIONAL, if not set, the commands will be sent directly to SCSI
* device.
* no firther actions required
* - The SCST_MGMT_STATUS_* error code if the command is failed and
* no further actions required
- * - SCST_DEV_TM_NOT_COMPLETED - regular standard actions for the command
- * should be done
+ * - SCST_DEV_TM_NOT_COMPLETED - regular standard actions for the
+ * command should be done
*
* Called without any locks held from a thread context.
*/
/**************************************************************/
- /* Alive commands for this session. ToDo: make it part of the common IO flow control */
+ /*
+ * Alive commands for this session. ToDo: make it part of the common
+ * IO flow control.
+ */
atomic_t sess_cmd_count;
spinlock_t sess_list_lock; /* protects search_cmd_list, etc */
/* List entry for the list that keeps session, waiting for the init */
struct list_head sess_init_list_entry;
- /* List entry for the list that keeps session, waiting for the shutdown */
+ /*
+ * List entry for the list that keeps session, waiting for the shutdown
+ */
struct list_head sess_shut_list_entry;
/*
enum scst_cmd_queue_type queue_type;
- int timeout; /* CDB execution timeout in seconds */
- int retries; /* Amount of retries that will be done by SCSI mid-level */
+ int timeout; /* CDB execution timeout in seconds */
+ int retries; /* Amount of retries that will be done by SCSI mid-level */
/* SCSI data direction, one of SCST_DATA_* constants */
scst_data_direction data_direction;
unsigned int needs_unblocking:1;
unsigned int lun_set:1; /* set, if lun field is valid */
unsigned int cmd_sn_set:1; /* set, if cmd_sn field is valid */
- unsigned int nexus_loss_check_done:1; /* set, if nexus loss check is done */
+ /* set, if nexus loss check is done */
+ unsigned int nexus_loss_check_done:1;
/*
* Number of commands to finish before sending response,
*************************************************************/
#define SCST_LOAD_SENSE(key_asc_ascq) key_asc_ascq
-#define SCST_SENSE_VALID(sense) ((sense != NULL) && \
- ((((uint8_t *)(sense))[0] & 0x70) == 0x70))
+#define SCST_SENSE_VALID(sense) ((sense != NULL) && \
+ ((((uint8_t *)(sense))[0] & 0x70) == 0x70))
-#define SCST_NO_SENSE(sense) ((sense != NULL) && \
- (((uint8_t *)(sense))[2] == 0))
+#define SCST_NO_SENSE(sense) ((sense != NULL) && \
+ (((uint8_t *)(sense))[2] == 0))
static inline int scst_is_ua_sense(const uint8_t *sense)
{
#define TRACE_ALL 0xffffffff
/* Flags 0xXXXX0000 are local for users */
-#define PRINT(log_flag, format, args...) printk("%s" format "\n", log_flag, ## args)
-#define PRINTN(log_flag, format, args...) printk("%s" format, log_flag, ## args)
+#define PRINT(log_flag, format, args...) \
+ printk("%s" format "\n", log_flag, ## args)
+#define PRINTN(log_flag, format, args...) \
+ printk("%s" format, log_flag, ## args)
#ifdef LOG_PREFIX
#define __LOG_PREFIX LOG_PREFIX
#define TRACE_DBG(args...) __TRACE(TRACE_DEBUG, args)
#define TRACE_DBG_SPECIAL(args...) __TRACE(TRACE_DEBUG|TRACE_SPECIAL, args)
#define TRACE_MGMT_DBG(args...) __TRACE(TRACE_MGMT_DEBUG, args)
-#define TRACE_MGMT_DBG_SPECIAL(args...) __TRACE(TRACE_MGMT_DEBUG|TRACE_SPECIAL, args)
+#define TRACE_MGMT_DBG_SPECIAL(args...) \
+ __TRACE(TRACE_MGMT_DEBUG|TRACE_SPECIAL, args)
#define TRACE_BUFFER(message, buff, len) \
do { \
__func__, (long)(res)); \
} \
else { \
- PRINT(LOG_FLAG, "EXIT %s: %ld", __func__, (long)(res)); \
+ PRINT(LOG_FLAG, "EXIT %s: %ld", \
+ __func__, (long)(res)); \
} \
} \
} while (0)
__func__, (long)(res)); \
} \
else { \
- PRINT(LOG_FLAG, "EXIT %s: %lx", __func__, (long)(res)); \
+ PRINT(LOG_FLAG, "EXIT %s: %lx", \
+ __func__, (long)(res)); \
} \
} \
} while (0)
#define DEV_USER_NAME "scst_user"
#define DEV_USER_PATH "/dev/"
#define DEV_USER_VERSION_NAME "1.0.1"
-#define DEV_USER_VERSION DEV_USER_VERSION_NAME "$Revision$" SCST_CONST_VERSION
+#define DEV_USER_VERSION \
+ DEV_USER_VERSION_NAME "$Revision$" SCST_CONST_VERSION
/*
* Chosen so sizeof(scst_user_sess) <= sizeof(scst_user_scsi_cmd_exec)
#define SCST_USER_PARTIAL_TRANSFERS_NOT_SUPPORTED 0
#define SCST_USER_PARTIAL_TRANSFERS_SUPPORTED_ORDERED 1
#define SCST_USER_PARTIAL_TRANSFERS_SUPPORTED 2
-#define SCST_USER_MAX_PARTIAL_TRANSFERS_OPT SCST_USER_PARTIAL_TRANSFERS_SUPPORTED
+#define SCST_USER_MAX_PARTIAL_TRANSFERS_OPT \
+ SCST_USER_PARTIAL_TRANSFERS_SUPPORTED
#ifndef aligned_u64
#define aligned_u64 uint64_t __attribute__((aligned(8)))
#define SCST_USER_REPLY_CMD _IOW('u', 6, struct scst_user_reply_cmd)
/* Values for scst_user_get_cmd.subcode */
-#define SCST_USER_ATTACH_SESS _IOR('s', UCMD_STATE_ATTACH_SESS, struct scst_user_sess)
-#define SCST_USER_DETACH_SESS _IOR('s', UCMD_STATE_DETACH_SESS, struct scst_user_sess)
-#define SCST_USER_PARSE _IOWR('s', UCMD_STATE_PARSING, struct scst_user_scsi_cmd_parse)
-#define SCST_USER_ALLOC_MEM _IOWR('s', UCMD_STATE_BUF_ALLOCING, struct scst_user_scsi_cmd_alloc_mem)
-#define SCST_USER_EXEC _IOWR('s', UCMD_STATE_EXECING, struct scst_user_scsi_cmd_exec)
-#define SCST_USER_ON_FREE_CMD _IOR('s', UCMD_STATE_ON_FREEING, struct scst_user_scsi_on_free_cmd)
-#define SCST_USER_ON_CACHED_MEM_FREE _IOR('s', UCMD_STATE_ON_CACHE_FREEING, struct scst_user_on_cached_mem_free)
-#define SCST_USER_TASK_MGMT _IOWR('s', UCMD_STATE_TM_EXECING, struct scst_user_tm)
+#define SCST_USER_ATTACH_SESS \
+ _IOR('s', UCMD_STATE_ATTACH_SESS, struct scst_user_sess)
+#define SCST_USER_DETACH_SESS \
+ _IOR('s', UCMD_STATE_DETACH_SESS, struct scst_user_sess)
+#define SCST_USER_PARSE \
+ _IOWR('s', UCMD_STATE_PARSING, struct scst_user_scsi_cmd_parse)
+#define SCST_USER_ALLOC_MEM \
+ _IOWR('s', UCMD_STATE_BUF_ALLOCING, struct scst_user_scsi_cmd_alloc_mem)
+#define SCST_USER_EXEC \
+ _IOWR('s', UCMD_STATE_EXECING, struct scst_user_scsi_cmd_exec)
+#define SCST_USER_ON_FREE_CMD \
+ _IOR('s', UCMD_STATE_ON_FREEING, struct scst_user_scsi_on_free_cmd)
+#define SCST_USER_ON_CACHED_MEM_FREE \
+ _IOR('s', UCMD_STATE_ON_CACHE_FREEING, \
+ struct scst_user_on_cached_mem_free)
+#define SCST_USER_TASK_MGMT \
+ _IOWR('s', UCMD_STATE_TM_EXECING, struct scst_user_tm)
#endif /* __SCST_USER_H */