1202437Strasz/*-
2202437Strasz * Copyright (c) 2010 Edward Tomasz Napierala <trasz@FreeBSD.org>
3202437Strasz * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4202437Strasz * All rights reserved.
5202437Strasz *
6202437Strasz * Redistribution and use in source and binary forms, with or without
7202437Strasz * modification, are permitted provided that the following conditions
8202437Strasz * are met:
9202437Strasz * 1. Redistributions of source code must retain the above copyright
10202437Strasz *    notice, this list of conditions and the following disclaimer.
11202437Strasz * 2. Redistributions in binary form must reproduce the above copyright
12202437Strasz *    notice, this list of conditions and the following disclaimer in the
13202437Strasz *    documentation and/or other materials provided with the distribution.
14202437Strasz *
15202437Strasz * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
16202437Strasz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17202437Strasz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18202437Strasz * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19202437Strasz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20202437Strasz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21202437Strasz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22202437Strasz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23202437Strasz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24202437Strasz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25202437Strasz * SUCH DAMAGE.
26202437Strasz *
27202437Strasz * $FreeBSD: stable/11/sys/geom/mountver/g_mountver.h 325819 2017-11-14 17:56:32Z trasz $
28202437Strasz */
29202437Strasz
30202437Strasz#ifndef	_G_MOUNTVER_H_
31202437Strasz#define	_G_MOUNTVER_H_
32202437Strasz
33202437Strasz#define	G_MOUNTVER_CLASS_NAME	"MOUNTVER"
34202437Strasz#define	G_MOUNTVER_VERSION	4
35202437Strasz#define	G_MOUNTVER_SUFFIX	".mountver"
36202437Strasz
37202437Strasz#ifdef _KERNEL
38202437Strasz
39202437Strasz#define	G_MOUNTVER_DEBUG(lvl, ...)	do {				\
40202437Strasz	if (g_mountver_debug >= (lvl)) {				\
41202437Strasz		printf("GEOM_MOUNTVER");				\
42202437Strasz		if (g_mountver_debug > 0)				\
43202437Strasz			printf("[%u]", lvl);				\
44202437Strasz		printf(": ");						\
45202437Strasz		printf(__VA_ARGS__);					\
46202437Strasz		printf("\n");						\
47202437Strasz	}								\
48202437Strasz} while (0)
49202437Strasz#define	G_MOUNTVER_LOGREQ(bp, ...)	do {				\
50202437Strasz	if (g_mountver_debug >= 2) {					\
51202437Strasz		printf("GEOM_MOUNTVER[2]: ");				\
52202437Strasz		printf(__VA_ARGS__);					\
53202437Strasz		printf(" ");						\
54202437Strasz		g_print_bio(bp);					\
55202437Strasz		printf("\n");						\
56202437Strasz	}								\
57202437Strasz} while (0)
58202437Strasz
59202437Straszstruct g_mountver_softc {
60202437Strasz	TAILQ_HEAD(, bio)		sc_queue;
61202437Strasz	struct mtx			sc_mtx;
62202437Strasz	char				*sc_provider_name;
63202437Strasz	char				sc_ident[DISK_IDENT_SIZE];
64202437Strasz	int				sc_orphaned;
65325819Strasz	int				sc_shutting_down;
66202437Strasz	int				sc_access_r;
67202437Strasz	int				sc_access_w;
68202437Strasz	int				sc_access_e;
69202437Strasz};
70202437Strasz#endif	/* _KERNEL */
71202437Strasz
72202437Strasz#endif	/* _G_MOUNTVER_H_ */
73