|
Packit Service |
646995 |
/*
|
|
Packit Service |
646995 |
* Copyright (C) 2017 Red Hat, Inc.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* This program is free software: you can redistribute it and/or modify
|
|
Packit Service |
646995 |
* it under the terms of the GNU General Public License as published by
|
|
Packit Service |
646995 |
* the Free Software Foundation, either version 3 of the License, or
|
|
Packit Service |
646995 |
* (at your option) any later version.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
646995 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
646995 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
646995 |
* GNU General Public License for more details.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
646995 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Author: Gris Ge <fge@redhat.com>
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
#ifndef _LIB_OPEN_ISCSI_USR_H_
|
|
Packit Service |
646995 |
#define _LIB_OPEN_ISCSI_USR_H_
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
#ifdef __cplusplus
|
|
Packit Service |
646995 |
extern "C" {
|
|
Packit Service |
646995 |
#endif
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
#include <stdint.h>
|
|
Packit Service |
646995 |
#include <stdarg.h>
|
|
Packit Service |
646995 |
#include <stdbool.h>
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
#include "libopeniscsiusr_common.h"
|
|
Packit Service |
646995 |
#include "libopeniscsiusr_session.h"
|
|
Packit Service |
646995 |
#include "libopeniscsiusr_iface.h"
|
|
Packit Service |
646995 |
#include "libopeniscsiusr_node.h"
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_log_priority_str() - Convert log priority to string.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Convert log priority to string (const char *).
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @priority:
|
|
Packit Service |
646995 |
* int. Log priority.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* const char *. Please don't free returned pointer. Valid string are:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * "ERROR" for LIBISCSI_LOG_PRIORITY_ERROR
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * "WARN" for LIBISCSI_LOG_PRIORITY_WARNING
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * "INFO" for LIBISCSI_LOG_PRIORITY_INFO
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * "DEBUG" for LIBISCSI_LOG_PRIORITY_DEBUG
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * "Invalid argument" for invalid log priority.
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT const char *iscsi_log_priority_str(int priority);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_strerror() - Convert error code to string.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Convert error code (int) to string (const char *):
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_OK -- "OK"
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_BUG -- "BUG of libopeniscsiusr library"
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_SESS_NOT_FOUND - "Specified iSCSI session not found"
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_ACCESS - "Permission deny"
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_NOMEM - "Out of memory"
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_SYSFS_LOOKUP - "Could not lookup object in sysfs"
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * Other invalid error number -- "Invalid argument"
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @rc:
|
|
Packit Service |
646995 |
* int. Return code by libiscsiur functions. When provided error code is
|
|
Packit Service |
646995 |
* not a valid error code, return "Invalid argument".
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* const char *. The meaning of provided error code. Don't free returned
|
|
Packit Service |
646995 |
* pointer.
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT const char *iscsi_strerror(int rc);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_context_new() - Create struct iscsi_context.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* The default logging level (LIBISCSI_LOG_PRIORITY_DEFAULT) is
|
|
Packit Service |
646995 |
* LIBISCSI_LOG_PRIORITY_WARNING which means only warning and error message will
|
|
Packit Service |
646995 |
* be forward to log handler function. The default log handler function will
|
|
Packit Service |
646995 |
* print log message to STDERR, to change so, please use
|
|
Packit Service |
646995 |
* iscsi_context_log_func_set() to set your own log handler, check manpage
|
|
Packit Service |
646995 |
* libopeniscsiusr.h(3) for detail.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'. Should be freed by
|
|
Packit Service |
646995 |
* iscsi_context_free().
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT struct iscsi_context *iscsi_context_new(void);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_context_free() - Release the memory of struct iscsi_context.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Release the memory of struct iscsi_context, but the userdata memory defined
|
|
Packit Service |
646995 |
* via iscsi_context_userdata_set() will not be touched.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void iscsi_context_free(struct iscsi_context *ctx);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_context_log_priority_set() - Set log priority.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* When library generates log message, only equal or more important(less value)
|
|
Packit Service |
646995 |
* message will be forwarded to log handler function. Valid log priority values
|
|
Packit Service |
646995 |
* are:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_LOG_PRIORITY_ERROR -- 3
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_LOG_PRIORITY_WARNING -- 4
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_LOG_PRIORITY_INFO -- 6
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_LOG_PRIORITY_DEBUG -- 7
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @priority:
|
|
Packit Service |
646995 |
* int, log priority.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void iscsi_context_log_priority_set(struct iscsi_context *ctx,
|
|
Packit Service |
646995 |
int priority);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_context_log_priority_get() - Get log priority.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Retrieve current log priority. Valid log priority values are:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_LOG_PRIORITY_ERROR -- 3
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_LOG_PRIORITY_WARNING -- 4
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_LOG_PRIORITY_INFO -- 5
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_LOG_PRIORITY_DEBUG -- 7
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* int, log priority.
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT int iscsi_context_log_priority_get(struct iscsi_context *ctx);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_context_log_func_set() - Set log handler function.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Set custom log handler. The log handler will be invoked when log message
|
|
Packit Service |
646995 |
* is equal or more important(less value) than log priority setting.
|
|
Packit Service |
646995 |
* Please check manpage libopeniscsiusr.h(3) for detail usage.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @log_func:
|
|
Packit Service |
646995 |
* Pointer of log handler function.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void iscsi_context_log_func_set
|
|
Packit Service |
646995 |
(struct iscsi_context *ctx,
|
|
Packit Service |
646995 |
void (*log_func) (struct iscsi_context *ctx, int priority,
|
|
Packit Service |
646995 |
const char *file, int line, const char *func_name,
|
|
Packit Service |
646995 |
const char *format, va_list args));
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_context_userdata_set() - Set user data pointer.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Store user data pointer into 'struct iscsi_context'.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @userdata:
|
|
Packit Service |
646995 |
* Pointer of user defined data.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void iscsi_context_userdata_set(struct iscsi_context *ctx,
|
|
Packit Service |
646995 |
void *userdata);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_context_userdata_get() - Get user data pointer.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Retrieve user data pointer from 'struct iscsi_context'.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void *. Pointer of user defined data.
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void *iscsi_context_userdata_get(struct iscsi_context *ctx);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_sessions_get() - Retrieve all iSCSI sessions.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Retrieves all iSCSI sessions. For the properties of 'struct iscsi_session',
|
|
Packit Service |
646995 |
* please refer to the functions defined in 'libopeniscsiusr_session.h' file.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @ses:
|
|
Packit Service |
646995 |
* Output pointer of 'struct iscsi_session' pointer array. Its memory
|
|
Packit Service |
646995 |
* should be freed by iscsi_sessions_free().
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @se_count:
|
|
Packit Service |
646995 |
* Output pointer of uint32_t. Will store the size of
|
|
Packit Service |
646995 |
* 'struct iscsi_session' pointer array.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* int. Valid error codes are:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_OK
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_BUG
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_NOMEM
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_ACCESS
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_SYSFS_LOOKUP
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Error number could be converted to string by iscsi_strerror().
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT int iscsi_sessions_get(struct iscsi_context *ctx,
|
|
Packit Service |
646995 |
struct iscsi_session ***ses,
|
|
Packit Service |
646995 |
uint32_t *se_count);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_sessions_free() - Free the memory of 'struct iscsi_session' pointer
|
|
Packit Service |
646995 |
* array
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Free the memory of 'iscsi_session' pointer array generated by
|
|
Packit Service |
646995 |
* 'iscsi_sessions_get()'.
|
|
Packit Service |
646995 |
* If provided 'ses' pointer is NULL or 'session_count' is 0, do nothing.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ses:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_session' pointer array.
|
|
Packit Service |
646995 |
* @session_count:
|
|
Packit Service |
646995 |
* uint32_t, the size of 'struct iscsi_session' pointer array.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void iscsi_sessions_free(struct iscsi_session **ses,
|
|
Packit Service |
646995 |
uint32_t session_count);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_session_get() - Retrieve specified iSCSI sessions.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Retrieves specified iSCSI sessions. For the properties of
|
|
Packit Service |
646995 |
* 'struct iscsi_session', please refer to the functions defined in
|
|
Packit Service |
646995 |
* 'libopeniscsiusr_session.h' file.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @sid:
|
|
Packit Service |
646995 |
* uint32_t, iSCSI session ID.
|
|
Packit Service |
646995 |
* @se:
|
|
Packit Service |
646995 |
* Output pointer of 'struct iscsi_session' pointer. Its memory
|
|
Packit Service |
646995 |
* should be freed by iscsi_session_free().
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* If specified iSCSI session does not exists, this pointer will be set to
|
|
Packit Service |
646995 |
* NULL with LIBISCSI_OK returned.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* int. Valid error codes are:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_OK
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_BUG
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_NOMEM
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_ACCESS
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_SYSFS_LOOKUP
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_SESS_NOT_FOUND
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Error number could be converted to string by iscsi_strerror().
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT int iscsi_session_get(struct iscsi_context *ctx, uint32_t sid,
|
|
Packit Service |
646995 |
struct iscsi_session **se);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_session_free() - Free the memory of 'struct iscsi_session'.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Free the memory of 'iscsi_session' pointer generated by
|
|
Packit Service |
646995 |
* 'iscsi_sessions_get()'.
|
|
Packit Service |
646995 |
* If provided 'se' pointer is NULL, do nothing.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @se:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_session' pointer.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void iscsi_session_free(struct iscsi_session *se);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_default_iface_setup() - Setup default iSCSI interfaces.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Setup default iSCSI interfaces for iSCSI TCP, iSER and iSCSI hardware offload
|
|
Packit Service |
646995 |
* cards. It is required after new iSCSI hardware offload card installed.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Below kernel modules will be loaded when required by this function:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * cxgb3i
|
|
Packit Service |
646995 |
* * cxgb4i
|
|
Packit Service |
646995 |
* * bnx2i
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* It will also create configuration files for iSCSI hardware offload cards in
|
|
Packit Service |
b0396a |
* /var/lib/iscsi/ifaces/<iface_name>.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* int. Valid error codes are:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_OK
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_BUG
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_NOMEM
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_ACCESS
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_SYSFS_LOOKUP
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_IDBM
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Error number could be converted to string by iscsi_strerror().
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT int iscsi_default_iface_setup(struct iscsi_context *ctx);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_ifaces_get() - Retrieve all iSCSI interfaces.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Retrieves all iSCSI interfaces. For the properties of 'struct iscsi_iface',
|
|
Packit Service |
646995 |
* please refer to the functions defined in 'libopeniscsiusr_iface.h' file.
|
|
Packit Service |
646995 |
* The returned results contains default iSCSI interfaces(iser and iscsi_tcp)
|
|
Packit Service |
b0396a |
* and iSCSI interfaces configured in "/var/lib/iscsi/ifaces/".
|
|
Packit Service |
646995 |
* Illegal configuration file will be skipped and warned.
|
|
Packit Service |
646995 |
* To generate iSCSI interface configuration when new card installed, please
|
|
Packit Service |
646995 |
* use iscsi_default_iface_setup().
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @ifaces:
|
|
Packit Service |
646995 |
* Output pointer of 'struct iscsi_iface' pointer array. Its memory
|
|
Packit Service |
646995 |
* should be freed by iscsi_ifaces_free().
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @iface_count:
|
|
Packit Service |
646995 |
* Output pointer of uint32_t. Will store the size of
|
|
Packit Service |
646995 |
* 'struct iscsi_iface' pointer array.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* int. Valid error codes are:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_OK
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_BUG
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_NOMEM
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_ACCESS
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_SYSFS_LOOKUP
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Error number could be converted to string by iscsi_strerror().
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT int iscsi_ifaces_get(struct iscsi_context *ctx,
|
|
Packit Service |
646995 |
struct iscsi_iface ***ifaces,
|
|
Packit Service |
646995 |
uint32_t *iface_count);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_ifaces_free() - Free the memory of 'struct iscsi_iface' pointer
|
|
Packit Service |
646995 |
* array
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Free the memory of 'iscsi_iface' pointer array generated by
|
|
Packit Service |
646995 |
* 'iscsi_ifaces_get()'.
|
|
Packit Service |
646995 |
* If provided 'ifaces' pointer is NULL or 'iface_count' is 0, do nothing.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ifaces:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_iface' pointer array.
|
|
Packit Service |
646995 |
* @iface_count:
|
|
Packit Service |
646995 |
* uint32_t, the size of 'struct iscsi_iface' pointer array.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void iscsi_ifaces_free(struct iscsi_iface **ifaces,
|
|
Packit Service |
646995 |
uint32_t iface_count);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_iface_get() - Retrieve specified iSCSI interface.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Retrieves specified iSCSI interfaces by reading configuration from
|
|
Packit Service |
b0396a |
* "/var/lib/iscsi/iface/<iface_name>".
|
|
Packit Service |
646995 |
* To generate iSCSI interface configuration when new card installed, please
|
|
Packit Service |
646995 |
* use iscsi_default_iface_setup().
|
|
Packit Service |
646995 |
* Illegal configuration file will be treated as error LIBISCSI_ERR_IDBM.
|
|
Packit Service |
646995 |
* Configuration file not found will be treated as error LIBISCSI_ERR_INVAL.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @iface_name:
|
|
Packit Service |
646995 |
* String. Name of iSCSI interface. Also the file name of configuration
|
|
Packit Service |
b0396a |
* file "/var/lib/iscsi/iface/<iface_name>".
|
|
Packit Service |
646995 |
* If this pointer is NULL or empty string, your program will be terminated
|
|
Packit Service |
646995 |
* by assert.
|
|
Packit Service |
646995 |
* @iface:
|
|
Packit Service |
646995 |
* Output pointer of 'struct iscsi_iface'. Its memory should be freed by
|
|
Packit Service |
646995 |
* iscsi_iface_free().
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* int. Valid error codes are:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_OK
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_BUG
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_NOMEM
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_ACCESS
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_SYSFS_LOOKUP
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_IDBM
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Error number could be converted to string by iscsi_strerror().
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT int iscsi_iface_get(struct iscsi_context *ctx,
|
|
Packit Service |
646995 |
const char *iface_name,
|
|
Packit Service |
646995 |
struct iscsi_iface **iface);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_iface_free() - Free the memory of 'struct iscsi_iface' pointer.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Free the memory of 'iscsi_iface' pointer generated by 'iscsi_iface_get()'.
|
|
Packit Service |
646995 |
* If provided 'iface' pointer is NULL, do nothing.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @iface:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_iface' pointer.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void iscsi_iface_free(struct iscsi_iface *iface);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_nodes_get() - Retrieve all iSCSI nodes.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Retrieves all iSCSI nodes. For the properties of 'struct iscsi_node',
|
|
Packit Service |
646995 |
* please refer to the functions defined in 'libopeniscsiusr_node.h' file.
|
|
Packit Service |
646995 |
* The returned results contains iSCSI nodes configured in "/etc/iscsi/nodes/".
|
|
Packit Service |
646995 |
* Illegal configuration file will be skipped and warned.
|
|
Packit Service |
646995 |
* The returned 'struct iscsi_node' pointer array is sorted by target name,
|
|
Packit Service |
646995 |
* connection address, connection port and interface.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @ctx:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_context'.
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @nodes:
|
|
Packit Service |
646995 |
* Output pointer of 'struct iscsi_node' pointer array. Its memory
|
|
Packit Service |
646995 |
* should be freed by iscsi_nodes_free().
|
|
Packit Service |
646995 |
* If this pointer is NULL, your program will be terminated by assert.
|
|
Packit Service |
646995 |
* @node_count:
|
|
Packit Service |
646995 |
* Output pointer of uint32_t. Will store the size of
|
|
Packit Service |
646995 |
* 'struct iscsi_node' pointer array.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* int. Valid error codes are:
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_OK
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_BUG
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_NOMEM
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_ACCESS
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_SYSFS_LOOKUP
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* * LIBISCSI_ERR_IDBM
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Error number could be converted to string by iscsi_strerror().
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT int iscsi_nodes_get(struct iscsi_context *ctx,
|
|
Packit Service |
646995 |
struct iscsi_node ***nodes,
|
|
Packit Service |
646995 |
uint32_t *node_count);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
/**
|
|
Packit Service |
646995 |
* iscsi_nodes_free() - Free the memory of 'struct iscsi_node' pointer
|
|
Packit Service |
646995 |
* array
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Free the memory of 'iscsi_node' pointer array generated by
|
|
Packit Service |
646995 |
* 'iscsi_nodes_get()'.
|
|
Packit Service |
646995 |
* If provided 'nodes' pointer is NULL or 'node_count' is 0, do nothing.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* @nodes:
|
|
Packit Service |
646995 |
* Pointer of 'struct iscsi_node' pointer array.
|
|
Packit Service |
646995 |
* @node_count:
|
|
Packit Service |
646995 |
* uint32_t, the size of 'struct iscsi_node' pointer array.
|
|
Packit Service |
646995 |
*
|
|
Packit Service |
646995 |
* Return:
|
|
Packit Service |
646995 |
* void
|
|
Packit Service |
646995 |
*/
|
|
Packit Service |
646995 |
__DLL_EXPORT void iscsi_nodes_free(struct iscsi_node **nodes,
|
|
Packit Service |
646995 |
uint32_t node_count);
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
#ifdef __cplusplus
|
|
Packit Service |
646995 |
} /* End of extern "C" */
|
|
Packit Service |
646995 |
#endif
|
|
Packit Service |
646995 |
|
|
Packit Service |
646995 |
#endif /* End of _LIB_OPEN_ISCSI_USR_H_ */
|