ebr.c revision 263537
14Srgrimes/*- 24Srgrimes * Copyright (c) 2014 Juniper Networks, Inc. 34Srgrimes * All rights reserved. 4974Sdg * 5974Sdg * Redistribution and use in source and binary forms, with or without 64Srgrimes * modification, are permitted provided that the following conditions 74Srgrimes * are met: 84Srgrimes * 1. Redistributions of source code must retain the above copyright 94Srgrimes * notice, this list of conditions and the following disclaimer. 104Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 114Srgrimes * notice, this list of conditions and the following disclaimer in the 124Srgrimes * documentation and/or other materials provided with the distribution. 134Srgrimes * 144Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 154Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 164Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 174Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 184Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 194Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 204Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 214Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 224Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 234Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 244Srgrimes * SUCH DAMAGE. 254Srgrimes */ 264Srgrimes 274Srgrimes#include <sys/cdefs.h> 284Srgrimes__FBSDID("$FreeBSD: user/marcel/mkimg/ebr.c 263537 2014-03-21 19:40:05Z marcel $"); 294Srgrimes 304Srgrimes#include <sys/types.h> 314Srgrimes#include <sys/diskmbr.h> 324Srgrimes#include <sys/errno.h> 334Srgrimes#include <stdlib.h> 34607Srgrimes 3550477Speter#include "mkimg.h" 364Srgrimes#include "scheme.h" 374Srgrimes 384Srgrimesstatic struct mkimg_alias ebr_aliases[] = { 39719Swollman { ALIAS_NONE, 0 } 40719Swollman}; 41719Swollman 424Srgrimesstatic u_int 434Srgrimesebr_metadata(u_int where, u_int parts __unused, u_int secsz __unused) 444Srgrimes{ 454Srgrimes u_int secs; 464Srgrimes 474Srgrimes secs = (where == SCHEME_META_PART_BEFORE) ? 1 : 0; 484Srgrimes return (secs); 4936909Sdg} 504Srgrimes 5136909Sdgstatic int 524Srgrimesebr_write(int fd __unused, off_t imgsz __unused, u_int parts __unused, 534Srgrimes u_int secsz __unused, void *bootcode __unused) 5430755Sjkh{ 554Srgrimes return (ENOSYS); 564Srgrimes} 571288Sdg 584Srgrimesstatic struct mkimg_scheme ebr_scheme = { 594Srgrimes .name = "ebr", 60926Sdg .description = "Extended Boot Record", 614Srgrimes .aliases = ebr_aliases, 621288Sdg .metadata = ebr_metadata, 631288Sdg .write = ebr_write, 641288Sdg .nparts = 4096 654Srgrimes}; 664Srgrimes 67276546SalcSCHEME_DEFINE(ebr_scheme); 68276546Salc