{
switch (dev->type) {
case KERNEL_NAME:
- dbg_parse("KERNEL name ='%s'"
- " owner = '%s', group = '%s', mode = '%#o'",
- dev->name,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("KERNEL name='%s' ,"
+ "owner='%s', group='%s', mode=%#o",
+ dev->name, dev->owner, dev->group, dev->mode);
break;
case LABEL:
- dbg_parse("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'"
- " owner = '%s', group = '%s', mode = '%#o'",
- dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("LABEL name='%s', bus='%s', sysfs_file='%s', sysfs_value='%s', "
+ "owner='%s', group='%s', mode=%#o",
+ dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value,
+ dev->owner, dev->group, dev->mode);
break;
case NUMBER:
- dbg_parse("NUMBER name = '%s', bus = '%s', id = '%s'"
- " owner = '%s', group = '%s', mode = '%#o'",
- dev->name, dev->bus, dev->id,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("NUMBER name='%s', bus='%s', id='%s', "
+ "owner='%s', group='%s', mode=%#o",
+ dev->name, dev->bus, dev->id,
+ dev->owner, dev->group, dev->mode);
break;
case TOPOLOGY:
- dbg_parse("TOPOLOGY name = '%s', bus = '%s', place = '%s'"
- " owner = '%s', group = '%s', mode = '%#o'",
- dev->name, dev->bus, dev->place,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s', "
+ "owner='%s', group='%s', mode=%#o",
+ dev->name, dev->bus, dev->place,
+ dev->owner, dev->group, dev->mode);
break;
case REPLACE:
- dbg_parse("REPLACE name = %s, kernel_name = %s"
- " owner = '%s', group = '%s', mode = '%#o'",
- dev->name, dev->kernel_name,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("REPLACE name=%s, kernel_name=%s, "
+ "owner='%s', group='%s', mode=%#o",
+ dev->name, dev->kernel_name,
+ dev->owner, dev->group, dev->mode);
break;
case CALLOUT:
- dbg_parse("CALLOUT name = '%s', program ='%s', bus = '%s', id = '%s'"
- " owner = '%s', group = '%s', mode = '%#o'",
- dev->name, dev->exec_program, dev->bus, dev->id,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("CALLOUT name='%s', program='%s', bus='%s', id='%s', "
+ "owner='%s', group='%s', mode=%#o",
+ dev->name, dev->exec_program, dev->bus, dev->id,
+ dev->owner, dev->group, dev->mode);
break;
default:
- dbg_parse("Unknown type of device!");
+ dbg_parse("unknown type of method");
}
}
return 0;
}
- /* not found, lets create a new structure, and add it to the list */
+ /* not found, add new structure to the device list */
tmp_dev = malloc(sizeof(*tmp_dev));
if (!tmp_dev)
return -ENOMEM;
dbg("opening %s to read as config", udev_config_filename);
fd = fopen(udev_config_filename, "r");
if (fd == NULL) {
- dbg("Can't open %s", udev_config_filename);
+ dbg("can't open %s", udev_config_filename);
return -ENODEV;
}
while (isspace(*temp))
++temp;
- /* no more line? */
+ /* empty line? */
if (*temp == 0x00)
continue;
break;
strfieldcpy(dev.name, temp3);
- dbg_parse("LABEL name = '%s', bus = '%s', "
- "sysfs_file = '%s', sysfs_value = '%s'",
- dev.name, dev.bus, dev.sysfs_file,
- dev.sysfs_value);
+ dbg_parse("LABEL name='%s', bus='%s', "
+ "sysfs_file='%s', sysfs_value='%s'",
+ dev.name, dev.bus, dev.sysfs_file,
+ dev.sysfs_value);
}
if (strcasecmp(temp2, TYPE_NUMBER) == 0) {
break;
strfieldcpy(dev.name, temp3);
- dbg_parse("NUMBER name = '%s', bus = '%s', id = '%s'",
- dev.name, dev.bus, dev.id);
+ dbg_parse("NUMBER name='%s', bus='%s', id='%s'",
+ dev.name, dev.bus, dev.id);
}
if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) {
break;
strfieldcpy(dev.name, temp3);
- dbg_parse("TOPOLOGY name = '%s', bus = '%s', place = '%s'",
- dev.name, dev.bus, dev.place);
+ dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s'",
+ dev.name, dev.bus, dev.place);
}
if (strcasecmp(temp2, TYPE_REPLACE) == 0) {
if (retval)
break;
strfieldcpy(dev.name, temp3);
- dbg_parse("REPLACE name = %s, kernel_name = %s",
- dev.name, dev.kernel_name);
+ dbg_parse("REPLACE name='%s', kernel_name='%s'",
+ dev.name, dev.kernel_name);
}
if (strcasecmp(temp2, TYPE_CALLOUT) == 0) {
/* number type */
if (retval)
break;
strfieldcpy(dev.name, temp3);
- dbg_parse("CALLOUT name = %s, program = %s",
- dev.name, dev.exec_program);
+ dbg_parse("CALLOUT name='%s', program='%s'",
+ dev.name, dev.exec_program);
}
retval = add_dev(&dev);
goto exit;
}
}
- dbg_parse("%s:%d:%Zd: error parsing ``%s''", udev_config_filename,
+ dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename,
lineno, temp - line, temp);
exit:
fclose(fd);
dbg("opening %s to read as permissions config", udev_config_permission_filename);
fd = fopen(udev_config_permission_filename, "r");
if (fd == NULL) {
- dbg("Can't open %s", udev_config_permission_filename);
+ dbg("can't open %s", udev_config_permission_filename);
return -ENODEV;
}
while (isspace(*temp))
++temp;
- /* no more line? */
+ /* empty line? */
if (*temp == 0x00)
continue;
dev.mode = strtol(temp, NULL, 8);
- dbg_parse("name = %s, owner = %s, group = %s, mode = %#o",
- dev.name, dev.owner, dev.group,
- dev.mode);
+ dbg_parse("name='%s', owner='%s', group='%s', mode=%#o",
+ dev.name, dev.owner, dev.group,
+ dev.mode);
retval = add_dev(&dev);
if (retval) {
dbg("add_dev returned with error %d", retval);
int value_set = 0;
char buffer[256];
- dbg("callout to %s\n", dev->exec_program);
+ dbg("callout to '%s'", dev->exec_program);
retval = pipe(fds);
if (retval != 0) {
dbg("pipe failed");
}
if (pid == 0) {
- /*
- * child
- */
+ /* child */
close(STDOUT_FILENO);
dup(fds[1]); /* dup write side of pipe to STDOUT */
retval = execve(dev->exec_program, main_argv, main_envp);
}
return -1; /* avoid compiler warning */
} else {
- /*
- * Parent reads from fds[0].
- */
+ /* parent reads from fds[0] */
close(fds[1]);
retval = 0;
while (1) {
strfieldcpy(udev->owner, dev->owner);
strfieldcpy(udev->group, dev->group);
}
- dbg_parse("device callout '%s' becomes '%s' - owner = %s, group = %s, mode = %#o",
- dev->id, udev->name,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("callout returned matching value '%s', '%s' becomes '%s'"
+ " - owner='%s', group='%s', mode =%#o",
+ dev->id, class_dev->name, udev->name,
+ dev->owner, dev->group, dev->mode);
return 0;
}
return -ENODEV;
if (dev->type != LABEL)
continue;
- dbg_parse("LABEL: match file '%s' with value '%s'",
- dev->sysfs_file, dev->sysfs_value);
+ dbg_parse("look for device attribute '%s'", dev->sysfs_file);
/* try to find the attribute in the class device directory */
tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file);
if (tmpattr)
label_found:
tmpattr->value[strlen(tmpattr->value)-1] = 0x00;
- dbg_parse("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value);
+ dbg_parse("compare attribute '%s' value '%s' with '%s'",
+ dev->sysfs_file, tmpattr->value, dev->sysfs_value);
if (strcmp(dev->sysfs_value, tmpattr->value) != 0)
continue;
strfieldcpy(udev->owner, dev->owner);
strfieldcpy(udev->group, dev->group);
}
- dbg_parse("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o",
- dev->sysfs_file, dev->sysfs_value, udev->name,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("found matching attribute '%s', '%s' becomes '%s' "
+ "- owner='%s', group='%s', mode=%#o",
+ dev->sysfs_file, class_dev->name, udev->name,
+ dev->owner, dev->group, dev->mode);
return 0;
}
found = 0;
strfieldcpy(path, sysfs_device->path);
temp = strrchr(path, '/');
- dbg_parse("NUMBER path = '%s'", path);
- dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id);
+ dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path);
if (strstr(temp, dev->id) != NULL) {
found = 1;
} else {
*temp = 0x00;
temp = strrchr(path, '/');
- dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id);
+ dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path);
if (strstr(temp, dev->id) != NULL)
found = 1;
}
strfieldcpy(udev->owner, dev->owner);
strfieldcpy(udev->group, dev->group);
}
- dbg_parse("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o",
- dev->id, udev->name,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("found matching id '%s', '%s' becomes '%s'"
+ " - owner='%s', group ='%s', mode=%#o",
+ dev->id, class_dev->name, udev->name,
+ dev->owner, dev->group, dev->mode);
return 0;
}
return -ENODEV;
found = 0;
strfieldcpy(path, sysfs_device->path);
temp = strrchr(path, '/');
- dbg_parse("TOPOLOGY path = '%s'", path);
- dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place);
+ dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path);
if (strstr(temp, dev->place) != NULL) {
found = 1;
} else {
*temp = 0x00;
temp = strrchr(path, '/');
- dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place);
+ dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path);
if (strstr(temp, dev->place) != NULL)
found = 1;
}
strfieldcpy(udev->owner, dev->owner);
strfieldcpy(udev->group, dev->group);
}
- dbg_parse("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o",
- dev->place, udev->name,
- dev->owner, dev->group, dev->mode);
-
+ dbg_parse("found matching place '%s', '%s' becomes '%s'"
+ " - owner='%s', group ='%s', mode=%#o",
+ dev->place, class_dev->name, udev->name,
+ dev->owner, dev->group, dev->mode);
return 0;
}
return -ENODEV;
if (dev->type != REPLACE)
continue;
- dbg_parse("REPLACE: replace name '%s' with '%s'",
+ dbg_parse("compare name '%s' with '%s'",
dev->kernel_name, dev->name);
if (strcmp(dev->kernel_name, class_dev->name) != 0)
continue;
strfieldcpy(udev->owner, dev->owner);
strfieldcpy(udev->group, dev->group);
}
- dbg_parse("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o",
- dev->kernel_name, udev->name,
- dev->owner, dev->group, dev->mode);
+ dbg_parse("found name, '%s' becomes '%s' - owner='%s', group='%s', mode = %#o",
+ dev->kernel_name, udev->name,
+ dev->owner, dev->group, dev->mode);
return 0;
}
continue;
}
if (dev->mode != 0) {
- dbg_parse("found permissions from config for '%s'", class_dev->name);
+ dbg_parse("found permissions for '%s'", class_dev->name);
udev->mode = dev->mode;
strfieldcpy(udev->owner, dev->owner);
strfieldcpy(udev->group, dev->group);
if (class_dev_parent == NULL) {
dbg("sysfs_open_class_device at '%s' failed", path);
} else {
- dbg_parse("class_dev_parent->name = %s", class_dev_parent->name);
+ dbg_parse("class_dev_parent->name=%s", class_dev_parent->name);
if (class_dev_parent->sysdevice)
sysfs_device = class_dev_parent->sysdevice;
}
}
if (sysfs_device) {
- dbg_parse("sysfs_device->path = '%s'", sysfs_device->path);
- dbg_parse("sysfs_device->bus_id = '%s'", sysfs_device->bus_id);
+ dbg_parse("sysfs_device->path='%s'", sysfs_device->path);
+ dbg_parse("sysfs_device->bus_id='%s'", sysfs_device->bus_id);
} else {
dbg_parse("class_dev->name = '%s'", class_dev->name);
}
if (!sysfs_device)
break;
strcat(udev->name, sysfs_device->bus_id);
- dbg("bus_id appended: %s",
+ dbg("bus_id inserted: %s",
sysfs_device->bus_id);
break;
case 'n':
while (isdigit(*(dig-1)))
dig--;
strcat(udev->name, dig);
- dbg("kernel number appended: %s", dig);
+ dbg("substitute kernel number '%s'", dig);
break;
case 'm':
sprintf(pos, "%u", udev->minor);
- dbg("minor number appended: %u", udev->minor);
+ dbg("substitute minor number '%u'", udev->minor);
break;
case 'M':
sprintf(pos, "%u", udev->major);
- dbg("major number appended: %u", udev->major);
+ dbg("substitute major number '%u'", udev->major);
break;
default:
- dbg("unknown substitution type: %%%c", pos[1]);
+ dbg("unknown substitution type '%%%c'", pos[1]);
break;
}
strcat(udev->name, name);