FreeBSD kernel CAM code
ctl_backend.h File Reference
#include <cam/ctl/ctl_ioctl.h>
#include <sys/nv.h>
Include dependency graph for ctl_backend.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ctl_be_lun
 
struct  ctl_backend_driver
 

Macros

#define CTL_BACKEND_DECLARE(name, driver)
 

Typedefs

typedef void(* be_callback_t) (struct ctl_be_lun *be_lun)
 
typedef int(* be_init_t) (void)
 
typedef int(* be_shutdown_t) (void)
 
typedef int(* be_func_t) (union ctl_io *io)
 
typedef void(* be_vfunc_t) (union ctl_io *io)
 
typedef int(* be_ioctl_t) (struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
 
typedef int(* be_luninfo_t) (struct ctl_be_lun *be_lun, struct sbuf *sb)
 
typedef uint64_t(* be_lunattr_t) (struct ctl_be_lun *be_lun, const char *attrname)
 

Enumerations

enum  ctl_lun_serseq { CTL_LUN_SERSEQ_OFF , CTL_LUN_SERSEQ_SOFT , CTL_LUN_SERSEQ_READ , CTL_LUN_SERSEQ_ON }
 
enum  ctl_backend_flags { CTL_BE_FLAG_NONE = 0x00 , CTL_BE_FLAG_HAS_CONFIG = 0x01 }
 

Functions

int ctl_backend_register (struct ctl_backend_driver *be)
 
int ctl_backend_deregister (struct ctl_backend_driver *be)
 
struct ctl_backend_driverctl_backend_find (char *backend_name)
 
int ctl_add_lun (struct ctl_be_lun *be_lun)
 
int ctl_remove_lun (struct ctl_be_lun *be_lun)
 
int ctl_start_lun (struct ctl_be_lun *be_lun)
 
int ctl_stop_lun (struct ctl_be_lun *be_lun)
 
int ctl_lun_no_media (struct ctl_be_lun *be_lun)
 
int ctl_lun_has_media (struct ctl_be_lun *be_lun)
 
int ctl_lun_ejected (struct ctl_be_lun *be_lun)
 
int ctl_lun_primary (struct ctl_be_lun *be_lun)
 
int ctl_lun_secondary (struct ctl_be_lun *be_lun)
 
void ctl_lun_capacity_changed (struct ctl_be_lun *be_lun)
 

Macro Definition Documentation

◆ CTL_BACKEND_DECLARE

#define CTL_BACKEND_DECLARE (   name,
  driver 
)
Value:
static int name ## _modevent(module_t mod, int type, void *data) \
{ \
switch (type) { \
case MOD_LOAD: \
(struct ctl_backend_driver *)data)); \
break; \
case MOD_UNLOAD: \
(struct ctl_backend_driver *)data)); \
break; \
default: \
return EOPNOTSUPP; \
} \
return 0; \
} \
static moduledata_t name ## _mod = { \
#name, \
name ## _modevent, \
(void *)&driver \
}; \
DECLARE_MODULE(name, name ## _mod, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); \
MODULE_DEPEND(name, ctl, 1, 1, 1); \
MODULE_DEPEND(name, cam, 1, 1, 1)
int ctl_backend_register(struct ctl_backend_driver *be)
Definition: ctl_backend.c:68
int ctl_backend_deregister(struct ctl_backend_driver *be)
Definition: ctl_backend.c:104

Definition at line 57 of file ctl_backend.h.

Typedef Documentation

◆ be_callback_t

typedef void(* be_callback_t) (struct ctl_be_lun *be_lun)

Definition at line 84 of file ctl_backend.h.

◆ be_func_t

typedef int(* be_func_t) (union ctl_io *io)

Definition at line 177 of file ctl_backend.h.

◆ be_init_t

typedef int(* be_init_t) (void)

Definition at line 175 of file ctl_backend.h.

◆ be_ioctl_t

typedef int(* be_ioctl_t) (struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)

Definition at line 179 of file ctl_backend.h.

◆ be_lunattr_t

typedef uint64_t(* be_lunattr_t) (struct ctl_be_lun *be_lun, const char *attrname)

Definition at line 182 of file ctl_backend.h.

◆ be_luninfo_t

typedef int(* be_luninfo_t) (struct ctl_be_lun *be_lun, struct sbuf *sb)

Definition at line 181 of file ctl_backend.h.

◆ be_shutdown_t

typedef int(* be_shutdown_t) (void)

Definition at line 176 of file ctl_backend.h.

◆ be_vfunc_t

typedef void(* be_vfunc_t) (union ctl_io *io)

Definition at line 178 of file ctl_backend.h.

Enumeration Type Documentation

◆ ctl_backend_flags

Enumerator
CTL_BE_FLAG_NONE 
CTL_BE_FLAG_HAS_CONFIG 

Definition at line 170 of file ctl_backend.h.

◆ ctl_lun_serseq

Enumerator
CTL_LUN_SERSEQ_OFF 
CTL_LUN_SERSEQ_SOFT 
CTL_LUN_SERSEQ_READ 
CTL_LUN_SERSEQ_ON 

Definition at line 48 of file ctl_backend.h.

Function Documentation

◆ ctl_add_lun()

int ctl_add_lun ( struct ctl_be_lun be_lun)

Definition at line 4571 of file ctl.c.

References ctl_lun::backend, ctl_be_lun::be, ctl_lun::be_lun, control_softc, ctl_clear_mask(), CTL_DEVID_LEN, CTL_DEVID_MIN_LEN, ctl_enable_lun(), ctl_est_ua_all(), ctl_ffz(), ctl_init_log_page_index(), ctl_init_page_index(), ctl_is_set(), ctl_softc::ctl_lock, ctl_be_lun::ctl_lun, CTL_LUN_DISABLED, CTL_LUN_EJECTED, CTL_LUN_FLAG_EJECTED, CTL_LUN_FLAG_ID_REQ, CTL_LUN_FLAG_NO_MEDIA, CTL_LUN_FLAG_PRIMARY, CTL_LUN_FLAG_STOPPED, ctl_softc::ctl_lun_mask, CTL_LUN_NO_MEDIA, CTL_LUN_PRIMARY_SC, CTL_LUN_REMOVABLE, CTL_LUN_STOPPED, ctl_softc::ctl_luns, CTL_MAX_INITIATORS, ctl_max_luns, ctl_max_ports, ctl_set_mask(), ctl_lun::ctl_softc, ctl_tpc_lun_init(), CTL_UA_LUN_CHANGE, CTL_VENDOR, ctl_devid::data, ctl_be_lun::device_id, ctl_be_lun::flags, ctl_lun::flags, hex2bin(), scsi_vpd_id_descriptor::id_type, scsi_vpd_id_descriptor::identifier, ctl_lun::ie_callout, ctl_lun::ie_reported, ctl_io_stats::item, ctl_devid::len, scsi_vpd_id_descriptor::length, ctl_lun::lun, ctl_lun::lun_devid, ctl_be_lun::lun_id, ctl_lun::lun_lock, ctl_be_lun::lun_type, ctl_softc::num_luns, ctl_be_lun::options, ctl_lun::pending_sense, ctl_lun::pending_ua, ctl_lun::pr_keys, ctl_lun::prevent, scsi_vpd_id_descriptor::proto_codeset, ctl_be_lun::req_lun_id, ctl_lun::stats, SVPD_ID_ASSOC_LUN, SVPD_ID_CODESET_ASCII, SVPD_ID_CODESET_BINARY, SVPD_ID_CODESET_UTF8, SVPD_ID_PIV, SVPD_ID_TYPE_EUI64, SVPD_ID_TYPE_NAA, SVPD_ID_TYPE_SCSI_NAME, SVPD_ID_TYPE_T10, SVPD_ID_TYPE_UUID, T_CDROM, T_CHANGER, T_DIRECT, T_PROCESSOR, T_SEQUENTIAL, scsi_vpd_id_t10::vendor, and scsi_vpd_id_t10::vendor_spec_id.

Referenced by ctl_backend_ramdisk_create(), and ctl_be_block_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl_backend_deregister()

int ctl_backend_deregister ( struct ctl_backend_driver be)

◆ ctl_backend_find()

struct ctl_backend_driver * ctl_backend_find ( char *  backend_name)

Definition at line 126 of file ctl_backend.c.

References control_softc, ctl_softc::ctl_lock, and ctl_backend_driver::name.

Referenced by ctl_ioctl().

Here is the caller graph for this function:

◆ ctl_backend_register()

int ctl_backend_register ( struct ctl_backend_driver be)

Definition at line 68 of file ctl_backend.c.

References control_softc, ctl_config_move_done(), ctl_softc::ctl_lock, ctl_backend_driver::init, ctl_backend_driver::name, and ctl_softc::num_backends.

Here is the call graph for this function:

◆ ctl_lun_capacity_changed()

void ctl_lun_capacity_changed ( struct ctl_be_lun be_lun)

Definition at line 5073 of file ctl.c.

References ctl_lun::be_lun, ctl_est_ua_all(), CTL_HA_CHAN_CTL, CTL_HA_MODE_XFER, ctl_ha_msg_send(), ctl_be_lun::ctl_lun, CTL_MSG_UA, CTL_UA_CAPACITY_CHANGE, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_modify(), and ctl_be_block_modify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl_lun_ejected()

int ctl_lun_ejected ( struct ctl_be_lun be_lun)

Definition at line 5004 of file ctl.c.

References ctl_lun::be_lun, ctl_be_lun::ctl_lun, CTL_LUN_EJECTED, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_config_write(), and ctl_be_block_config_write().

Here is the caller graph for this function:

◆ ctl_lun_has_media()

int ctl_lun_has_media ( struct ctl_be_lun be_lun)

◆ ctl_lun_no_media()

int ctl_lun_no_media ( struct ctl_be_lun be_lun)

Definition at line 4965 of file ctl.c.

References ctl_lun::be_lun, ctl_be_lun::ctl_lun, CTL_LUN_NO_MEDIA, and ctl_lun::lun.

Referenced by ctl_be_block_config_write(), ctl_be_block_modify(), and ctl_be_block_rm().

Here is the caller graph for this function:

◆ ctl_lun_primary()

int ctl_lun_primary ( struct ctl_be_lun be_lun)

Definition at line 5015 of file ctl.c.

References ctl_lun::be_lun, ctl_est_ua_all(), ctl_isc_announce_lun(), ctl_be_lun::ctl_lun, CTL_LUN_PRIMARY_SC, CTL_UA_ASYM_ACC_CHANGE, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_modify(), and ctl_be_block_modify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl_lun_secondary()

int ctl_lun_secondary ( struct ctl_be_lun be_lun)

Definition at line 5028 of file ctl.c.

References ctl_lun::be_lun, ctl_est_ua_all(), ctl_isc_announce_lun(), ctl_be_lun::ctl_lun, CTL_UA_ASYM_ACC_CHANGE, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_modify(), and ctl_be_block_modify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl_remove_lun()

int ctl_remove_lun ( struct ctl_be_lun be_lun)

Definition at line 5047 of file ctl.c.

References ctl_lun::be_lun, ctl_disable_lun(), ctl_free_lun(), ctl_be_lun::ctl_lun, CTL_LUN_INVALID, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_rm(), ctl_backend_ramdisk_shutdown(), ctl_be_block_rm(), and ctl_be_block_shutdown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl_start_lun()

int ctl_start_lun ( struct ctl_be_lun be_lun)

Definition at line 4943 of file ctl.c.

References ctl_lun::be_lun, ctl_be_lun::ctl_lun, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_config_write(), and ctl_be_block_config_write().

Here is the caller graph for this function:

◆ ctl_stop_lun()

int ctl_stop_lun ( struct ctl_be_lun be_lun)

Definition at line 4954 of file ctl.c.

References ctl_lun::be_lun, ctl_be_lun::ctl_lun, CTL_LUN_STOPPED, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_config_write(), and ctl_be_block_config_write().

Here is the caller graph for this function: