summaryrefslogtreecommitdiff
path: root/usr.sbin/acpidump/aml_dump.c
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2007-02-22 19:09:27 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2007-02-22 19:09:27 +0000
commit7b957b62ebc65d4f300af06463bb68b56cf3e597 (patch)
tree5115f69e1cab801641fb61cd31f8f87069fd5aea /usr.sbin/acpidump/aml_dump.c
parent90f87489f35b6526225602784c2ff8a7361ff4ad (diff)
Added changes to dump all tables not just DSDT
-o generates files of form <prefix>.<sig>.<num> eg. -o foo generates foo.DSDT.1 foo.FACP.0 foo.MCFG.2 etc ok marco@
Diffstat (limited to 'usr.sbin/acpidump/aml_dump.c')
-rw-r--r--usr.sbin/acpidump/aml_dump.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.sbin/acpidump/aml_dump.c b/usr.sbin/acpidump/aml_dump.c
index 11acc4858e1..b18e957261d 100644
--- a/usr.sbin/acpidump/aml_dump.c
+++ b/usr.sbin/acpidump/aml_dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aml_dump.c,v 1.1 2005/06/02 20:09:39 tholo Exp $ */
+/* $OpenBSD: aml_dump.c,v 1.2 2007/02/22 19:09:26 jordan Exp $ */
/*-
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
* All rights reserved.
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aml_dump.c,v 1.1 2005/06/02 20:09:39 tholo Exp $
+ * $Id: aml_dump.c,v 1.2 2007/02/22 19:09:26 jordan Exp $
* $FreeBSD: src/usr.sbin/acpi/acpidump/aml_dump.c,v 1.3 2000/11/08 02:37:00 iwasaki Exp $
*/
@@ -40,8 +40,10 @@
char *aml_dumpfile = NULL;
void
-aml_dump(struct ACPIsdt *dsdp)
+aml_dump(struct ACPIsdt *hdr)
{
+ static int hdr_index;
+ char name[128];
int fd;
mode_t mode;
@@ -49,13 +51,17 @@ aml_dump(struct ACPIsdt *dsdp)
return;
}
+ snprintf(name, sizeof(name), "%s.%c%c%c%c.%d",
+ aml_dumpfile, hdr->signature[0], hdr->signature[1],
+ hdr->signature[2], hdr->signature[3],
+ hdr_index++);
+
mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
- fd = open(aml_dumpfile, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd == -1) {
return;
}
- write(fd, dsdp, SIZEOF_SDT_HDR);
- write(fd, dsdp->body, dsdp->len - SIZEOF_SDT_HDR);
+ write(fd, hdr, SIZEOF_SDT_HDR);
+ write(fd, hdr->body, hdr->len - SIZEOF_SDT_HDR);
close(fd);
}
-