forked from pool/hdparm
This commit is contained in:
parent
eab1f05dc9
commit
aa102ae591
@ -1,19 +0,0 @@
|
||||
--- hdparm.c
|
||||
+++ hdparm.c
|
||||
@@ -1290,14 +1290,14 @@
|
||||
if (get_acoustic) {
|
||||
printf(" setting acoustic management to %d\n", acoustic);
|
||||
}
|
||||
-#if 0
|
||||
+#if 1
|
||||
if (ioctl(fd, HDIO_SET_ACOUSTIC, acoustic))
|
||||
perror(" HDIO_SET_ACOUSTIC failed");
|
||||
#else
|
||||
{
|
||||
unsigned char args[4] = {WIN_SETFEATURES,0,0,0};
|
||||
- args[1] = acoustic;
|
||||
args[2] = acoustic ? 0x42 : 0xc2;
|
||||
+ args[3] = acoustic;
|
||||
if (ioctl(fd, HDIO_DRIVE_CMD, &args)) {
|
||||
err = errno;
|
||||
perror(" HDIO_DRIVE_CMD:ACOUSTIC failed");
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ceac61cf17376e2aaa65d8c4d7f74bd96d0cc7352a32937b5757dcad76549664
|
||||
size 56716
|
@ -1,30 +1,29 @@
|
||||
--- hdparm.c
|
||||
+++ hdparm.c
|
||||
@@ -401,18 +401,20 @@
|
||||
return 0;
|
||||
@@ -281,17 +281,20 @@
|
||||
}
|
||||
#endif
|
||||
rc = ioctl(fd, BLKGETSIZE, &blksize32); // returns sectors
|
||||
- if (rc)
|
||||
+ if (rc) {
|
||||
+ rc = errno;
|
||||
perror(" BLKGETSIZE failed");
|
||||
+ }
|
||||
+ }
|
||||
*blksize64 = blksize32;
|
||||
return rc;
|
||||
}
|
||||
|
||||
-void time_device (int fd)
|
||||
+int time_device (int fd)
|
||||
-static void time_device (int fd)
|
||||
+static int time_device (int fd)
|
||||
{
|
||||
char *buf;
|
||||
double elapsed;
|
||||
struct itimerval e1, e2;
|
||||
- int shmid;
|
||||
+ int shmid, err = 0;
|
||||
+ int err = 0;
|
||||
unsigned int max_iterations = 1024, total_MB, iterations;
|
||||
|
||||
/*
|
||||
@@ -421,23 +423,26 @@
|
||||
@@ -300,12 +303,12 @@
|
||||
if (do_ctimings || do_timings) {
|
||||
unsigned long long blksize;
|
||||
do_flush = 1;
|
||||
@ -32,38 +31,42 @@
|
||||
+ if (0 == (err = do_blkgetsize(fd, &blksize)))
|
||||
max_iterations = blksize / (2 * 1024) / TIMING_BUF_MB;
|
||||
}
|
||||
buf = prepare_timing_buf(TIMING_BUF_BYTES);
|
||||
if (!buf)
|
||||
- return;
|
||||
+ return 1;
|
||||
|
||||
if ((shmid = shmget(IPC_PRIVATE, TIMING_BUF_BYTES, 0600)) == -1) {
|
||||
+ err = errno;
|
||||
perror ("could not allocate sharedmem buf");
|
||||
- return;
|
||||
+ return err;
|
||||
}
|
||||
if (shmctl(shmid, SHM_LOCK, NULL) == -1) {
|
||||
+ err = errno;
|
||||
perror ("could not lock sharedmem buf");
|
||||
(void) shmctl(shmid, IPC_RMID, NULL);
|
||||
- return;
|
||||
+ return err;
|
||||
}
|
||||
if ((buf = shmat(shmid, (char *) 0, 0)) == (char *) -1) {
|
||||
+ err = errno;
|
||||
perror ("could not attach sharedmem buf");
|
||||
(void) shmctl(shmid, IPC_RMID, NULL);
|
||||
- return;
|
||||
+ return err;
|
||||
}
|
||||
if (shmctl(shmid, IPC_RMID, NULL) == -1)
|
||||
perror ("shmctl(,IPC_RMID,) failed");
|
||||
@@ -477,6 +482,7 @@
|
||||
printf(" Timing %s disk reads: ", (open_flags & O_DIRECT) ? "O_DIRECT" : "buffered");
|
||||
fflush(stdout);
|
||||
@@ -338,6 +341,7 @@
|
||||
quit:
|
||||
if (-1 == shmdt(buf))
|
||||
perror ("could not detach sharedmem buf");
|
||||
munlockall();
|
||||
munmap(buf, TIMING_BUF_BYTES);
|
||||
+ return err;
|
||||
}
|
||||
|
||||
static void on_off (unsigned int value)
|
||||
@@ -784,7 +790,7 @@
|
||||
static void dmpstr (const char *prefix, unsigned int i, const char *s[], unsigned int maxi)
|
||||
@@ -789,21 +793,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
-static void flush_wcache (int fd, __u16 **id_p)
|
||||
+static int flush_wcache (int fd, __u16 **id_p)
|
||||
{
|
||||
__u8 args[4] = {ATA_OP_FLUSHCACHE,0,0,0};
|
||||
__u16 *id;
|
||||
+ int err = 0;
|
||||
|
||||
*id_p = id = get_identify_data(fd, *id_p);
|
||||
if (id && (id[83] & 0xe000) == 0x6000)
|
||||
args[0] = ATA_OP_FLUSHCACHE_EXT;
|
||||
- if (do_drive_cmd(fd, args))
|
||||
+ if (do_drive_cmd(fd, args)) {
|
||||
+ err = errno;
|
||||
perror (" HDIO_DRIVE_CMD(flushcache) failed");
|
||||
+ }
|
||||
+ return err;
|
||||
}
|
||||
|
||||
void process_dev (char *devname)
|
||||
{
|
||||
@ -72,7 +75,7 @@
|
||||
static long parm, multcount;
|
||||
__u16 *id = (void *)-1;
|
||||
|
||||
@@ -800,14 +806,18 @@
|
||||
@@ -819,14 +827,18 @@
|
||||
if (set_fsreadahead) {
|
||||
if (get_fsreadahead)
|
||||
printf(" setting fs readahead to %d\n", fsreadahead);
|
||||
@ -93,7 +96,7 @@
|
||||
}
|
||||
if (scan_hwif) {
|
||||
int args[3];
|
||||
@@ -815,8 +825,10 @@
|
||||
@@ -834,8 +846,10 @@
|
||||
args[0] = hwif_data;
|
||||
args[1] = hwif_ctrl;
|
||||
args[2] = hwif_irq;
|
||||
@ -105,7 +108,7 @@
|
||||
}
|
||||
if (set_piomode) {
|
||||
if (get_piomode) {
|
||||
@@ -829,68 +841,86 @@
|
||||
@@ -848,68 +862,86 @@
|
||||
else
|
||||
printf(" attempting to set UDMA mode to %d\n", (piomode-200));
|
||||
}
|
||||
@ -201,7 +204,7 @@
|
||||
}
|
||||
if (set_doorlock) {
|
||||
__u8 args[4] = {0,0,0,0};
|
||||
@@ -899,8 +929,10 @@
|
||||
@@ -918,8 +950,10 @@
|
||||
printf(" setting drive doorlock to %d", doorlock);
|
||||
on_off(doorlock);
|
||||
}
|
||||
@ -213,7 +216,7 @@
|
||||
}
|
||||
if (set_dkeep) {
|
||||
/* lock/unlock the drive's "feature" settings */
|
||||
@@ -910,24 +942,30 @@
|
||||
@@ -929,24 +963,30 @@
|
||||
on_off(dkeep);
|
||||
}
|
||||
args[2] = dkeep ? 0x66 : 0xcc;
|
||||
@ -247,7 +250,7 @@
|
||||
}
|
||||
if (set_xfermode) {
|
||||
__u8 args[4] = {ATA_OP_SETFEATURES,0,3,0};
|
||||
@@ -936,8 +974,10 @@
|
||||
@@ -955,8 +995,10 @@
|
||||
printf(" setting xfermode to %d", xfermode_requested);
|
||||
interpret_xfermode(xfermode_requested);
|
||||
}
|
||||
@ -259,7 +262,7 @@
|
||||
}
|
||||
if (set_lookahead) {
|
||||
__u8 args[4] = {ATA_OP_SETFEATURES,0,0,0};
|
||||
@@ -946,8 +986,10 @@
|
||||
@@ -965,8 +1007,10 @@
|
||||
printf(" setting drive read-lookahead to %d", lookahead);
|
||||
on_off(lookahead);
|
||||
}
|
||||
@ -271,7 +274,7 @@
|
||||
}
|
||||
if (set_powerup_in_standby) {
|
||||
__u8 args[4] = {ATA_OP_SETFEATURES,0,0,0};
|
||||
@@ -982,14 +1024,18 @@
|
||||
@@ -1004,14 +1048,18 @@
|
||||
if (get_apmmode)
|
||||
printf(" 0x%02x (%d)\n",apmmode,apmmode);
|
||||
}
|
||||
@ -292,7 +295,7 @@
|
||||
}
|
||||
if (set_acoustic) {
|
||||
__u8 args[4];
|
||||
@@ -999,8 +1045,10 @@
|
||||
@@ -1021,8 +1069,10 @@
|
||||
args[1] = acoustic;
|
||||
args[2] = acoustic ? 0x42 : 0xc2;
|
||||
args[3] = 0;
|
||||
@ -303,28 +306,29 @@
|
||||
+ }
|
||||
}
|
||||
if (set_wcache) {
|
||||
__u8 flushcache1[4] = {ATA_OP_FLUSHCACHE,0,0,0};
|
||||
@@ -1013,11 +1061,16 @@
|
||||
if (get_wcache) {
|
||||
@@ -1030,15 +1080,17 @@
|
||||
on_off(wcache);
|
||||
}
|
||||
if (!wcache && do_drive_cmd(fd, flushcache1))
|
||||
perror (" HDIO_DRIVE_CMD(flushcache1) failed");
|
||||
- if (ioctl(fd, HDIO_SET_WCACHE, wcache))
|
||||
if (!wcache)
|
||||
- flush_wcache(fd, &id);
|
||||
+ err = flush_wcache(fd, &id);
|
||||
if (ioctl(fd, HDIO_SET_WCACHE, wcache)) {
|
||||
__u8 setcache[4] = {ATA_OP_SETFEATURES,0,0,0};
|
||||
setcache[2] = wcache ? 0x02 : 0x82;
|
||||
- if (do_drive_cmd(fd, setcache))
|
||||
+ if (ioctl(fd, HDIO_SET_WCACHE, wcache)) {
|
||||
+ if (do_drive_cmd(fd, setcache)) {
|
||||
+ err = errno;
|
||||
perror(" HDIO_DRIVE_CMD(setcache) failed");
|
||||
- if (!wcache && do_drive_cmd(fd, flushcache2))
|
||||
+ }
|
||||
+ }
|
||||
+ if (!wcache && do_drive_cmd(fd, flushcache2)) {
|
||||
+ err = errno;
|
||||
perror (" HDIO_DRIVE_CMD(flushcache2) failed");
|
||||
+ }
|
||||
}
|
||||
if (!wcache)
|
||||
- flush_wcache(fd, &id);
|
||||
+ err = flush_wcache(fd, &id);
|
||||
}
|
||||
if (set_standbynow) {
|
||||
__u8 args1[4] = {ATA_OP_STANDBYNOW1,0,0,0};
|
||||
@@ -1025,8 +1078,10 @@
|
||||
@@ -1046,8 +1098,10 @@
|
||||
if (get_standbynow)
|
||||
printf(" issuing standby command\n");
|
||||
if (do_drive_cmd(fd, args1)
|
||||
@ -336,7 +340,7 @@
|
||||
}
|
||||
if (set_sleepnow) {
|
||||
__u8 args1[4] = {ATA_OP_SLEEPNOW1,0,0,0};
|
||||
@@ -1034,8 +1089,10 @@
|
||||
@@ -1055,8 +1109,10 @@
|
||||
if (get_sleepnow)
|
||||
printf(" issuing sleep command\n");
|
||||
if (do_drive_cmd(fd, args1)
|
||||
@ -348,7 +352,7 @@
|
||||
}
|
||||
if (set_security) {
|
||||
do_set_security(fd);
|
||||
@@ -1043,15 +1100,19 @@
|
||||
@@ -1064,15 +1120,19 @@
|
||||
if (set_freeze) {
|
||||
__u8 args[4] = {ATA_OP_SECURITY_FREEZE_LOCK,0,0,0};
|
||||
printf(" issuing Security Freeze command\n");
|
||||
@ -370,7 +374,7 @@
|
||||
}
|
||||
if (set_standby) {
|
||||
__u8 args[4] = {ATA_OP_SETIDLE1,standby,0,0};
|
||||
@@ -1059,14 +1120,18 @@
|
||||
@@ -1080,14 +1140,18 @@
|
||||
printf(" setting standby to %u", standby);
|
||||
interpret_standby();
|
||||
}
|
||||
@ -391,7 +395,7 @@
|
||||
}
|
||||
if (do_drq_hsm_error) {
|
||||
id = get_identify_data(fd, id);
|
||||
@@ -1122,12 +1187,18 @@
|
||||
@@ -1143,12 +1207,18 @@
|
||||
break;
|
||||
default:printf("\?\?\?)\n");
|
||||
}
|
||||
@ -410,7 +414,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1138,6 +1209,9 @@
|
||||
@@ -1159,6 +1229,9 @@
|
||||
printf(" (DMA-Assisted-PIO)\n");
|
||||
else
|
||||
on_off(parm);
|
||||
@ -420,7 +424,7 @@
|
||||
}
|
||||
}
|
||||
if (get_dma_q) {
|
||||
@@ -1152,28 +1226,34 @@
|
||||
@@ -1173,28 +1246,34 @@
|
||||
if (0 == ioctl(fd, HDIO_GET_KEEPSETTINGS, &parm)) {
|
||||
printf(" keepsettings = %2ld", parm);
|
||||
on_off(parm);
|
||||
@ -461,7 +465,7 @@
|
||||
printf(" readahead = %2ld", parm);
|
||||
on_off(parm);
|
||||
}
|
||||
@@ -1188,12 +1268,13 @@
|
||||
@@ -1209,12 +1288,13 @@
|
||||
static struct hd_geometry g;
|
||||
static struct local_hd_big_geometry bg;
|
||||
|
||||
@ -478,7 +482,7 @@
|
||||
printf(msg, g.cylinders, g.heads, g.sectors, blksize, g.start);
|
||||
}
|
||||
}
|
||||
@@ -1202,9 +1283,10 @@
|
||||
@@ -1223,9 +1303,10 @@
|
||||
const char *state;
|
||||
if (do_drive_cmd(fd, args)
|
||||
&& (args[0] = ATA_OP_CHECKPOWERMODE2) /* (single =) try again with 0x98 */
|
||||
@ -491,7 +495,7 @@
|
||||
state = (args[2] == 255) ? "active/idle" : "standby";
|
||||
printf(" drive state is: %s\n", state);
|
||||
}
|
||||
@@ -1219,8 +1301,10 @@
|
||||
@@ -1240,8 +1321,10 @@
|
||||
dump_identity(id2);
|
||||
} else if (errno == -ENOMSG)
|
||||
printf(" no identification info available\n");
|
||||
@ -503,7 +507,7 @@
|
||||
}
|
||||
if (do_IDentity) {
|
||||
id = get_identify_data(fd, id);
|
||||
@@ -1273,39 +1357,46 @@
|
||||
@@ -1294,41 +1377,48 @@
|
||||
}
|
||||
}
|
||||
if (get_busstate) {
|
||||
@ -517,12 +521,15 @@
|
||||
}
|
||||
|
||||
if (do_ctimings)
|
||||
time_cache (fd);
|
||||
time_cache(fd);
|
||||
if (do_flush_wcache)
|
||||
- flush_wcache(fd, &id);
|
||||
+ err = flush_wcache(fd, &id);
|
||||
if (do_timings)
|
||||
- time_device (fd);
|
||||
+ err = time_device (fd);
|
||||
- time_device(fd);
|
||||
+ err = time_device(fd);
|
||||
if (do_flush)
|
||||
flush_buffer_cache (fd);
|
||||
flush_buffer_cache(fd);
|
||||
if (set_reread_partn) {
|
||||
if (get_reread_partn)
|
||||
printf(" re-reading partition table\n");
|
||||
@ -555,14 +562,3 @@
|
||||
}
|
||||
|
||||
static void usage_help (int rc)
|
||||
--- hdparm.h
|
||||
+++ hdparm.h
|
||||
@@ -19,7 +19,7 @@
|
||||
extern int seek_to_zero (int fd);
|
||||
extern int read_big_block (int fd, char *buf);
|
||||
extern void time_cache (int fd);
|
||||
-extern void time_device (int fd);
|
||||
+extern int time_device (int fd);
|
||||
extern void no_scsi (void);
|
||||
extern void no_xt (void);
|
||||
extern void process_dev (char *devname);
|
3
hdparm-7.6.tar.bz2
Normal file
3
hdparm-7.6.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:09f09ba33af61500ee1db5bde82f3c6c4e1252847bbadbf937a088157b88d7b3
|
||||
size 56816
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 20 00:36:36 CEST 2007 - ro@suse.de
|
||||
|
||||
- update to 7.6
|
||||
- added -F flag to flush on-drive write cache buffer
|
||||
- replaced use of shm* functions with of mmap()/mlock()
|
||||
- removed gcc -Wextra flag --> unsupported on Debian Sarge
|
||||
- re-allow use of --security-freeze in combination with other flags
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 8 00:51:18 CEST 2007 - ro@suse.de
|
||||
|
||||
|
18
hdparm.spec
18
hdparm.spec
@ -1,5 +1,5 @@
|
||||
#
|
||||
# spec file for package hdparm (Version 7.5)
|
||||
# spec file for package hdparm (Version 7.6)
|
||||
#
|
||||
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# This file and all modifications and additions to the pristine
|
||||
@ -16,17 +16,16 @@ Group: Hardware/Other
|
||||
PreReq: %insserv_prereq %fillup_prereq coreutils
|
||||
Provides: base:/sbin/hdparm
|
||||
Autoreqprov: on
|
||||
Version: 7.5
|
||||
Version: 7.6
|
||||
Release: 1
|
||||
Summary: A Program to Get and Set Hard Disk Parameters
|
||||
Source: hdparm-%{version}.tar.bz2
|
||||
Source1: 56-idedma.rules
|
||||
Source2: sysconfig.ide
|
||||
Source3: udev.idedma.sh
|
||||
Patch: hdparm-6.3-err_return.patch
|
||||
Patch: hdparm-7.6-err_return.patch
|
||||
Patch1: hdparm-5.8-silence.patch
|
||||
Patch2: hdparm-5.8-acoustic.patch
|
||||
Patch3: nostrip.patch
|
||||
Patch2: nostrip.patch
|
||||
URL: http://sourceforge.net/projects/hdparm/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
@ -44,8 +43,7 @@ Authors:
|
||||
%setup -q
|
||||
%patch
|
||||
%patch1
|
||||
#patch2
|
||||
%patch3
|
||||
%patch2
|
||||
|
||||
%build
|
||||
make CFLAGS="$RPM_OPT_FLAGS -Wall -Wstrict-prototypes" LDFLAGS=
|
||||
@ -114,6 +112,12 @@ fi
|
||||
/var/adm/fillup-templates/sysconfig.ide
|
||||
|
||||
%changelog
|
||||
* Wed Jun 20 2007 - ro@suse.de
|
||||
- update to 7.6
|
||||
- added -F flag to flush on-drive write cache buffer
|
||||
- replaced use of shm* functions with of mmap()/mlock()
|
||||
- removed gcc -Wextra flag --> unsupported on Debian Sarge
|
||||
- re-allow use of --security-freeze in combination with other flags
|
||||
* Fri Jun 08 2007 - ro@suse.de
|
||||
- update to 7.5
|
||||
- beef up warnings for -s1 flag, as people seem to be ignoring them
|
||||
|
Loading…
Reference in New Issue
Block a user