}
udev_init_device(&udev, devpath, subsystem, action);
- udev_rules_init(&rules, 0);
+ udev_rules_init(&rules, 1, 0);
retval = udev_process_event(&rules, &udev);
int resolve_names;
};
-extern int udev_rules_init(struct udev_rules *rules, int resolve_names);
+extern int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_names);
extern void udev_rules_close(struct udev_rules *rules);
extern void udev_apply_format(struct udevice *udev, char *string, size_t maxsize,
return 0;
}
-int udev_rules_init(struct udev_rules *rules, int resolve_names)
+int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_names)
{
char comp[PATH_SIZE];
struct stat stats;
rules->resolve_names = resolve_names;
/* check for precompiled rules */
- strlcpy(comp, udev_rules_filename, sizeof(comp));
- strlcat(comp, ".compiled", sizeof(comp));
- if (stat(comp, &stats) == 0) {
- dbg("map compiled rules '%s'", comp);
- if (rules_map(rules, comp) == 0)
- return 0;
+ if (read_compiled) {
+ strlcpy(comp, udev_rules_filename, sizeof(comp));
+ strlcat(comp, ".compiled", sizeof(comp));
+ if (stat(comp, &stats) == 0) {
+ dbg("map compiled rules '%s'", comp);
+ if (rules_map(rules, comp) == 0)
+ return 0;
+ }
}
+ /* parse rules file or all matching files in directory */
if (stat(udev_rules_filename, &stats) != 0)
return -1;
unlink(comp);
unlink(comp_tmp);
- udev_rules_init(&rules, 1);
+ udev_rules_init(&rules, 0, 1);
f = fopen(comp_tmp, "w");
if (f == NULL) {
/* trigger timeout to prevent hanging processes */
alarm(UDEV_ALARM_TIMEOUT);
- udev_rules_init(&rules, 1);
+ udev_rules_init(&rules, 0, 1);
udev_scan_block();
udev_scan_class();
info("looking at device '%s' from subsystem '%s'", devpath, subsystem);
/* initialize the naming deamon */
- udev_rules_init(&rules, 0);
+ udev_rules_init(&rules, 0, 0);
/* fill in values and test_run flag*/
udev_init_device(&udev, devpath, subsystem, "add");