Current File : //usr/include/libfstyp.h
/*
 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
 */

#ifndef	_LIBFSTYP_H
#define	_LIBFSTYP_H

/*
 * libfstyp: filesystem identification library
 */
#ifdef	__cplusplus
extern "C" {
#endif

#include <sys/types.h>
#include <libnvpair.h>

typedef struct fstyp_handle *fstyp_handle_t;

enum {
	FSTYP_ERR_OK = 0,
	FSTYP_ERR_NO_MATCH,		/* no matches */
	FSTYP_ERR_MULT_MATCH,		/* multiple matches */
	FSTYP_ERR_HANDLE,		/* invalid handle */
	FSTYP_ERR_OFFSET,		/* invalid or unsupported offset */
	FSTYP_ERR_NO_PARTITION,		/* partition not found */
	FSTYP_ERR_NOP,			/* no such operation */
	FSTYP_ERR_DEV_OPEN,		/* cannot open device */
	FSTYP_ERR_IO,			/* I/O error */
	FSTYP_ERR_NOMEM,		/* out of memory */
	FSTYP_ERR_MOD_NOT_FOUND,	/* requested fs module not found */
	FSTYP_ERR_MOD_DIR_OPEN,		/* cannot open directory */
	FSTYP_ERR_MOD_OPEN,		/* cannot open module */
	FSTYP_ERR_MOD_VERSION,		/* invalid module version */
	FSTYP_ERR_MOD_INVALID,		/* invalid module */
	FSTYP_ERR_NAME_TOO_LONG		/* fs name exceeds FSTYPSZ */
};

/*
 * generic attribute names
 *
 * gen_clean (DATA_TYPE_BOOLEAN_VALUE)
 * gen_guid (DATA_TYPE_STRING)
 * gen_version (DATA_TYPE_STRING)
 * gen_volume_label (DATA_TYPE_STRING)
 */

int fstyp_init(int fd, off64_t offset, char *module_dir,
    fstyp_handle_t *handle);
void fstyp_fini(fstyp_handle_t handle);
int fstyp_ident(fstyp_handle_t handle, const char *fsname,
    const char **ident);
int fstyp_get_attr(fstyp_handle_t handle, nvlist_t **attr);
int fstyp_dump(fstyp_handle_t handle, FILE *fout, FILE *ferr);
const char *fstyp_strerror(fstyp_handle_t handle, int error);

#ifdef __cplusplus
}
#endif

#endif /* _LIBFSTYP_H */