Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
spv.h File Reference

Go to the source code of this file.

Detailed Description

Sparse Vector API.

This is a trimmed down sparse vector implementation tuned to the problem of 24-bit FC_IDs. In this case, the 24-bit index value is broken down in three 8-bit values. These values are used to index up to three 256 element arrays. Arrays are allocated, only when needed.

The lookup can complete in constant time (3 indexed array references).

A typical use case would be that the fabric/directory FC_IDs would cause two rows to be allocated, and the fabric assigned remote nodes would cause two rows to be allocated, with the root row always allocated. This gives five rows of 256 x sizeof(void*), resulting in 10k.

Definition in file spv.h.

Data Structures

struct  sparse_vector_t
 Sparse vector structure. More...
 

Macros

#define SPV_ROWLEN   256
 
#define SPV_DIM   3
 

Functions

void spv_del (sparse_vector_t spv)
 Delete a sparse vector. More...
 
sparse_vector_t spv_new (ocs_os_handle_t os)
 Instantiate a new sparse vector object. More...
 
void spv_set (sparse_vector_t sv, uint32_t idx, void *value)
 Set the sparse vector cell value. More...
 
void * spv_get (sparse_vector_t sv, uint32_t idx)
 Return the sparse vector cell value. More...
 

Macro Details

#define SPV_DIM   3

Definition at line 53 of file spv.h.

#define SPV_ROWLEN   256

Definition at line 52 of file spv.h.