ebr.c revision 263653
112256Sgoetz/*- 212256Sgoetz * Copyright (c) 2014 Juniper Networks, Inc. 312256Sgoetz * All rights reserved. 412256Sgoetz * 512256Sgoetz * Redistribution and use in source and binary forms, with or without 612256Sgoetz * modification, are permitted provided that the following conditions 712256Sgoetz * are met: 812256Sgoetz * 1. Redistributions of source code must retain the above copyright 912256Sgoetz * notice, this list of conditions and the following disclaimer. 1012256Sgoetz * 2. Redistributions in binary form must reproduce the above copyright 1112256Sgoetz * notice, this list of conditions and the following disclaimer in the 1212256Sgoetz * documentation and/or other materials provided with the distribution. 1312256Sgoetz * 1412256Sgoetz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1512256Sgoetz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1612256Sgoetz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1712256Sgoetz * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1812256Sgoetz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1912256Sgoetz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2012256Sgoetz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2112256Sgoetz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2212256Sgoetz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2312256Sgoetz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2412256Sgoetz * SUCH DAMAGE. 2512256Sgoetz */ 2612256Sgoetz 2712256Sgoetz#include <sys/cdefs.h> 2812256Sgoetz__FBSDID("$FreeBSD: user/marcel/mkimg/ebr.c 263653 2014-03-23 01:10:05Z marcel $"); 2912256Sgoetz 3012256Sgoetz#include <sys/types.h> 3112256Sgoetz#include <sys/diskmbr.h> 3212256Sgoetz#include <sys/errno.h> 3312256Sgoetz#include <stdlib.h> 3412256Sgoetz 3512256Sgoetz#include "mkimg.h" 3612256Sgoetz#include "scheme.h" 3712256Sgoetz 3812256Sgoetzstatic struct mkimg_alias ebr_aliases[] = { 3912256Sgoetz { ALIAS_NONE, 0 } 40}; 41 42static u_int 43ebr_metadata(u_int where) 44{ 45 u_int secs; 46 47 secs = (where == SCHEME_META_PART_BEFORE) ? 1 : 0; 48 return (secs); 49} 50 51static int 52ebr_write(int fd __unused, lba_t imgsz __unused, void *bootcode __unused) 53{ 54 return (ENOSYS); 55} 56 57static struct mkimg_scheme ebr_scheme = { 58 .name = "ebr", 59 .description = "Extended Boot Record", 60 .aliases = ebr_aliases, 61 .metadata = ebr_metadata, 62 .write = ebr_write, 63 .nparts = 4096 64}; 65 66SCHEME_DEFINE(ebr_scheme); 67