FreeBSD kernel CAM code
ses_iterator Struct Reference

Structure encapsulating all data necessary to traverse the elements of a SES configuration. More...

Collaboration diagram for ses_iterator:

Data Fields

enc_softc_tenc
 Backlink to the overal software configuration structure. More...
 
enc_cache_tcache
 
int type_index
 Index of the type of the current element within the ses_cache's ses_types array. More...
 
int type_element_index
 The position (0 based) of this element relative to all other elements of this type. More...
 
int individual_element_index
 The position (0 based) of this element relative to all other individual status elements in the configuration. More...
 
int global_element_index
 The position (0 based) of this element relative to all elements in the configration. More...
 
int saved_individual_element_index
 The last valid individual element index of this iterator. More...
 

Detailed Description

Structure encapsulating all data necessary to traverse the elements of a SES configuration.

The ses_iterator object simplifies the task of iterating through all elements detected via the SES configuration page by tracking the numerous element indexes that, instead of memoizing in the softc, we calculate on the fly during the traversal of the element objects. The various indexes are necessary due to the varying needs of matching objects in the different SES pages. Some pages (e.g. Status/Control) contain all elements, while others (e.g. Additional Element Status) only contain individual elements (no overal status elements) of particular types.

To use an iterator, initialize it with ses_iter_init(), and then use ses_iter_next() to traverse the elements (including the first) in the configuration. Once an iterator is initiailized with ses_iter_init(), you may also seek to any particular element by either it's global or individual element index via the ses_iter_seek_to() function. You may also return an iterator to the position just before the first element (i.e. the same state as after an ses_iter_init()), with ses_iter_reset().

Definition at line 181 of file scsi_enc_ses.c.

Field Documentation

◆ cache

enc_cache_t* ses_iterator::cache

Definition at line 190 of file scsi_enc_ses.c.

Referenced by ses_iter_init(), ses_iter_next(), and ses_iter_seek_to().

◆ enc

enc_softc_t* ses_iterator::enc

Backlink to the overal software configuration structure.

This is included for convenience so the iteration functions need only take a single, struct ses_iterator *, argument.

Definition at line 188 of file scsi_enc_ses.c.

Referenced by ses_iter_init(), ses_publish_cache(), and ses_publish_physpaths().

◆ global_element_index

int ses_iterator::global_element_index

The position (0 based) of this element relative to all elements in the configration.

This index is appropriate for indexing into enc->ses_elm_map.

Definition at line 225 of file scsi_enc_ses.c.

Referenced by ses_encode(), ses_iter_next(), ses_iter_reset(), ses_iter_seek_to(), ses_process_config(), ses_process_elm_addlstatus(), ses_process_elm_descs(), and ses_process_status().

◆ individual_element_index

int ses_iterator::individual_element_index

The position (0 based) of this element relative to all other individual status elements in the configuration.

This index ranges from 0 through the number of individual elements in the configuration. When the iterator returns an overall status element, individual_element_index is set to ITERATOR_INDEX_INVALID, to indicate that it does not apply to the current element.

Definition at line 217 of file scsi_enc_ses.c.

Referenced by ses_iter_next(), ses_iter_reset(), ses_iter_seek_to(), and ses_process_elm_addlstatus().

◆ saved_individual_element_index

int ses_iterator::saved_individual_element_index

The last valid individual element index of this iterator.

When an iterator traverses an overal status element, the individual element index is reset to ITERATOR_INDEX_INVALID to prevent unintential use of the individual_element_index field. The saved_individual_element_index allows the iterator to restore it's position in the individual elements upon reaching the next individual element.

Definition at line 238 of file scsi_enc_ses.c.

Referenced by ses_iter_next(), and ses_iter_reset().

◆ type_element_index

int ses_iterator::type_element_index

The position (0 based) of this element relative to all other elements of this type.

This index resets to zero every time the iterator transitions to elements of a new type in the configuration.

Definition at line 205 of file scsi_enc_ses.c.

Referenced by ses_iter_next(), ses_iter_reset(), ses_process_config(), ses_process_elm_addlstatus(), ses_process_elm_descs(), ses_process_status(), and ses_set_physpath().

◆ type_index

int ses_iterator::type_index

Index of the type of the current element within the ses_cache's ses_types array.

Definition at line 196 of file scsi_enc_ses.c.

Referenced by ses_encode(), ses_iter_next(), ses_iter_reset(), ses_process_config(), ses_process_elm_addlstatus(), ses_process_elm_descs(), ses_process_status(), and ses_set_physpath().


The documentation for this struct was generated from the following file: