Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
osd_initiator.c File Reference
#include <linux/slab.h>
#include <linux/module.h>
#include <scsi/osd_initiator.h>
#include <scsi/osd_sec.h>
#include <scsi/osd_attributes.h>
#include <scsi/osd_sense.h>
#include <scsi/scsi_device.h>
#include "osd_debug.h"

Go to the source code of this file.

Macros

#define __unused   __attribute__((unused))
 
#define ATTR_DEF_RI(id, len)   ATTR_DEF(OSD_APAGE_ROOT_INFORMATION, id, len)
 
#define OSD_SENSE_PRINT1(fmt, a...)
 
#define OSD_SENSE_PRINT2(fmt, a...)   OSD_SENSE_PRINT1(" " fmt, ##a)
 

Enumerations

enum  { OSD_REQ_RETRIES = 1 }
 
enum  { OSD_SEC_CAP_V1_ALL_CAPS }
 
enum  { OSD_SEC_CAP_V2_ALL_CAPS }
 

Functions

 MODULE_AUTHOR ("Boaz Harrosh <[email protected]>")
 
 MODULE_DESCRIPTION ("open-osd initiator library libosd.ko")
 
 MODULE_LICENSE ("GPL")
 
int osd_auto_detect_ver (struct osd_dev *od, void *caps, struct osd_dev_info *odi)
 
 EXPORT_SYMBOL (osd_auto_detect_ver)
 
void osd_dev_init (struct osd_dev *osdd, struct scsi_device *scsi_device)
 
 EXPORT_SYMBOL (osd_dev_init)
 
void osd_dev_fini (struct osd_dev *osdd)
 
 EXPORT_SYMBOL (osd_dev_fini)
 
struct osd_requestosd_start_request (struct osd_dev *dev, gfp_t gfp)
 
 EXPORT_SYMBOL (osd_start_request)
 
void osd_end_request (struct osd_request *or)
 
 EXPORT_SYMBOL (osd_end_request)
 
int osd_execute_request (struct osd_request *or)
 
 EXPORT_SYMBOL (osd_execute_request)
 
int osd_execute_request_async (struct osd_request *or, osd_req_done_fn *done, void *private)
 
 EXPORT_SYMBOL (osd_execute_request_async)
 
void osd_req_format (struct osd_request *or, u64 tot_capacity)
 
 EXPORT_SYMBOL (osd_req_format)
 
int osd_req_list_dev_partitions (struct osd_request *or, osd_id initial_id, struct osd_obj_id_list *list, unsigned nelem)
 
 EXPORT_SYMBOL (osd_req_list_dev_partitions)
 
void osd_req_flush_obsd (struct osd_request *or, enum osd_options_flush_scope_values op)
 
 EXPORT_SYMBOL (osd_req_flush_obsd)
 
void osd_req_create_partition (struct osd_request *or, osd_id partition)
 
 EXPORT_SYMBOL (osd_req_create_partition)
 
void osd_req_remove_partition (struct osd_request *or, osd_id partition)
 
 EXPORT_SYMBOL (osd_req_remove_partition)
 
int osd_req_list_partition_collections (struct osd_request *or, osd_id partition, osd_id initial_id, struct osd_obj_id_list *list, unsigned nelem)
 
 EXPORT_SYMBOL (osd_req_list_partition_collections)
 
int osd_req_list_partition_objects (struct osd_request *or, osd_id partition, osd_id initial_id, struct osd_obj_id_list *list, unsigned nelem)
 
 EXPORT_SYMBOL (osd_req_list_partition_objects)
 
void osd_req_flush_partition (struct osd_request *or, osd_id partition, enum osd_options_flush_scope_values op)
 
 EXPORT_SYMBOL (osd_req_flush_partition)
 
int osd_req_list_collection_objects (struct osd_request *or, const struct osd_obj_id *obj, osd_id initial_id, struct osd_obj_id_list *list, unsigned nelem)
 
 EXPORT_SYMBOL (osd_req_list_collection_objects)
 
void osd_req_flush_collection (struct osd_request *or, const struct osd_obj_id *obj, enum osd_options_flush_scope_values op)
 
 EXPORT_SYMBOL (osd_req_flush_collection)
 
void osd_req_create_object (struct osd_request *or, struct osd_obj_id *obj)
 
 EXPORT_SYMBOL (osd_req_create_object)
 
void osd_req_remove_object (struct osd_request *or, struct osd_obj_id *obj)
 
 EXPORT_SYMBOL (osd_req_remove_object)
 
