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