xref: /titanic_41/usr/src/common/lvm/md_revchk.c (revision 4745263a792e84bbd9e36b3ceb07d1275762cf9b)
1*4745263aSmw145384 /*
2*4745263aSmw145384  * CDDL HEADER START
3*4745263aSmw145384  *
4*4745263aSmw145384  * The contents of this file are subject to the terms of the
5*4745263aSmw145384  * Common Development and Distribution License, Version 1.0 only
6*4745263aSmw145384  * (the "License").  You may not use this file except in compliance
7*4745263aSmw145384  * with the License.
8*4745263aSmw145384  *
9*4745263aSmw145384  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*4745263aSmw145384  * or http://www.opensolaris.org/os/licensing.
11*4745263aSmw145384  * See the License for the specific language governing permissions
12*4745263aSmw145384  * and limitations under the License.
13*4745263aSmw145384  *
14*4745263aSmw145384  * When distributing Covered Code, include this CDDL HEADER in each
15*4745263aSmw145384  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*4745263aSmw145384  * If applicable, add the following below this CDDL HEADER, with the
17*4745263aSmw145384  * fields enclosed by brackets "[]" replaced with your own identifying
18*4745263aSmw145384  * information: Portions Copyright [yyyy] [name of copyright owner]
19*4745263aSmw145384  *
20*4745263aSmw145384  * CDDL HEADER END
21*4745263aSmw145384  */
22*4745263aSmw145384 /*
23*4745263aSmw145384  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*4745263aSmw145384  * Use is subject to license terms.
25*4745263aSmw145384  */
26*4745263aSmw145384 
27*4745263aSmw145384 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*4745263aSmw145384 
29*4745263aSmw145384 #include <sys/types.h>
30*4745263aSmw145384 /*
31*4745263aSmw145384  * Need to include md_mddb.h for the MDDB_REV_MAJOR and MDDB_REV_MINOR
32*4745263aSmw145384  * definitions.  The other files included are required for md_mddb.h.
33*4745263aSmw145384  */
34*4745263aSmw145384 #ifdef _KERNEL
35*4745263aSmw145384 #include <sys/lvm/md_basic.h>
36*4745263aSmw145384 #include <sys/lvm/mdvar.h>
37*4745263aSmw145384 #else /* !_KERNEL */
38*4745263aSmw145384 #include <meta.h>
39*4745263aSmw145384 #endif /* _KERNEL */
40*4745263aSmw145384 #include <sys/lvm/md_mddb.h>
41*4745263aSmw145384 
42*4745263aSmw145384 
43*4745263aSmw145384 /*
44*4745263aSmw145384  * revchk()
45*4745263aSmw145384  * Checks the major and minor revision numbers for either an in-core or on-disk
46*4745263aSmw145384  * directory block or record block against the currently defined major and
47*4745263aSmw145384  * minor numbers(MDDB_REV_MAJOR and MDDB_REV_MINOR) to make sure that they are
48*4745263aSmw145384  * compatible with this version of SVM.  For example, earlier versions of SVM
49*4745263aSmw145384  * don't understand dummy masterblocks or deviceIDs in disksets.
50*4745263aSmw145384  */
51*4745263aSmw145384 int
revchk(uint_t my_rev,uint_t data)52*4745263aSmw145384 revchk(
53*4745263aSmw145384 	uint_t	my_rev,
54*4745263aSmw145384 	uint_t	data
55*4745263aSmw145384 )
56*4745263aSmw145384 {
57*4745263aSmw145384 	if ((MDDB_REV_MAJOR & my_rev) != (MDDB_REV_MAJOR & data))
58*4745263aSmw145384 		return (1);
59*4745263aSmw145384 	if ((MDDB_REV_MINOR & my_rev) < (MDDB_REV_MINOR & data))
60*4745263aSmw145384 		return (1);
61*4745263aSmw145384 	return (0);
62*4745263aSmw145384 }
63