39 #define domain_printf(domain, fmt, ...) \
41 ocs_log_debug(domain ? domain->ocs : NULL, fmt, ##__VA_ARGS__); \
49 void *arg_out, uint32_t arg_out_length,
void *domain);
77 domain = ocs_malloc(ocs,
sizeof(*domain), OCS_M_NOWAIT | OCS_M_ZERO);
80 domain->instance_index = ocs->domain_instance_count++;
93 ocs_log_err(ocs,
"domain allocation failed\n");
125 if (domain == ocs->domain) {
132 ocs_free(ocs, domain,
sizeof(*domain));
175 ocs_domain_t *domain = NULL;
177 if (index >= OCS_MAX_DOMAINS) {
178 ocs_log_err(ocs,
"invalid index: %d\n", index);
183 if (domain->instance_index == index) {
237 ocs_domain_t *domain = (ocs_domain_t *)
object;
245 if ((sport->mgmt_functions) && (sport->mgmt_functions->get_list_handler)) {
246 sport->mgmt_functions->get_list_handler(textbuf, sport);
259 ocs_domain_t *domain = (ocs_domain_t *)
object;
265 snprintf(qualifier,
sizeof(qualifier),
"%s/domain[%d]", parent, 0);
268 if (ocs_strncmp(name, qualifier, strlen(qualifier)) == 0) {
277 if ((sport->mgmt_functions) && (sport->mgmt_functions->get_handler)) {
278 retval = sport->mgmt_functions->get_handler(textbuf, qualifier, name, sport);
299 ocs_domain_t *domain = (ocs_domain_t *)
object;
305 if ((sport->mgmt_functions) && (sport->mgmt_functions->get_all_handler)) {
306 sport->mgmt_functions->get_all_handler(textbuf, sport);
319 ocs_domain_t *domain = (ocs_domain_t *)
object;
323 snprintf(qualifier,
sizeof(qualifier),
"%s.domain%d", parent, 0);
326 if (ocs_strncmp(name, qualifier, strlen(qualifier)) == 0) {
331 if ((sport->mgmt_functions) && (sport->mgmt_functions->set_handler)) {
332 retval = sport->mgmt_functions->set_handler(qualifier, name, value, sport);
347 void *arg_out, uint32_t arg_out_length,
void *
object)
350 ocs_domain_t *domain = (ocs_domain_t *)
object;
354 snprintf(qualifier,
sizeof(qualifier),
"%s/domain[%d]", parent, 0);
357 if (ocs_strncmp(action, qualifier, strlen(qualifier)) == 0) {
361 if ((sport->mgmt_functions) && (sport->mgmt_functions->exec_handler)) {
362 retval = sport->mgmt_functions->exec_handler(qualifier, action, arg_in, arg_in_length, arg_out, arg_out_length, sport);
static int32_t ocs_domain_lock_try(ocs_domain_t *domain)
void ocs_domain_force_free(ocs_domain_t *domain)
Free memory resources of a domain object.
static int32_t ocs_list_empty(ocs_list_t *list)
Test if a list is empty.
ocs_domain_t * ocs_domain_get_instance(ocs_t *ocs, uint32_t index)
Return a pointer to the domain, given the instance index.
static void ocs_device_lock(ocs_t *ocs)
int ocs_ddump_domain(ocs_textbuf_t *textbuf, ocs_domain_t *domain)
Generate domain ddump.
static ocs_mgmt_functions_t domain_mgmt_functions
void ocs_domain_free(ocs_domain_t *domain)
free a domain object
void ocs_ddump_section(ocs_textbuf_t *textbuf, const char *name, uint32_t instance)
Generate driver dump section start data.
void ocs_mgmt_start_section(ocs_textbuf_t *textbuf, const char *name, int index)
Generate the beginning of a numbered section in a management XML document.
int ocs_ddump_sport(ocs_textbuf_t *textbuf, ocs_sli_port_t *sport)
Generate sli port ddump.
static void * ocs_list_remove(ocs_list_t *list, void *item)
Remove an item from the list.
ocs_domain_t * ocs_domain_alloc(ocs_t *ocs)
Allocate a domain object.
#define ocs_list_init(head, type, link)
#define ocs_list_foreach_safe(list, item, nxt)
Iterate a linked list safely.
static void ocs_device_unlock(ocs_t *ocs)
#define domain_printf(domain, fmt,...)
void ocs_mgmt_domain_get_all(ocs_textbuf_t *textbuf, void *domain)
void ocs_mgmt_end_section(ocs_textbuf_t *textbuf, const char *name, int index)
Generate the indexed end of a section in a management XML document.
void ocs_sport_force_free(ocs_sport_t *sport)
Free memory resources of a SLI port object.
static void ocs_domain_lock_init(ocs_domain_t *domain)
void ocs_ddump_endsection(ocs_textbuf_t *textbuf, const char *name, uint32_t instance)
Generate driver dump section end data.
ocs_mgmt_get_list_handler get_list_handler
static void ocs_domain_lock_free(ocs_domain_t *domain)
static void ocs_list_add_tail(ocs_list_t *list, void *item)
Add an item to the tail of the list.
void ocs_scsi_tgt_ddump(ocs_textbuf_t *textbuf, ocs_scsi_ddump_type_e type, void *obj)
static void ocs_domain_lock(ocs_domain_t *domain)
int ocs_mgmt_domain_get(ocs_textbuf_t *textbuf, char *parent, char *name, void *domain)
#define ocs_assert(cond,...)
void ocs_mgmt_domain_list(ocs_textbuf_t *textbuf, void *domain)
int ocs_mgmt_domain_set(char *parent, char *name, char *value, void *domain)
#define ocs_list_foreach(list, item)
Iterate a linked list.
static void ocs_domain_unlock(ocs_domain_t *domain)
int ocs_mgmt_domain_exec(char *parent, char *action, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length, void *domain)