mkimg.h revision 263831
1156952Sume/*-
2156952Sume * Copyright (c) 2014 Juniper Networks, Inc.
3156952Sume * All rights reserved.
4156952Sume *
5156952Sume * Redistribution and use in source and binary forms, with or without
6156952Sume * modification, are permitted provided that the following conditions
7156952Sume * are met:
8156952Sume * 1. Redistributions of source code must retain the above copyright
9156952Sume *    notice, this list of conditions and the following disclaimer.
10156952Sume * 2. Redistributions in binary form must reproduce the above copyright
11156952Sume *    notice, this list of conditions and the following disclaimer in the
12156952Sume *    documentation and/or other materials provided with the distribution.
13156952Sume *
14156952Sume * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15156952Sume * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16156952Sume * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17156952Sume * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18156952Sume * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19156952Sume * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20156952Sume * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21156952Sume * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22156952Sume * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23156952Sume * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24156952Sume * SUCH DAMAGE.
25156952Sume *
26156952Sume * $FreeBSD: user/marcel/mkimg/mkimg.h 263831 2014-03-27 20:14:40Z marcel $
27156952Sume */
28156952Sume
29156952Sume#ifndef _MKIMG_MKIMG_H_
30156952Sume#define	_MKIMG_MKIMG_H_
31156952Sume
32156952Sume#include <sys/queue.h>
33156952Sume
34156952Sumetypedef int64_t	lba_t;
35156952Sume
36156952Sumestruct part {
37156952Sume	STAILQ_ENTRY(part) link;
38156952Sume	char	*alias;		/* Partition type alias. */
39156952Sume	char	*contents;	/* Contents/size specification. */
40156952Sume	u_int	kind;		/* Content kind. */
41156952Sume#define	PART_UNDEF	0
42156952Sume#define	PART_KIND_FILE	1
43156952Sume#define	PART_KIND_PIPE	2
44156952Sume#define	PART_KIND_SIZE	3
45156952Sume	u_int	index;		/* Partition index (0-based). */
46156952Sume	uintptr_t type;		/* Scheme-specific partition type. */
47156952Sume	lba_t	block;		/* Block-offset of partition in image. */
48156952Sume	lba_t	size;		/* Size in blocks of partition. */
49156952Sume	char	*label;		/* Partition label. */
50156952Sume};
51156952Sume
52156952Sumeextern STAILQ_HEAD(partlisthead, part) partlist;
53156952Sumeextern u_int nparts;
54156952Sume
55156952Sumeextern u_int verbose;
56156952Sume
57156952Sumeextern u_int ncyls;
58156952Sumeextern u_int nheads;
59156952Sumeextern u_int nsecs;
60156952Sumeextern u_int secsz;	/* Logical block size. */
61156952Sumeextern u_int blksz;	/* Physical block size. */
62156952Sume
63156952Sumeint mkimg_seek(int fd, lba_t blk);
64156952Sume
65156952Sume#endif /* _MKIMG_MKIMG_H_ */
66156952Sume