summaryrefslogtreecommitdiff
path: root/sbin/atactl/atactl.c
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2002-01-30 00:46:37 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2002-01-30 00:46:37 +0000
commitac5d23d3344c748e48da4be021208124e9163dd0 (patch)
tree03e047dd8219eddbe2f4009018404dde2e4cd6dd /sbin/atactl/atactl.c
parentdf9110fc04262051735916327f1da5971285d40c (diff)
atactl [ata device] dump
will dump the ATA trace buffers
Diffstat (limited to 'sbin/atactl/atactl.c')
-rw-r--r--sbin/atactl/atactl.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sbin/atactl/atactl.c b/sbin/atactl/atactl.c
index 38c8cb27a41..bfa9a278bbf 100644
--- a/sbin/atactl/atactl.c
+++ b/sbin/atactl/atactl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atactl.c,v 1.8 2001/07/07 18:26:09 deraadt Exp $ */
+/* $OpenBSD: atactl.c,v 1.9 2002/01/30 00:46:36 csapuntz Exp $ */
/* $NetBSD: atactl.c,v 1.4 1999/02/24 18:49:14 jwise Exp $ */
/*-
@@ -78,6 +78,7 @@ const char *cmdname; /* command user issued */
extern const char *__progname; /* from crt0.o */
+void device_dump(int, char*[]);
void device_identify __P((int, char *[]));
void device_setidle __P((int, char *[]));
void device_idle __P((int, char *[]));
@@ -88,6 +89,7 @@ void device_feature __P((int, char *[]));
void device_smart __P((int, char *[]));
struct command commands[] = {
+ { "dump", device_dump },
{ "identify", device_identify },
{ "setidle", device_setidle },
{ "setstandby", device_setidle },
@@ -315,6 +317,26 @@ print_bitinfo(f, bits, binfo)
* DEVICE COMMANDS
*/
+void
+device_dump(argc, argv)
+ int argc;
+ char *argv[];
+{
+ unsigned char buf[131072];
+ int error;
+ struct atagettrace agt = { sizeof(buf), &buf, 0 };
+
+ error = ioctl(fd, ATAIOGETTRACE, &agt);
+ if (error == -1) {
+ err(1, "ATAIOGETTRACE failed");
+ }
+
+ write(1, agt.buf, agt.bytes_copied);
+ fprintf(stderr, "%d bytes written\n", agt.bytes_copied);
+
+ return;
+}
+
/*
* device_identify:
*