aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/usage.h8
-rw-r--r--miscutils/Config.in8
-rw-r--r--miscutils/hdparm.c6
3 files changed, 20 insertions, 2 deletions
diff --git a/include/usage.h b/include/usage.h
index 60a9f99f2..1e489a5c6 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -835,6 +835,12 @@
#define USAGE_TRISTATE_HWIF(a)
#endif
+#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
+#define USAGE_GETSET_DMA(a) a
+#else
+#define USAGE_GETSET_DMA(a)
+#endif
+
#define hdparm_trivial_usage \
"[options] [device] .."
#define hdparm_full_usage \
@@ -845,7 +851,7 @@
" -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" \
+ USAGE_GETSET_DMA(" -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" \
diff --git a/miscutils/Config.in b/miscutils/Config.in
index 0c56f0ee9..a994c5096 100644
--- a/miscutils/Config.in
+++ b/miscutils/Config.in
@@ -100,6 +100,14 @@ config CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
and the '-b' option to get/set bus state. This is dangerous
stuff, so you should probably say N.
+config CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
+ bool " get/set using_dma flag (DANGEROUS)"
+ default n
+ depends on CONFIG_HDPARM
+ help
+ Enables the 'hdparm -d' option to get/set using_dma flag.
+ This is dangerous stuff, so you should probably say N.
+
config CONFIG_MAKEDEVS
bool "makedevs"
default n
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index eb4991ef3..0263f2893 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -1820,6 +1820,7 @@ static void process_dev (char *devname)
if (ioctl(fd, HDIO_SET_UNMASKINTR, unmask))
bb_perror_msg(" HDIO_SET_UNMASKINTR failed");
}
+#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
if (set_dma) {
no_scsi();
if (get_dma) {
@@ -1829,6 +1830,7 @@ static void process_dev (char *devname)
if (ioctl(fd, HDIO_SET_DMA, dma))
bb_perror_msg(" HDIO_SET_DMA failed");
}
+#endif /* CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA */
if (set_dma_q) {
no_scsi();
if (get_dma_q) {
@@ -2080,7 +2082,7 @@ static void process_dev (char *devname)
}
}
-#ifdef CONFIG_FEATURE_HDPARM_HDIO_GET_DMA
+#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
if ((verbose && !is_scsi_hd) || get_dma) {
no_scsi();
if (ioctl(fd, HDIO_GET_DMA, &parm))
@@ -2382,6 +2384,7 @@ int hdparm_main(int argc, char **argv)
unmask = *p++ - '0';
}
break;
+#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
case 'd':
get_dma = noisy;
noisy = 1;
@@ -2392,6 +2395,7 @@ int hdparm_main(int argc, char **argv)
dma = *p++ - '0';
}
break;
+#endif /* CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA */
case 'n':
get_nowerr = noisy;
noisy = 1;