libexplain  1.4.D001
Functions
libexplain/buffer/device_name.c File Reference
#include <libexplain/ac/dirent.h>
#include <libexplain/ac/limits.h>
#include <libexplain/ac/sys/param.h>
#include <libexplain/buffer/device_name.h>
#include <libexplain/buffer/pointer.h>
#include <libexplain/is_efault.h>

Go to the source code of this file.

Functions

static int dev_stat_rec (explain_string_buffer_t *dev_path, dev_t dev, struct stat *st, explain_string_buffer_t *shortest_dev_path)
int explain_buffer_device_name (explain_string_buffer_t *sb, dev_t dev, struct stat *st)

Function Documentation

static int dev_stat_rec ( explain_string_buffer_t dev_path,
dev_t  dev,
struct stat *  st,
explain_string_buffer_t shortest_dev_path 
) [static]

The dev_stat_rec function is used to walk the /dev directory tree, looking for a specific device.

Parameters:
dev_pathThe is the path recursively constructed as we descend down the directory tree looking for devices.
devThe device beeing searched for.
stThe details of the device found (output).
shortest_dev_pathThe path of the device found. If nore than one is found, the shortest device_path is remembered.
Returns:
0 on success (shortest_dev_path has been set), -1 if the device is not found.

Definition at line 47 of file device_name.c.

int explain_buffer_device_name ( explain_string_buffer_t sb,
dev_t  dev,
struct stat *  st 
)

The explain_buffer_device_name function may be used locate a device's name an print it into the supplied buffer.

Parameters:
sbThe string buffer to print into.
devThe device to look for.
stThe file info that provoked the request.
Returns:
0 on success, -1 on error

Definition at line 130 of file device_name.c.