raw.c revision 268161
199122Sobrien/*- 299122Sobrien * Copyright (c) 2014 Juniper Networks, Inc. 399122Sobrien * All rights reserved. 499122Sobrien * 599122Sobrien * Redistribution and use in source and binary forms, with or without 699122Sobrien * modification, are permitted provided that the following conditions 799122Sobrien * are met: 899122Sobrien * 1. Redistributions of source code must retain the above copyright 999122Sobrien * notice, this list of conditions and the following disclaimer. 1099122Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1199122Sobrien * notice, this list of conditions and the following disclaimer in the 1299122Sobrien * documentation and/or other materials provided with the distribution. 1399122Sobrien * 1499122Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1599122Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1699122Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1799122Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1899122Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1999122Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2099122Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2199122Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2299122Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2399122Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2499122Sobrien * SUCH DAMAGE. 2599122Sobrien */ 2699122Sobrien 2799122Sobrien#include <sys/cdefs.h> 2899122Sobrien__FBSDID("$FreeBSD: stable/10/usr.bin/mkimg/raw.c 268161 2014-07-02 14:54:41Z marcel $"); 2999122Sobrien 3099122Sobrien#include <sys/types.h> 3199122Sobrien#include <sys/apm.h> 3299122Sobrien#include <sys/endian.h> 3399122Sobrien#include <sys/errno.h> 34104583Smike#include <stdlib.h> 35102227Smike#include <string.h> 3699122Sobrien#include <unistd.h> 37104583Smike 38104583Smike#include "image.h" 39102227Smike#include "format.h" 40104583Smike#include "mkimg.h" 4199122Sobrien 42143434Speterstatic int 43143434Speterraw_resize(lba_t imgsz __unused) 4499122Sobrien{ 45162487Skan 4699122Sobrien return (0); 4799122Sobrien} 4899122Sobrien 4999122Sobrienstatic int 50121450Speterraw_write(int fd) 51121450Speter{ 52121450Speter 53104583Smike return (image_copyout(fd)); 54103526Smike} 55121450Speter 56104583Smikestatic struct mkimg_format raw_format = { 57103526Smike .name = "raw", 5899122Sobrien .description = "Raw Disk", 5999122Sobrien .resize = raw_resize, 6099122Sobrien .write = raw_write, 61114870Speter}; 62114870Speter 63114870SpeterFORMAT_DEFINE(raw_format); 64114870Speter