3 #include <sys/sysmacros.h>
9 #include "linux-dev-lookup.h"
11 int blktrace_lookup_device(const char *redirect, char *path, unsigned int maj,
23 while ((dir = readdir(D)) != NULL) {
26 if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
29 sprintf(full_path, "%s/%s", path, dir->d_name);
30 if (lstat(full_path, &st) == -1) {
35 if (S_ISDIR(st.st_mode)) {
36 found = blktrace_lookup_device(redirect, full_path,
39 strcpy(path, full_path);
44 if (!S_ISBLK(st.st_mode))
48 * If replay_redirect is set then always return this device
49 * upon lookup which overrides the device lookup based on
50 * major minor in the actual blktrace
53 strcpy(path, redirect);
58 if (maj == major(st.st_rdev) && min == minor(st.st_rdev)) {
59 strcpy(path, full_path);