All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: swich attribute open() to simple stat()
Date: Fri, 15 Oct 2004 17:36:19 +0000	[thread overview]
Message-ID: <20041015173619.GD6056@vrfy.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

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.

Thanks,
Kay

[-- Attachment #2: udev-stat-instead-open.patch --]
[-- Type: text/plain, Size: 1451 bytes --]

===== wait_for_sysfs.c 1.18 vs edited =====
--- 1.18/wait_for_sysfs.c	2004-10-14 16:14:00 +02:00
+++ edited/wait_for_sysfs.c	2004-10-15 19:32:38 +02:00
@@ -47,7 +47,7 @@ void log_message(int level, const char *
 }
 #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_attribu
 		{ .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_attribu
 			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;
 		}

             reply	other threads:[~2004-10-15 17:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-15 17:36 Kay Sievers [this message]
2004-10-15 18:48 ` swich attribute open() to simple stat() Greg KH
2004-10-15 20:55 ` Greg KH
2004-10-15 21:58 ` Greg KH
2004-10-15 22:38 ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041015173619.GD6056@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.