linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* swich attribute open() to simple stat()
@ 2004-10-15 17:36 Kay Sievers
  2004-10-15 18:48 ` Greg KH
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kay Sievers @ 2004-10-15 17:36 UTC (permalink / raw)
  To: linux-hotplug

[-- 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;
 		}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: swich attribute open() to simple stat()
  2004-10-15 17:36 swich attribute open() to simple stat() Kay Sievers
@ 2004-10-15 18:48 ` Greg KH
  2004-10-15 20:55 ` Greg KH
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2004-10-15 18:48 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Oct 15, 2004 at 07:36:19PM +0200, Kay Sievers wrote:
> 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.

Applied, thanks.

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: swich attribute open() to simple stat()
  2004-10-15 17:36 swich attribute open() to simple stat() Kay Sievers
  2004-10-15 18:48 ` Greg KH
@ 2004-10-15 20:55 ` Greg KH
  2004-10-15 21:58 ` Greg KH
  2004-10-15 22:38 ` Kay Sievers
  3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2004-10-15 20:55 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Oct 15, 2004 at 07:36:19PM +0200, Kay Sievers wrote:
> 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

> === 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) {

Wait, this patch stops us from looking for "file" which had been set to
the file we wanted to look at, right?  Now we are just verifying that
the sysfs _directory_ for the class device is present.

While this is a good check (and we should do this to verify that the
device hasn't gone away, like in the vcs issue), I don't think this is
what you wanted to do, right?

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: swich attribute open() to simple stat()
  2004-10-15 17:36 swich attribute open() to simple stat() Kay Sievers
  2004-10-15 18:48 ` Greg KH
  2004-10-15 20:55 ` Greg KH
@ 2004-10-15 21:58 ` Greg KH
  2004-10-15 22:38 ` Kay Sievers
  3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2004-10-15 21:58 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Oct 15, 2004 at 01:55:21PM -0700, Greg KH wrote:
> 
> While this is a good check (and we should do this to verify that the
> device hasn't gone away, like in the vcs issue), I don't think this is
> what you wanted to do, right?

Ok, I've fixed this up in the bk tree.  A new udev release will be
soon...

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: swich attribute open() to simple stat()
  2004-10-15 17:36 swich attribute open() to simple stat() Kay Sievers
                   ` (2 preceding siblings ...)
  2004-10-15 21:58 ` Greg KH
@ 2004-10-15 22:38 ` Kay Sievers
  3 siblings, 0 replies; 5+ messages in thread
From: Kay Sievers @ 2004-10-15 22:38 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Oct 15, 2004 at 01:55:21PM -0700, Greg KH wrote:
> On Fri, Oct 15, 2004 at 07:36:19PM +0200, Kay Sievers wrote:
> > 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.

> > -		if (sysfs_get_classdev_attr(class_dev, file) != NULL) {
> > +		struct stat stats;
> > +
> > +		if (stat(class_dev->path, &stats) = 0) {
> 
> Wait, this patch stops us from looking for "file" which had been set to
> the file we wanted to look at, right?  Now we are just verifying that
> the sysfs _directory_ for the class device is present.
> 
> While this is a good check (and we should do this to verify that the
> device hasn't gone away, like in the vcs issue), I don't think this is
> what you wanted to do, right?

Yeah, you're right, sorry.

Kay


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-10-15 22:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-15 17:36 swich attribute open() to simple stat() Kay Sievers
2004-10-15 18:48 ` Greg KH
2004-10-15 20:55 ` Greg KH
2004-10-15 21:58 ` Greg KH
2004-10-15 22:38 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).