[udev] patch for automount issue.
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-core / udev / udev-182 / udev_scan_sys_block.patch
1 diff --git a/src/libudev-enumerate.c b/src/libudev-enumerate.c
2 index 034d96f..ca7f068 100644
3 --- a/src/libudev-enumerate.c
4 +++ b/src/libudev-enumerate.c
5 @@ -730,6 +730,30 @@ static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir,
6          return 0;
7  }
8  
9 +static int scan_dir_block(struct udev_enumerate *udev_enumerate)
10 +{
11 +        struct udev *udev = udev_enumerate_get_udev(udev_enumerate);
12 +
13 +        char path[UTIL_PATH_SIZE];
14 +        DIR *dir;
15 +        struct dirent *dent;
16 +               const char *basedir = "block";
17 +
18 +        util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL);
19 +        dir = opendir(path);
20 +        if (dir == NULL)
21 +                return -1;
22 +        for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
23 +                if (dent->d_name[0] == '.')
24 +                        continue;
25 +                if ((dent->d_name[0] != 's') || (dent->d_name[1] != 'd'))
26 +                        continue;
27 +                scan_dir_and_add_devices(udev_enumerate, basedir, dent->d_name, NULL);
28 +        }
29 +        closedir(dir);
30 +        return 0;
31 +}
32 +
33  /**
34   * udev_enumerate_add_syspath:
35   * @udev_enumerate: context
36 @@ -877,6 +901,15 @@ static int scan_devices_all(struct udev_enumerate *udev_enumerate)
37                  scan_dir(udev_enumerate, "bus", "devices", NULL);
38                  dbg(udev, "searching '/class/*' dir\n");
39                  scan_dir(udev_enumerate, "class", NULL, NULL);
40 +                {
41 +                    char tmp[UTIL_PATH_SIZE];
42 +                    util_strscpyl(tmp, sizeof(tmp), udev_get_sys_path(udev), "/class/block", NULL);
43 +                    if (stat(tmp, &statbuf) != 0)
44 +                    {
45 +                            dbg(udev, "searching %s/*\n", tmp);
46 +                            scan_dir_block(udev_enumerate);
47 +                    }
48 +                }
49          }
50          return 0;
51  }