xref: /titanic_41/usr/src/lib/libfstyp/common/libfstyp.h (revision 0e42dee69ed771bf604dd1789fca9d77b5bbe302)
1*0e42dee6Sartem /*
2*0e42dee6Sartem  * CDDL HEADER START
3*0e42dee6Sartem  *
4*0e42dee6Sartem  * The contents of this file are subject to the terms of the
5*0e42dee6Sartem  * Common Development and Distribution License (the "License").
6*0e42dee6Sartem  * You may not use this file except in compliance with the License.
7*0e42dee6Sartem  *
8*0e42dee6Sartem  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*0e42dee6Sartem  * or http://www.opensolaris.org/os/licensing.
10*0e42dee6Sartem  * See the License for the specific language governing permissions
11*0e42dee6Sartem  * and limitations under the License.
12*0e42dee6Sartem  *
13*0e42dee6Sartem  * When distributing Covered Code, include this CDDL HEADER in each
14*0e42dee6Sartem  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*0e42dee6Sartem  * If applicable, add the following below this CDDL HEADER, with the
16*0e42dee6Sartem  * fields enclosed by brackets "[]" replaced with your own identifying
17*0e42dee6Sartem  * information: Portions Copyright [yyyy] [name of copyright owner]
18*0e42dee6Sartem  *
19*0e42dee6Sartem  * CDDL HEADER END
20*0e42dee6Sartem  */
21*0e42dee6Sartem /*
22*0e42dee6Sartem  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*0e42dee6Sartem  * Use is subject to license terms.
24*0e42dee6Sartem  */
25*0e42dee6Sartem 
26*0e42dee6Sartem #ifndef	_LIBFSTYP_H
27*0e42dee6Sartem #define	_LIBFSTYP_H
28*0e42dee6Sartem 
29*0e42dee6Sartem #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*0e42dee6Sartem 
31*0e42dee6Sartem /*
32*0e42dee6Sartem  * libfstyp: filesystem identification library
33*0e42dee6Sartem  */
34*0e42dee6Sartem #ifdef	__cplusplus
35*0e42dee6Sartem extern "C" {
36*0e42dee6Sartem #endif
37*0e42dee6Sartem 
38*0e42dee6Sartem #include <sys/types.h>
39*0e42dee6Sartem #include <libnvpair.h>
40*0e42dee6Sartem 
41*0e42dee6Sartem typedef struct fstyp_handle *fstyp_handle_t;
42*0e42dee6Sartem 
43*0e42dee6Sartem enum {
44*0e42dee6Sartem 	FSTYP_ERR_OK = 0,
45*0e42dee6Sartem 	FSTYP_ERR_NO_MATCH,		/* no matches */
46*0e42dee6Sartem 	FSTYP_ERR_MULT_MATCH,		/* multiple matches */
47*0e42dee6Sartem 	FSTYP_ERR_HANDLE,		/* invalid handle */
48*0e42dee6Sartem 	FSTYP_ERR_OFFSET,		/* invalid or unsupported offset */
49*0e42dee6Sartem 	FSTYP_ERR_NO_PARTITION,		/* partition not found */
50*0e42dee6Sartem 	FSTYP_ERR_NOP,			/* no such operation */
51*0e42dee6Sartem 	FSTYP_ERR_DEV_OPEN,		/* cannot open device */
52*0e42dee6Sartem 	FSTYP_ERR_IO,			/* I/O error */
53*0e42dee6Sartem 	FSTYP_ERR_NOMEM,		/* out of memory */
54*0e42dee6Sartem 	FSTYP_ERR_MOD_NOT_FOUND,	/* requested fs module not found */
55*0e42dee6Sartem 	FSTYP_ERR_MOD_DIR_OPEN,		/* cannot open directory */
56*0e42dee6Sartem 	FSTYP_ERR_MOD_OPEN,		/* cannot open module */
57*0e42dee6Sartem 	FSTYP_ERR_MOD_VERSION,		/* invalid module version */
58*0e42dee6Sartem 	FSTYP_ERR_MOD_INVALID,		/* invalid module */
59*0e42dee6Sartem 	FSTYP_ERR_NAME_TOO_LONG		/* fs name exceeds FSTYPSZ */
60*0e42dee6Sartem };
61*0e42dee6Sartem 
62*0e42dee6Sartem /*
63*0e42dee6Sartem  * generic attribute names
64*0e42dee6Sartem  *
65*0e42dee6Sartem  * gen_clean (DATA_TYPE_BOOLEAN_VALUE)
66*0e42dee6Sartem  * gen_guid (DATA_TYPE_STRING)
67*0e42dee6Sartem  * gen_version (DATA_TYPE_STRING)
68*0e42dee6Sartem  * gen_volume_label (DATA_TYPE_STRING)
69*0e42dee6Sartem  */
70*0e42dee6Sartem 
71*0e42dee6Sartem int fstyp_init(int fd, off64_t offset, char *module_dir,
72*0e42dee6Sartem     fstyp_handle_t *handle);
73*0e42dee6Sartem void fstyp_fini(fstyp_handle_t handle);
74*0e42dee6Sartem int fstyp_ident(fstyp_handle_t handle, const char *fsname,
75*0e42dee6Sartem     const char **ident);
76*0e42dee6Sartem int fstyp_get_attr(fstyp_handle_t handle, nvlist_t **attr);
77*0e42dee6Sartem int fstyp_dump(fstyp_handle_t handle, FILE *fout, FILE *ferr);
78*0e42dee6Sartem const char *fstyp_strerror(fstyp_handle_t handle, int error);
79*0e42dee6Sartem 
80*0e42dee6Sartem #ifdef __cplusplus
81*0e42dee6Sartem }
82*0e42dee6Sartem #endif
83*0e42dee6Sartem 
84*0e42dee6Sartem #endif /* _LIBFSTYP_H */
85