Lines Matching refs:cfg_p

52 isns_issue_cmd(struct isns_config_s *cfg_p, uint8_t cmd_type)
54 return (int)write(cfg_p->pipe_fds[1], &cmd_type, 1);
59 isns_issue_cmd_with_data(struct isns_config_s *cfg_p, uint8_t cmd_type,
69 return (int)isns_file_writev(cfg_p->pipe_fds[1], iov, 2);
74 isns_change_kevent_list(struct isns_config_s *cfg_p,
80 return kevent(cfg_p->kq, &evt, 1, NULL, 0, NULL);
87 struct isns_config_s *cfg_p;
90 cfg_p = (struct isns_config_s *)
92 if (cfg_p == NULL) {
96 cfg_p->kq = -1;
97 cfg_p->pipe_fds[0] = -1;
98 cfg_p->pipe_fds[1] = -1;
99 cfg_p->curtask_p = NULL;
100 cfg_p->sd_connected = 0;
101 cfg_p->ai_p = NULL;
102 cfg_p->pdu_in_p = NULL;
104 cfg_p->refresh_p = NULL;
108 if (pthread_mutex_init(&cfg_p->taskq_mutex, &mutexattr) != 0) {
110 isns_free(cfg_p);
116 if (pthread_mutex_init(&cfg_p->trans_mutex, &mutexattr) != 0) {
118 pthread_mutex_destroy(&cfg_p->taskq_mutex);
119 isns_free(cfg_p);
123 SIMPLEQ_INIT(&cfg_p->taskq_head);
125 cfg_p->control_thread_p = (pthread_t *)isns_malloc(sizeof(pthread_t));
126 if (cfg_p->control_thread_p == NULL) {
128 isns_destroy_config(cfg_p);
132 return cfg_p;
137 isns_destroy_config(struct isns_config_s *cfg_p)
141 if (cfg_p != NULL) {
142 if (cfg_p->kq != -1)
143 close(cfg_p->kq);
144 if (cfg_p->pipe_fds[0] != -1)
145 close(cfg_p->pipe_fds[0]);
146 if (cfg_p->pipe_fds[1] != -1)
147 close(cfg_p->pipe_fds[1]);
148 if (cfg_p->control_thread_p != NULL)
149 isns_free(cfg_p->control_thread_p);
150 if (cfg_p->refresh_p != NULL) {
151 if (cfg_p->refresh_p->trans_p != NULL)
152 isns_free_trans(cfg_p->refresh_p->trans_p);
153 isns_free(cfg_p->refresh_p);
156 if ((task_p = cfg_p->curtask_p) != NULL) {
162 while ((task_p = isns_taskq_remove(cfg_p)) != NULL) {
167 pthread_mutex_destroy(&cfg_p->taskq_mutex);
168 pthread_mutex_destroy(&cfg_p->trans_mutex);
169 if (cfg_p->ai_p != NULL) {
170 if (cfg_p->ai_p->ai_canonname != NULL)
171 isns_free(cfg_p->ai_p->ai_canonname);
172 if (cfg_p->ai_p->ai_addr != NULL)
173 isns_free(cfg_p->ai_p->ai_addr);
174 isns_free(cfg_p->ai_p);
176 isns_free(cfg_p);
185 isns_thread_create(struct isns_config_s *cfg_p)
208 error = pthread_create(cfg_p->control_thread_p,
209 &attr, isns_control_thread, cfg_p);
225 isns_thread_destroy(struct isns_config_s *cfg_p)
232 if ((cfg_p == NULL) || (cfg_p->control_thread_p == NULL))
236 error = pthread_join(*cfg_p->control_thread_p, &rv);
249 isns_process_connection_loss(struct isns_config_s *cfg_p)
257 if (cfg_p->curtask_p != NULL) {
258 trans_p = cfg_p->curtask_p->var.send_pdu.trans_p;
262 isns_end_task(cfg_p->curtask_p);
264 if (cfg_p->pdu_in_p != NULL) {
265 isns_free_pdu(cfg_p->pdu_in_p);
266 cfg_p->pdu_in_p = NULL;
280 isns_taskq_insert_head(cfg_p, cfg_p->curtask_p);
281 cfg_p->curtask_p = NULL;
283 isns_issue_cmd(cfg_p, ISNS_CMD_PROCESS_TASKQ);