X hits on this document

PDF document

February 10, 2006 - page 124 / 238

651 views

0 shares

0 downloads

0 comments

124 / 238

112

CHAPTER 7. ENTITIES

The “len” function returns the length of the string. The “type” function returns the type of string per standard OpenIPMI string handling. See section A.1 on page 157 for more details. The last function returns the actual string. The integer that strlen points to must be set to the length of the str array. Upon return, the integer that strlen points to will contain the actual length. If there is not enough space for the whole string, the beginning of the string that fills the array will be copied in. All these functions return an error; the only current return is ENOSYS if the parameter is not present.

You may also fetch fru data (except for multi-records) through a single general function. It is a necessarily

complex interface. The function is:

int

index,

char

**name,

int

*num,

_ _ enum ipmi fru data_type_e *dtype,

int

*intval,

time_t

*time,

char

**data,

unsigned int

*data_len);

i n t i p m i _ f r u _ g e t ( i p m i _ f r u _ t

*fru,

The index is a contiguous range from zero that holds every FRU data item. So you can iterate through the indexes from 0 until it returns EINVAL to find all the names.

The name returns the string name for the index. Note that the indexes may change between release, so don’t rely on absolute numbers. The names will remain the same, so you can rely on those.

The number is a pointer to an integer with the number of the item to get within the field. Some fields (custom records) have multiple items in them. The first item will be zero, and the integer here will be updated to reference the next item. When the last item is reached, the field will be updated to -1. For fields that don’t have multiple items, this will not modify the value num points to, so you can use that to detect if indexes are used for the item.

The dtype field will be set to the data type. If it is an integer value, then intval will be set to whatever the value is. If it is a time value, then the time field will be filled in. If it is not, then a block of data will be allocated to hold the field and placed into data, the length of the data will be in data_len. You must free the data when you are done with ipmi_fru_data_free().

This function Returns EINVAL if the index is out of range, ENOSYS if the particular index is not supported (the name will still be set), or E2BIG if the num is too big (again, the name will be set).

Any of the return values may be passed NULL to ignore the data.

Writing FRU Data to a FRU OpenIPMI supports writing FRU data. This is a very dangerous oper- ations and should not be done by general code. There are no locks on the FRU data, so multiple writers can easily corrupt the data. But for doing FRU data updates, OpenIPMI can be used to fetch, modify, and write the FRU data assuming proper care is taken.

To write to the FRU, you must first fetch it by allocating it. If the FRU data currently in the fru is corrupt, you will get errors, but as long as the data length of the FRU is non-zero you can still modify it and write it back out.

After the FRU has been fetched, you may then modify the contents. Remember that each field of a FRU is in an area. To increase the size of a field or add a new field, it’s area must have enough space.

You may change the size of an area by increasing or decreasing its length. You may also add a new area, but it must be one of the supported types. You must, however, make sure there is enough empty space to

Document info
Document views651
Page views651
Page last viewedFri Dec 09 04:32:34 UTC 2016
Pages238
Paragraphs8090
Words85809

Comments