void osd_req_write (struct osd_request *or, const struct osd_obj_id *obj, u64 offset, struct bio *bio, u64 len)
 
 EXPORT_SYMBOL (osd_req_write)
 
int osd_req_write_kern (struct osd_request *or, const struct osd_obj_id *obj, u64 offset, void *buff, u64 len)
 
 EXPORT_SYMBOL (osd_req_write_kern)
 
void osd_req_flush_object (struct osd_request *or, const struct osd_obj_id *obj, enum osd_options_flush_scope_values op, u64 offset, u64 len)
 
 EXPORT_SYMBOL (osd_req_flush_object)
 
void osd_req_read (struct osd_request *or, const struct osd_obj_id *obj, u64 offset, struct bio *bio, u64 len)
 
 EXPORT_SYMBOL (osd_req_read)
 
int osd_req_read_kern (struct osd_request *or, const struct osd_obj_id *obj, u64 offset, void *buff, u64 len)
 
 EXPORT_SYMBOL (osd_req_read_kern)
 
int osd_req_write_sg (struct osd_request *or, const struct osd_obj_id *obj, struct bio *bio, const struct osd_sg_entry *sglist, unsigned numentries)
 
 EXPORT_SYMBOL (osd_req_write_sg)
 
int osd_req_read_sg (struct osd_request *or, const struct osd_obj_id *obj, struct bio *bio, const struct osd_sg_entry *sglist, unsigned numentries)
 
 EXPORT_SYMBOL (osd_req_read_sg)
 
int osd_req_write_sg_kern (struct osd_request *or, const struct osd_obj_id *obj, void **buff, const struct osd_sg_entry *sglist, unsigned numentries)
 
 EXPORT_SYMBOL (osd_req_write_sg_kern)
 
int osd_req_read_sg_kern (struct osd_request *or, const struct osd_obj_id *obj, void **buff, const struct osd_sg_entry *sglist, unsigned numentries)
 
 EXPORT_SYMBOL (osd_req_read_sg_kern)
 
void osd_req_get_attributes (struct osd_request *or, const struct osd_obj_id *obj)
 
 EXPORT_SYMBOL (osd_req_get_attributes)
 
void osd_req_set_attributes (struct osd_request *or, const struct osd_obj_id *obj)
 
 EXPORT_SYMBOL (osd_req_set_attributes)
 
int osd_req_add_set_attr_list (struct osd_request *or, const struct osd_attr *oa, unsigned nelem)
 
 EXPORT_SYMBOL (osd_req_add_set_attr_list)
 
int osd_req_add_get_attr_list (struct osd_request *or, const struct osd_attr *oa, unsigned nelem)
 
 EXPORT_SYMBOL (osd_req_add_get_attr_list)
 
int osd_req_decode_get_attr_list (struct osd_request *or, struct osd_attr *oa, int *nelem, void **iterator)
 
 EXPORT_SYMBOL (osd_req_decode_get_attr_list)
 
int osd_req_add_get_attr_page (struct osd_request *or, u32 page_id, void *attar_page, unsigned max_page_len, const struct osd_attr *set_one_attr)
 
 EXPORT_SYMBOL (osd_req_add_get_attr_page)
 
int osd_finalize_request (struct osd_request *or, u8 options, const void *cap, const u8 *cap_key)
 
 EXPORT_SYMBOL (osd_finalize_request)
 
int osd_req_decode_sense_full (struct osd_request *or, struct osd_sense_info *osi, bool silent, struct osd_obj_id *bad_obj_list __unused, int max_obj __unused, struct osd_attr *bad_attr_list, int max_attr)
 
 EXPORT_SYMBOL (osd_req_decode_sense_full)
 
void osd_sec_init_nosec_doall_caps (void *caps, const struct osd_obj_id *obj, bool is_collection, const bool is_v1)
 
 EXPORT_SYMBOL (osd_sec_init_nosec_doall_caps)
 
void osd_set_caps (struct osd_cdb *cdb, const void *caps)
 
bool osd_is_sec_alldata (struct osd_security_parameters *sec_parms __unused)
 
void osd_sec_sign_cdb (struct osd_cdb *ocdb __unused, const u8 *cap_key __unused)
 
void osd_sec_sign_data (void *data_integ __unused, struct bio *bio __unused, const u8 *cap_key __unused)
 
osd_cdb_offset __osd_encode_offset (u64 offset, unsigned *padding, int min_shift, int max_shift)
 

Variables

u8 sg_out_pad_buffer [1<< OSDv1_OFFSET_MIN_SHIFT]
 
