summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-10-15 19:45:56 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 22:02:45 -0700
commit1946fec4deba1ea5505c286ef2dd4ff2c6863b1c (patch)
tree5e4cd923e1214e2449fd759cf93ad72e26eccc6a
parent79db6912cf8827bf4293d2d15b84cc9633dd7d4e (diff)
[PATCH] swich attribute open() to simple stat()
Here we switch to a simple stat() to recognize the file creation. This will make it possible to wait for files, which are unreadable. I've switched the timout back to 5 seconds cause the our /class/vc errors seems like a bug in the vc layer not a sysfs delay.
-rw-r--r--wait_for_sysfs.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c
index 25a3fb4eef..72368efac8 100644
--- a/wait_for_sysfs.c
+++ b/wait_for_sysfs.c
@@ -47,7 +47,7 @@ void log_message(int level, const char *format, ...)
}
#endif
-#define WAIT_MAX_SECONDS 10
+#define WAIT_MAX_SECONDS 5
#define WAIT_LOOP_PER_SECOND 20
/* wait for specific file to show up, normally the "dev"-file */
@@ -60,7 +60,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev
{ .subsystem = "net", .file = "ifindex" },
{ .subsystem = "scsi_host", .file = "unique_id" },
{ .subsystem = "scsi_device", .file = NULL },
- { .subsystem = "pcmcia_socket", .file = NULL }, /* all files are unreadable in empty slot :( */
+ { .subsystem = "pcmcia_socket", .file = "card_type" },
{ .subsystem = "usb_host", .file = NULL },
{ .subsystem = "bluetooth", .file = "address" },
{ .subsystem = "firmware", .file = "data" },
@@ -86,11 +86,14 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev
break;
}
}
- dbg("looking at class '%s' for specific file '%s'", class_dev->classname, file);
+
+ dbg("looking at class '%s' for specific file '%s'", class_dev->classname, class_dev->path);
loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND;
while (--loop) {
- if (sysfs_get_classdev_attr(class_dev, file) != NULL) {
+ struct stat stats;
+
+ if (stat(class_dev->path, &stats) == 0) {
dbg("class '%s' specific file '%s' found", class_dev->classname, file);
return 0;
}