ctl_ioctl.h revision 229997
1169695Skan/*- 2169695Skan * Copyright (c) 2003 Silicon Graphics International Corp. 3169695Skan * Copyright (c) 2011 Spectra Logic Corporation 4169695Skan * All rights reserved. 5169695Skan * 6169695Skan * Redistribution and use in source and binary forms, with or without 7169695Skan * modification, are permitted provided that the following conditions 8169695Skan * are met: 9169695Skan * 1. Redistributions of source code must retain the above copyright 10169695Skan * notice, this list of conditions, and the following disclaimer, 11169695Skan * without modification. 12169695Skan * 2. Redistributions in binary form must reproduce at minimum a disclaimer 13169695Skan * substantially similar to the "NO WARRANTY" disclaimer below 14169695Skan * ("Disclaimer") and any redistribution must be conditioned upon 15169695Skan * including a substantially similar Disclaimer requirement for further 16169695Skan * binary redistribution. 17169695Skan * 18169695Skan * NO WARRANTY 19169695Skan * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20169695Skan * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21169695Skan * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 22169695Skan * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23169695Skan * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24169695Skan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25169695Skan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26169695Skan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27169695Skan * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 28169695Skan * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29169695Skan * POSSIBILITY OF SUCH DAMAGES. 30169695Skan * 31169695Skan * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_ioctl.h#4 $ 32169695Skan * $FreeBSD: head/sys/cam/ctl/ctl_ioctl.h 229997 2012-01-12 00:34:33Z ken $ 33169695Skan */ 34169695Skan/* 35169695Skan * CAM Target Layer ioctl interface. 36169695Skan * 37169695Skan * Author: Ken Merry <ken@FreeBSD.org> 38169695Skan */ 39169695Skan 40169695Skan#ifndef _CTL_IOCTL_H_ 41169695Skan#define _CTL_IOCTL_H_ 42169695Skan 43169695Skan#define CTL_DEFAULT_DEV "/dev/cam/ctl" 44169695Skan/* 45169695Skan * Maximum number of targets we support. 46169695Skan */ 47169695Skan#define CTL_MAX_TARGETS 1 48169695Skan 49169695Skan/* 50169695Skan * Maximum target ID we support. 51169695Skan */ 52169695Skan#define CTL_MAX_TARGID 15 53169695Skan 54169695Skan/* 55169695Skan * Maximum number of LUNs we support at the moment. MUST be a power of 2. 56169695Skan */ 57169695Skan#define CTL_MAX_LUNS 256 58169695Skan 59169695Skan/* 60169695Skan * Maximum number of initiators per port. 61169695Skan */ 62169695Skan#define CTL_MAX_INIT_PER_PORT 2048 // Was 16 63169695Skan 64169695Skan/* 65169695Skan * Maximum number of ports registered at one time. 66169695Skan */ 67169695Skan#define CTL_MAX_PORTS 32 68169695Skan 69169695Skan/* 70169695Skan * Maximum number of initiators we support. 71169695Skan */ 72169695Skan#define CTL_MAX_INITIATORS (CTL_MAX_INIT_PER_PORT * CTL_MAX_PORTS) 73169695Skan 74169695Skan/* Hopefully this won't conflict with new misc devices that pop up */ 75169695Skan#define CTL_MINOR 225 76169695Skan 77169695Skantypedef enum { 78169695Skan CTL_OOA_INVALID_LUN, 79169695Skan CTL_OOA_SUCCESS 80169695Skan} ctl_ooa_status; 81169695Skan 82169695Skanstruct ctl_ooa_info { 83169695Skan uint32_t target_id; /* Passed in to CTL */ 84169695Skan uint32_t lun_id; /* Passed in to CTL */ 85169695Skan uint32_t num_entries; /* Returned from CTL */ 86169695Skan ctl_ooa_status status; /* Returned from CTL */ 87169695Skan}; 88169695Skan 89169695Skanstruct ctl_hard_startstop_info { 90169695Skan cfi_mt_status status; 91169695Skan int total_luns; 92169695Skan int luns_complete; 93169695Skan int luns_failed; 94169695Skan}; 95169695Skan 96169695Skanstruct ctl_bbrread_info { 97169695Skan int lun_num; /* Passed in to CTL */ 98169695Skan uint64_t lba; /* Passed in to CTL */ 99169695Skan int len; /* Passed in to CTL */ 100169695Skan cfi_mt_status status; /* Returned from CTL */ 101169695Skan cfi_bbrread_status bbr_status; /* Returned from CTL */ 102169695Skan uint8_t scsi_status; /* Returned from CTL */ 103169695Skan struct scsi_sense_data sense_data; /* Returned from CTL */ 104169695Skan}; 105169695Skan 106169695Skantypedef enum { 107169695Skan CTL_DELAY_TYPE_NONE, 108169695Skan CTL_DELAY_TYPE_CONT, 109169695Skan CTL_DELAY_TYPE_ONESHOT 110169695Skan} ctl_delay_type; 111169695Skan 112169695Skantypedef enum { 113169695Skan CTL_DELAY_LOC_NONE, 114169695Skan CTL_DELAY_LOC_DATAMOVE, 115169695Skan CTL_DELAY_LOC_DONE, 116169695Skan} ctl_delay_location; 117169695Skan 118169695Skantypedef enum { 119169695Skan CTL_DELAY_STATUS_NONE, 120169695Skan CTL_DELAY_STATUS_OK, 121169695Skan CTL_DELAY_STATUS_INVALID_LUN, 122169695Skan CTL_DELAY_STATUS_INVALID_TYPE, 123169695Skan CTL_DELAY_STATUS_INVALID_LOC, 124169695Skan CTL_DELAY_STATUS_NOT_IMPLEMENTED 125169695Skan} ctl_delay_status; 126169695Skan 127169695Skanstruct ctl_io_delay_info { 128169695Skan uint32_t target_id; 129169695Skan uint32_t lun_id; 130169695Skan ctl_delay_type delay_type; 131169695Skan ctl_delay_location delay_loc; 132169695Skan uint32_t delay_secs; 133169695Skan ctl_delay_status status; 134169695Skan}; 135169695Skan 136169695Skantypedef enum { 137169695Skan CTL_GS_SYNC_NONE, 138169695Skan CTL_GS_SYNC_OK, 139169695Skan CTL_GS_SYNC_NO_LUN 140169695Skan} ctl_gs_sync_status; 141169695Skan 142169695Skan/* 143169695Skan * The target and LUN id specify which device to modify. The sync interval 144169695Skan * means that we will let through every N SYNCHRONIZE CACHE commands. 145169695Skan */ 146169695Skanstruct ctl_sync_info { 147169695Skan uint32_t target_id; /* passed to kernel */ 148169695Skan uint32_t lun_id; /* passed to kernel */ 149169695Skan int sync_interval; /* depends on whether get/set */ 150169695Skan ctl_gs_sync_status status; /* passed from kernel */ 151169695Skan}; 152169695Skan 153169695Skantypedef enum { 154169695Skan CTL_STATS_NO_IO, 155169695Skan CTL_STATS_READ, 156169695Skan CTL_STATS_WRITE 157169695Skan} ctl_stat_types; 158169695Skan#define CTL_STATS_NUM_TYPES 3 159169695Skan 160169695Skantypedef enum { 161169695Skan CTL_LUN_STATS_NO_BLOCKSIZE = 0x01 162169695Skan} ctl_lun_stats_flags; 163169695Skan 164169695Skanstruct ctl_lun_io_port_stats { 165169695Skan uint32_t targ_port; 166169695Skan uint64_t bytes[CTL_STATS_NUM_TYPES]; 167169695Skan uint64_t operations[CTL_STATS_NUM_TYPES]; 168169695Skan struct bintime time[CTL_STATS_NUM_TYPES]; 169169695Skan uint64_t num_dmas[CTL_STATS_NUM_TYPES]; 170169695Skan struct bintime dma_time[CTL_STATS_NUM_TYPES]; 171169695Skan}; 172169695Skan 173169695Skanstruct ctl_lun_io_stats { 174169695Skan uint8_t device_type; 175169695Skan uint64_t lun_number; 176169695Skan uint32_t blocksize; 177169695Skan ctl_lun_stats_flags flags; 178169695Skan struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; 179169695Skan}; 180169695Skan 181169695Skantypedef enum { 182169695Skan CTL_SS_OK, 183169695Skan CTL_SS_NEED_MORE_SPACE, 184169695Skan CTL_SS_ERROR 185169695Skan} ctl_stats_status; 186169695Skan 187169695Skantypedef enum { 188169695Skan CTL_STATS_FLAG_NONE = 0x00, 189169695Skan CTL_STATS_FLAG_TIME_VALID = 0x01 190169695Skan} ctl_stats_flags; 191169695Skan 192169695Skanstruct ctl_stats { 193169695Skan int alloc_len; /* passed to kernel */ 194169695Skan struct ctl_lun_io_stats *lun_stats; /* passed to/from kernel */ 195169695Skan int fill_len; /* passed to userland */ 196169695Skan int num_luns; /* passed to userland */ 197169695Skan ctl_stats_status status; /* passed to userland */ 198169695Skan ctl_stats_flags flags; /* passed to userland */ 199169695Skan struct timespec timestamp; /* passed to userland */ 200169695Skan}; 201169695Skan 202169695Skan/* 203169695Skan * The types of errors that can be injected: 204169695Skan * 205169695Skan * NONE: No error specified. 206169695Skan * ABORTED: SSD_KEY_ABORTED_COMMAND, 0x45, 0x00 207169695Skan * MEDIUM_ERR: Medium error, different asc/ascq depending on read/write. 208169695Skan * UA: Unit attention. 209169695Skan * CUSTOM: User specifies the sense data. 210169695Skan * TYPE: Mask to use with error types. 211169695Skan * 212169695Skan * Flags that affect injection behavior: 213169695Skan * CONTINUOUS: This error will stay around until explicitly cleared. 214169695Skan * DESCRIPTOR: Use descriptor sense instead of fixed sense. 215169695Skan */ 216169695Skantypedef enum { 217169695Skan CTL_LUN_INJ_NONE = 0x000, 218169695Skan CTL_LUN_INJ_ABORTED = 0x001, 219169695Skan CTL_LUN_INJ_MEDIUM_ERR = 0x002, 220169695Skan CTL_LUN_INJ_UA = 0x003, 221169695Skan CTL_LUN_INJ_CUSTOM = 0x004, 222169695Skan CTL_LUN_INJ_TYPE = 0x0ff, 223169695Skan CTL_LUN_INJ_CONTINUOUS = 0x100, 224169695Skan CTL_LUN_INJ_DESCRIPTOR = 0x200 225169695Skan} ctl_lun_error; 226169695Skan 227169695Skan/* 228169695Skan * Flags to specify what type of command the given error pattern will 229169695Skan * execute on. The first group of types can be ORed together. 230169695Skan * 231169695Skan * READ: Any read command. 232169695Skan * WRITE: Any write command. 233169695Skan * READWRITE: Any read or write command. 234169695Skan * READCAP: Any read capacity command. 235169695Skan * TUR: Test Unit Ready. 236169695Skan * ANY: Any command. 237169695Skan * MASK: Mask for basic command patterns. 238169695Skan * 239169695Skan * Special types: 240169695Skan * 241169695Skan * CMD: The CDB to act on is specified in struct ctl_error_desc_cmd. 242169695Skan * RANGE: For read/write commands, act when the LBA is in the 243169695Skan * specified range. 244169695Skan */ 245169695Skantypedef enum { 246169695Skan CTL_LUN_PAT_NONE = 0x000, 247169695Skan CTL_LUN_PAT_READ = 0x001, 248169695Skan CTL_LUN_PAT_WRITE = 0x002, 249169695Skan CTL_LUN_PAT_READWRITE = CTL_LUN_PAT_READ | CTL_LUN_PAT_WRITE, 250169695Skan CTL_LUN_PAT_READCAP = 0x004, 251169695Skan CTL_LUN_PAT_TUR = 0x008, 252169695Skan CTL_LUN_PAT_ANY = 0x0ff, 253169695Skan CTL_LUN_PAT_MASK = 0x0ff, 254169695Skan CTL_LUN_PAT_CMD = 0x100, 255169695Skan CTL_LUN_PAT_RANGE = 0x200 256169695Skan} ctl_lun_error_pattern; 257169695Skan 258169695Skan/* 259169695Skan * This structure allows the user to specify a particular CDB pattern to 260169695Skan * look for. 261169695Skan * 262169695Skan * cdb_pattern: Fill in the relevant bytes to look for in the CDB. 263169695Skan * cdb_valid_bytes: Bitmask specifying valid bytes in the cdb_pattern. 264169695Skan * flags: Specify any command flags (see ctl_io_flags) that 265169695Skan * should be set. 266169695Skan */ 267169695Skanstruct ctl_error_desc_cmd { 268169695Skan uint8_t cdb_pattern[CTL_MAX_CDBLEN]; 269169695Skan uint32_t cdb_valid_bytes; 270169695Skan uint32_t flags; 271169695Skan}; 272169695Skan 273169695Skan/* 274169695Skan * Error injection descriptor. 275169695Skan * 276169695Skan * target_id: Target ID to act on. 277169695Skan * lun_id LUN to act on. 278169695Skan * lun_error: The type of error to inject. See above for descriptions. 279169695Skan * error_pattern: What kind of command to act on. See above. 280169695Skan * cmd_desc: For CTL_LUN_PAT_CMD only. 281169695Skan * lba_range: For CTL_LUN_PAT_RANGE only. 282169695Skan * custom_sense: Specify sense. For CTL_LUN_INJ_CUSTOM only. 283169695Skan * serial: Serial number returned by the kernel. Use for deletion. 284169695Skan * links: Kernel use only. 285169695Skan */ 286169695Skanstruct ctl_error_desc { 287169695Skan uint32_t target_id; /* To kernel */ 288169695Skan uint32_t lun_id; /* To kernel */ 289169695Skan ctl_lun_error lun_error; /* To kernel */ 290169695Skan ctl_lun_error_pattern error_pattern; /* To kernel */ 291169695Skan struct ctl_error_desc_cmd cmd_desc; /* To kernel */ 292169695Skan struct ctl_lba_len lba_range; /* To kernel */ 293169695Skan struct scsi_sense_data custom_sense; /* To kernel */ 294169695Skan uint64_t serial; /* From kernel */ 295169695Skan STAILQ_ENTRY(ctl_error_desc) links; /* Kernel use only */ 296169695Skan}; 297169695Skan 298169695Skantypedef enum { 299169695Skan CTL_OOA_FLAG_NONE = 0x00, 300169695Skan CTL_OOA_FLAG_ALL_LUNS = 0x01 301169695Skan} ctl_ooa_flags; 302169695Skan 303169695Skantypedef enum { 304169695Skan CTL_OOA_OK, 305169695Skan CTL_OOA_NEED_MORE_SPACE, 306169695Skan CTL_OOA_ERROR 307169695Skan} ctl_get_ooa_status; 308169695Skan 309169695Skantypedef enum { 310169695Skan CTL_OOACMD_FLAG_NONE = 0x00, 311169695Skan CTL_OOACMD_FLAG_DMA = 0x01, 312169695Skan CTL_OOACMD_FLAG_BLOCKED = 0x02, 313169695Skan CTL_OOACMD_FLAG_ABORT = 0x04, 314169695Skan CTL_OOACMD_FLAG_RTR = 0x08, 315169695Skan CTL_OOACMD_FLAG_DMA_QUEUED = 0x10 316169695Skan} ctl_ooa_cmd_flags; 317169695Skan 318169695Skanstruct ctl_ooa_entry { 319169695Skan ctl_ooa_cmd_flags cmd_flags; 320169695Skan uint8_t cdb[CTL_MAX_CDBLEN]; 321169695Skan uint8_t cdb_len; 322169695Skan uint32_t tag_num; 323169695Skan uint32_t lun_num; 324169695Skan struct bintime start_bt; 325169695Skan}; 326169695Skan 327169695Skanstruct ctl_ooa { 328169695Skan ctl_ooa_flags flags; /* passed to kernel */ 329169695Skan uint64_t lun_num; /* passed to kernel */ 330169695Skan uint32_t alloc_len; /* passed to kernel */ 331169695Skan uint32_t alloc_num; /* passed to kernel */ 332169695Skan struct ctl_ooa_entry *entries; /* filled in kernel */ 333169695Skan uint32_t fill_len; /* passed to userland */ 334169695Skan uint32_t fill_num; /* passed to userland */ 335169695Skan uint32_t dropped_num; /* passed to userland */ 336169695Skan struct bintime cur_bt; /* passed to userland */ 337169695Skan ctl_get_ooa_status status; /* passed to userland */ 338169695Skan}; 339169695Skan 340169695Skantypedef enum { 341169695Skan CTL_PORT_LIST_NONE, 342169695Skan CTL_PORT_LIST_OK, 343169695Skan CTL_PORT_LIST_NEED_MORE_SPACE, 344169695Skan CTL_PORT_LIST_ERROR 345169695Skan} ctl_port_list_status; 346169695Skan 347169695Skanstruct ctl_port_list { 348169695Skan uint32_t alloc_len; /* passed to kernel */ 349169695Skan uint32_t alloc_num; /* passed to kernel */ 350169695Skan struct ctl_port_entry *entries; /* filled in kernel */ 351169695Skan uint32_t fill_len; /* passed to userland */ 352169695Skan uint32_t fill_num; /* passed to userland */ 353169695Skan uint32_t dropped_num; /* passed to userland */ 354169695Skan ctl_port_list_status status; /* passed to userland */ 355169695Skan}; 356169695Skan 357169695Skantypedef enum { 358169695Skan CTL_LUN_NOSTATUS, 359169695Skan CTL_LUN_OK, 360169695Skan CTL_LUN_ERROR 361169695Skan} ctl_lun_status; 362169695Skan 363169695Skan#define CTL_ERROR_STR_LEN 160 364169695Skan 365169695Skan#define CTL_BEARG_RD 0x01 366169695Skan#define CTL_BEARG_WR 0x02 367169695Skan#define CTL_BEARG_RW (CTL_BEARG_RD|CTL_BEARG_WR) 368169695Skan#define CTL_BEARG_ASCII 0x04 369169695Skan 370169695Skan/* 371169695Skan * Backend Argument: 372169695Skan * 373169695Skan * namelen: Length of the name field, including the terminating NUL. 374169695Skan * 375169695Skan * name: Name of the paramter. This must be NUL-terminated. 376169695Skan * 377169695Skan * flags: Flags for the parameter, see above for values. 378169695Skan * 379169695Skan * vallen: Length of the value in bytes. 380169695Skan * 381169695Skan * value: Value to be set/fetched. 382169695Skan * 383169695Skan * kname: For kernel use only. 384169695Skan * 385169695Skan * kvalue: For kernel use only. 386169695Skan */ 387169695Skanstruct ctl_be_arg { 388169695Skan int namelen; 389169695Skan char *name; 390 int flags; 391 int vallen; 392 void *value; 393 394 char *kname; 395 void *kvalue; 396}; 397 398typedef enum { 399 CTL_LUNREQ_CREATE, 400 CTL_LUNREQ_RM 401} ctl_lunreq_type; 402 403 404/* 405 * LUN creation parameters: 406 * 407 * flags: Various LUN flags, see ctl_backend.h for a 408 * description of the flag values and meanings. 409 * 410 * device_type: The SCSI device type. e.g. 0 for Direct Access, 411 * 3 for Processor, etc. Only certain backends may 412 * support setting this field. The CTL_LUN_FLAG_DEV_TYPE 413 * flag should be set in the flags field if the device 414 * type is set. 415 * 416 * lun_size_bytes: The size of the LUN in bytes. For some backends 417 * this is relevant (e.g. ramdisk), for others, it may 418 * be ignored in favor of using the properties of the 419 * backing store. If specified, this should be a 420 * multiple of the blocksize. 421 * 422 * The actual size of the LUN is returned in this 423 * field. 424 * 425 * blocksize_bytes: The LUN blocksize in bytes. For some backends this 426 * is relevant, for others it may be ignored in 427 * favor of using the properties of the backing store. 428 * 429 * The actual blocksize of the LUN is returned in this 430 * field. 431 * 432 * req_lun_id: The requested LUN ID. The CTL_LUN_FLAG_ID_REQ flag 433 * should be set if this is set. The request will be 434 * granted if the LUN number is available, otherwise 435 * the LUN addition request will fail. 436 * 437 * The allocated LUN number is returned in this field. 438 * 439 * serial_num: This is the value returned in SCSI INQUIRY VPD page 440 * 0x80. If it is specified, the CTL_LUN_FLAG_SERIAL_NUM 441 * flag should be set. 442 * 443 * The serial number value used is returned in this 444 * field. 445 * 446 * device_id: This is the value returned in the T10 vendor ID 447 * based DESIGNATOR field in the SCSI INQUIRY VPD page 448 * 0x83 data. If it is specified, the CTL_LUN_FLAG_DEVID 449 * flag should be set. 450 * 451 * The device id value used is returned in this field. 452 */ 453struct ctl_lun_create_params { 454 ctl_backend_lun_flags flags; 455 uint8_t device_type; 456 uint64_t lun_size_bytes; 457 uint32_t blocksize_bytes; 458 uint32_t req_lun_id; 459 uint8_t serial_num[CTL_SN_LEN]; 460 uint8_t device_id[CTL_DEVID_LEN]; 461}; 462 463/* 464 * LUN removal parameters: 465 * 466 * lun_id: The number of the LUN to delete. This must be set. 467 * The LUN must be backed by the given backend. 468 */ 469struct ctl_lun_rm_params { 470 uint32_t lun_id; 471}; 472 473/* 474 * Union of request type data. Fill in the appropriate union member for 475 * the request type. 476 */ 477union ctl_lunreq_data { 478 struct ctl_lun_create_params create; 479 struct ctl_lun_rm_params rm; 480}; 481 482/* 483 * LUN request interface: 484 * 485 * backend: This is required, and is NUL-terminated a string 486 * that is the name of the backend, like "ramdisk" or 487 * "block". 488 * 489 * reqtype: The type of request, CTL_LUNREQ_CREATE to create a 490 * LUN, CTL_LUNREQ_RM to delete a LUN. 491 * 492 * reqdata: Request type-specific information. See the 493 * description of individual the union members above 494 * for more information. 495 * 496 * num_be_args: This is the number of backend-specific arguments 497 * in the be_args array. 498 * 499 * be_args: This is an array of backend-specific arguments. 500 * See above for a description of the fields in this 501 * structure. 502 * 503 * status: Status of the LUN request. 504 * 505 * error_str: If the status is CTL_LUN_ERROR, this will 506 * contain a string describing the error. 507 * 508 * kern_be_args: For kernel use only. 509 */ 510struct ctl_lun_req { 511 char backend[CTL_BE_NAME_LEN]; 512 ctl_lunreq_type reqtype; 513 union ctl_lunreq_data reqdata; 514 int num_be_args; 515 struct ctl_be_arg *be_args; 516 ctl_lun_status status; 517 char error_str[CTL_ERROR_STR_LEN]; 518 struct ctl_be_arg *kern_be_args; 519}; 520 521/* 522 * LUN list status: 523 * 524 * NONE: No status. 525 * 526 * OK: Request completed successfully. 527 * 528 * NEED_MORE_SPACE: The allocated length of the entries field is too 529 * small for the available data. 530 * 531 * ERROR: An error occured, look at the error string for a 532 * description of the error. 533 */ 534typedef enum { 535 CTL_LUN_LIST_NONE, 536 CTL_LUN_LIST_OK, 537 CTL_LUN_LIST_NEED_MORE_SPACE, 538 CTL_LUN_LIST_ERROR 539} ctl_lun_list_status; 540 541/* 542 * LUN list interface 543 * 544 * backend_name: This is a NUL-terminated string. If the string 545 * length is 0, then all LUNs on all backends will 546 * be enumerated. Otherwise this is the name of the 547 * backend to be enumerated, like "ramdisk" or "block". 548 * 549 * alloc_len: The length of the data buffer allocated for entries. 550 * In order to properly size the buffer, make one call 551 * with alloc_len set to 0, and then use the returned 552 * dropped_len as the buffer length to allocate and 553 * pass in on a subsequent call. 554 * 555 * lun_xml: XML-formatted information on the requested LUNs. 556 * 557 * fill_len: The amount of data filled in the storage for entries. 558 * 559 * status: The status of the request. See above for the 560 * description of the values of this field. 561 * 562 * error_str: If the status indicates an error, this string will 563 * be filled in to describe the error. 564 */ 565struct ctl_lun_list { 566 char backend[CTL_BE_NAME_LEN]; /* passed to kernel*/ 567 uint32_t alloc_len; /* passed to kernel */ 568 char *lun_xml; /* filled in kernel */ 569 uint32_t fill_len; /* passed to userland */ 570 ctl_lun_list_status status; /* passed to userland */ 571 char error_str[CTL_ERROR_STR_LEN]; 572 /* passed to userland */ 573}; 574 575#define CTL_IO _IOWR(CTL_MINOR, 0x00, union ctl_io) 576#define CTL_ENABLE_PORT _IOW(CTL_MINOR, 0x04, struct ctl_port_entry) 577#define CTL_DISABLE_PORT _IOW(CTL_MINOR, 0x05, struct ctl_port_entry) 578#define CTL_DUMP_OOA _IO(CTL_MINOR, 0x06) 579#define CTL_CHECK_OOA _IOWR(CTL_MINOR, 0x07, struct ctl_ooa_info) 580#define CTL_HARD_STOP _IOR(CTL_MINOR, 0x08, \ 581 struct ctl_hard_startstop_info) 582#define CTL_HARD_START _IOR(CTL_MINOR, 0x09, \ 583 struct ctl_hard_startstop_info) 584#define CTL_DELAY_IO _IOWR(CTL_MINOR, 0x10, struct ctl_io_delay_info) 585#define CTL_REALSYNC_GET _IOR(CTL_MINOR, 0x11, int) 586#define CTL_REALSYNC_SET _IOW(CTL_MINOR, 0x12, int) 587#define CTL_SETSYNC _IOWR(CTL_MINOR, 0x13, struct ctl_sync_info) 588#define CTL_GETSYNC _IOWR(CTL_MINOR, 0x14, struct ctl_sync_info) 589#define CTL_GETSTATS _IOWR(CTL_MINOR, 0x15, struct ctl_stats) 590#define CTL_ERROR_INJECT _IOWR(CTL_MINOR, 0x16, struct ctl_error_desc) 591#define CTL_BBRREAD _IOWR(CTL_MINOR, 0x17, struct ctl_bbrread_info) 592#define CTL_GET_OOA _IOWR(CTL_MINOR, 0x18, struct ctl_ooa) 593#define CTL_DUMP_STRUCTS _IO(CTL_MINOR, 0x19) 594#define CTL_GET_PORT_LIST _IOWR(CTL_MINOR, 0x20, struct ctl_port_list) 595#define CTL_LUN_REQ _IOWR(CTL_MINOR, 0x21, struct ctl_lun_req) 596#define CTL_LUN_LIST _IOWR(CTL_MINOR, 0x22, struct ctl_lun_list) 597#define CTL_ERROR_INJECT_DELETE _IOW(CTL_MINOR, 0x23, struct ctl_error_desc) 598#define CTL_SET_PORT_WWNS _IOW(CTL_MINOR, 0x24, struct ctl_port_entry) 599 600#endif /* _CTL_IOCTL_H_ */ 601 602/* 603 * vim: ts=8 604 */ 605