summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2006-12-08 09:48:53 +0100
committerKay Sievers <kay.sievers@vrfy.org>2006-12-08 09:48:53 +0100
commit9dd0c2573b1e3a6f18356e4db6cee5e5329ecb67 (patch)
tree70dcbc629bdc600aa48e8dab838d2a9f29cd697c
parent768cd81b7db0737240c759f59edd6d3399e1707a (diff)
rename config "filename" to "dir"
-rw-r--r--Makefile2
-rw-r--r--udev.h2
-rw-r--r--udev_config.c10
-rw-r--r--udev_rules.h2
-rw-r--r--udev_rules_parse.c12
-rw-r--r--udev_utils.c19
-rw-r--r--udevd.c2
7 files changed, 25 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index 947eacaf44..b3a5005757 100644
--- a/Makefile
+++ b/Makefile
@@ -199,7 +199,7 @@ udev_version.h:
$(Q) echo \#define UDEV_VERSION \"$(VERSION)\" >> $@
$(Q) echo \#define UDEV_ROOT \"$(udevdir)\" >> $@
$(Q) echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@
- $(Q) echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@
+ $(Q) echo \#define UDEV_RULES_DIR \"$(configdir)/rules.d\" >> $@
# man pages
%.8 %.7: %.xml
diff --git a/udev.h b/udev.h
index d09c9922cd..849de96459 100644
--- a/udev.h
+++ b/udev.h
@@ -92,7 +92,7 @@ struct udevice {
/* udev_config.c */
extern char udev_root[PATH_SIZE];
extern char udev_config_filename[PATH_SIZE];
-extern char udev_rules_filename[PATH_SIZE];
+extern char udev_rules_dir[PATH_SIZE];
extern int udev_log_priority;
extern int udev_run;
extern void udev_config_init(void);
diff --git a/udev_config.c b/udev_config.c
index 3d18e59796..3f226b9d7c 100644
--- a/udev_config.c
+++ b/udev_config.c
@@ -31,7 +31,7 @@
/* global variables */
char udev_root[PATH_SIZE];
char udev_config_filename[PATH_SIZE];
-char udev_rules_filename[PATH_SIZE];
+char udev_rules_dir[PATH_SIZE];
int udev_log_priority;
int udev_run;
@@ -145,8 +145,8 @@ static int parse_config_file(void)
}
if (strcasecmp(variable, "udev_rules") == 0) {
- strlcpy(udev_rules_filename, value, sizeof(udev_rules_filename));
- remove_trailing_chars(udev_rules_filename, '/');
+ strlcpy(udev_rules_dir, value, sizeof(udev_rules_dir));
+ remove_trailing_chars(udev_rules_dir, '/');
continue;
}
@@ -166,7 +166,7 @@ void udev_config_init(void)
strcpy(udev_root, UDEV_ROOT);
strcpy(udev_config_filename, UDEV_CONFIG_FILE);
- strcpy(udev_rules_filename, UDEV_RULES_FILE);
+ strcpy(udev_rules_dir, UDEV_RULES_DIR);
udev_log_priority = LOG_ERR;
udev_run = 1;
@@ -195,6 +195,6 @@ void udev_config_init(void)
dbg("UDEV_CONFIG_FILE='%s'", udev_config_filename);
dbg("udev_root='%s'", udev_root);
- dbg("udev_rules='%s'", udev_rules_filename);
+ dbg("udev_rules='%s'", udev_rules_dir);
dbg("udev_log=%d", udev_log_priority);
}
diff --git a/udev_rules.h b/udev_rules.h
index 4a9cd58484..56153519d4 100644
--- a/udev_rules.h
+++ b/udev_rules.h
@@ -24,7 +24,7 @@
#include "list.h"
#define PAIRS_MAX 5
-#define RULEFILE_SUFFIX ".rules"
+#define RULESFILE_SUFFIX ".rules"
enum key_operation {
KEY_OP_UNSET,
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index 535b59590a..3f7e43f839 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -627,7 +627,7 @@ static int parse_file(struct udev_rules *rules, const char *filename)
err("can't open '%s' as rules file: %s", filename, strerror(errno));
return -1;
}
- dbg("reading '%s' as rules file", filename);
+ info("reading '%s' as rules file", filename);
/* loop through the whole file */
cur = 0;
@@ -683,18 +683,18 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names)
rules->resolve_names = resolve_names;
/* parse rules file or all matching files in directory */
- if (stat(udev_rules_filename, &stats) != 0)
+ if (stat(udev_rules_dir, &stats) != 0)
return -1;
if ((stats.st_mode & S_IFMT) != S_IFDIR) {
- dbg("parse single rules file '%s'", udev_rules_filename);
- retval = parse_file(rules, udev_rules_filename);
+ dbg("parse single rules file '%s'", udev_rules_dir);
+ retval = parse_file(rules, udev_rules_dir);
} else {
struct name_entry *name_loop, *name_tmp;
LIST_HEAD(name_list);
- dbg("parse rules directory '%s'", udev_rules_filename);
- retval = add_matching_files(&name_list, udev_rules_filename, RULEFILE_SUFFIX);
+ dbg("parse rules directory '%s'", udev_rules_dir);
+ retval = add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX);
list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) {
if (stat(name_loop->name, &stats) == 0) {
diff --git a/udev_utils.c b/udev_utils.c
index b6e5275a16..e892012132 100644
--- a/udev_utils.c
+++ b/udev_utils.c
@@ -126,7 +126,6 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c
{
struct dirent *ent;
DIR *dir;
- char *ext;
char filename[PATH_SIZE];
dbg("open directory '%s'", dirname);
@@ -145,14 +144,16 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c
continue;
/* look for file matching with specified suffix */
- ext = strrchr(ent->d_name, '.');
- if (ext == NULL)
- continue;
-
- if (strcmp(ext, suffix) != 0)
- continue;
-
- dbg("put file '%s/%s' in list", dirname, ent->d_name);
+ if (suffix != NULL) {
+ const char *ext;
+
+ ext = strrchr(ent->d_name, '.');
+ if (ext == NULL)
+ continue;
+ if (strcmp(ext, suffix) != 0)
+ continue;
+ }
+ dbg("put file '%s/%s' into list", dirname, ent->d_name);
snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name);
filename[sizeof(filename)-1] = '\0';
diff --git a/udevd.c b/udevd.c
index 3adedac080..79465a1da0 100644
--- a/udevd.c
+++ b/udevd.c
@@ -1104,7 +1104,7 @@ int main(int argc, char *argv[], char *envp[])
/* watch rules directory */
inotify_fd = inotify_init();
if (inotify_fd >= 0)
- inotify_add_watch(inotify_fd, udev_rules_filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
+ inotify_add_watch(inotify_fd, udev_rules_dir, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
else if (errno == ENOSYS)
err("the kernel does not support inotify, udevd can't monitor configuration file changes");
else