DIR *dir;
struct dirent *dent;
- devpath = "block";
- dir = opendir(SYSBLOCK);
+ /*
+ * We want to scan the class tree first as lvm and dm needs to be able
+ * to have access to the char control device when probing the block
+ * devices.
+ */
+ devpath = "class";
+ dir = opendir(SYSCLASS);
if (dir != NULL) {
for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
char dirname[MAX_PATHLEN];
(strcmp(dent->d_name, "..") == 0))
continue;
- snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name);
- dirname[MAX_PATHLEN-1] = '\0';
- udev_exec(dirname, "block");
-
- snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name);
+ snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name);
+ dirname[MAX_PATHLEN] = '\0';
dir2 = opendir(dirname);
if (dir2 != NULL) {
for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
- char dirname2[MAX_PATHLEN];
+ char dirname2[MAX_PATHLEN-1];
DIR *dir3;
struct dirent *dent3;
char filename[MAX_PATHLEN];
if (strcmp(dent3->d_name, "dev") == 0) {
- snprintf(filename, MAX_PATHLEN, "/block/%s/%s",
+ snprintf(filename, MAX_PATHLEN, "/class/%s/%s",
dent->d_name, dent2->d_name);
filename[MAX_PATHLEN-1] = '\0';
- udev_exec(filename, "block");
+ udev_exec(filename, dent->d_name);
}
}
closedir(dir3);
closedir(dir);
}
- devpath = "class";
- dir = opendir(SYSCLASS);
+ devpath = "block";
+ dir = opendir(SYSBLOCK);
if (dir != NULL) {
for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
char dirname[MAX_PATHLEN];
(strcmp(dent->d_name, "..") == 0))
continue;
- snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name);
- dirname[MAX_PATHLEN] = '\0';
+ snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name);
+ dirname[MAX_PATHLEN-1] = '\0';
+ udev_exec(dirname, "block");
+
+ snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name);
dir2 = opendir(dirname);
if (dir2 != NULL) {
for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
- char dirname2[MAX_PATHLEN-1];
+ char dirname2[MAX_PATHLEN];
DIR *dir3;
struct dirent *dent3;
char filename[MAX_PATHLEN];
if (strcmp(dent3->d_name, "dev") == 0) {
- snprintf(filename, MAX_PATHLEN, "/class/%s/%s",
+ snprintf(filename, MAX_PATHLEN, "/block/%s/%s",
dent->d_name, dent2->d_name);
filename[MAX_PATHLEN-1] = '\0';
- udev_exec(filename, dent->d_name);
+ udev_exec(filename, "block");
}
}
closedir(dir3);
}
}
-
int main(int argc, char *argv[], char *envp[])
{
init_logging("udevstart");