Hi,
On Monday, 18 June 2007 22:55, Tim Dijkstra wrote:
> Hi,
>
> What do people think about this?
[It's quite difficult to comment attached patches.]
> --- resume.c.dpkg 2007-06-10 22:49:25.000000000 -0400
> +++ resume.c 2007-06-11 23:02:33.000000000 -0400
> @@ -731,6 +731,9 @@
> struct stat stat_buf;
> int dev;
> int n, error = 0;
> + // Grace period variables
> + int loopcnt;
> + unsigned int usecs = 500000; // half a second
I'd prefer less than that and more steps. Say 0.1 s.
And call it 'stat_timeout' or anything more meaningful than it's now.
Also, why does it need to be a variable?
> page_size = getpagesize();
> buffer_size = BUFFER_PAGES * page_size;
> @@ -755,6 +758,18 @@
> if (splash_param != 'y' && splash_param != 'Y')
> splash_param = 0;
>
> + /*
> + * 30 second grace period to allow resume device
> + * to come online (i.e. external USB drives)
> + */
> + for (loopcnt = 1; loopcnt <= 60; loopcnt++)
No magic numbers, please.
> + {
> + if (stat(resume_dev_name, &stat_buf) != 0)
> + usleep(usecs); // wait a half
> second
> + else
> + break;
> + }
for (loopcnt = 0; loopcnt < STAT_LOOP_STEPS; loopcnt++) {
if (!stat(resume_dev_name, &stat_buf))
break;
usleep(STAT_TIMEOUT);
}
> while (stat(resume_dev_name, &stat_buf)) {
> fprintf(stderr,
> "resume: Could not stat the resume device
> file.\n"
Greetings,
Rafael
--
"Premature optimization is the root of all evil." - Donald Knuth
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Suspend-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/suspend-devel