# sysdep.c File Reference

Interact with system dependencies. More...

`#include <assert.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <discover/discover.h>`
`#include <discover/discover-conf.h>`
`#include <discover/discover-xml.h>`
`#include <discover/sysdep.h>`
`#include <discover/device.h>`
`#include <discover/utils.h>`

Go to the source code of this file.

## Typedefs

typedef discover_sysdep_data_t *( | raw_sysdep_function_t )(void)

## Functions

discover_sysdep_data_t * | _discover_sysdep_data_new (void)
discover_sysdep_device_data_t * | _discover_sysdep_device_data_new (void)
void | _discover_free_sysdep_data (discover_sysdep_data_t *head)
void | _discover_free_sysdep_device_data (discover_sysdep_device_data_t *head)
discover_data_t * | _discover_convert_device_data (discover_sysdep_device_data_t *head)
discover_device_t * | discover_get_devices (discover_bus_t bus, discover_error_t *status)
void | discover_free_devices (void)

## Detailed Description

Interact with system dependencies.

This file holds the routines that interact with the system-dependent interface. This file essentially bridges the gap between the XML data and the hardware contained within the machine.

Definition in file sysdep.c.

## Typedef Documentation

typedef discover_sysdep_data_t*( raw_sysdep_function_t)(void)

| Function pointers Definition at line 49 of file sysdep.c.

## Function Documentation

discover_data_t* _discover_convert_device_data | ( | discover_sysdep_device_data_t * | head | ) |

Convert sysdep device data into discover data under the "device" node.

Set up the toplevel data node.

Set up the first parent below "device" for this node.

Set up the token parser.

Split the node path by the path separator.

Set up the new data node.

Does this node have a predecessor in the path?

No; make it a child of the "device" node.

Yes; make it a child of the previous.

Clean up after the token parser.

Definition at line 135 of file sysdep.c.

References discover_data_new(), discover_sysdep_device_data::next, discover_sysdep_device_data::path, and discover_sysdep_device_data::value.

Referenced by discover_get_devices().

void _discover_free_sysdep_data | ( | discover_sysdep_data_t * | head | ) |

| Release the memory that the sysdep data was holding. Definition at line 92 of file sysdep.c. References _discover_free_sysdep_device_data(), discover_sysdep_data::busclass, discover_sysdep_data::data, discover_sysdep_data::model, discover_sysdep_data::next, and discover_sysdep_data::vendor. Referenced by discover_get_devices().

void _discover_free_sysdep_device_data | ( | discover_sysdep_device_data_t * | head | ) |

| Release memory being held by device-specific data. Definition at line 117 of file sysdep.c. References discover_sysdep_device_data::next, discover_sysdep_device_data::path, and discover_sysdep_device_data::value. Referenced by _discover_free_sysdep_data().

discover_sysdep_data_t* _discover_sysdep_data_new | ( | void |  | ) |

| Create a new instance of sysdep data. Definition at line 66 of file sysdep.c. References discover_sysdep_data::busclass, discover_sysdep_data::data, discover_sysdep_data::model, discover_sysdep_data::next, and discover_sysdep_data::vendor.

discover_sysdep_device_data_t* _discover_sysdep_device_data_new | ( | void |  | ) |

| Create a new instance of sysdep device data. Definition at line 80 of file sysdep.c. References discover_sysdep_device_data::next, discover_sysdep_device_data::path, and discover_sysdep_device_data::value.

void discover_free_devices | ( | void |  | ) |

| Free the currently allocated memory holding the device information. Definition at line 301 of file sysdep.c. References BUS_COUNT, and discover_device_free().

discover_device_t* discover_get_devices | ( | discover_bus_t | bus,
|  | discover_error_t * | status
| ) |

Function responsible for returning a devicelist of current devices

Definition at line 206 of file sysdep.c.

References _discover_convert_device_data(), _discover_free_sysdep_data(), discover_error::code, discover_conf_get_bus_map(), discover_device_new(), DISCOVER_EBUSDISABLED, DISCOVER_SUCCESS, discover_xml_get_devices(), discover_xml_get_matching_devices(), discover_bus_map::get_raw, and discover_bus_map::scan_never.

Referenced by discover_device_find().