1265625Smarcel/*- 2265625Smarcel * Copyright (c) 2014 Juniper Networks, Inc. 3265625Smarcel * All rights reserved. 4265625Smarcel * 5265625Smarcel * Redistribution and use in source and binary forms, with or without 6265625Smarcel * modification, are permitted provided that the following conditions 7265625Smarcel * are met: 8265625Smarcel * 1. Redistributions of source code must retain the above copyright 9265625Smarcel * notice, this list of conditions and the following disclaimer. 10265625Smarcel * 2. Redistributions in binary form must reproduce the above copyright 11265625Smarcel * notice, this list of conditions and the following disclaimer in the 12265625Smarcel * documentation and/or other materials provided with the distribution. 13265625Smarcel * 14265625Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15265625Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16265625Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17265625Smarcel * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18265625Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19265625Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20265625Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21265625Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22265625Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23265625Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24265625Smarcel * SUCH DAMAGE. 25265625Smarcel * 26265625Smarcel * $FreeBSD: stable/11/usr.bin/mkimg/format.h 329059 2018-02-09 09:15:43Z manu $ 27265625Smarcel */ 28265625Smarcel 29265625Smarcel#ifndef _MKIMG_FORMAT_H_ 30265625Smarcel#define _MKIMG_FORMAT_H_ 31265625Smarcel 32265625Smarcelstruct mkimg_format { 33329059Smanu struct mkimg_format *next; 34265625Smarcel const char *name; 35265625Smarcel const char *description; 36266039Smarcel int (*resize)(lba_t); 37265625Smarcel int (*write)(int); 38265625Smarcel}; 39265625Smarcel 40329059Smanu#define FORMAT_DEFINE(nm) \ 41329059Smanustatic void format_register_##nm(void) __attribute__((constructor)); \ 42329059Smanustatic void format_register_##nm(void) { format_register(&nm); } 43265625Smarcel 44329059Smanustruct mkimg_format *format_iterate(struct mkimg_format *); 45329059Smanuvoid format_register(struct mkimg_format *); 46265625Smarcelint format_select(const char *); 47265625Smarcelstruct mkimg_format *format_selected(void); 48329059Smanu 49329059Smanuint format_resize(lba_t); 50265718Smarcelint format_write(int); 51265625Smarcel 52265625Smarcel#endif /* _MKIMG_FORMAT_H_ */ 53