mkimg.h revision 263653
1263382Smarcel/*-
2263382Smarcel * Copyright (c) 2014 Juniper Networks, Inc.
3263382Smarcel * All rights reserved.
4263382Smarcel *
5263382Smarcel * Redistribution and use in source and binary forms, with or without
6263382Smarcel * modification, are permitted provided that the following conditions
7263382Smarcel * are met:
8263382Smarcel * 1. Redistributions of source code must retain the above copyright
9263382Smarcel *    notice, this list of conditions and the following disclaimer.
10263382Smarcel * 2. Redistributions in binary form must reproduce the above copyright
11263382Smarcel *    notice, this list of conditions and the following disclaimer in the
12263382Smarcel *    documentation and/or other materials provided with the distribution.
13263382Smarcel *
14263382Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15263382Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16263382Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17263382Smarcel * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18263382Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19263382Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20263382Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21263382Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22263382Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23263382Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24263382Smarcel * SUCH DAMAGE.
25263382Smarcel *
26263382Smarcel * $FreeBSD: user/marcel/mkimg/mkimg.h 263653 2014-03-23 01:10:05Z marcel $
27263382Smarcel */
28263382Smarcel
29263382Smarcel#ifndef _MKIMG_MKIMG_H_
30263382Smarcel#define	_MKIMG_MKIMG_H_
31263382Smarcel
32263442Smarcel#include <sys/queue.h>
33263442Smarcel
34263653Smarceltypedef int64_t	lba_t;
35263653Smarcel
36263382Smarcelstruct part {
37263382Smarcel	STAILQ_ENTRY(part) link;
38263414Smarcel	char	*alias;		/* Partition type alias. */
39263382Smarcel	char	*contents;	/* Contents/size specification. */
40263382Smarcel	u_int	kind;		/* Content kind. */
41263382Smarcel#define	PART_UNDEF	0
42263382Smarcel#define	PART_KIND_FILE	1
43263382Smarcel#define	PART_KIND_PIPE	2
44263382Smarcel#define	PART_KIND_SIZE	3
45263382Smarcel	u_int	index;		/* Partition index (0-based). */
46263461Smarcel	uintptr_t type;		/* Scheme-specific partition type. */
47263653Smarcel	lba_t	block;		/* Block-offset of partition in image. */
48263653Smarcel	lba_t	size;		/* Size in blocks of partition. */
49263466Smarcel	char	*label;		/* Partition label. */
50263382Smarcel};
51263382Smarcel
52263382Smarcelextern STAILQ_HEAD(partlisthead, part) partlist;
53263382Smarcelextern u_int nparts;
54263382Smarcel
55263653Smarcelextern u_int secsz;
56263653Smarcel
57263653Smarcelint mkimg_seek(int fd, lba_t blk);
58263653Smarcel
59263382Smarcel#endif /* _MKIMG_MKIMG_H_ */
60