1332947Sbenno/*- 2332947Sbenno * Copyright (c) 2018 iXsystems, Inc. 3332947Sbenno * All rights reserved. 4332947Sbenno * 5332947Sbenno * Redistribution and use in source and binary forms, with or without 6332947Sbenno * modification, are permitted provided that the following conditions 7332947Sbenno * are met: 8332947Sbenno * 1. Redistributions of source code must retain the above copyright 9332947Sbenno * notice, this list of conditions and the following disclaimer. 10332947Sbenno * 2. Redistributions in binary form must reproduce the above copyright 11332947Sbenno * notice, this list of conditions and the following disclaimer in the 12332947Sbenno * documentation and/or other materials provided with the distribution. 13332947Sbenno * 14332947Sbenno * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15332947Sbenno * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16332947Sbenno * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17332947Sbenno * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18332947Sbenno * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19332947Sbenno * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20332947Sbenno * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21332947Sbenno * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22332947Sbenno * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23332947Sbenno * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24332947Sbenno * SUCH DAMAGE. 25332947Sbenno */ 26332947Sbenno 27332947Sbenno#include <sys/cdefs.h> 28332947Sbenno__FBSDID("$FreeBSD: stable/11/usr.bin/etdump/output_shell.c 332947 2018-04-24 17:35:13Z benno $"); 29332947Sbenno 30332947Sbenno#include <stdbool.h> 31332947Sbenno#include <stdio.h> 32332947Sbenno 33332947Sbenno#include "cd9660.h" 34332947Sbenno#include "cd9660_eltorito.h" 35332947Sbenno 36332947Sbenno#include "etdump.h" 37332947Sbenno 38332947Sbennostatic void 39332947Sbennooutput_entry(FILE *outfile, const char *filename __unused, 40332947Sbenno boot_catalog_section_entry *bcse, u_char platform_id, bool initial) 41332947Sbenno{ 42332947Sbenno const char *platform; 43332947Sbenno 44332947Sbenno switch (bcse->boot_indicator[0]) { 45332947Sbenno case ET_BOOTABLE: 46332947Sbenno break; 47332947Sbenno case ET_NOT_BOOTABLE: 48332947Sbenno default: 49332947Sbenno return; 50332947Sbenno } 51332947Sbenno 52332947Sbenno if (initial) 53332947Sbenno platform = "default"; 54332947Sbenno else 55332947Sbenno platform = system_id_string(platform_id); 56332947Sbenno 57332947Sbenno fprintf(outfile, 58332947Sbenno "et_platform=%s;et_system=%s;et_lba=%d;et_sectors=%d\n", 59332947Sbenno platform, system_id_string(bcse->system_type[0]), 60332947Sbenno isonum_731(bcse->load_rba), isonum_721(bcse->sector_count)); 61332947Sbenno} 62332947Sbenno 63332947Sbennostatic struct outputter _output_shell = { 64332947Sbenno .output_image = NULL, 65332947Sbenno .output_section = NULL, 66332947Sbenno .output_entry = output_entry, 67332947Sbenno}; 68332947Sbenno 69332947Sbennostruct outputter *output_shell = &_output_shell; 70