Scroll to navigation

libsmdev(3) Library Functions Manual libsmdev(3)

NAME

libsmdev.hLibrary to access and read storage media (SM) devices

SYNOPSIS

#include <libsmdev.h>

Support functions
const char *
libsmdev_get_version(void);

int
libsmdev_get_access_flags_read(void);

int
libsmdev_get_access_flags_read_write(void);

int
libsmdev_get_access_flags_write(void);

int
libsmdev_get_codepage(int *codepage, libsmdev_error_t **error);

int
libsmdev_set_codepage(int codepage, libsmdev_error_t **error);

int
libsmdev_check_device(const char *filename, libsmdev_error_t **error);

Available when compiled with wide character string support:
int
libsmdev_check_device_wide(const wchar_t *filename, libsmdev_error_t **error);

Notify functions
void
libsmdev_notify_set_verbose(int verbose);

int
libsmdev_notify_set_stream(FILE *stream, libsmdev_error_t **error);

int
libsmdev_notify_stream_open(const char *filename, libsmdev_error_t **error);

int
libsmdev_notify_stream_close(libsmdev_error_t **error);

Error functions
void
libsmdev_error_free(libsmdev_error_t **error);

int
libsmdev_error_fprint(libsmdev_error_t *error, FILE *stream);

int
libsmdev_error_sprint(libsmdev_error_t *error, char *string, size_t size);

int
libsmdev_error_backtrace_fprint(libsmdev_error_t *error, FILE *stream);

int
libsmdev_error_backtrace_sprint(libsmdev_error_t *error, char *string, size_t size);

Handle functions
int
libsmdev_handle_initialize(libsmdev_handle_t **handle, libsmdev_error_t **error);

int
libsmdev_handle_free(libsmdev_handle_t **handle, libsmdev_error_t **error);

int
libsmdev_handle_signal_abort(libsmdev_handle_t *handle, libsmdev_error_t **error);

int
libsmdev_handle_open(libsmdev_handle_t *handle, const char *filename, int access_flags, libsmdev_error_t **error);

int
libsmdev_handle_close(libsmdev_handle_t *handle, libsmdev_error_t **error);

ssize_t
libsmdev_handle_read_buffer(libsmdev_handle_t *handle, uint8_t *buffer, size_t buffer_size, libsmdev_error_t **error);

ssize_t
libsmdev_handle_read_buffer_at_offset(libsmdev_handle_t *handle, uint8_t *buffer, size_t buffer_size, off64_t offset, libsmdev_error_t **error);

ssize_t
libsmdev_handle_write_buffer(libsmdev_handle_t *handle, const uint8_t *buffer, size_t buffer_size, libsmdev_error_t **error);

ssize_t
libsmdev_handle_write_buffer_at_offset(libsmdev_handle_t *handle, const uint8_t *buffer, size_t buffer_size, off64_t offset, libsmdev_error_t **error);

off64_t
libsmdev_handle_seek_offset(libsmdev_handle_t *handle, off64_t offset, int whence, libsmdev_error_t **error);

int
libsmdev_handle_get_offset(libsmdev_handle_t *handle, off64_t *offset, libsmdev_error_t **error);

int
libsmdev_handle_get_filename_size(libsmdev_handle_t *handle, size_t *filename_size, libsmdev_error_t **error);

int
libsmdev_handle_get_filename(libsmdev_handle_t *handle, char *filename, size_t filename_size, libsmdev_error_t **error);

Available when compiled with wide character string support:
int
libsmdev_handle_open_wide(libsmdev_handle_t *handle, const wchar_t *filename, int access_flags, libsmdev_error_t **error);

int
libsmdev_handle_get_filename_size_wide(libsmdev_handle_t *handle, size_t *filename_size, libsmdev_error_t **error);

int
libsmdev_handle_get_filename_wide(libsmdev_handle_t *handle, wchar_t *filename, size_t filename_size, libsmdev_error_t **error);

