Go to main content

man pages section 3: Extended Library Functions, Volume 1

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

fstyp_init(3FSTYP)

Name

fstyp_init, fstyp_fini - initialize and finalize libfstyp handle

Synopsis

cc [ flag… ] file–lfstyp –lnvpair [ library… ]
#include <libnvpair.h>
#include <libfstyp.h>

int fstyp_init(int fd, off64_t **offset, char *module_dir,
     fstyp_handle_t *handle);
void fstyp_fini(fstyp_handle_t handle);

Parameters

fd

Open file descriptor of a block or a raw device that contains the file system to be identified.

offset

Offset from the beginning of the device where the file system is located.

module_dir

Optional location of the libfstyp modules.

handle

Opaque handle to be used with libfstyp functions.

Description

The fstyp_init() function returns a handle associated with the specified parameters. This handle should be used with all other libfstyp functions.

If module_dir is NULL, fstyp_init() looks for modules in the default location: /usr/lib/fs subdirectories. The fstyp_init() function locates libfstyp modules, but might defer loading the modules until the subsequent fstyp_ident() call.

If module_dir is other than NULL, the fstyp_init() function locates a module in the directory that is specified. If no module is found, fstyp_init fails with FSTYP_ERR_MOD_NOT_FOUND.

Modules that do not support non-zero offset can fail fstyp_init() with FSTYP_ERR_OFFSET.

The fstyp_fini() function releases all resources associated with a handle and invalidates the handle.

Return Values

The fstyp_init() function returns 0 on success and an error value on failure. See fstyp_strerror(3FSTYP).

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
MT-Safe

See Also

fstyp_ident(3FSTYP), fstyp_mod_init(3FSTYP), fstyp_strerror(3FSTYP), libfstyp(3LIB), attributes(7)