1*158d2fcdSBenno Rice /*-
2*158d2fcdSBenno Rice * Copyright (c) 2018 iXsystems, Inc.
3*158d2fcdSBenno Rice * All rights reserved.
4*158d2fcdSBenno Rice *
5*158d2fcdSBenno Rice * Redistribution and use in source and binary forms, with or without
6*158d2fcdSBenno Rice * modification, are permitted provided that the following conditions
7*158d2fcdSBenno Rice * are met:
8*158d2fcdSBenno Rice * 1. Redistributions of source code must retain the above copyright
9*158d2fcdSBenno Rice * notice, this list of conditions and the following disclaimer.
10*158d2fcdSBenno Rice * 2. Redistributions in binary form must reproduce the above copyright
11*158d2fcdSBenno Rice * notice, this list of conditions and the following disclaimer in the
12*158d2fcdSBenno Rice * documentation and/or other materials provided with the distribution.
13*158d2fcdSBenno Rice *
14*158d2fcdSBenno Rice * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*158d2fcdSBenno Rice * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*158d2fcdSBenno Rice * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*158d2fcdSBenno Rice * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*158d2fcdSBenno Rice * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*158d2fcdSBenno Rice * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*158d2fcdSBenno Rice * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*158d2fcdSBenno Rice * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*158d2fcdSBenno Rice * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*158d2fcdSBenno Rice * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*158d2fcdSBenno Rice * SUCH DAMAGE.
25*158d2fcdSBenno Rice */
26*158d2fcdSBenno Rice
27*158d2fcdSBenno Rice #include <sys/cdefs.h>
28*158d2fcdSBenno Rice #include <stdbool.h>
29*158d2fcdSBenno Rice #include <stdio.h>
30*158d2fcdSBenno Rice
31*158d2fcdSBenno Rice #include "cd9660.h"
32*158d2fcdSBenno Rice #include "cd9660_eltorito.h"
33*158d2fcdSBenno Rice
34*158d2fcdSBenno Rice #include "etdump.h"
35*158d2fcdSBenno Rice
36*158d2fcdSBenno Rice static void
output_entry(FILE * outfile,const char * filename __unused,boot_catalog_section_entry * bcse,u_char platform_id,bool initial)37*158d2fcdSBenno Rice output_entry(FILE *outfile, const char *filename __unused,
38*158d2fcdSBenno Rice boot_catalog_section_entry *bcse, u_char platform_id, bool initial)
39*158d2fcdSBenno Rice {
40*158d2fcdSBenno Rice const char *platform;
41*158d2fcdSBenno Rice
42*158d2fcdSBenno Rice switch (bcse->boot_indicator[0]) {
43*158d2fcdSBenno Rice case ET_BOOTABLE:
44*158d2fcdSBenno Rice break;
45*158d2fcdSBenno Rice case ET_NOT_BOOTABLE:
46*158d2fcdSBenno Rice default:
47*158d2fcdSBenno Rice return;
48*158d2fcdSBenno Rice }
49*158d2fcdSBenno Rice
50*158d2fcdSBenno Rice if (initial)
51*158d2fcdSBenno Rice platform = "default";
52*158d2fcdSBenno Rice else
53*158d2fcdSBenno Rice platform = system_id_string(platform_id);
54*158d2fcdSBenno Rice
55*158d2fcdSBenno Rice fprintf(outfile,
56*158d2fcdSBenno Rice "et_platform=%s;et_system=%s;et_lba=%d;et_sectors=%d\n",
57*158d2fcdSBenno Rice platform, system_id_string(bcse->system_type[0]),
58*158d2fcdSBenno Rice isonum_731(bcse->load_rba), isonum_721(bcse->sector_count));
59*158d2fcdSBenno Rice }
60*158d2fcdSBenno Rice
61*158d2fcdSBenno Rice static struct outputter _output_shell = {
62*158d2fcdSBenno Rice .output_image = NULL,
63*158d2fcdSBenno Rice .output_section = NULL,
64*158d2fcdSBenno Rice .output_entry = output_entry,
65*158d2fcdSBenno Rice };
66*158d2fcdSBenno Rice
67*158d2fcdSBenno Rice struct outputter *output_shell = &_output_shell;
68