|
libfru 2.1
FRU Manupulation Library
|
FRU generator utility header file. More...
#include <errno.h>#include <stdio.h>#include <unistd.h>#include "fru.h"

Go to the source code of this file.
Data Structures | |
| struct | frugen_fruinfo_s |
| struct | frugen_config_s |
| struct | fieldopt_t |
Macros | |
| #define | fatal(fmt, args...) |
| #define | warn(fmt, args...) |
| #define | debug(level, fmt, args...) |
| #define | FRU_FIELD_CUSTOM (-1) |
| #define | DATEBUF_SZ 20 |
| Date string buffer length (must fit "DD/MM/YYYY HH:MM:SS") | |
Enumerations | |
| enum | frugen_format_t { FRUGEN_FMT_UNSET , FRUGEN_FMT_FIRST , FRUGEN_FMT_JSON = FRUGEN_FMT_FIRST , FRUGEN_FMT_BINARY , FRUGEN_FMT_TEXTOUT , FRUGEN_FMT_LAST = FRUGEN_FMT_TEXTOUT } |
Functions | |
| bool | datestr_to_tv (const char *datestr, struct timeval *tv) |
| void | tv_to_datestr (char *datestr, const struct timeval *tv) |
| fieldopt_t | arg_to_fieldopt (char *arg) |
| fru_mr_mgmt_type_t | fru_mr_mgmt_type_by_name (const char *name) |
| char * | fru_mr_mgmt_name_by_type (fru_mr_mgmt_type_t type) |
Variables | |
| volatile int | debug_level |
FRU generator utility header file.
Copyright (C) 2016-2023 Alexander Amelkin alexa.nosp@m.nder.nosp@m.@amel.nosp@m.kin..nosp@m.msk.r.nosp@m.u SPDX-License-Identifier: GPL-2.0-or-later OR Apache-2.0
| #define DATEBUF_SZ 20 |
Date string buffer length (must fit "DD/MM/YYYY HH:MM:SS")
| #define debug | ( | level, | |
| fmt, | |||
| args... | |||
| ) |
| #define fatal | ( | fmt, | |
| args... | |||
| ) |
| #define FRU_FIELD_CUSTOM (-1) |
| #define warn | ( | fmt, | |
| args... | |||
| ) |
| enum frugen_format_t |
| fieldopt_t arg_to_fieldopt | ( | char * | arg | ) |
Split a --set command line option argument string into fields.
The argument format is expected to be:
[<encoding>:]<area>.<field>=
Works for string fields only (i.e. not chassis.type or board.date)
Examples: 6bitascii:product.pn=ABCDEF123 // Force 6-bit ASCII if possible text:procuct.name=SOMEPRODUCT // Force plain text, prevent 6-bit board.serial=Whatever // Autodetect encoding product.custom=Sometext // Autodetect, request addition product.custom.1=Sometext // Autodetect, request replacement of field 1
Returns field_opt_t structure. Terminates the program on parsing failure.
WARNING: Modifies the input string.
References fieldopt_t::area, fieldopt_t::custom_index, debug, fatal, fieldopt_t::field, fru_enc_name_by_type(), fru_enc_type_by_name(), FRU_FIELD_CUSTOM, FRU_FIELD_NOT_PRESENT, fieldopt_t::index, fieldopt_t::type, and fieldopt_t::value.
Referenced by main().


| bool datestr_to_tv | ( | const char * | datestr, |
| struct timeval * | tv | ||
| ) |
Convert local date/time string to UTC time in seconds for FRU
Referenced by load_from_json_file(), and main().

| char * fru_mr_mgmt_name_by_type | ( | fru_mr_mgmt_type_t | type | ) |
Get Multirecord Area Record name by its type
Reverse of fru_mr_mgmt_type_by_name(). Returns an allocated copy of the name string, don't forget to free it.
References fatal, and MGMT_TYPE_ID.
| fru_mr_mgmt_type_t fru_mr_mgmt_type_by_name | ( | const char * | name | ) |
Find a Management Access record subtype by its short name
Takes a short name of the subtype from the following list and returs the ID as per Table 18-6.
Terminates the program on failure.
| [in] | name | The short name of the type: surl = System URL sname = System Name spingaddr = System ping address curl = Component URL cname = Component name cpingaddr = Component ping address uuid = System UUID |
| 1..7 | The subtype ID |
References fatal.
| void tv_to_datestr | ( | char * | datestr, |
| const struct timeval * | tv | ||
| ) |
Convert FRU time (in UTC) to a local date/time string
Referenced by save_to_json_file(), and save_to_text_file().

|
extern |
Referenced by main().