Skip to content

Commit

Permalink
HDPARM 6.9 for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
srctfux committed Jul 27, 2021
0 parents commit 43a1737
Show file tree
Hide file tree
Showing 30 changed files with 6,234 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Changelog text eol=lf
Changelog.* text eol=lf
LICENSE.* text eol=lf
Makefile text eol=lf
Makefile.* text eol=lf
README text eol=lf
README.* text eol=lf
*.c text eol=lf
*.h text eol=lf
232 changes: 232 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
hdparm-6.9
- added -s flag to control power-up in standby
(thanks to chrfranke)
- make --Istdin more robust
- added -I recognition of SMART Command Transport (SCT)
(thanks to chrfranke).
- fix X2 over-reporting of -T results
- add udma 3/4/5 modes to the -i results
hdparm-6.8
- improve parsing/operation of --Istdin function
hdparm-6.7
- 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
hdparm-6.6
- fix build for Redhat/Fedora systems.
- disable security commands when building on Redhat/Fedora,
as they lack the required data structures in the system headers.
hdparm-6.5
- fix -I bugs from version 6.4.
hdparm-6.4
- Makefile updates from Mikkel Krautz.
- manpage updates / corrections.
- fixed bug in -C code.
- major updates to bring -I information up to current specs.
hdparm-6.3
- added reporting of ATA revision numbers > 7
hdparm-6.2
- eliminated short form (-F) of --security-freeze flag
- completely revamped ATA Security Commands
(now they actually work sometimes)
courtesy of Leonard den Ottolander (a BIG thank-you!)
hdparm-6.1
- fix BLKGETSIZE bug introduced in 6.0
- man page clarification for -M (courtesy Stephen Gran)
hdparm-6.0
- correct usage of BLKGETSIZE64 (returns bytes instead of sectors)
- Added ATA Security switches (Benjamin Benz bbe[AT]heise[DOT]de)
hdparm-5.9
- fix security-mode display (Franz Lehner)
- fixed -W bug (Stephan Gran)
hdparm-5.8
- added HDIO_SET_WCACHE support to -W
- fixed double byteswap for big endian
- fixed %lld warnings on 64-bit architectures
- "hdparm -h" now goes to stdout instead of stderr
hdparm-5.7
- fixed output of NULs in -I string fields
- fixed big-endian -I crashes from 5.6
- removed remains of defunct major-number checks
- added support for BLKGETSIZE64 ioctl internally
- added --direct flag to use O_DIRECT on device open
- renamed -Istdin to --Istdin
- renamed -Istdout to --Istdout
- allow other flags to follow any of: -I, --Istdin, --Istdout
hdparm-5.6
- fixed reversed device names in idectl script
- renamed readahead variables to avoid new glibc conflicts
- added -Istdout flag to dump IDENTIFY data as hex
- removed MAJOR number checks to open up hdpar for SATA-SCSI drivers
hdparm-5.5
- added limited support for SCSI(-controlled) CDROM/optical drives
- incorporated various -I clean-up patches from Maciej W. Rozycki
- removed wordswap from capacity calculation: latest kenels already do it
- fixed slight issues with ATA Revision display
- added debian scripts from Stephan Gran
hdparm-5.4
- fixed 2.5.67 compile error (LVM_BLK_MAJOR)
- first attempt to support BIG_ENDIAN in identify.c
- converted -T and -t to use minimum timing intervals (2 and 3 seconds)
- fix device size overflow issue with -t
- hdparm -I: fixed device size output for devices with reversed endian.
- hdparm -i: added explanation for "*"
- slight formatting change for -Tt outputs
- fixed "(illegal value)" formatting
- added CCISS_MAJOR
- incorporated RedHat-8.0 and other patches
hdparm-5.3
- get rid of malloc()
- fix(?) BIG_ENDIAN problems
- fix -tT to work on very small drives
- fix -p output for parameters >= 100
hdparm-5.2
- compile fixes for latest 2.5.xx kernels
- moved -s from CFLAGS to LDFLAGS
- fixed manpage formatting error from 5.1
- -i was broken due to non-compatible changes in 2.5.xx
- the fix for -i now breaks hdparm -i for really old kernels
hdparm-5.1
- fixed segfault from -i on older drives
hdparm-5.0
- updated -I to most recent ATA6 draft standard
- added -Istdin to process input from /proc/ide/hd*/identify
- CFLAGS Makefile fix from Kevin P. Fleming
- -X mode names from Martin
- tweaked #include's for Slackware
- eliminate bogus "udma10" from -I output
- formatting fixes for -I from various people
- clean compile fixes from Steven Augart <steve@augart.com>
- allow -d parameters other than 0/1 for special uses
- removed busstate, acoustic, and nowerr from "-v" subset
- support for Pacific Digital ADMA-100i
hdparm-4.9
- fixed compile error with some kernels
hdparm-4.8
- updated -Q to take queue depth as parameter value
hdparm-4.7
- add -z option for BLKRRPART ("re-read partition table")
- add -Q option to turn on/off tagged queuing
- add -M option for acoustic feature set
- allow ANY value for the parameter to '-p' (user beware!)
- applied APM fixes from Gildas Bazin <gbazin@netcourrier.com>
hdparm-4.6
- fix version numbers, update DMA notes in manpage
hdparm-4.5
- ENDIAN tidyup, GETGEO fixes, Makefile fixes, mostly courtesy of Maciej W. Rozycki
hdparm-4.4
- add -b option, courtesy of Tim Hockin
hdparm-4.3
- display most fields as unsigned rather than signed values
hdparm-4.2
- completely new format/implementation of "-I" with much more detail
- code cleanups for newer libs/compilers
hdparm-4.1
- merge some changes from Andre
- code cleanups from Neil Macvicar and others
- improved output from -i for newer features
- incorporate RedHat-7.0 patches
hdparm-4.0
- no such release
hdparm-3.9
- added IDE_MAJOR[6-9]
- nuked the LBAsects display (again!)
hdparm-3.8
- fix display of drive capacity (Stephane Eranian <eranian@cello.hpl.hp.com>)
- new -E "set cdrom speed" option (Matthias Oster <Matthias.Oster@eikon.tum.de>)
- new -R and -U "(un)register hwif" options (Christian Lademann <cal@zls.de>)
- new contrib subdirectory with contributed scripts from users.
- support for display of newer PIO and DMA/UDMA modes
hdparm-3.7
- use O_NONBLOCK for open(), to handle drives with media removed
- make "HDIO_DRIVE_CMD failed" messages slightly more verbose
- get rid of "HDIO_GET_MULTCOUNT failed" from -i on non-disks
hdparm-3.6
- added new -V (version) option
- removed confusing LBA "remapping" geometry calculation
- small fix to "-I"
- Courtesy of Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>:
- added support for old XT drives
- transfer display in kB/s rather than in MB/s for slow disks
- fixed -v for SCSI disks
- added -L to lock/unlock door of removeable harddisks
- added udma modes 3,4,5..
- updated Makefile to use "destdir" prefix -- Ytiddo <ytiddo@dicksonstreet.com>
hdparm-3.5
- fixed compilation under older kernels
- fixed udma mode info under older kernels
hdparm-3.4
- added udma mode info
- added support for SCSI_DISK_MAJOR{0-7}
- fix -h (help) to show -y instead of -Y for "standby"
- fix display of drive SerialNo: 20 chars instead of just 8
- modify -C -y -Y to each try both possible command codes
- add interpretations for use of -X to set UltraDMA modes
- add -D for enable/disable drive defect-mgmt
hdparm-3.3
- add -C, -y, and -Y flags for IDE power management
hdparm-3.2
- force BLKFLSBUF after -T or -t -- kmg@barco.com
- fix minor -T/-t mixup in manpage -- hankedr@mail.auburn.edu
hdparm-3.1
- permit "-p" with values larger than 5 (for cmd640 readahead)
- updated version number on manpage (was way out of date!)
hdparm-3.0
- always touch each sector in read_big_block() -- Jon Burgess
- move cache timings to new -T option -- piercarl@sabi.demon.co.uk
hdparm-2.9:
- updated author's email address
hdparm-2.8:
- fixed compilation against older kernels
- changed "KB" to "kB"
- support for "-t" on "md" devices (from boris@xtalk.msk.su)
- removed "Estimating raw driver speed" message from "-t"
because it is likely very incorrect on faster systems
- added "-I" to re-issue IDENTIFY command to drive
hdparm-2.7:
- fixed .lsm file
- fixed "hdparm -c" (broken in 2.6) (kudos to clive@epos.demon.co.uk)
hdparm-2.6:
- tidied up manpage
- added support for HDIO_SET_PIO_MODE (kernel 1.3.61+)
- reduced codesize by combining fprintf's in help
hdparm-2.5:
- fixed -i display of eight character fwrev field
- rearranged output of -v
hdparm-2.4:
- added flag to turn on/off "using_dma" flag (kernel 1.3.22+)
- added warnings about CMD-640B and RZ1000 bugs to manpage ("-u1")
- cleaned up output from -c, added text interpretations
- added -c functionality to -v
- removed -a functionality from -v for scsi drives
- added -n flag for ignoring the "write error" bit from a drive
- moved binary from /usr/local/bin to /usr/local/sbin
- added support for 3rd/4th IDE interfaces
hdparm-2.3:
- added -c flag for controlling 32-bit chipset features with 1.2.9+
- fixed error messages when -t used on SCSI drives
- fixed date on man page to read 1995 rather than 1994 (late change)
hdparm-2.2:
- fixed a memory problem in my PC, and now BLKFLSBUF seems safe again
- fixed "help" line for "-v"
hdparm-2.1:
- fixed formatting of DMA info line
- added "(DANGEROUS)" to -u,-X,-W options in "hdparm -h"
- changed order in which settings are applied: placed standby last
hdparm-2.0:
- added this file to the distribution
- added -f and -q flags to hdparm.c and hdparm.8
- added -N to gcc in makefile
- changed installation paths to /usr/local/* in makefile
- removed meaningless CPU% measures
- removed -s and -x flags
- added new -AKPSWXZ flags using new HDIO_DRIVE_CMD ioctl
- removed BLKFLSBUF ioctl from everywhere except -t
(there may be a kernel bug in the implementation of BLKFLSBUF
when used on an active (mounted rw) filesystem).
- most features now require (E)IDE driver v2.6 or higher
(ide-2.6.patch.65+.gz)
9 changes: 9 additions & 0 deletions LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
BSD-Style Open Source License:

You may freely use, modify, and redistribute the hdparm program,
as either binary or source, or both.

The only condition is that my name and copyright notice
remain in the source code as-is.

Mark Lord (mlord@pobox.com)
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Makefile for hdparm

# DESTDIR is for non root installs (eg packages, NFS) only!
DESTDIR =

binprefix =
manprefix = /usr
exec_prefix = $(binprefix)/
sbindir = $(exec_prefix)sbin
mandir = $(manprefix)/share/man
oldmandir = $(manprefix)/man

ifndef CC
CC = gcc
endif
CFLAGS := -O2 -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs $(CFLAGS)


LDFLAGS = -s
INSTALL = install
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -m 755 -d
INSTALL_PROGRAM = $(INSTALL)

all: hdparm

hdparm: hdparm.o identify.o hdparm.h
$(CC) $(LDFLAGS) -o hdparm hdparm.o identify.o

install: all hdparm.8
if [ ! -z $(DESTDIR) ]; then $(INSTALL_DIR) $(DESTDIR) ; fi
if [ ! -z $(DESTDIR)$(sbindir) ]; then $(INSTALL_DIR) $(DESTDIR)$(sbindir) ; fi
if [ ! -z $(DESTDIR)$(mandir) ]; then $(INSTALL_DIR) $(DESTDIR)$(mandir) ; fi
if [ ! -z $(DESTDIR)$(mandir)/man8/ ]; then $(INSTALL_DIR) $(DESTDIR)$(mandir)/man8/ ; fi
if [ -f $(DESTDIR)$(sbindir)/hdparm ]; then rm -f $(DESTDIR)$(sbindir)/hdparm ; fi
if [ -f $(DESTDIR)$(mandir)/man8/hdparm.8 ]; then rm -f $(DESTDIR)$(mandir)/man8/hdparm.8 ;\
elif [ -f $(DESTDIR)$(oldmandir)/man8/hdparm.8 ]; then rm -f $(DESTDIR)$(oldmandir)/man8/hdparm.8 ; fi
$(INSTALL_PROGRAM) -D hdparm $(DESTDIR)$(sbindir)/hdparm
if [ -d $(DESTDIR)$(mandir) ]; then $(INSTALL_DATA) -D hdparm.8 $(DESTDIR)$(mandir)/man8/hdparm.8 ;\
elif [ -d $(DESTDIR)$(oldmandir) ]; then $(INSTALL_DATA) -D hdparm.8 $(DESTDIR)$(oldmandir)/man8/hdparm.8 ; fi

clean:
rm -f hdparm *.o core

48 changes: 48 additions & 0 deletions Makefile.cygwin
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Makefile for hdparm for Cygwin

DESTDIR =

binprefix = /usr
manprefix = /usr
exec_prefix = $(binprefix)/
sbindir = $(exec_prefix)sbin
mandir = $(manprefix)/share/man
oldmandir = $(manprefix)/man

CC = gcc
CFLAGS = -O2 -W -Wall

LDFLAGS = -s
INSTALL = install
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -m 755 -d
INSTALL_PROGRAM = $(INSTALL)

all: hdparm

hdparm.o: hdparm.h fs.h hdreg.h rawio.h shm.h version.h

identify.o: hdparm.h

rawio.o: rawio.h fs.h hdreg.h

shm.o: shm.h

hdparm: hdparm.o identify.o rawio.o shm.o
$(CC) $(LDFLAGS) -o $@ hdparm.o identify.o rawio.o shm.o

install: all hdparm.8
if [ ! -z $(DESTDIR) ]; then $(INSTALL_DIR) $(DESTDIR) ; fi
if [ ! -z $(DESTDIR)$(sbindir) ]; then $(INSTALL_DIR) $(DESTDIR)$(sbindir) ; fi
if [ ! -z $(DESTDIR)$(mandir) ]; then $(INSTALL_DIR) $(DESTDIR)$(mandir) ; fi
if [ ! -z $(DESTDIR)$(mandir)/man8/ ]; then $(INSTALL_DIR) $(DESTDIR)$(mandir)/man8/ ; fi
if [ -f $(DESTDIR)$(sbindir)/hdparm ]; then rm -f $(DESTDIR)$(sbindir)/hdparm ; fi
if [ -f $(DESTDIR)$(mandir)/man8/hdparm.8 ]; then rm -f $(DESTDIR)$(mandir)/man8/hdparm.8 ;\
elif [ -f $(DESTDIR)$(oldmandir)/man8/hdparm.8 ]; then rm -f $(DESTDIR)$(oldmandir)/man8/hdparm.8 ; fi
$(INSTALL_PROGRAM) -D hdparm $(DESTDIR)$(sbindir)/hdparm
if [ -d $(DESTDIR)$(mandir) ]; then $(INSTALL_DATA) -D hdparm.8 $(DESTDIR)$(mandir)/man8/hdparm.8 ;\
elif [ -d $(DESTDIR)$(oldmandir) ]; then $(INSTALL_DATA) -D hdparm.8 $(DESTDIR)$(oldmandir)/man8/hdparm.8 ; fi

clean:
rm -f hdparm.exe *.o

39 changes: 39 additions & 0 deletions Makefile.mingw32
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Mingw-w64 win32 Makefile

CC = i686-w64-mingw32-gcc
CFLAGS = -O2 -Wall -Wextra -ffunction-sections -fdata-sections -static
LDFLAGS = -s -Wl,--gc-sections


all: hdparm.exe

hdparm.exe: hdparm.o
$(CC) -o hdparm.exe hdparm.o identify.o rawio.o shm.o timer.o $(LDFLAGS)

hdparm.o: identify.o rawio.o shm.o timer.o
$(CC) $(CFLAGS) -o hdparm.o -c hdparm.c

identify.o:
$(CC) $(CFLAGS) -o identify.o -c identify.c

rawio.o:
$(CC) $(CFLAGS) -o rawio.o -c ./win32/rawio.c

shm.o:
$(CC) $(CFLAGS) -o shm.o -c ./win32/shm.c

timer.o:
$(CC) $(CFLAGS) -o timer.o -c ./win32/timer.c


doc: hdparm.8.html hdparm.8.txt

hdparm.8.html: hdparm.8
man2html hdparm.8 | sed 1d > hdparm.8.html

hdparm.8.txt: hdparm.8
groff -man -Tascii -P'-bcou' < hdparm.8 > hdparm.8.txt


clean:
rm -f hdparm.exe *.o hdparm.8.html hdparm.8.txt
Loading

0 comments on commit 43a1737

Please sign in to comment.