tag 436703 patch
thanks

Hi,

I'm attaching a patch that fixes it. It basically follows http://linux-ata.org/shutdown.html and skips the drive shutdown when the respective /sys/block/sdX/device/scsi_disk:*/manage_start_stop exists (leaving it for the kernel to do).

After fixing, contact [EMAIL PROTECTED] We still have a chance of Debian being the first in the list supporting this new kernel "feature". ;)

bye,
  Roland
--- 67_init_hddown.dpatch.orig	2007-08-25 13:22:06.000000000 +0200
+++ 67_init_hddown.dpatch	2007-08-25 13:22:09.000000000 +0200
@@ -8,7 +8,15 @@
 @DPATCH@
 --- sysvinit-2.86.ds1/src/hddown.c	2004-06-09 14:47:45.000000000 +0200
 +++ sysvinit-2.86.ds1-new/src/hddown.c	2006-01-16 18:05:48.000000000 +0100
-@@ -25,18 +25,17 @@
+@@ -12,6 +12,7 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <dirent.h>
++#include <glob.h>
+ 
+ #ifdef __linux__
+ 
+@@ -25,18 +26,17 @@
  /*
   *	Find all IDE disks through /proc.
   */
@@ -29,7 +37,7 @@
  		if (strncmp(d->d_name, "hd", 2) != 0)
  			continue;
  		buf[0] = 0;
-@@ -50,21 +49,58 @@
+@@ -50,21 +50,67 @@
  		}
  		fclose(fp);
  		snprintf(buf, sizeof(buf), DEV_BASE "/%s", d->d_name);
@@ -50,14 +58,23 @@
 + */
 +static int find_scsidisks(const char **dev, int maxdev, int *count)
 +{
-+	if (*count < maxdev) dev[(*count)++] = DEV_BASE "/sda";
-+	if (*count < maxdev) dev[(*count)++] = DEV_BASE "/sdb";
-+	if (*count < maxdev) dev[(*count)++] = DEV_BASE "/sdc";
-+	if (*count < maxdev) dev[(*count)++] = DEV_BASE "/sdd";
-+	if (*count < maxdev) dev[(*count)++] = DEV_BASE "/sde";
-+	if (*count < maxdev) dev[(*count)++] = DEV_BASE "/sdf";
-+	if (*count < maxdev) dev[(*count)++] = DEV_BASE "/sdg";
-+	if (*count < maxdev) dev[(*count)++] = DEV_BASE "/sdh";
++#define MAX_SCSI_DISKS 8
++#define DEV_NAME (DEV_BASE "/sdX")
++#define DEV_NAME_SIZE sizeof(DEV_NAME)
++	static char devnames[MAX_SCSI_DISKS][DEV_NAME_SIZE];
++	int i;
++	glob_t gl;
++	char pattern[] =
++		"/sys/block/sdX/device/scsi_disk:*/manage_start_stop";
++
++	for (i = 0; i < MAX_SCSI_DISKS; i++) {
++		memcpy(devnames[i], DEV_NAME, DEV_NAME_SIZE);
++		devnames[i][DEV_NAME_SIZE - 2] = pattern[13] = 'a' + i;
++		if (glob(pattern, 0, NULL, &gl) == 0) /* found */
++			globfree(&gl);
++		else
++		        if (*count < maxdev) dev[(*count)++] = devnames[i];
++	}
 +
 +	return 0;
 +}
@@ -94,7 +111,7 @@
  {
  #ifndef WIN_STANDBYNOW1
  #define WIN_STANDBYNOW1 0xE0
-@@ -74,9 +110,8 @@
+@@ -74,9 +120,8 @@
  #endif
  	unsigned char args1[4] = {WIN_STANDBYNOW1,0,0,0};
  	unsigned char args2[4] = {WIN_STANDBYNOW2,0,0,0};
@@ -105,7 +122,7 @@
  		return -1;
  
  	if (ioctl(fd, HDIO_DRIVE_CMD, &args1) &&
-@@ -87,22 +122,37 @@
+@@ -87,22 +132,37 @@
  }
  
  /*

Reply via email to