1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27
28#ifndef	_SVM_H
29#define	_SVM_H
30
31#pragma ident	"%Z%%M%	%I%	%E% SMI"
32
33#ifdef	__cplusplus
34extern "C" {
35#endif
36
37
38#define	RET_SUCCESS	0
39#define	RET_ERROR	-1
40#define	RET_NOERROR	RET_SUCCESS
41
42
43#define	PROP_KEEP_REPL_STATE	"md_keep_repl_state"
44#define	PROP_DEVID_DESTROY	"md_devid_destroy"
45
46#define	MD_CONF		"/kernel/drv/md.conf"
47#define	MD_CONF_ORIG	"/tmp/md.conf.orig"
48#define	SYSTEM_FILE	"/etc/system"
49#define	NAME_TO_MAJOR	"/etc/name_to_major"
50#define	VFSTAB		"/etc/vfstab"
51
52#define	MD_MODULE "md"
53#define	ROOT_MNTPT "/"
54#define	ROOT_METADEVICE "/dev/md/dsk/"
55
56
57typedef enum {
58	MD_STR_NOTFOUND,	/* bootlist not found */
59	MD_STR_START,		/* bootlist found, convertion started */
60	MD_STR_DONE		/* bootlist converversion done */
61} convflag_t;
62
63/* The following defines have been taken from addrem.h */
64#define	MAX_CMD_LINE	256
65#define	MAX_N2M_ALIAS_LINE	FILENAME_MAX + FILENAME_MAX + 1
66#define	MAXLEN_NAM_TO_MAJ_ENT	FILENAME_MAX + MAX_STR_MAJOR + 1
67#define	OPT_LEN	128
68#define	CADDR_HEX_STR	16
69#define	UINT_STR	10
70#define	MODLINE_ENT_MAX	(4 * UINT_STR) + CADDR_HEX_STR + MODMAXNAMELEN
71#define	MAX_STR_MAJOR	UINT_STR
72#define	STR_LONG	10
73#define	PERM_STR	4
74#define	MAX_PERM_ENTRY	(2 * STR_LONG) + PERM_STR + (2 * FILENAME_MAX) + 1
75#define	MAX_DBFILE_ENTRY	MAX_PERM_ENTRY
76
77extern void create_diskset_links();
78extern int copyfile(char *from, char *to);
79extern int get_drv_name(major_t major, char *file_name, char *buf);
80extern int mod_unload(char *modname);
81extern int valid_bootlist(FILE *fp, int line_size);
82extern int convert_bootlist(char *systemfile, char *mdconf, char **tmpfilename);
83extern int write_xlate_to_mdconf(char *rootpath);
84extern int write_targ_nm_table(char *rootpath);
85extern int get_rootmetadevice(char *rootpath, char **devname);
86extern void set_upgrade_prop(char *prop_name, int val);
87extern int is_upgrade_prop(char *prop_name);
88extern int create_in_file_prop(char *prop_name, char *fname);
89extern void debug_printf(char *fmt, ...);
90
91#ifdef	__cplusplus
92}
93#endif
94
95#endif	/* _SVM_H */
96