u8 sg_in_pad_buffer [1<< OSDv1_OFFSET_MIN_SHIFT]
 

Macro Definition Documentation

#define __unused   __attribute__((unused))

Definition at line 55 of file osd_initiator.c.

#define ATTR_DEF_RI (   id,
  len 
)    ATTR_DEF(OSD_APAGE_ROOT_INFORMATION, id, len)

Definition at line 77 of file osd_initiator.c.

#define OSD_SENSE_PRINT1 (   fmt,
  a... 
)
Value:
do { \
if (__cur_sense_need_output) \
OSD_ERR(fmt, ##a); \
} while (0)

Definition at line 1710 of file osd_initiator.c.

#define OSD_SENSE_PRINT2 (   fmt,
  a... 
)    OSD_SENSE_PRINT1(" " fmt, ##a)

Definition at line 1716 of file osd_initiator.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
OSD_REQ_RETRIES 

Definition at line 58 of file osd_initiator.c.

anonymous enum
Enumerator:
OSD_SEC_CAP_V1_ALL_CAPS 

Definition at line 1951 of file osd_initiator.c.

anonymous enum
Enumerator:
OSD_SEC_CAP_V2_ALL_CAPS 

Definition at line 1958 of file osd_initiator.c.

Function Documentation

osd_cdb_offset __osd_encode_offset ( u64  offset,
unsigned *  padding,
int  min_shift,
int  max_shift 
)

Definition at line 2034 of file osd_initiator.c.

EXPORT_SYMBOL ( osd_auto_detect_ver  )
EXPORT_SYMBOL ( osd_dev_init  )
EXPORT_SYMBOL ( osd_dev_fini  )
EXPORT_SYMBOL ( osd_start_request  )
EXPORT_SYMBOL ( osd_end_request  )
EXPORT_SYMBOL ( osd_execute_request  )
EXPORT_SYMBOL ( osd_execute_request_async  )
EXPORT_SYMBOL ( osd_req_format  )
EXPORT_SYMBOL ( osd_req_list_dev_partitions  )
EXPORT_SYMBOL ( osd_req_flush_obsd  )
EXPORT_SYMBOL ( osd_req_create_partition  )
EXPORT_SYMBOL ( osd_req_remove_partition  )
EXPORT_SYMBOL ( osd_req_list_partition_objects  )
EXPORT_SYMBOL ( osd_req_flush_partition  )
EXPORT_SYMBOL ( osd_req_list_collection_objects  )
EXPORT_SYMBOL ( osd_req_flush_collection  )
EXPORT_SYMBOL ( osd_req_create_object  )
EXPORT_SYMBOL ( osd_req_remove_object  )
EXPORT_SYMBOL ( osd_req_write  )
EXPORT_SYMBOL ( osd_req_write_kern  )
EXPORT_SYMBOL ( osd_req_flush_object  )
EXPORT_SYMBOL ( osd_req_read  )
EXPORT_SYMBOL ( osd_req_read_kern  )
EXPORT_SYMBOL ( osd_req_write_sg  )
EXPORT_SYMBOL ( osd_req_read_sg  )
EXPORT_SYMBOL ( osd_req_write_sg_kern  )
EXPORT_SYMBOL ( osd_req_read_sg_kern  )
EXPORT_SYMBOL ( osd_req_get_attributes  )
EXPORT_SYMBOL ( osd_req_set_attributes  )
EXPORT_SYMBOL ( osd_req_add_set_attr_list  )
EXPORT_SYMBOL ( osd_req_add_get_attr_list  )
EXPORT_SYMBOL ( osd_req_decode_get_attr_list  )
EXPORT_SYMBOL ( osd_req_add_get_attr_page  )
EXPORT_SYMBOL ( osd_finalize_request  )
EXPORT_SYMBOL ( osd_req_decode_sense_full  )
EXPORT_SYMBOL ( osd_sec_init_nosec_doall_caps  )
MODULE_AUTHOR ( "Boaz Harrosh <[email protected]>"  )
MODULE_DESCRIPTION ( "open-osd initiator library libosd.ko"  )
MODULE_LICENSE ( "GPL"  )
int osd_auto_detect_ver ( struct osd_dev od,
void caps,
struct osd_dev_info odi 
)

osd_auto_detect_ver - Detect the OSD version, return Unique Identification

: OSD target lun handle : Capabilities authorizing OSD root read attributes access : Retrieved information uniquely identifying the osd target lun Note: odi->osdname must be kfreed by caller.

Auto detects the OSD version of the OSD target and sets the accordingly. Meanwhile also returns the "system id" and "osd name" root attributes which uniquely identify the OSD target. This member is usually called by the ULD. ULD users should call osduld_device_info(). This rutine allocates osd requests and memory at GFP_KERNEL level and might sleep.

Definition at line 197 of file osd_initiator.c.

void osd_dev_fini ( struct osd_dev osdd)

Definition at line 388 of file osd_initiator.c.

void osd_dev_init ( struct osd_dev osdd,
struct scsi_device scsi_device 
)

Definition at line 376 of file osd_initiator.c.

void osd_end_request ( struct osd_request or)

osd_end_request - return osd_request to free store

: osd_request to free

Deallocate all osd_request resources (struct req's, BIOs, buffers, etc.)

Definition at line 452 of file osd_initiator.c.

int osd_execute_request ( struct osd_request or)

osd_execute_request - Execute the request synchronously through block-layer

: osd_request to Executed

Calls blk_execute_rq to q the command and waits for completion.

Definition at line 486 of file osd_initiator.c.

int osd_execute_request_async ( struct osd_request or,
osd_req_done_fn done,
void private 
)

osd_execute_request_async - Execute the request without waitting.

: - osd_request to Executed : (Optional) - Called at end of execution : - Will be passed to function

Calls blk_execute_rq_nowait to queue the command. When execution is done optionally calls with as parameter. ->async_error will have the return code

Definition at line 516 of file osd_initiator.c.

int osd_finalize_request ( struct osd_request or,
u8  options,
const void cap,
const u8 cap_key 
)

osd_finalize_request - Sign request and prepare request for execution

: osd_request to prepare : combination of osd_req_options bit flags or 0. : A Pointer to an OSD_CAP_LEN bytes buffer that is received from The security manager as capabilities for this cdb. : The cryptographic key used to sign the cdb/data. Can be null if NOSEC is used.

The actual request and bios are only allocated here, so are the get_attr buffers that will receive the returned attributes. Copy's to cdb. Sign the cdb/data with .

Definition at line 1620 of file osd_initiator.c.

bool osd_is_sec_alldata ( struct osd_security_parameters *sec_parms  __unused)

Definition at line 2013 of file osd_initiator.c.

int osd_req_add_get_attr_list ( struct osd_request or,
const struct osd_attr oa,
unsigned  nelem 
)

Definition at line 1225 of file osd_initiator.c.

int osd_req_add_get_attr_page ( struct osd_request or,
u32  page_id,
void attar_page,
unsigned  max_page_len,
const struct osd_attr set_one_attr 
)

Definition at line 1419 of file osd_initiator.c.

int osd_req_add_set_attr_list ( struct osd_request or,
const struct osd_attr oa,
unsigned  nelem 
)

Definition at line 1120 of file osd_initiator.c.

void osd_req_create_object ( struct osd_request or,
struct osd_obj_id obj 
)

Definition at line 803 of file osd_initiator.c.

void osd_req_create_partition ( struct osd_request or,
osd_id  partition 
)

Definition at line 692 of file osd_initiator.c.

int osd_req_decode_get_attr_list ( struct osd_request or,
struct osd_attr oa,
int nelem,
void **  iterator 
)

Definition at line 1348 of file osd_initiator.c.

int osd_req_decode_sense_full ( struct osd_request or,
struct osd_sense_info osi,
bool  silent,
struct osd_obj_id *bad_obj_list  __unused,
int max_obj  __unused,
struct osd_attr bad_attr_list,
int  max_attr 
)

Definition at line 1718 of file osd_initiator.c.

void osd_req_flush_collection ( struct osd_request or,
const struct osd_obj_id obj,
enum osd_options_flush_scope_values  op 
)

Definition at line 789 of file osd_initiator.c.

void osd_req_flush_object ( struct osd_request or,
const struct osd_obj_id obj,
enum osd_options_flush_scope_values  op,
u64  offset,
u64  len 
)

Definition at line 856 of file osd_initiator.c.

void osd_req_flush_obsd ( struct osd_request or,
enum osd_options_flush_scope_values  op 
)

Definition at line 666 of file osd_initiator.c.

void osd_req_flush_partition ( struct osd_request or,
osd_id  partition,
enum osd_options_flush_scope_values  op 
)

Definition at line 762 of file osd_initiator.c.

void osd_req_format ( struct osd_request or,
u64  tot_capacity 
)

Definition at line 644 of file osd_initiator.c.

void osd_req_get_attributes ( struct osd_request or,
const struct osd_obj_id obj 
)

Definition at line 1102 of file osd_initiator.c.

int osd_req_list_collection_objects ( struct osd_request or,
const struct osd_obj_id obj,
osd_id  initial_id,
struct osd_obj_id_list list,
unsigned  nelem 
)

Definition at line 778 of file osd_initiator.c.

int osd_req_list_dev_partitions ( struct osd_request or,
osd_id  initial_id,
struct osd_obj_id_list list,
unsigned  nelem 
)

Definition at line 651 of file osd_initiator.c.

int osd_req_list_partition_collections ( struct osd_request or,
osd_id  partition,
osd_id  initial_id,
struct osd_obj_id_list list,
unsigned  nelem 
)

Definition at line 734 of file osd_initiator.c.

int osd_req_list_partition_objects ( struct osd_request or,
osd_id  partition,
osd_id  initial_id,
struct osd_obj_id_list list,
unsigned  nelem 
)

Definition at line 748 of file osd_initiator.c.

void osd_req_read ( struct osd_request or,
const struct osd_obj_id obj,
u64  offset,
struct bio *  bio,
u64  len 
)

Definition at line 871 of file osd_initiator.c.

int osd_req_read_kern ( struct osd_request or,
const struct osd_obj_id obj,
u64  offset,
void buff,
u64  len 
)

Definition at line 883 of file osd_initiator.c.

int osd_req_read_sg ( struct osd_request or,
const struct osd_obj_id obj,
struct bio *  bio,
const struct osd_sg_entry sglist,
unsigned  numentries 
)

Definition at line 1004 of file osd_initiator.c.

int osd_req_read_sg_kern ( struct osd_request or,
const struct osd_obj_id obj,
void **  buff,
const struct osd_sg_entry sglist,
unsigned  numentries 
)

Definition at line 1086 of file osd_initiator.c.

void osd_req_remove_object ( struct osd_request or,
struct osd_obj_id obj 
)

Definition at line 809 of file osd_initiator.c.

void osd_req_remove_partition ( struct osd_request or,
osd_id  partition 
)

Definition at line 698 of file osd_initiator.c.

void osd_req_set_attributes ( struct osd_request or,
const struct osd_obj_id obj 
)

Definition at line 1109 of file osd_initiator.c.

void osd_req_write ( struct osd_request or,
const struct osd_obj_id obj,
u64  offset,
struct bio *  bio,
u64  len 
)

Definition at line 820 of file osd_initiator.c.

int osd_req_write_kern ( struct osd_request or,
const struct osd_obj_id obj,
u64  offset,
void buff,
u64  len 
)

Definition at line 832 of file osd_initiator.c.

int osd_req_write_sg ( struct osd_request or,
const struct osd_obj_id obj,
struct bio *  bio,
const struct osd_sg_entry sglist,
unsigned  numentries 
)

Definition at line 986 of file osd_initiator.c.

int osd_req_write_sg_kern ( struct osd_request or,
const struct osd_obj_id obj,
void **  buff,
const struct osd_sg_entry sglist,
unsigned  numentries 
)

Definition at line 1071 of file osd_initiator.c.

void osd_sec_init_nosec_doall_caps ( void caps,
const struct osd_obj_id obj,
bool  is_collection,
const bool  is_v1 
)

Definition at line 1962 of file osd_initiator.c.

void osd_sec_sign_cdb ( struct osd_cdb *ocdb  __unused,
const u8 *cap_key  __unused 
)

Definition at line 2018 of file osd_initiator.c.

void osd_sec_sign_data ( void *data_integ  __unused,
struct bio *bio  __unused,
const u8 *cap_key  __unused 
)

Definition at line 2022 of file osd_initiator.c.

void osd_set_caps ( struct osd_cdb cdb,
const void caps 
)

Definition at line 2006 of file osd_initiator.c.

struct osd_request* osd_start_request ( struct osd_dev od,
gfp_t  gfp 
)
read

osd_start_request - Allocate and initialize an osd_request

: OSD device that holds the scsi-device and default values that the request is associated with. : The allocation flags to use for request allocation, and all subsequent allocations. This will be stored at osd_request->alloc_flags, can be changed by user later

Allocate osd_request and initialize all members to the default/initial state.

Definition at line 410 of file osd_initiator.c.

Variable Documentation

u8 sg_in_pad_buffer[1<< OSDv1_OFFSET_MIN_SHIFT]

Definition at line 530 of file osd_initiator.c.

u8 sg_out_pad_buffer[1<< OSDv1_OFFSET_MIN_SHIFT]

Definition at line 529 of file osd_initiator.c.