Matteo Croce submitted a hdparm applet.

This commit is contained in:
Eric Andersen 2003-07-22 07:30:36 +00:00
parent 1ebcff191a
commit 3443bd7286
5 changed files with 2794 additions and 0 deletions

View File

@ -241,6 +241,9 @@
#ifdef CONFIG_HALT
APPLET(halt, halt_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_HDPARM
APPLET(hdparm, hdparm_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_HEAD
APPLET(head, head_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
#endif

View File

@ -805,6 +805,81 @@
#define halt_full_usage \
"Halt the system."
#ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY
#define USAGE_HDPARM_IDENT(a) a
#else
#define USAGE_HDPARM_IDENT(a)
#endif
#ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
#define USAGE_SCAN_HWIF(a) a
#else
#define USAGE_SCAN_HWIF(a)
#endif
#ifdef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
#define USAGE_UNREGISTER_HWIF(a) a
#else
#define USAGE_UNREGISTER_HWIF(a)
#endif
#ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET
#define USAGE_DRIVE_RESET(a) a
#else
#define USAGE_DRIVE_RESET(a)
#endif
#ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
#define USAGE_TRISTATE_HWIF(a) a
#else
#define USAGE_TRISTATE_HWIF(a)
#endif
#define hdparm_trivial_usage \
"[options] [device] .."
#define hdparm_full_usage \
"Options:" \
" -a get/set fs readahead\n" \
" -A set drive read-lookahead flag (0/1)\n" \
" -b get/set bus state (0 == off, 1 == on, 2 == tristate)\n" \
" -B set Advanced Power Management setting (1-255)\n" \
" -c get/set IDE 32-bit IO setting\n" \
" -C check IDE power mode status\n" \
" -d get/set using_dma flag\n" \
" -D enable/disable drive defect-mgmt\n" \
" -f flush buffer cache for device on exit\n" \
" -g display drive geometry\n" \
" -h display terse usage information\n" \
" -i display drive identification\n" \
USAGE_HDPARM_IDENT(" -I detailed/current information directly from drive\n") \
USAGE_HDPARM_IDENT(" -Istdin similar to -I, but wants /proc/ide/" "*" "/hd?/identify as input\n") \
" -k get/set keep_settings_over_reset flag (0/1)\n" \
" -K set drive keep_features_over_reset flag (0/1)\n" \
" -L set drive doorlock (0/1) (removable harddisks only)\n" \
" -m get/set multiple sector count\n" \
" -n get/set ignore-write-errors flag (0/1)\n" \
" -p set PIO mode on IDE interface chipset (0,1,2,3,4,...)\n" \
" -P set drive prefetch count\n" \
" -q change next setting quietly\n" \
" -Q get/set DMA tagged-queuing depth (if supported)\n" \
" -r get/set readonly flag (DANGEROUS to set)\n" \
USAGE_SCAN_HWIF(" -R register an IDE interface (DANGEROUS)\n") \
" -S set standby (spindown) timeout\n" \
" -t perform device read timings\n" \
" -T perform cache read timings\n" \
" -u get/set unmaskirq flag (0/1)\n" \
USAGE_UNREGISTER_HWIF(" -U un-register an IDE interface (DANGEROUS)\n") \
" -v defaults; same as -mcudkrag for IDE drives\n" \
" -V display program version and exit immediately\n" \
USAGE_DRIVE_RESET(" -w perform device reset (DANGEROUS)\n") \
" -W set drive write-caching flag (0/1) (DANGEROUS)\n" \
USAGE_TRISTATE_HWIF(" -x tristate device for hotswap (0/1) (DANGEROUS)\n") \
" -X set IDE xfer mode (DANGEROUS)\n" \
" -y put IDE drive in standby mode\n" \
" -Y put IDE drive to sleep\n" \
" -Z disable Seagate auto-powersaving mode\n" \
" -z re-read partition table\n"
#ifdef CONFIG_FEATURE_FANCY_HEAD
#define USAGE_FANCY_HEAD(a) a
#else

View File

@ -39,6 +39,56 @@ config CONFIG_DUTMP
help
Please submit a patch to add help text for this item.
config CONFIG_HDPARM
bool "hdparm"
default n
help
Get/Set hard drive parameters. Primarily intended for ATA
drives. Adds about 13k (or around 30k if you enable the
CONFIG_FEATURE_HDPARM_GET_IDENTITY option)....
config CONFIG_FEATURE_HDPARM_GET_IDENTITY
bool " Support obtaining detailed information directly from drives"
default y
depends on CONFIG_HDPARM
help
Enables the -I and -Istdin options to obtain detailed information
directly from drives about their capabilities and supported ATA
feature set. Enabling this option will add about 16k...
config CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
bool " Register an IDE interface (DANGEROUS)"
default n
depends on CONFIG_HDPARM
help
Enables the 'hdparm -R' option to register an IDE interface.
This is dangerous stuff, so you should probably say N.
config CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
bool " Un-register an IDE interface (DANGEROUS)"
default n
depends on CONFIG_HDPARM
help
Enables the 'hdparm -U' option to un-register an IDE interface.
This is dangerous stuff, so you should probably say N.
config CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET
bool " perform device reset (DANGEROUS)"
default n
depends on CONFIG_HDPARM
help
Enables the 'hdparm -w' option to perform a device reset.
This is dangerous stuff, so you should probably say N.
config CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
bool " tristate device for hotswap (DANGEROUS)"
default n
depends on CONFIG_HDPARM
help
Enables the 'hdparm -x' option to tristate device for hotswap,
and the '-b' option to get/set bus state. This is dangerous
stuff, so you should probably say N.
config CONFIG_MAKEDEVS
bool "makedevs"
default n

View File

@ -29,6 +29,7 @@ MISCUTILS-$(CONFIG_CROND) += crond.o
MISCUTILS-$(CONFIG_CRONTAB) += crontab.o
MISCUTILS-$(CONFIG_DC) += dc.o
MISCUTILS-$(CONFIG_DUTMP) += dutmp.o
MISCUTILS-$(CONFIG_HDPARM) += hdparm.o
MISCUTILS-$(CONFIG_MAKEDEVS) += makedevs.o
MISCUTILS-$(CONFIG_MT) += mt.o
MISCUTILS-$(CONFIG_STRINGS) += strings.o

2665
miscutils/hdparm.c Normal file

File diff suppressed because it is too large Load Diff