This commit is contained in:
parent
7829692707
commit
01e570923f
@ -1,5 +1,5 @@
|
|||||||
--- src/hddown.c
|
--- src/hddown.c
|
||||||
+++ src/hddown.c 2007-06-12 16:19:45.618059522 +0200
|
+++ src/hddown.c 2007-06-12 19:24:34.351142441 +0200
|
||||||
@@ -5,6 +5,9 @@
|
@@ -5,6 +5,9 @@
|
||||||
*/
|
*/
|
||||||
char *v_hddown = "@(#)hddown.c 1.02 22-Apr-2003 miquels@cistron.nl";
|
char *v_hddown = "@(#)hddown.c 1.02 22-Apr-2003 miquels@cistron.nl";
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -18,6 +21,315 @@ char *v_hddown = "@(#)hddown.c 1.02 22
|
@@ -18,6 +21,326 @@ char *v_hddown = "@(#)hddown.c 1.02 22
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <linux/hdreg.h>
|
#include <linux/hdreg.h>
|
||||||
|
|
||||||
@ -77,27 +77,13 @@
|
|||||||
+ if (ret != '0')
|
+ if (ret != '0')
|
||||||
+ continue; /* not a hard disk */
|
+ continue; /* not a hard disk */
|
||||||
+
|
+
|
||||||
+ fp = hdopen(SYS_BLK "/%s/size", d->d_name);
|
|
||||||
+ if ((long)fp <= 0) {
|
|
||||||
+ if ((long)fp < 0)
|
|
||||||
+ goto empty; /* error */
|
|
||||||
+ continue; /* no entry `size' */
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ptr = fgets(buf, sizeof(buf), fp);
|
|
||||||
+ fclose(fp);
|
|
||||||
+ if (ptr == (char*)0)
|
|
||||||
+ continue; /* should not happen */
|
|
||||||
+
|
|
||||||
+ ptr = strstrip(buf);
|
|
||||||
+ if (*ptr == '\0')
|
|
||||||
+ continue; /* should not happen */
|
|
||||||
+
|
|
||||||
+ if (((size_t)atoll(buf) >= (1<<28)) && flush_cache_ext(d->d_name))
|
|
||||||
+ (*flags) |= DISK_EXTFLUSH;
|
|
||||||
+
|
|
||||||
+ if (d->d_name[0] == 'h') {
|
+ if (d->d_name[0] == 'h') {
|
||||||
+ (*flags) |= DISK_IS_IDE;
|
+ (*flags) |= DISK_IS_IDE;
|
||||||
|
+ if ((ret = flush_cache_ext(d->d_name))) {
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ goto empty;
|
||||||
|
+ (*flags) |= DISK_EXTFLUSH;
|
||||||
|
+ }
|
||||||
+ break; /* old IDE disk not managed by kernel, out here */
|
+ break; /* old IDE disk not managed by kernel, out here */
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -150,6 +136,11 @@
|
|||||||
+ continue; /* no SATA but a real SCSI disk */
|
+ continue; /* no SATA but a real SCSI disk */
|
||||||
+
|
+
|
||||||
+ (*flags) |= (DISK_IS_IDE|DISK_IS_SATA);
|
+ (*flags) |= (DISK_IS_IDE|DISK_IS_SATA);
|
||||||
|
+ if ((ret = flush_cache_ext(d->d_name))) {
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ goto empty;
|
||||||
|
+ (*flags) |= DISK_EXTFLUSH;
|
||||||
|
+ }
|
||||||
+ break; /* new SATA disk to shutdown, out here */
|
+ break; /* new SATA disk to shutdown, out here */
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
@ -286,12 +277,32 @@
|
|||||||
+#endif
|
+#endif
|
||||||
+ unsigned char args[4+IDBYTES];
|
+ unsigned char args[4+IDBYTES];
|
||||||
+ unsigned short *id = (unsigned short*)(&args[4]);
|
+ unsigned short *id = (unsigned short*)(&args[4]);
|
||||||
+ char buf[NAME_MAX+1];
|
+ char buf[NAME_MAX+1], *ptr;
|
||||||
+ int fd = -1, ret = 0;
|
+ int fd = -1, ret = 0;
|
||||||
|
+ FILE *fp;
|
||||||
+
|
+
|
||||||
|
+ fp = hdopen(SYS_BLK "/%s/size", device);
|
||||||
|
+ if ((long)fp <= 0) {
|
||||||
|
+ if ((long)fp < 0)
|
||||||
|
+ return -1; /* error */
|
||||||
|
+ goto out; /* no entry `size' */
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ptr = fgets(buf, sizeof(buf), fp);
|
||||||
|
+ fclose(fp);
|
||||||
|
+ if (ptr == (char*)0)
|
||||||
|
+ goto out; /* should not happen */
|
||||||
|
+
|
||||||
|
+ ptr = strstrip(buf);
|
||||||
|
+ if (*ptr == '\0')
|
||||||
|
+ goto out; /* should not happen */
|
||||||
|
+
|
||||||
|
+ if ((size_t)atoll(buf) < (1<<28))
|
||||||
|
+ goto out; /* small disk */
|
||||||
|
+
|
||||||
+ ret = snprintf(buf, sizeof(buf), DEV_BASE "/%s", device);
|
+ ret = snprintf(buf, sizeof(buf), DEV_BASE "/%s", device);
|
||||||
+ if ((ret >= sizeof(buf)) || (ret < 0))
|
+ if ((ret >= sizeof(buf)) || (ret < 0))
|
||||||
+ return -1;
|
+ return -1; /* error */
|
||||||
+
|
+
|
||||||
+ if ((fd = open(buf, O_RDONLY|O_NONBLOCK)) < 0)
|
+ if ((fd = open(buf, O_RDONLY|O_NONBLOCK)) < 0)
|
||||||
+ goto out;
|
+ goto out;
|
||||||
@ -326,7 +337,7 @@
|
|||||||
#define MAX_DISKS 64
|
#define MAX_DISKS 64
|
||||||
#define PROC_IDE "/proc/ide"
|
#define PROC_IDE "/proc/ide"
|
||||||
#define DEV_BASE "/dev"
|
#define DEV_BASE "/dev"
|
||||||
@@ -104,7 +416,7 @@ int hddown(void)
|
@@ -104,7 +427,7 @@ int hddown(void)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jun 13 13:09:35 CEST 2007 - werner@suse.de
|
||||||
|
|
||||||
|
- bug #229210: avoid HDIO_DRIVE_CM ioctl for real SCSI disks.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jun 12 11:42:43 CEST 2007 - werner@suse.de
|
Tue Jun 12 11:42:43 CEST 2007 - werner@suse.de
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ Group: System/Base
|
|||||||
PreReq: coreutils
|
PreReq: coreutils
|
||||||
Autoreqprov: on
|
Autoreqprov: on
|
||||||
Version: 2.86
|
Version: 2.86
|
||||||
Release: 81
|
Release: 83
|
||||||
Summary: SysV-Style init
|
Summary: SysV-Style init
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
Source: sysvinit-2.86.tar.bz2
|
Source: sysvinit-2.86.tar.bz2
|
||||||
@ -282,6 +282,8 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||||||
%doc %{_mandir}/man8/startpar.8.gz
|
%doc %{_mandir}/man8/startpar.8.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 13 2007 - werner@suse.de
|
||||||
|
- bug #229210: avoid HDIO_DRIVE_CM ioctl for real SCSI disks.
|
||||||
* Tue Jun 12 2007 - werner@suse.de
|
* Tue Jun 12 2007 - werner@suse.de
|
||||||
- bug #229210: check for the FLUSH CACHE EXT capability for large
|
- bug #229210: check for the FLUSH CACHE EXT capability for large
|
||||||
disks and use this capability if available.
|
disks and use this capability if available.
|
||||||
|
Loading…
Reference in New Issue
Block a user