GVM User Suite
User tools for the GVM open source project.
Functions
device.c File Reference
#include <utils/device.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
Include dependency graph for device.c:

Go to the source code of this file.

Functions

uint8_t device_exists (const char *device_name)
 Does a device file exist? More...
 
int32_t get_major (const char *device)
 Gets the device major id from /proc/devices. More...
 
int32_t get_param (const char *filename, const char *parameter)
 Gets a parameter from a driver param file. More...
 

Function Documentation

◆ device_exists()

uint8_t device_exists ( const char *  device_name)

Does a device file exist?

Possible Failures:
Invalid File - The only way this function can fail is by not having the file in question exist.

Definition at line 30 of file device.c.

Here is the caller graph for this function:

◆ get_major()

int32_t get_major ( const char *  device)

Gets the device major id from /proc/devices.

Possible Failures:

Invalid Device - In the case of an invalid device being passed it will return -1.

Device List Not Found - Device list is not found, this can occur on unsupported operating systems.

Definition at line 42 of file device.c.

Here is the caller graph for this function:

◆ get_param()

int32_t get_param ( const char *  filename,
const char *  parameter 
)

Gets a parameter from a driver param file.

Possible Failures:
Param File Not Found - Check if the device driver is loaded correctly.

Definition at line 71 of file device.c.

Here is the caller graph for this function: