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