xref: /netbsd-src/sbin/dkscan_bsdlabel/dkscan_util.h (revision 71997035dc592ba0e52b1b6cd3d7a2d1b7afec1e)
1*71997035Schs /* $NetBSD: dkscan_util.h,v 1.5 2017/06/08 22:24:29 chs Exp $ */
2c6eb40afSmartin 
3c6eb40afSmartin /*-
4c6eb40afSmartin  * Copyright (c) 2007 The NetBSD Foundation, Inc.
5c6eb40afSmartin  * All rights reserved.
6c6eb40afSmartin  *
7c6eb40afSmartin  * This code is derived from software contributed to The NetBSD Foundation
8c6eb40afSmartin  * by Martin Husemann <martin@NetBSD.org>.
9c6eb40afSmartin  *
10c6eb40afSmartin  * Redistribution and use in source and binary forms, with or without
11c6eb40afSmartin  * modification, are permitted provided that the following conditions
12c6eb40afSmartin  * are met:
13c6eb40afSmartin  * 1. Redistributions of source code must retain the above copyright
14c6eb40afSmartin  *    notice, this list of conditions and the following disclaimer.
15c6eb40afSmartin  * 2. Redistributions in binary form must reproduce the above copyright
16c6eb40afSmartin  *    notice, this list of conditions and the following disclaimer in the
17c6eb40afSmartin  *    documentation and/or other materials provided with the distribution.
18c6eb40afSmartin  *
19c6eb40afSmartin  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20c6eb40afSmartin  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21c6eb40afSmartin  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22c6eb40afSmartin  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23c6eb40afSmartin  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24c6eb40afSmartin  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25c6eb40afSmartin  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26c6eb40afSmartin  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27c6eb40afSmartin  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28c6eb40afSmartin  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29c6eb40afSmartin  * POSSIBILITY OF SUCH DAMAGE.
30c6eb40afSmartin  */
31c6eb40afSmartin 
32c6eb40afSmartin 
33c6eb40afSmartin #define BLOCK_SIZE	512	/* XXX */
34c6eb40afSmartin 
35c6eb40afSmartin u_int dkcksum(struct disklabel *);
36c6eb40afSmartin u_int dkcksum_sized(struct disklabel *, size_t);
37*71997035Schs struct disk;
38*71997035Schs struct vnode;
39c6eb40afSmartin int dkwedge_read(struct disk *pdk, struct vnode *vp, daddr_t blkno,
40c6eb40afSmartin 	void *tbuf, size_t len);
41c6eb40afSmartin int dkwedge_add(struct dkwedge_info *dkw);
4266dd2755Sjoerg void aprint_error(const char *format, ...) __printflike(1, 2);
4366dd2755Sjoerg void aprint_verbose(const char *format, ...) __printflike(1, 2);
44c6eb40afSmartin 
45c6eb40afSmartin extern int verbose;	/* are we verbose? */
46c6eb40afSmartin extern int no_action;	/* don't do anything, just print info */
47c6eb40afSmartin extern int disk_fd;	/* file descriptor for disk access */
48