#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <string.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <dirent.h>
#include <unistd.h>
#include <ctype.h>
#include <ocs_ioctl.h>
#include "elxu_common.h"
#include "elxu_mgmt.h"
Go to the source code of this file.
| char* decode_entry_type |
( |
uint32_t |
entry_type | ) |
|
Return the name of a UFI entry type.
- Description
- Given an integer that represents an entry type in a UFI directory, this function returns a pointer to a constant string containing the name of that entry type.
- Parameters
-
| entry_type | The type of the entry to lookup. |
- Returns
- Returns a pointer to a constant string which is the name of the given entry type. If the entry type is not recognized the string "Unknown" will be returned.
Definition at line 474 of file elxu_common.c.
| void dump8 |
( |
const char * |
label, |
|
|
void * |
buffer, |
|
|
uint32_t |
bufferLength |
|
) |
| |
Print a buffer in hexadecimal and ASCII.
- Description
- This function prints out a buffer of data in both hexadecimal and ASCII.
- Parameters
-
| label | Label to be printed above the output. |
| buffer | Buffer of binary data to be printed. |
| bufferLength | Length of buffer. |
- Returns
- Returns nothing.
Definition at line 100 of file elxu_common.c.
| void elxu_display_device_list |
( |
char * |
hostname | ) |
|
Display the list of available devices.
- Description
- This function displays the list of available devices. It iterates over devices, starting with index 0. For each index it attempts to open the device. If the device is opened successfully then the information about that device is displayed. The loop terminates when any open fails.
- Parameters
-
| hostname | hostname in the case of the user space driver. |
- Returns
- Returns nothing.
Definition at line 152 of file elxu_common.c.
Displays HBA List information.
- Description
- Given an open device pointer, this function retrieves and displays information about the device. The actual handler is different depending on the driver.
- Parameters
-
| device_p | A pointer to an elxu_device_t. The device should already have been opened with elxu_open_device. |
- Returns
- Returns nothing.
Definition at line 188 of file elxu_common.c.
| char* format_wwn |
( |
uint64_t |
wwn_in | ) |
|
Format a 64-bit WWN for printing.
- Description
- Given a 64-bit WWN value, return a string in the format xx:xx:xx:xx:xx:xx:xx:xx
- Parameters
-
| wwn_in | uint64_t containing the WWN |
- Returns
- Returns a pointer to the formatted string
Definition at line 368 of file elxu_common.c.
| char* get_numa_node_map |
( |
uint32_t |
device_port | ) |
|
Return a string of cpu to numa node mapping .
- Description
- Given the port index for the ocs port, this function returns a pointer to a string containing the cpu to numa node mapping for that port
- Parameters
-
| device_port | The type of the port to list the cpu to numa node map. |
- Returns
- Returns a pointer to a string which lists the cpu to numa node map for the given port. If the port is not recognized no value is returned.
Definition at line 537 of file elxu_common.c.
| char* get_physical_numa_node |
( |
char * |
bus_addr | ) |
|
Return the physical Numa Node location for an OCS port .
- Description
- Given the port index for the ocs port, this function returns a pointer to a string containing the value of the physical numa node the OCS port is associated with
- Parameters
-
| bus_addr | The bus address for the current OCS port |
- Returns
- Returns a pointer to a string listing the Physical Numa Node port for the given port. If the bus address is not found a value of 'n/a' is listed.
Definition at line 658 of file elxu_common.c.
| char* hex_dump |
( |
uint8_t * |
value, |
|
|
int |
size |
|
) |
| |
Display a buffer in hexadecimal.
- Description
- The buffer pointed to by value is displayed in hexadecimal. The bytes are displayed as two digit hexadecimal values separated by spaces. The result is termintated with a NULL.
- Parameters
-
| value | A pointer to an array of bytes to be printed. |
| size | The size of the array. The maximum size that can be handled is 25 bytes. Values larger than 25 will result in only the first 25 bytes being printed. |
- Returns
- Returns a pointer to a static character string with the hexadecimal values.
Definition at line 401 of file elxu_common.c.
| int parse_wwn |
( |
char * |
wwn_in, |
|
|
uint64_t * |
wwn_out |
|
) |
| |
Parse a WWN from a string into a 64-bit value.
- Description
- Given a pointer to a string, parse the string into a 64-bit WWN value. The format of the string must be xx:xx:xx:xx:xx:xx:xx:xx
- Parameters
-
| wwn_in | Pointer to the string to be parsed. |
| wwn_out | Pointer to uint64_t in which to put the parsed result. |
- Returns
- Returns 0 if successful; non-zero if the WWN is malformed and couldn't be parsed
Definition at line 327 of file elxu_common.c.
| char* trimmed_string |
( |
uint8_t * |
string | ) |
|
Trim trailing non-printable characters from a string.
- Description
- Given a pointer to a string, this function returns a copy of the string up to the first non-printable character found. The largest string that can be returned is 2047 characters plus the terminating NULL.
- Parameters
-
| string | A pointer to the string to be trimmed. |
- Returns
- Returns a pointer to a static copy of the input string up to the first non-printable character, or the first 2047 characters if no non-printable character is found in that range.
Definition at line 437 of file elxu_common.c.
Frees memory that has been allocated.
- Description
- Free memory that was allocated with malloc or zmalloc. If the pointer is NULL no action is taken.
- Parameters
-
| p | The pointer to the memory to be freed. |
Definition at line 80 of file elxu_common.c.
| void* zmalloc |
( |
uint32_t |
len | ) |
|
Allocates and zeroes memory to be used.
- Parameters
-
| len | The amount of memory to be zeroed and allocated. |
- Returns
- Returns a pointer to the allocated memory or NULL on failure.
Definition at line 63 of file elxu_common.c.