X hits on this document

PDF document

February 10, 2006 - page 28 / 238

659 views

0 shares

0 downloads

0 comments

28 / 238

16

CHAPTER 2. OPENIPMI

ipmi_entity_id tmp_id;

switch (op) { case IPMI_ADDED: if (entity_i_care_about(entity)) m y _ e n t i t y _ i d = i p m i _ e n t i t y _ c o n v e r t _ t o _ i d ( e n t i t y break; ) ;

case IPMI_DELETED: tmp_id = ipmi_entity_convert_to_id(entity); i f ( i p m i _ c m p _ e n t i t y _ i d ( m y _ e n t i t y _ i d , t m p _ i d ) = = 0 ) i p m i _ e n t i t y _ i d _ s e t _ i n v a l i d ( & m y _ e n t i t y _ i d break; ) ;

default: break;

}

}

In this example, the entity is in-use in this call, because you have received a pointer to the entity in the callback.

However, suppose you want to use the entity id later because the user asks about the entity to see if it is present. You might have a piece of code that looks like:

static void m y _ e n t i t y _ i d _ c b ( i p m i _ e n t i t y _ t * e n t i t y , v o i d * c b _ d a t a { )

m y _ d a t a _ t * d a t a = c b _ d a t a ;

d data->exists = 1; a t a - > p r e s e n t = i p m i _ e n t i t y _ i s _ p r e s e n t ( e n t i t y ) ;

}

void c h e c k _ i f _ m y _ e n t i t y _ p r e s e n t ( m y _ d a t a _ t * d a t a { )

int rv;

data->exists = 0; data->present = 0; r v = i p m i _ e n t i t y _ p o i n t e r _ c b ( m y _ e n t i t y _ i d , m y _ e n t i t y _ i d _ c b , d a t a ) if (rv) ;

printf("The entity could not be found\n");

}

Most of the data about the various OpenIPMI objects is static, so you can pre-collect the information about the objects in the callback where there existance is reported. Some local information, such as entity

Document info
Document views659
Page views659
Page last viewedFri Dec 09 08:41:32 UTC 2016
Pages238
Paragraphs8090
Words85809

Comments