+ /* eat the whitespace */
+ while ((count > 0) && isspace(bufline[0])) {
+ bufline++;
+ count--;
+ }
+ if (count == 0)
+ continue;
+
+ /* see if this is a comment */
+ if (bufline[0] == COMMENT_CHARACTER)
+ continue;
+
+ memcpy(line, bufline, count);
+ line[count] = '\0';
+
+ linepos = line;
+ if (get_key(&linepos, &variable, &value) == 0) {
+ dbg("import '%s=%s'", variable, value);
+
+ /* handle device, renamed by external tool, returning new path */
+ if (strcmp(variable, "DEVPATH") == 0) {
+ info("updating devpath from '%s' to '%s'", udev->dev->devpath, value);
+ sysfs_device_set_values(udev->dev, value, NULL, NULL);
+ } else
+ name_list_key_add(&udev->env_list, variable, value);
+ setenv(variable, value, 1);
+ }
+ }
+
+ return 0;
+}
+
+static int import_file_into_env(struct udevice *udev, const char *filename)
+{
+ char *buf;
+ size_t bufsize;
+
+ if (file_map(filename, &buf, &bufsize) != 0) {
+ err("can't open '%s': %s", filename, strerror(errno));
+ return -1;
+ }
+ import_keys_into_env(udev, buf, bufsize);
+ file_unmap(buf, bufsize);
+
+ return 0;
+}
+
+static int import_program_into_env(struct udevice *udev, const char *program)
+{
+ char result[1024];
+ size_t reslen;
+
+ if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_INFO)) != 0)
+ return -1;
+ return import_keys_into_env(udev, result, reslen);
+}
+
+static int import_parent_into_env(struct udevice *udev, const char *filter)
+{
+ struct sysfs_device *dev_parent;
+ int rc = -1;
+
+ dev_parent = sysfs_device_get_parent(udev->dev);
+ if (dev_parent != NULL) {
+ struct udevice *udev_parent;
+ struct name_entry *name_loop;
+
+ dbg("found parent '%s', get the node name", dev_parent->devpath);
+ udev_parent = udev_device_init(NULL);
+ if (udev_parent == NULL)