]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/target/target_core_backend.h
target/pscsi: call spc_emulate_report_luns directly
[mirror_ubuntu-bionic-kernel.git] / include / target / target_core_backend.h
CommitLineData
c4795fb2
CH
1#ifndef TARGET_CORE_BACKEND_H
2#define TARGET_CORE_BACKEND_H
3
4#define TRANSPORT_PLUGIN_PHBA_PDEV 1
5#define TRANSPORT_PLUGIN_VHBA_PDEV 2
6#define TRANSPORT_PLUGIN_VHBA_VDEV 3
7
8struct se_subsystem_api {
9 struct list_head sub_api_list;
10
11 char name[16];
0fd97ccf
CH
12 char inquiry_prod[16];
13 char inquiry_rev[4];
c4795fb2
CH
14 struct module *owner;
15
16 u8 transport_type;
17
c4795fb2
CH
18 int (*attach_hba)(struct se_hba *, u32);
19 void (*detach_hba)(struct se_hba *);
20 int (*pmode_enable_hba)(struct se_hba *, unsigned long);
0fd97ccf
CH
21
22 struct se_device *(*alloc_device)(struct se_hba *, const char *);
23 int (*configure_device)(struct se_device *);
24 void (*free_device)(struct se_device *device);
25
26 ssize_t (*set_configfs_dev_params)(struct se_device *,
27 const char *, ssize_t);
28 ssize_t (*show_configfs_dev_params)(struct se_device *, char *);
29
d5829eac
PB
30 void (*transport_complete)(struct se_cmd *cmd,
31 struct scatterlist *,
32 unsigned char *);
d6e0175c 33
1fd032ee 34 int (*parse_cdb)(struct se_cmd *cmd);
c4795fb2
CH
35 u32 (*get_device_rev)(struct se_device *);
36 u32 (*get_device_type)(struct se_device *);
37 sector_t (*get_blocks)(struct se_device *);
5787cacd 38 unsigned char *(*get_sense_buffer)(struct se_cmd *);
c4795fb2
CH
39};
40
9e999a6c 41struct sbc_ops {
0c2ad7d1 42 int (*execute_rw)(struct se_cmd *cmd);
ad67f0d9 43 int (*execute_sync_cache)(struct se_cmd *cmd);
6f974e8c 44 int (*execute_write_same)(struct se_cmd *cmd);
14150a6b 45 int (*execute_unmap)(struct se_cmd *cmd);
0c2ad7d1
CH
46};
47
c4795fb2
CH
48int transport_subsystem_register(struct se_subsystem_api *);
49void transport_subsystem_release(struct se_subsystem_api *);
50
6bb35e00 51void target_complete_cmd(struct se_cmd *, u8);
c4795fb2 52
9e999a6c 53int sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops);
1fd032ee 54int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size);
8de530a5 55int spc_emulate_report_luns(struct se_cmd *cmd);
6f974e8c 56int spc_get_write_same_sectors(struct se_cmd *cmd);
d6e0175c 57
c4795fb2
CH
58void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
59int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
60int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *);
61int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
62
63/* core helpers also used by command snooping in pscsi */
4949314c
AG
64void *transport_kmap_data_sg(struct se_cmd *);
65void transport_kunmap_data_sg(struct se_cmd *);
c4795fb2 66
4a5a75f3
JE
67void array_free(void *array, int n);
68
c4795fb2 69#endif /* TARGET_CORE_BACKEND_H */