Skip to content

Commit cdaf9c4

Browse files
Yaowei BaiMike Christie
Yaowei Bai
authored and
Mike Christie
committed
libtcmu: move tcmu_get_runner_handler into scsi.c
There needs one place to store codes to be sharable between tcmu-runner and other daemons like consume and tcmu-synthesizer but not libtcmu users out of tree. Maybe tcmu_get_runner_handler is not much about SCSI, it's still reasonable to place it there for simplicity. Signed-off-by: Yaowei Bai <[email protected]>
1 parent 117e84c commit cdaf9c4

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

libtcmu.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
#include "libtcmu.h"
2828
#include "libtcmu_log.h"
2929
#include "libtcmu_priv.h"
30-
#include "tcmur_aio.h"
31-
#include "tcmur_cmd_handler.h"
32-
#include "tcmu-runner.h"
33-
#include "tcmur_device.h"
30+
#include "scsi_defs.h"
3431

3532
#define TCMU_NL_VERSION 2
3633

@@ -948,13 +945,6 @@ struct tcmulib_handler *tcmu_get_dev_handler(struct tcmu_device *dev)
948945
return dev->handler;
949946
}
950947

951-
struct tcmur_handler *tcmu_get_runner_handler(struct tcmu_device *dev)
952-
{
953-
struct tcmulib_handler *handler = tcmu_get_dev_handler(dev);
954-
955-
return handler->hm_private;
956-
}
957-
958948
static inline struct tcmu_cmd_entry *
959949
device_cmd_head(struct tcmu_device *dev)
960950
{

libtcmu_common.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ bool tcmu_get_dev_write_cache_enabled(struct tcmu_device *dev);
141141
void tcmu_set_dev_solid_state_media(struct tcmu_device *dev, bool solid_state);
142142
bool tcmu_get_dev_solid_state_media(struct tcmu_device *dev);
143143
struct tcmulib_handler *tcmu_get_dev_handler(struct tcmu_device *dev);
144-
struct tcmur_handler *tcmu_get_runner_handler(struct tcmu_device *dev);
145144
void tcmu_block_device(struct tcmu_device *dev);
146145
void tcmu_unblock_device(struct tcmu_device *dev);
147146
void tcmu_flush_device(struct tcmu_device *dev);

scsi.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ bool char_to_hex(unsigned char *val, char c)
8282
return false;
8383
}
8484

85+
struct tcmur_handler *tcmu_get_runner_handler(struct tcmu_device *dev)
86+
{
87+
struct tcmulib_handler *handler = tcmu_get_dev_handler(dev);
88+
89+
return handler->hm_private;
90+
}
91+
8592
int tcmu_emulate_evpd_inquiry(
8693
struct tcmu_device *dev,
8794
struct tgt_port *port,

scsi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ extern "C" {
3030

3131
/* Basic implementations of mandatory SCSI commands */
3232
bool char_to_hex(unsigned char *val, char c);
33+
struct tcmur_handler *tcmu_get_runner_handler(struct tcmu_device *dev);
3334
int tcmu_emulate_inquiry(struct tcmu_device *dev, struct tgt_port *port, uint8_t *cdb, struct iovec *iovec, size_t iov_cnt);
3435
int tcmu_emulate_start_stop(struct tcmu_device *dev, uint8_t *cdb);
3536
int tcmu_emulate_test_unit_ready(uint8_t *cdb, struct iovec *iovec, size_t iov_cnt);

tcmur_cmd_handler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include "libtcmu_common.h"
2424
#include "tcmur_aio.h"
2525
#include "tcmur_device.h"
26-
#include "tcmur_cmd_handler.h"
2726
#include "tcmu-runner.h"
27+
#include "tcmur_cmd_handler.h"
2828
#include "alua.h"
2929

3030
static void _cleanup_spin_lock(void *arg)

0 commit comments

Comments
 (0)