mirror of
https://github.com/openbsd/src.git
synced 2025-01-09 22:38:01 -08:00
If the argument of -o specifies a directory, dump the files without using a
prefix. ok deraadt@
This commit is contained in:
parent
d2ba3035c2
commit
c8dab64c7c
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: acpidump.8,v 1.16 2016/09/25 15:23:37 deraadt Exp $
|
||||
.\" $OpenBSD: acpidump.8,v 1.17 2016/09/26 19:58:26 kettenis Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Doug Rabson <dfr@FreeBSD.org>
|
||||
.\" Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
|
||||
@ -29,7 +29,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD: src/usr.sbin/acpi/acpidump/acpidump.8,v 1.9 2001/09/05 19:21:25 dd Exp $
|
||||
.\"
|
||||
.Dd $Mdocdate: September 25 2016 $
|
||||
.Dd $Mdocdate: September 26 2016 $
|
||||
.Dt ACPIDUMP 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -37,21 +37,25 @@
|
||||
.Nd dump ACPI tables
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Fl o Ar prefix_for_output
|
||||
.Fl o Ar prefix
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
command stores ACPI tables from physical memory into files specified by
|
||||
.Ar prefix_for_output .
|
||||
The files generated will
|
||||
be of the form <prefix>.<sig>.<id>.
|
||||
.Ar prefix .
|
||||
If
|
||||
.Ar prefix
|
||||
specifies a directory, the generated files will be of the form
|
||||
<prefix>/<sig>.<id>.
|
||||
Otherwise, they will be named <prefix>.<sig>.<id>.
|
||||
.Dq sig
|
||||
is the signature of the ACPI Table;
|
||||
.Dq id
|
||||
is unique for each table.
|
||||
.Pp
|
||||
Additionally a file called <prefix>.headers will be created that contains
|
||||
additional human readable information pertaining to this specific dump.
|
||||
Additionally a file called <prefix>/headers or <prefix>.headers will
|
||||
be created that contains additional human readable information
|
||||
pertaining to this specific dump.
|
||||
.Pp
|
||||
The ACPICA disassembler is available through the
|
||||
.Ox
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: acpidump.c,v 1.16 2015/10/12 04:02:57 semarie Exp $ */
|
||||
/* $OpenBSD: acpidump.c,v 1.17 2016/09/26 19:58:26 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
@ -167,6 +167,7 @@ LIST_HEAD(acpi_user_mapping_list, acpi_user_mapping) maplist;
|
||||
|
||||
int acpi_mem_fd = -1;
|
||||
char *aml_dumpfile;
|
||||
int aml_dumpdir;
|
||||
FILE *fhdr;
|
||||
|
||||
int acpi_checksum(void *_p, size_t _length);
|
||||
@ -343,8 +344,9 @@ aml_dump(struct ACPIsdt *hdr)
|
||||
int fd;
|
||||
mode_t mode;
|
||||
|
||||
snprintf(name, sizeof(name), "%s.%c%c%c%c.%d",
|
||||
aml_dumpfile, hdr->signature[0], hdr->signature[1],
|
||||
snprintf(name, sizeof(name), "%s%c%c%c%c%c.%d",
|
||||
aml_dumpfile, aml_dumpdir ? '/' : '.',
|
||||
hdr->signature[0], hdr->signature[1],
|
||||
hdr->signature[2], hdr->signature[3],
|
||||
hdr_index++);
|
||||
|
||||
@ -529,7 +531,8 @@ asl_dump_from_devmem(void)
|
||||
struct ACPIsdt *rsdp;
|
||||
char name[PATH_MAX];
|
||||
|
||||
snprintf(name, sizeof(name), "%s.headers", aml_dumpfile);
|
||||
snprintf(name, sizeof(name), "%s%cheaders", aml_dumpfile,
|
||||
aml_dumpdir ? '/' : '.');
|
||||
|
||||
acpi_user_init();
|
||||
|
||||
@ -560,13 +563,14 @@ usage(void)
|
||||
{
|
||||
extern char *__progname;
|
||||
|
||||
fprintf(stderr, "usage: %s -o prefix_for_output\n", __progname);
|
||||
fprintf(stderr, "usage: %s -o prefix\n", __progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct stat st;
|
||||
char c;
|
||||
|
||||
while ((c = getopt(argc, argv, "o:")) != -1) {
|
||||
@ -583,6 +587,9 @@ main(int argc, char *argv[])
|
||||
if (aml_dumpfile == NULL)
|
||||
usage();
|
||||
|
||||
if (stat(aml_dumpfile, &st) == 0 && S_ISDIR(st.st_mode))
|
||||
aml_dumpdir = 1;
|
||||
|
||||
asl_dump_from_devmem();
|
||||
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user