Meta data functions
int
libsmdev_handle_get_media_size(libsmdev_handle_t *handle, size64_t *media_size, libsmdev_error_t **error);

int
libsmdev_handle_get_bytes_per_sector(libsmdev_handle_t *handle, uint32_t *bytes_per_sector, libsmdev_error_t **error);

int
libsmdev_handle_get_media_type(libsmdev_handle_t *handle, uint8_t *media_type, libsmdev_error_t **error);

int
libsmdev_handle_get_bus_type(libsmdev_handle_t *handle, uint8_t *bus_type, libsmdev_error_t **error);

int
libsmdev_handle_get_utf8_information_value(libsmdev_handle_t *handle, const uint8_t *identifier, size_t identifier_length, uint8_t *utf8_string, size_t utf8_string_size, libsmdev_error_t **error);

int
libsmdev_handle_get_utf16_information_value(libsmdev_handle_t *handle, const uint8_t *identifier, size_t identifier_length, uint16_t *utf16_string, size_t utf16_string_size, libsmdev_error_t **error);

int
libsmdev_handle_get_number_of_sessions(libsmdev_handle_t *handle, int *number_of_sessions, libsmdev_error_t **error);

int
libsmdev_handle_get_session(libsmdev_handle_t *handle, int index, uint64_t *start_sector, uint64_t *number_of_sectors, libsmdev_error_t **error);

int
libsmdev_handle_get_number_of_tracks(libsmdev_handle_t *handle, int *number_of_tracks, libsmdev_error_t **error);

int
libsmdev_handle_get_track(libsmdev_handle_t *handle, int index, uint64_t *start_sector, uint64_t *number_of_sectors, uint8_t *type, libsmdev_error_t **error);

int
libsmdev_handle_get_number_of_error_retries(libsmdev_handle_t *handle, uint8_t *number_of_error_retries, libsmdev_error_t **error);

int
libsmdev_handle_set_number_of_error_retries(libsmdev_handle_t *handle, uint8_t number_of_error_retries, libsmdev_error_t **error);

int
libsmdev_handle_get_error_granularity(libsmdev_handle_t *handle, size_t *error_granularity, libsmdev_error_t **error);

int
libsmdev_handle_set_error_granularity(libsmdev_handle_t *handle, size_t error_granularity, libsmdev_error_t **error);

int
libsmdev_handle_get_error_flags(libsmdev_handle_t *handle, uint8_t *error_flags, libsmdev_error_t **error);

int
libsmdev_handle_set_error_flags(libsmdev_handle_t *handle, uint8_t error_flags, libsmdev_error_t **error);

int
libsmdev_handle_get_number_of_errors(libsmdev_handle_t *handle, int *number_of_errors, libsmdev_error_t **error);

int
libsmdev_handle_get_error(libsmdev_handle_t *handle, int index, off64_t *offset, size64_t *size, libsmdev_error_t **error);

DESCRIPTION

The () function is used to retrieve the library version.

RETURN VALUES

Most of the functions return NULL or -1 on error, dependent on the return type. For the actual return values see "libsmdev.h".

ENVIRONMENT

None

FILES

None

NOTES

libsmdev can be compiled with wide character support (wchar_t).

To compile libsmdev with wide character support use: ./configure --enable-wide-character-type=yes
or define: _UNICODE
or UNICODE
during compilation.

LIBSMDEV_WIDE_CHARACTER_TYPE
in libsmdev/features.h can be used to determine if libsmdev was compiled with wide character support.

BUGS

Please report bugs of any kind on the project issue tracker: https://github.com/libyal/libsmdev/issues

AUTHOR

These man pages are generated from "libsmdev.h".

COPYRIGHT

Copyright (C) 2010-2019, Joachim Metz <joachim.metz@gmail.com>.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO

the libsmdev.h include file

March 10, 2019 libsmdev