| Server IP : 127.0.1.1 / Your IP : 216.73.216.152 Web Server : Apache/2.4.52 (Ubuntu) System : Linux bahcrestlinepropertiesllc 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/2792866/cwd/usr/share/doc/libopeniscsiusr/ |
Upload File : |
.TH "libopeniscsiusr.h" 3 "November 2017" "iSCSI userspace API - libopeniscsiusr Manual"
.SH NAME
libopeniscsiusr.h \- iSCSI userspace API.
.SH SYNOPSIS
#include <libopeniscsiusr/libopeniscsiusr.h>
.SH "DESCRIPTION"
All the libopeniscsiusr public functions ship their own man pages.
You may use 'man -k iscsi' to find out and use 'man 3 <function_name>' to check
the detail usage.
.SH "USAGE"
To use libopeniscsiusr in your project, we suggest to use the 'pkg-config' way:
* Add this line into your configure.ac:
PKG_CHECK_MODULES([LIBISCSIUSR], [libopeniscsiusr])
* Add these lines into your Makefile.am:
foo_LDFLAGS += $(LIBISCSIUSR_LIBS)
foo_CFLAGS += $(LIBISCSIUSR_CFLAGS)
.SH LOG HANDLING
The log handler function could be set via 'iscsi_context_log_func_set()'.
The log priority could be set via 'iscsi_context_log_priority_set()'.
By default, the log priorities is 'LIBISCSI_LOG_PRIORITY_WARNING'.
By default, the log handler is print log to STDERR, and its code is listed
below in case you want to take it as an example to create your own log handler.
#define _ISCSI_LOG_STRERR_ALIGN_WIDTH 80
void _iscsi_log_stderr(struct iscsi_context *ctx, int priority,
const char *file, int line,
const char *func_name,
const char *format, va_list args)
{
int printed_bytes = 0;
printed_bytes += fprintf(stderr, "iSCSI %s: ",
iscsi_log_priority_str(priority));
printed_bytes += vfprintf(stderr, format, args);
if (printed_bytes < _ISCSI_LOG_STRERR_ALIGN_WIDTH) {
fprintf(stderr, "%*s # %s:%s():%d\n",
_ISCSI_LOG_STRERR_ALIGN_WIDTH - printed_bytes,
"", file, func_name, line);
} else {
fprintf(stderr, " # %s:%s():%d\n", file, func_name,
line);
}
}
.SH "SAMPLE CODE"
struct iscsi_context *ctx = NULL;
struct iscsi_session **ses = NULL;
uint32_t se_count = 0;
uint32_t i = 0;
int rc = EXIT_SUCCESS;
ctx = iscsi_context_new();
iscsi_context_log_priority_set(ctx, LIBISCSI_LOG_PRIORITY_DEBUG);
if (iscsi_sessions_get(ctx, &ses, &se_count) != LIBISCSI_OK) {
printf("FAILED\n");
rc = EXIT_FAILURE;
} else {
printf("\nGot %" PRIu32 " iSCSI sessions\n", se_count);
for (i = 0; i < se_count; ++i)
printf("SID is %" PRIu32 "\n",
iscsi_session_sid_get(ses[i]));
iscsi_sessions_free(ses, se_count);
}
iscsi_context_free(ctx);
exit(rc);
.SH "LICENSE"
GPLv3+
.SH "BUG"
Please report bug to https://github.com/open-iscsi/open-iscsi/issues