summaryrefslogtreecommitdiff
path: root/udev_rules_parse.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-11-05 20:00:31 +0100
committerKay Sievers <kay.sievers@suse.de>2005-11-05 20:00:31 +0100
commit287814b23cd564043391ce449f27e6ccd9d244e4 (patch)
treef55b43012e145fbcfa3cbaf9945cadfe4a45c531 /udev_rules_parse.c
parent3904a7581776cffc7ddaf4adbfbea8a57ab1adaa (diff)
remove precompiled rules option
It was a workaround for speed up udev "coldplug", where ~800 events happened a second time during bootup. No need for it with the rules aleady parsed in the daemon. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules_parse.c')
-rw-r--r--udev_rules_parse.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index 7d1853acbe..6e978d74b4 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -591,42 +591,14 @@ static int parse_file(struct udev_rules *rules, const char *filename)
return retval;
}
-static int rules_map(struct udev_rules *rules, const char *filename)
+int udev_rules_init(struct udev_rules *rules, int resolve_names)
{
- if (file_map(filename, &rules->buf, &rules->bufsize)) {
- rules->buf = NULL;
- return -1;
- }
- if (rules->bufsize == 0) {
- file_unmap(rules->buf, rules->bufsize);
- rules->buf = NULL;
- return -1;
- }
- rules->mapped = 1;
-
- return 0;
-}
-
-int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_names)
-{
- char comp[PATH_SIZE];
struct stat stats;
int retval;
memset(rules, 0x00, sizeof(struct udev_rules));
rules->resolve_names = resolve_names;
- /* check for precompiled rules */
- 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;
@@ -660,11 +632,7 @@ int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_nam
void udev_rules_close(struct udev_rules *rules)
{
if (rules->buf) {
- if (rules->mapped) {
- rules->mapped = 0;
- file_unmap(rules->buf, rules->bufsize);
- } else
- free(rules->buf);
+ free(rules->buf);
rules->buf = NULL;
}
}