Lines Matching defs:devpath
80 void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath,
85 strlcpy(dev->devpath, devpath, sizeof(dev->devpath));
92 pos = strrchr(dev->devpath, '/');
114 int sysfs_resolve_link(char *devpath, size_t size)
123 strlcat(link_path, devpath, sizeof(link_path));
128 dbg("path link '%s' points to '%s'", devpath, link_target);
132 dbg("base '%s', tail '%s', back %i", devpath, &link_target[back * 3], back);
134 char *pos = strrchr(devpath, '/');
140 dbg("after moving back '%s'", devpath);
141 strlcat(devpath, "/", size);
142 strlcat(devpath, &link_target[back * 3], size);
146 struct sysfs_device *sysfs_device_get(const char *devpath)
159 if (devpath != NULL &&
160 strncmp(devpath, "/devices/", 9) != 0 &&
161 strncmp(devpath, "/subsystem/", 11) != 0 &&
162 strncmp(devpath, "/module/", 8) != 0 &&
163 strncmp(devpath, "/bus/", 5) != 0 &&
164 strncmp(devpath, "/class/", 7) != 0 &&
165 strncmp(devpath, "/block/", 7) != 0)
168 dbg("open '%s'", devpath);
169 strlcpy(devpath_real, devpath, sizeof(devpath_real));
171 if (devpath[0] == '\0' )
176 if (strcmp(dev_loop->devpath, devpath_real) == 0) {
177 dbg("found in cache '%s'", dev_loop->devpath);
195 if (strcmp(dev_loop->devpath, devpath_real) == 0) {
196 dbg("found in cache '%s'", dev_loop->devpath);
213 strlcat(link_path, dev->devpath, sizeof(link_path));
223 } else if (strncmp(dev->devpath, "/class/", 7) == 0) {
225 strlcpy(dev->subsystem, &dev->devpath[7], sizeof(dev->subsystem));
231 } else if (strncmp(dev->devpath, "/block/", 7) == 0) {
233 } else if (strncmp(dev->devpath, "/devices/", 9) == 0) {
236 strlcat(link_path, dev->devpath, sizeof(link_path));
246 } else if (strstr(dev->devpath, "/drivers/") != NULL) {
248 } else if (strncmp(dev->devpath, "/module/", 8) == 0) {
250 } else if (strncmp(dev->devpath, "/subsystem/", 11) == 0) {
251 pos = strrchr(dev->devpath, '/');
252 if (pos == &dev->devpath[10])
254 } else if (strncmp(dev->devpath, "/bus/", 5) == 0) {
255 pos = strrchr(dev->devpath, '/');
256 if (pos == &dev->devpath[4])
262 strlcat(link_path, dev->devpath, sizeof(link_path));
273 dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'", dev->devpath, dev->subsystem, dev->driver);
284 dbg("open '%s'", dev->devpath);
290 strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath));
321 strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath));
344 char *sysfs_attr_get_value(const char *devpath, const char *attr_name)
356 dbg("open '%s'/'%s'", devpath, attr_name);
359 strlcat(path_full, devpath, sizeof(path_full));