commit 0594fc5df2af131804430d41f4c722f2bba97b826ec2733a9a3f4352319ef76f Author: OBS User unknown Date: Mon Jan 15 23:16:28 2007 +0000 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hdparm?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/56-idedma.rules b/56-idedma.rules new file mode 100644 index 0000000..0c8649e --- /dev/null +++ b/56-idedma.rules @@ -0,0 +1,2 @@ +# start idedma script for each added IDE device +KERNEL=="hd*[!0-9]", ACTION=="add", RUN+="/lib/udev/idedma.sh /dev/%k" diff --git a/hdparm-5.8-acoustic.patch b/hdparm-5.8-acoustic.patch new file mode 100644 index 0000000..aa9866d --- /dev/null +++ b/hdparm-5.8-acoustic.patch @@ -0,0 +1,19 @@ +--- 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"); diff --git a/hdparm-5.8-silence.patch b/hdparm-5.8-silence.patch new file mode 100644 index 0000000..f35af6e --- /dev/null +++ b/hdparm-5.8-silence.patch @@ -0,0 +1,17 @@ +--- hdparm.c ++++ hdparm.c +@@ -292,11 +292,10 @@ + void flush_buffer_cache (int fd) + { + fsync (fd); /* flush buffers */ +- if (ioctl(fd, BLKFLSBUF, NULL)) /* do it again, big time */ +- perror("BLKFLSBUF failed"); ++ ioctl(fd, BLKFLSBUF, NULL); /* do it again, big time */ + #ifdef HDIO_DRIVE_CMD +- if (ioctl(fd, HDIO_DRIVE_CMD, NULL) && errno != EINVAL) /* await completion */ +- perror("HDIO_DRIVE_CMD(null) (wait for flush complete) failed"); ++ if (errno != EINVAL && errno != EOPNOTSUPP) ++ ioctl(fd, HDIO_DRIVE_CMD, NULL);/* await completion */ + #endif + } + diff --git a/hdparm-6.3-err_return.patch b/hdparm-6.3-err_return.patch new file mode 100644 index 0000000..7c4e588 --- /dev/null +++ b/hdparm-6.3-err_return.patch @@ -0,0 +1,600 @@ +--- hdparm.c ++++ hdparm.c +@@ -446,18 +446,20 @@ + return 0; + } + 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) + { + char *buf; + double elapsed; + struct itimerval e1, e2; +- int shmid; ++ int shmid, err = 0; + unsigned int max_iterations = 1024, total_MB, iterations; + + // +@@ -465,23 +467,26 @@ + // + if (do_ctimings || do_timings) { + unsigned long long blksize; +- if (0 == do_blkgetsize(fd, &blksize)) ++ if (0 == (err = do_blkgetsize(fd, &blksize))) + max_iterations = blksize / (2 * 1024) / TIMING_BUF_MB; + } + + 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"); +@@ -521,6 +526,7 @@ + quit: + if (-1 == shmdt(buf)) + perror ("could not detach sharedmem buf"); ++ return err; + } + + static void on_off (unsigned int value) +@@ -707,7 +713,7 @@ + + void process_dev (char *devname) + { +- int fd; ++ int fd, err = 0; + static long parm, multcount; + #ifndef HDIO_DRIVE_CMD + int force_operation = 0; +@@ -724,14 +730,18 @@ + if (set_fsreadahead) { + if (get_fsreadahead) + printf(" setting fs readahead to %ld\n", fsreadahead); +- if (ioctl(fd, BLKRASET, fsreadahead)) ++ if (ioctl(fd, BLKRASET, fsreadahead)) { ++ err = errno; + perror(" BLKRASET failed"); ++ } + } + #ifdef HDIO_UNREGISTER_HWIF + if (unregister_hwif) { + printf(" attempting to unregister hwif#%u\n", hwif); +- if (ioctl(fd, HDIO_UNREGISTER_HWIF, hwif)) ++ if (ioctl(fd, HDIO_UNREGISTER_HWIF, hwif)) { ++ err = errno; + perror(" HDIO_UNREGISTER_HWIF failed"); ++ } + } + #endif + #ifdef HDIO_SCAN_HWIF +@@ -741,8 +751,10 @@ + args[0] = hwif_data; + args[1] = hwif_ctrl; + args[2] = hwif_irq; +- if (ioctl(fd, HDIO_SCAN_HWIF, args)) ++ if (ioctl(fd, HDIO_SCAN_HWIF, args)) { ++ err = errno; + perror(" HDIO_SCAN_HWIF failed"); ++ } + } + #endif + #ifdef HDIO_SET_PIO_MODE +@@ -757,21 +769,27 @@ + else + printf(" attempting to set UDMA mode to %d\n", (piomode-200)); + } +- if (ioctl(fd, HDIO_SET_PIO_MODE, piomode)) ++ if (ioctl(fd, HDIO_SET_PIO_MODE, piomode)) { ++ err = errno; + perror(" HDIO_SET_PIO_MODE failed"); ++ } + } + #endif + if (set_io32bit) { + if (get_io32bit) + printf(" setting 32-bit IO_support flag to %ld\n", io32bit); +- if (ioctl(fd, HDIO_SET_32BIT, io32bit)) ++ if (ioctl(fd, HDIO_SET_32BIT, io32bit)) { ++ err = errno; + perror(" HDIO_SET_32BIT failed"); ++ } + } + if (set_mult) { + if (get_mult) + printf(" setting multcount to %ld\n", mult); +- if (ioctl(fd, HDIO_SET_MULTCOUNT, mult)) ++ if (ioctl(fd, HDIO_SET_MULTCOUNT, mult)) { ++ err = errno; + perror(" HDIO_SET_MULTCOUNT failed"); ++ } + #ifndef HDIO_DRIVE_CMD + else force_operation = 1; + #endif +@@ -781,16 +799,20 @@ + printf(" setting readonly to %ld", readonly); + on_off(readonly); + } +- if (ioctl(fd, BLKROSET, &readonly)) ++ if (ioctl(fd, BLKROSET, &readonly)) { ++ err = errno; + perror(" BLKROSET failed"); ++ } + } + if (set_unmask) { + if (get_unmask) { + printf(" setting unmaskirq to %ld", unmask); + on_off(unmask); + } +- if (ioctl(fd, HDIO_SET_UNMASKINTR, unmask)) ++ if (ioctl(fd, HDIO_SET_UNMASKINTR, unmask)) { ++ err = errno; + perror(" HDIO_SET_UNMASKINTR failed"); ++ } + } + #ifdef HDIO_SET_DMA + if (set_dma) { +@@ -798,8 +820,10 @@ + printf(" setting using_dma to %ld", dma); + on_off(dma); + } +- if (ioctl(fd, HDIO_SET_DMA, dma)) ++ if (ioctl(fd, HDIO_SET_DMA, dma)) { ++ err = errno; + perror(" HDIO_SET_DMA failed"); ++ } + } + #endif + #ifdef HDIO_SET_QDMA +@@ -808,8 +832,10 @@ + printf(" setting DMA queue_depth to %ld", dma_q); + on_off(dma_q); + } +- if (ioctl(fd, HDIO_SET_QDMA, dma_q)) ++ if (ioctl(fd, HDIO_SET_QDMA, dma_q)) { ++ err = errno; + perror(" HDIO_SET_QDMA failed"); ++ } + } + #endif + #ifdef HDIO_SET_NOWERR +@@ -818,8 +844,10 @@ + printf(" setting nowerr to %ld", nowerr); + on_off(nowerr); + } +- if (ioctl(fd, HDIO_SET_NOWERR, nowerr)) ++ if (ioctl(fd, HDIO_SET_NOWERR, nowerr)) { ++ err = errno; + perror(" HDIO_SET_NOWERR failed"); ++ } + } + #endif + #ifdef HDIO_GET_KEEPSETTINGS +@@ -828,8 +856,10 @@ + printf(" setting keep_settings to %ld", keep); + on_off(keep); + } +- if (ioctl(fd, HDIO_SET_KEEPSETTINGS, keep)) ++ if (ioctl(fd, HDIO_SET_KEEPSETTINGS, keep)) { ++ err = errno; + perror(" HDIO_SET_KEEPSETTINGS failed"); ++ } + } + #endif /* HDIO_GET_KEEPSETTINGS */ + if (set_doorlock) { +@@ -839,8 +869,10 @@ + printf(" setting drive doorlock to %ld", doorlock); + on_off(doorlock); + } +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(doorlock) failed"); ++ } + } + if (set_dkeep) { + /* lock/unlock the drive's "feature" settings */ +@@ -850,24 +882,30 @@ + on_off(dkeep); + } + args[2] = dkeep ? 0x66 : 0xcc; +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(keepsettings) failed"); ++ } + } + if (set_defects) { + unsigned char args[4] = {WIN_SETFEATURES,0,0x04,0}; + args[2] = defects ? 0x04 : 0x84; + if (get_defects) + printf(" setting drive defect management to %ld\n", defects); +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(defectmgmt) failed"); ++ } + } + if (set_prefetch) { + unsigned char args[4] = {WIN_SETFEATURES,0,0xab,0}; + args[1] = prefetch; + if (get_prefetch) + printf(" setting drive prefetch to %ld\n", prefetch); +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(setprefetch) failed"); ++ } + } + if (set_xfermode) { + unsigned char args[4] = {WIN_SETFEATURES,0,3,0}; +@@ -876,8 +914,10 @@ + printf(" setting xfermode to %d", xfermode_requested); + interpret_xfermode(xfermode_requested); + } +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(setxfermode) failed"); ++ } + } + if (set_lookahead) { + unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; +@@ -886,8 +926,10 @@ + printf(" setting drive read-lookahead to %ld", lookahead); + on_off(lookahead); + } +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(setreadahead) failed"); ++ } + } + if (set_apmmode) { + unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; +@@ -905,14 +947,18 @@ + args[1] = apmmode; /* sector count register */ + if (get_apmmode) printf(" 0x%02lX (%ld)\n",apmmode,apmmode); + } +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD failed"); ++ } + } + #ifdef CDROM_SELECT_SPEED + if (set_cdromspeed) { + printf ("setting cdrom speed to %ld\n", cdromspeed); +- if (ioctl (fd, CDROM_SELECT_SPEED, cdromspeed)) ++ if (ioctl (fd, CDROM_SELECT_SPEED, cdromspeed)) { ++ err = errno; + perror(" CDROM_SELECT_SPEED failed"); ++ } + } + #endif + if (set_wcache) { +@@ -929,13 +975,23 @@ + on_off(wcache); + } + #ifdef HDIO_SET_WCACHE +- if (ioctl(fd, HDIO_SET_WCACHE, wcache)) ++ if (ioctl(fd, HDIO_SET_WCACHE, wcache)) { + #endif +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(setcache) failed"); ++ } ++#ifdef HDIO_SET_WCACHE ++ } else { ++ err = errno; ++ perror(" HDIO_SET_WCACHE(wcache) failed"); ++ } ++#endif + #ifdef DO_FLUSHCACHE +- if (!wcache && ioctl(fd, HDIO_DRIVE_CMD, &flushcache)) ++ if (!wcache && ioctl(fd, HDIO_DRIVE_CMD, &flushcache)) { ++ err = errno; + perror (" HDIO_DRIVE_CMD(flushcache) failed"); ++ } + #endif /* DO_FLUSHCACHE */ + } + if (set_standbynow) { +@@ -950,8 +1006,10 @@ + if (get_standbynow) + printf(" issuing standby command\n"); + if (ioctl(fd, HDIO_DRIVE_CMD, &args1) +- && ioctl(fd, HDIO_DRIVE_CMD, &args2)) ++ && ioctl(fd, HDIO_DRIVE_CMD, &args2)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(standby) failed"); ++ } + } + if (set_sleepnow) { + #ifndef WIN_SLEEPNOW1 +@@ -965,8 +1023,10 @@ + if (get_sleepnow) + printf(" issuing sleep command\n"); + if (ioctl(fd, HDIO_DRIVE_CMD, &args1) +- && ioctl(fd, HDIO_DRIVE_CMD, &args2)) ++ && ioctl(fd, HDIO_DRIVE_CMD, &args2)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(sleep) failed"); ++ } + } + #ifdef WIN_SECURITY_FREEZE_LOCK + if (set_security) { +@@ -1093,8 +1153,10 @@ + unsigned char args[4] = {0xfb,0,0,0}; + if (get_seagate) + printf(" disabling Seagate auto powersaving mode\n"); +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(seagatepwrsave) failed"); ++ } + } + if (set_standby) { + unsigned char args[4] = {WIN_SETIDLE1,standby_requested,0,0}; +@@ -1102,8 +1164,10 @@ + printf(" setting standby to %lu", standby_requested); + interpret_standby(standby_requested); + } +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(setidle1) failed"); ++ } + } + + if (!flagcount) +@@ -1134,12 +1198,18 @@ + break; + default:printf("\?\?\?)\n"); + } ++ } else { ++ err = errno; ++ perror(" HDIO_GET_32BIT failed"); + } + } + if (verbose || get_unmask) { + if (0 == ioctl(fd, HDIO_GET_UNMASKINTR, &parm)) { + printf(" unmaskirq = %2ld", parm); + on_off(parm); ++ } else { ++ err = errno; ++ perror(" HDIO_GET_UNMASKINTR failed"); + } + } + +@@ -1151,12 +1221,16 @@ + printf(" (DMA-Assisted-PIO)\n"); + else + on_off(parm); ++ } else { ++ err = errno; ++ perror(" HDIO_GET_DMA failed"); + } + } + #endif + #ifdef HDIO_GET_QDMA + if (get_dma_q) { + if(ioctl(fd, HDIO_GET_QDMA, &parm)) { ++ err = errno; + perror(" HDIO_GET_QDMA failed"); + } else { + printf(" queue_depth = %2ld", parm); +@@ -1169,32 +1243,38 @@ + if (0 == ioctl(fd, HDIO_GET_KEEPSETTINGS, &parm)) { + printf(" keepsettings = %2ld", parm); + on_off(parm); ++ } else { ++ err = errno; ++ perror(" HDIO_GET_KEEPSETTINGS failed"); + } + } + #endif /* HDIO_GET_KEEPSETTINGS */ + + #ifdef HDIO_SET_NOWERR + if (get_nowerr) { +- if (ioctl(fd, HDIO_GET_NOWERR, &parm)) ++ if (ioctl(fd, HDIO_GET_NOWERR, &parm)) { ++ err = errno; + perror(" HDIO_GET_NOWERR failed"); +- else { ++ } else { + printf(" nowerr = %2ld", parm); + on_off(parm); + } + } + #endif + if (verbose || get_readonly) { +- if (ioctl(fd, BLKROGET, &parm)) ++ if (ioctl(fd, BLKROGET, &parm)) { ++ err = errno; + perror(" BLKROGET failed"); +- else { ++ } else { + printf(" readonly = %2ld", parm); + on_off(parm); + } + } + if (verbose || get_fsreadahead) { +- if (ioctl(fd, BLKRAGET, &parm)) ++ if (ioctl(fd, BLKRAGET, &parm)) { ++ err = errno; + perror(" BLKRAGET failed"); +- else { ++ } else { + printf(" readahead = %2ld", parm); + on_off(parm); + } +@@ -1209,15 +1289,16 @@ + static struct hd_big_geometry bg; + #endif + +- if (0 == do_blkgetsize(fd, &blksize)) { ++ if (0 == (err = do_blkgetsize(fd, &blksize))) { + #ifdef HDIO_GETGEO_BIG + if (!ioctl(fd, HDIO_GETGEO_BIG, &bg)) + printf(msg, bg.cylinders, bg.heads, bg.sectors, blksize, bg.start); + else + #endif +- if (ioctl(fd, HDIO_GETGEO, &g)) ++ if (ioctl(fd, HDIO_GETGEO, &g)) { ++ err = errno; + perror(" HDIO_GETGEO failed"); +- else ++ } else + printf(msg, g.cylinders, g.heads, g.sectors, blksize, g.start); + } + } +@@ -1234,6 +1315,7 @@ + if (ioctl(fd, HDIO_DRIVE_CMD, &args) + && (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */ + && ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + if (errno != EIO || args[0] != 0 || args[1] != 0) + state = "unknown"; + else +@@ -1246,15 +1328,19 @@ + #endif + #ifdef HDIO_DRIVE_RESET + if (perform_reset) { +- if (ioctl(fd, HDIO_DRIVE_RESET, NULL)) ++ if (ioctl(fd, HDIO_DRIVE_RESET, NULL)) { ++ err = errno; + perror(" HDIO_DRIVE_RESET failed"); ++ } + } + #endif /* HDIO_DRIVE_RESET */ + #ifdef HDIO_TRISTATE_HWIF + if (perform_tristate) { + unsigned char args[4] = {0,tristate,0,0}; +- if (ioctl(fd, HDIO_TRISTATE_HWIF, &args)) ++ if (ioctl(fd, HDIO_TRISTATE_HWIF, &args)) { ++ err = errno; + perror(" HDIO_TRISTATE_HWIF failed"); ++ } + } + #endif /* HDIO_TRISTATE_HWIF */ + if (get_identity) { +@@ -1269,8 +1355,10 @@ + dump_identity(&id); + } else if (errno == -ENOMSG) + printf(" no identification info available\n"); +- else ++ else { ++ err = errno; + perror(" HDIO_GET_IDENTITY failed"); ++ } + } + if (get_IDentity) { + __u16 *id; +@@ -1279,6 +1367,7 @@ + if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { + args[0] = WIN_PIDENTIFY; + if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD(identify) failed"); + goto identify_abort; + } +@@ -1303,15 +1392,18 @@ + printf(" setting bus state to %d", busstate); + bus_state_value(busstate); + } +- if (ioctl(fd, HDIO_SET_BUSSTATE, busstate)) ++ if (ioctl(fd, HDIO_SET_BUSSTATE, busstate)) { ++ err = errno; + perror(" HDIO_SET_BUSSTATE failed"); ++ } + } + #endif + #ifdef HDIO_GET_BUSSTATE + if (get_busstate) { +- if (ioctl(fd, HDIO_GET_BUSSTATE, &parm)) ++ if (ioctl(fd, HDIO_GET_BUSSTATE, &parm)) { ++ err = errno; + perror(" HDIO_GET_BUSSTATE failed"); +- else { ++ } else { + printf(" busstate = %2ld", parm); + bus_state_value(parm); + } +@@ -1319,6 +1411,7 @@ + #endif + if (reread_partn) { + if (ioctl(fd, BLKRRPART, NULL)) { ++ err = errno; + perror(" BLKRRPART failed"); + } + } +@@ -1335,8 +1428,10 @@ + unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; + args[1] = acoustic; + args[2] = acoustic ? 0x42 : 0xc2; +- if (ioctl(fd, HDIO_DRIVE_CMD, &args)) ++ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) { ++ err = errno; + perror(" HDIO_DRIVE_CMD:ACOUSTIC failed"); ++ } + } + #endif + } +@@ -1344,6 +1439,7 @@ + #ifdef HDIO_GET_ACOUSTIC + if (get_acoustic) { + if (ioctl(fd, HDIO_GET_ACOUSTIC, &parm)) { ++ err = errno; + perror(" HDIO_GET_ACOUSTIC failed"); + } else { + printf(" acoustic = %2ld (128=quiet ... 254=fast)\n", parm); +@@ -1354,10 +1450,11 @@ + if (do_ctimings) + time_cache (fd); + if (do_timings) +- time_device (fd); ++ err = time_device (fd); + if (do_flush) + flush_buffer_cache (fd); + close (fd); ++ exit(err); + } + + void usage_error (int out) +--- 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); diff --git a/hdparm-6.9.tar.bz2 b/hdparm-6.9.tar.bz2 new file mode 100644 index 0000000..526fec8 --- /dev/null +++ b/hdparm-6.9.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc7de2aebec2b9eefe9b32fb488e27690a614398f72e261b8ab124b596dd46db +size 43009 diff --git a/hdparm.changes b/hdparm.changes new file mode 100644 index 0000000..f63123d --- /dev/null +++ b/hdparm.changes @@ -0,0 +1,198 @@ +------------------------------------------------------------------- +Sat Oct 28 15:53:07 CEST 2006 - aj@suse.de + +- Update to version 6.9, changes since 6.6 are: + * added -s flag to control power-up in standby + * make --Istdin more robust + * added -I recognition of SMART Command Transport (SCT) + * fix X2 over-reporting of -T results + * add udma 3/4/5 modes to the -i results + * improve parsing/operation of --Istdin function + * don't default to "-v" when only new "--" longopts are used. + * calculate integrity word if not correct + * remove used code/parameter from identify() + * fix "(null)" strings from the "Drive conforms to" line of -I + * tidied up usage of prefix vars in Makefile + * fix bug in -C implementation + * new -H flag for (Hitachi) drive temperature + +------------------------------------------------------------------- +Mon Jun 12 01:35:33 CEST 2006 - ro@suse.de + +- update to version 6.6 + - manpage updates / corrections. + - fixed bug in -C code. + - major updates to bring -I information up to current specs. + +------------------------------------------------------------------- +Mon May 22 20:47:16 CEST 2006 - schwab@suse.de + +- Don't strip binaries. + +------------------------------------------------------------------- +Wed Jan 25 21:36:26 CET 2006 - mls@suse.de + +- converted neededforbuild to BuildRequires + +------------------------------------------------------------------- +Wed Nov 30 12:32:06 CET 2005 - ro@suse.de + +- moved udev helper script to /lib/udev + +------------------------------------------------------------------- +Tue Oct 25 14:09:13 CEST 2005 - ro@suse.de + +- update to version 6.3 + +------------------------------------------------------------------- +Fri Oct 7 13:08:15 CEST 2005 - ro@suse.de + +- added udev rule 56-idedma.rules +- moved sysconfig/ide from aaa_base to this package + (and all the legacy postinstall code with it) + +------------------------------------------------------------------- +Mon Apr 18 16:49:23 CEST 2005 - ro@suse.de + +- update to 6.1 + +------------------------------------------------------------------- +Tue Mar 8 01:27:31 CET 2005 - ro@suse.de + +- use HDIO_SET_ACOUSTIC + +------------------------------------------------------------------- +Fri Feb 11 15:24:00 CET 2005 - ro@suse.de + +- update to 5.9 + +------------------------------------------------------------------- +Wed Feb 2 17:33:15 CET 2005 - ro@suse.de + +- fix set acoustic (#48595) + +------------------------------------------------------------------- +Fri Nov 5 11:01:00 CET 2004 - ro@suse.de + +- update to 5.8 +- remove-dup-swap.patch has been merged upstream + +------------------------------------------------------------------- +Thu Oct 21 00:36:50 CEST 2004 - ro@suse.de + +- silence errors for BLKFLSBUF (#45057) + +------------------------------------------------------------------- +Tue Oct 12 12:58:26 CEST 2004 - ro@suse.de + +- added contrib files to doc (#47105) + +------------------------------------------------------------------- +Sun Sep 5 00:24:43 CEST 2004 - ro@suse.de + +- update to 5.7 +- removed obsolete lvm patch +- recreated err_return patch again + +------------------------------------------------------------------- +Tue Aug 17 12:07:01 CEST 2004 - ro@suse.de + +- update to 5.6 +- recreated err_return patch +- readahead.patch is obsolete + +------------------------------------------------------------------- +Wed May 12 15:51:31 CEST 2004 - meissner@suse.de + +- Removed duplicated byte swapping on big endian, it + is no longer needed. (SUSE#39628/LTC#7961) + +------------------------------------------------------------------- +Tue Feb 3 11:47:09 CET 2004 - ro@suse.de + +- update to hdparm-5.5 +- added limited support for SCSI(-controlled) CDROM/optical drives + +------------------------------------------------------------------- +Tue Jan 27 01:34:55 CET 2004 - ro@suse.de + +- rename variable readahead (glibc using this as a function) + +------------------------------------------------------------------- +Thu Nov 6 15:46:58 CET 2003 - ro@suse.de + +- added README.acoustic (#32917) + +------------------------------------------------------------------- +Mon Oct 20 02:05:21 CEST 2003 - ro@suse.de + +- use defattr +- don't build as root + +------------------------------------------------------------------- +Sun Jul 6 10:46:11 CEST 2003 - ro@suse.de + +- update to 5.4 with new timing code + +------------------------------------------------------------------- +Tue Jun 3 23:15:39 CEST 2003 - olh@suse.de + +- add hdparm-5.3-dump_identity-endian.dif + do not swap the id->cur_capacity0/1 values in userland + +------------------------------------------------------------------- +Mon May 12 14:32:40 CEST 2003 - ro@suse.de + +- define LVM_BLK_MAJOR if not defined + +------------------------------------------------------------------- +Wed Mar 26 17:09:58 CET 2003 - ro@suse.de + +- fix timing test for large disks (#25861) + +------------------------------------------------------------------- +Wed Mar 12 14:02:10 CET 2003 - ro@suse.de + +- added patch to return an error for most failed ioctls + (not all, because cdroms always fail for e.g. HDIO_GETGEO) + +------------------------------------------------------------------- +Wed Nov 27 11:23:08 CET 2002 - ro@suse.de + +- update (v5.3 endian fixes, other stuff) + +------------------------------------------------------------------- +Thu Aug 1 16:17:25 CEST 2002 - ro@suse.de + +- update to 5.2 + . updated -Q to take queue depth as parameter value + . formatting fixes for -I from various people + . updated -I to most recent ATA6 draft standard + . various compile fixes + +------------------------------------------------------------------- +Thu Apr 25 12:17:53 CEST 2002 - ro@suse.de + +- added patch from axboe to make TCQ work + +------------------------------------------------------------------- +Thu Apr 25 11:52:59 CEST 2002 - ro@suse.de + +- up to vanilla hdparm-4.7 +- use buildroot + +------------------------------------------------------------------- +Tue Sep 4 18:04:18 CEST 2001 - ro@suse.de + +- update to 4.1 (mostly merged changes from andre's patch) + +------------------------------------------------------------------- +Thu Mar 22 18:51:02 CET 2001 - ro@suse.de + +- added split-aliases as provides + +------------------------------------------------------------------- +Thu Mar 15 02:18:02 CET 2001 - ro@suse.de + +- split from base + diff --git a/hdparm.spec b/hdparm.spec new file mode 100644 index 0000000..c4f7118 --- /dev/null +++ b/hdparm.spec @@ -0,0 +1,203 @@ +# +# spec file for package hdparm (Version 6.9) +# +# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +# norootforbuild + +Name: hdparm +License: Freely Redistributable Software (FSR) +Group: Hardware/Other +PreReq: %insserv_prereq %fillup_prereq coreutils +Provides: base:/sbin/hdparm +Autoreqprov: on +Version: 6.9 +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 +Patch1: hdparm-5.8-silence.patch +Patch2: hdparm-5.8-acoustic.patch +URL: http://sourceforge.net/projects/hdparm/ +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +A shell utility to access and tune the ioctl features of the Linux IDE +driver and IDE drives. + + + +Authors: +-------- + Mark Lord + +%prep +%setup -q +%patch +%patch1 +%patch2 + +%build +make CFLAGS="$RPM_OPT_FLAGS -Wall -Wstrict-prototypes" LDFLAGS= + +%install +mkdir -p $RPM_BUILD_ROOT/sbin +mkdir -p $RPM_BUILD_ROOT/usr/share/man/man8 +make install DESTDIR=$RPM_BUILD_ROOT +mv contrib/README contrib/README.contrib +install -d $RPM_BUILD_ROOT/etc/udev/rules.d +install -m 644 %{S:1} $RPM_BUILD_ROOT/etc/udev/rules.d +install -d $RPM_BUILD_ROOT/var/adm/fillup-templates +install %{S:2} $RPM_BUILD_ROOT/var/adm/fillup-templates +install -d $RPM_BUILD_ROOT/lib/udev +install -m 755 %{S:3} $RPM_BUILD_ROOT/lib/udev/idedma.sh + +%post +if [ -f etc/sysconfig/hardware ] ; then + mv etc/sysconfig/hardware etc/sysconfig/ide +fi +%{remove_and_set -n ide DEVICES_FORCE_IDE_DMA_ON DEVICES_FORCE_IDE_DMA_OFF} +%{fillup_only -n ide} +# new settings +NEW_DMA="" +# convert old settings +if [ "$DEVICES_FORCE_IDE_DMA_ON" != "" -a "$DEVICES_FORCE_IDE_DMA_ON" != "no" ] ; then + for dev in $DEVICES_FORCE_IDE_DMA_ON; do + NEW_DMA="${NEW_DMA:+$NEW_DMA }/dev/$dev:on" + done +fi +if [ "$DEVICES_FORCE_IDE_DMA_OFF" != "" -a "$DEVICES_FORCE_IDE_DMA_OFF" != "no" ] ; then + for dev in $DEVICES_FORCE_IDE_DMA_OFF; do + NEW_DMA="${NEW_DMA:+$NEW_DMA }/dev/$dev:off" + done +fi +# update sysconfig file +if [ "$NEW_DMA" != "" ] ; then + echo "Updating etc/sysconfig/ide" + # remove old values, update new variable + sed -e "s|^DEVICES_FORCE_IDE_DMA=\"\\(.*\\)\"|DEVICES_FORCE_IDE_DMA=\"$NEW_DMA \\1\"|" \ + etc/sysconfig/ide > etc/sysconfig/ide.new \ + && mv etc/sysconfig/ide.new etc/sysconfig/ide + rm -f etc/sysconfig/ide.new +fi + +%files +%defattr(-,root,root) +%doc Changelog README.acoustic contrib/* +%doc %{_mandir}/man8/hdparm.8.gz +/sbin/hdparm +%dir /lib/udev +/lib/udev/idedma.sh +%dir /etc/udev +%dir /etc/udev/rules.d +/etc/udev/rules.d/56-idedma.rules +/var/adm/fillup-templates/sysconfig.ide + +%changelog -n hdparm +* Sat Oct 28 2006 - aj@suse.de +- Update to version 6.9, changes since 6.6 are: + * added -s flag to control power-up in standby + * make --Istdin more robust + * added -I recognition of SMART Command Transport (SCT) + * fix X2 over-reporting of -T results + * add udma 3/4/5 modes to the -i results + * improve parsing/operation of --Istdin function + * don't default to "-v" when only new "--" longopts are used. + * calculate integrity word if not correct + * remove used code/parameter from identify() + * fix "(null)" strings from the "Drive conforms to" line of -I + * tidied up usage of prefix vars in Makefile + * fix bug in -C implementation + * new -H flag for (Hitachi) drive temperature +* Mon Jun 12 2006 - ro@suse.de +- update to version 6.6 + - manpage updates / corrections. + - fixed bug in -C code. + - major updates to bring -I information up to current specs. +* Mon May 22 2006 - schwab@suse.de +- Don't strip binaries. +* Wed Jan 25 2006 - mls@suse.de +- converted neededforbuild to BuildRequires +* Wed Nov 30 2005 - ro@suse.de +- moved udev helper script to /lib/udev +* Tue Oct 25 2005 - ro@suse.de +- update to version 6.3 +* Fri Oct 07 2005 - ro@suse.de +- added udev rule 56-idedma.rules +- moved sysconfig/ide from aaa_base to this package + (and all the legacy postinstall code with it) +* Mon Apr 18 2005 - ro@suse.de +- update to 6.1 +* Tue Mar 08 2005 - ro@suse.de +- use HDIO_SET_ACOUSTIC +* Fri Feb 11 2005 - ro@suse.de +- update to 5.9 +* Wed Feb 02 2005 - ro@suse.de +- fix set acoustic (#48595) +* Fri Nov 05 2004 - ro@suse.de +- update to 5.8 +- remove-dup-swap.patch has been merged upstream +* Thu Oct 21 2004 - ro@suse.de +- silence errors for BLKFLSBUF (#45057) +* Tue Oct 12 2004 - ro@suse.de +- added contrib files to doc (#47105) +* Sun Sep 05 2004 - ro@suse.de +- update to 5.7 +- removed obsolete lvm patch +- recreated err_return patch again +* Tue Aug 17 2004 - ro@suse.de +- update to 5.6 +- recreated err_return patch +- readahead.patch is obsolete +* Wed May 12 2004 - meissner@suse.de +- Removed duplicated byte swapping on big endian, it + is no longer needed. (SUSE#39628/LTC#7961) +* Tue Feb 03 2004 - ro@suse.de +- update to hdparm-5.5 +- added limited support for SCSI(-controlled) CDROM/optical drives +* Tue Jan 27 2004 - ro@suse.de +- rename variable readahead (glibc using this as a function) +* Thu Nov 06 2003 - ro@suse.de +- added README.acoustic (#32917) +* Mon Oct 20 2003 - ro@suse.de +- use defattr +- don't build as root +* Sun Jul 06 2003 - ro@suse.de +- update to 5.4 with new timing code +* Tue Jun 03 2003 - olh@suse.de +- add hdparm-5.3-dump_identity-endian.dif + do not swap the id->cur_capacity0/1 values in userland +* Mon May 12 2003 - ro@suse.de +- define LVM_BLK_MAJOR if not defined +* Wed Mar 26 2003 - ro@suse.de +- fix timing test for large disks (#25861) +* Wed Mar 12 2003 - ro@suse.de +- added patch to return an error for most failed ioctls + (not all, because cdroms always fail for e.g. HDIO_GETGEO) +* Wed Nov 27 2002 - ro@suse.de +- update (v5.3 endian fixes, other stuff) +* Thu Aug 01 2002 - ro@suse.de +- update to 5.2 + . updated -Q to take queue depth as parameter value + . formatting fixes for -I from various people + . updated -I to most recent ATA6 draft standard + . various compile fixes +* Thu Apr 25 2002 - ro@suse.de +- added patch from axboe to make TCQ work +* Thu Apr 25 2002 - ro@suse.de +- up to vanilla hdparm-4.7 +- use buildroot +* Tue Sep 04 2001 - ro@suse.de +- update to 4.1 (mostly merged changes from andre's patch) +* Thu Mar 22 2001 - ro@suse.de +- added split-aliases as provides +* Thu Mar 15 2001 - ro@suse.de +- split from base diff --git a/ready b/ready new file mode 100644 index 0000000..473a0f4 diff --git a/sysconfig.ide b/sysconfig.ide new file mode 100644 index 0000000..7aa3e67 --- /dev/null +++ b/sysconfig.ide @@ -0,0 +1,12 @@ +## Path: Hardware/IDE +## Description: IDE device settings +## Type: string +## Default: "" +# +# Force DMA mode for selected device. Use pairs : separated +# by space - dma_mode can be "on" (enable default DMA mode), "off" (disable DMA +# mode) or any mode supported by hdparm (e.g. "mdma2", "udma5", ...) +# Example: "/dev/hdc:off /dev/hdd:udma2" +# +DEVICES_FORCE_IDE_DMA="" + diff --git a/udev.idedma.sh b/udev.idedma.sh new file mode 100644 index 0000000..8274da0 --- /dev/null +++ b/udev.idedma.sh @@ -0,0 +1,65 @@ +#! /bin/sh +# Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany +# +# Author: Ladislav Slezak +# +# System script for enabling/disabling IDE DMA mode +# +# The script takes the first command line parameter and sets the configured DMA +# mode up. If the device is not configured in DEVICES_FORCE_IDE_DMA variable DMA +# status is not changed. +# + +HDPARM=/sbin/hdparm +test -x $HDPARM || exit 5 + +# read values from sysconfig +. /etc/sysconfig/ide + +if [ "$DEVICES_FORCE_IDE_DMA" = "" -o $1 = "" ] ; then + exit 0; +fi + + +OLDIFS=$IFS +for dev in $DEVICES_FORCE_IDE_DMA ; do + # Get device and DMA mode + + MODE="" + DEVICE="" + OPTIONS="" + FIRST=0 + + # The setting e.g. "/dev/hda:69:-c1:-m16:-u1:-W1:-A1" should be + # expanded as "hdparm -d 1 -X 69 -c1 -m16 -u1 -W1 -A1 /dev/hda" + + IFS=":" + for d in $dev ; do + case $((FIRST++)) in + 0) DEVICE=$d ;; + 1) MODE=$d ;; + *) OPTIONS="$OPTIONS$d:" + esac + done + unset d + + if [ "$DEVICE" == "$1" ] ; then + echo "$DEVICE: setting up IDE DMA mode $MODE" + + # Set DMA mode by hdparm utility + if [ -z "$MODE" ] ; then + echo "Missing DMA mode for device $DEVICE" + elif [ $MODE = "off" ] ; then + $HDPARM -d 0 "$DEVICE" + elif [ $MODE = "on" ] ; then + $HDPARM -d 1 "$DEVICE" + else + $HDPARM -d 1 -X "$MODE" ${OPTIONS:+$OPTIONS} "$DEVICE" + fi + fi + + # Reset Internal Field Separator for the outer loop + IFS=$OLDIFS +done +unset dev +