corosync  2.4.4-dirty
lib/cfg.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2005 MontaVista Software, Inc.
3  * Copyright (c) 2006-2013 Red Hat, Inc.
4  *
5  * All rights reserved.
6  *
7  * Author: Steven Dake (sdake@redhat.com)
8  *
9  * This software licensed under BSD license, the text of which follows:
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * - Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  * - Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  * - Neither the name of the MontaVista Software, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33  * THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #include <config.h>
37 
38 #include <stdio.h>
39 #include <string.h>
40 #include <stdlib.h>
41 #include <unistd.h>
42 #include <errno.h>
43 #include <pthread.h>
44 #include <limits.h>
45 #include <sys/types.h>
46 #include <sys/socket.h>
47 #include <sys/select.h>
48 #include <sys/un.h>
49 #include <sys/uio.h>
50 
51 #include <qb/qbipcc.h>
52 
53 #include <corosync/corotypes.h>
54 #include <corosync/corodefs.h>
55 #include <corosync/hdb.h>
56 
57 #include <corosync/cfg.h>
58 #include <corosync/ipc_cfg.h>
59 
60 #include "util.h"
61 
62 /*
63  * Data structure for instance data
64  */
65 struct cfg_inst {
66  qb_ipcc_connection_t *c;
70  int finalize;
71 };
72 
73 /*
74  * All instances in one database
75  */
76 static void cfg_inst_free (void *inst);
77 
78 DECLARE_HDB_DATABASE (cfg_hdb, cfg_inst_free);
79 
80 /*
81  * Implementation
82  */
83 
86  corosync_cfg_handle_t *cfg_handle,
87  const corosync_cfg_callbacks_t *cfg_callbacks)
88 {
89  struct cfg_inst *cfg_inst;
90  cs_error_t error = CS_OK;
91 
92  error = hdb_error_to_cs (hdb_handle_create (&cfg_hdb, sizeof (struct cfg_inst), cfg_handle));
93  if (error != CS_OK) {
94  goto error_no_destroy;
95  }
96 
97  error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, *cfg_handle, (void *)&cfg_inst));
98  if (error != CS_OK) {
99  goto error_destroy;
100  }
101 
102  cfg_inst->finalize = 0;
103  cfg_inst->c = qb_ipcc_connect ("cfg", IPC_REQUEST_SIZE);
104  if (cfg_inst->c == NULL) {
105  error = qb_to_cs_error(-errno);
106  goto error_put_destroy;
107  }
108 
109  if (cfg_callbacks) {
110  memcpy (&cfg_inst->callbacks, cfg_callbacks, sizeof (corosync_cfg_callbacks_t));
111  }
112 
113  (void)hdb_handle_put (&cfg_hdb, *cfg_handle);
114 
115  return (CS_OK);
116 
117 error_put_destroy:
118  (void)hdb_handle_put (&cfg_hdb, *cfg_handle);
119 error_destroy:
120  (void)hdb_handle_destroy (&cfg_hdb, *cfg_handle);
121 error_no_destroy:
122  return (error);
123 }
124 
127  corosync_cfg_handle_t cfg_handle,
128  int32_t *selection_fd)
129 {
130  struct cfg_inst *cfg_inst;
131  cs_error_t error;
132 
133  error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, cfg_handle, (void *)&cfg_inst));
134  if (error != CS_OK) {
135  return (error);
136  }
137 
138  error = qb_to_cs_error (qb_ipcc_fd_get (cfg_inst->c, selection_fd));
139 
140  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
141  return (error);
142 }
143 
146  corosync_cfg_handle_t cfg_handle,
147  cs_dispatch_flags_t dispatch_flags)
148 {
149  int timeout = -1;
150  cs_error_t error;
151  int cont = 1; /* always continue do loop except when set to 0 */
152  struct cfg_inst *cfg_inst;
155  struct qb_ipc_response_header *dispatch_data;
156  char dispatch_buf[IPC_DISPATCH_SIZE];
157 
158  error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, cfg_handle,
159  (void *)&cfg_inst));
160  if (error != CS_OK) {
161  return (error);
162  }
163 
164  /*
165  * Timeout instantly for CS_DISPATCH_ONE_NONBLOCKING or CS_DISPATCH_ALL and
166  * wait indefinately for CS_DISPATCH_ONE or CS_DISPATCH_BLOCKING
167  */
168  if (dispatch_flags == CS_DISPATCH_ALL || dispatch_flags == CS_DISPATCH_ONE_NONBLOCKING) {
169  timeout = 0;
170  }
171 
172  dispatch_data = (struct qb_ipc_response_header *)dispatch_buf;
173  do {
174  error = qb_to_cs_error (qb_ipcc_event_recv (
175  cfg_inst->c,
176  dispatch_buf,
178  timeout));
179  if (error == CS_ERR_BAD_HANDLE) {
180  error = CS_OK;
181  goto error_put;
182  }
183  if (error == CS_ERR_TRY_AGAIN) {
184  if (dispatch_flags == CS_DISPATCH_ONE_NONBLOCKING) {
185  /*
186  * Don't mask error
187  */
188  goto error_put;
189  }
190  error = CS_OK;
191  if (dispatch_flags == CS_DISPATCH_ALL) {
192  break; /* exit do while cont is 1 loop */
193  } else {
194  continue; /* next poll */
195  }
196  }
197  if (error != CS_OK) {
198  goto error_put;
199  }
200 
201  /*
202  * Make copy of callbacks, message data, unlock instance, and call callback
203  * A risk of this dispatch method is that the callback routines may
204  * operate at the same time that cfgFinalize has been called in another thread.
205  */
206  memcpy (&callbacks, &cfg_inst->callbacks, sizeof (corosync_cfg_callbacks_t));
207 
208  /*
209  * Dispatch incoming response
210  */
211  switch (dispatch_data->id) {
213  if (callbacks.corosync_cfg_shutdown_callback == NULL) {
214  break;
215  }
216 
217  res_lib_cfg_testshutdown = (struct res_lib_cfg_testshutdown *)dispatch_data;
218  callbacks.corosync_cfg_shutdown_callback(cfg_handle, res_lib_cfg_testshutdown->flags);
219  break;
220  default:
221  error = CS_ERR_LIBRARY;
222  goto error_nounlock;
223  break;
224  }
225  if (cfg_inst->finalize) {
226  /*
227  * If the finalize has been called then get out of the dispatch.
228  */
229  error = CS_ERR_BAD_HANDLE;
230  goto error_put;
231  }
232 
233  /*
234  * Determine if more messages should be processed
235  */
236  if (dispatch_flags == CS_DISPATCH_ONE || dispatch_flags == CS_DISPATCH_ONE_NONBLOCKING) {
237  cont = 0;
238  }
239  } while (cont);
240 
241 error_put:
242  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
243 error_nounlock:
244  return (error);
245 }
246 
247 static void cfg_inst_free (void *inst)
248 {
249  struct cfg_inst *cfg_inst = (struct cfg_inst *)inst;
250  qb_ipcc_disconnect(cfg_inst->c);
251 }
252 
255  corosync_cfg_handle_t cfg_handle)
256 {
257  struct cfg_inst *cfg_inst;
258  cs_error_t error;
259 
260  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle, (void *)&cfg_inst));
261  if (error != CS_OK) {
262  return (error);
263  }
264 
265  /*
266  * Another thread has already started finalizing
267  */
268  if (cfg_inst->finalize) {
269  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
270  return (CS_ERR_BAD_HANDLE);
271  }
272 
273  cfg_inst->finalize = 1;
274 
275  (void)hdb_handle_destroy (&cfg_hdb, cfg_handle);
276 
277  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
278 
279  return (error);
280 }
281 
284  corosync_cfg_handle_t cfg_handle,
285  char ***interface_names,
286  char ***status,
287  unsigned int *interface_count)
288 {
289  struct cfg_inst *cfg_inst;
290  struct req_lib_cfg_ringstatusget req_lib_cfg_ringstatusget;
291  struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget;
292  unsigned int i, j;
293  cs_error_t error;
294  struct iovec iov;
295 
296  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle, (void *)&cfg_inst));
297  if (error != CS_OK) {
298  return (error);
299  }
300 
301  req_lib_cfg_ringstatusget.header.size = sizeof (struct req_lib_cfg_ringstatusget);
302  req_lib_cfg_ringstatusget.header.id = MESSAGE_REQ_CFG_RINGSTATUSGET;
303 
304  iov.iov_base = (void *)&req_lib_cfg_ringstatusget,
305  iov.iov_len = sizeof (struct req_lib_cfg_ringstatusget),
306 
307  error = qb_to_cs_error (qb_ipcc_sendv_recv(cfg_inst->c,
308  &iov,
309  1,
310  &res_lib_cfg_ringstatusget,
311  sizeof (struct res_lib_cfg_ringstatusget), CS_IPC_TIMEOUT_MS));
312 
313  if (error != CS_OK) {
314  goto exit_handle_put;
315  }
316 
317  *interface_count = res_lib_cfg_ringstatusget.interface_count;
318  *interface_names = malloc (sizeof (char *) * *interface_count);
319  if (*interface_names == NULL) {
320  return (CS_ERR_NO_MEMORY);
321  }
322  memset (*interface_names, 0, sizeof (char *) * *interface_count);
323 
324  *status = malloc (sizeof (char *) * *interface_count);
325  if (*status == NULL) {
326  error = CS_ERR_NO_MEMORY;
327  goto error_free_interface_names_array;
328  }
329  memset (*status, 0, sizeof (char *) * *interface_count);
330 
331  for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) {
332  (*(interface_names))[i] = strdup (res_lib_cfg_ringstatusget.interface_name[i]);
333  if ((*(interface_names))[i] == NULL) {
334  error = CS_ERR_NO_MEMORY;
335  goto error_free_interface_names;
336  }
337  }
338 
339  for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) {
340  (*(status))[i] = strdup (res_lib_cfg_ringstatusget.interface_status[i]);
341  if ((*(status))[i] == NULL) {
342  error = CS_ERR_NO_MEMORY;
343  goto error_free_status;
344  }
345  }
346  goto exit_handle_put;
347 
348 error_free_status:
349  for (j = 0; j < i; j++) {
350  free ((*(status))[j]);
351  }
352  i = *interface_count;
353 
354 error_free_interface_names:
355  for (j = 0; j < i; j++) {
356  free ((*(interface_names))[j]);
357  }
358 
359  free (*status);
360 
361 error_free_interface_names_array:
362  free (*interface_names);
363 
364 exit_handle_put:
365  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
366 
367  return (error);
368 }
369 
372  corosync_cfg_handle_t cfg_handle)
373 {
374  struct cfg_inst *cfg_inst;
375  struct req_lib_cfg_ringreenable req_lib_cfg_ringreenable;
376  struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable;
377  cs_error_t error;
378  struct iovec iov;
379 
380  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle, (void *)&cfg_inst));
381  if (error != CS_OK) {
382  return (error);
383  }
384 
385  req_lib_cfg_ringreenable.header.size = sizeof (struct req_lib_cfg_ringreenable);
386  req_lib_cfg_ringreenable.header.id = MESSAGE_REQ_CFG_RINGREENABLE;
387 
388  iov.iov_base = (void *)&req_lib_cfg_ringreenable,
389  iov.iov_len = sizeof (struct req_lib_cfg_ringreenable);
390 
391  error = qb_to_cs_error (qb_ipcc_sendv_recv (cfg_inst->c,
392  &iov,
393  1,
394  &res_lib_cfg_ringreenable,
395  sizeof (struct res_lib_cfg_ringreenable), CS_IPC_TIMEOUT_MS));
396 
397  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
398 
399  return (error);
400 }
401 
404  corosync_cfg_handle_t cfg_handle,
405  unsigned int nodeid,
406  const char *reason)
407 {
408  struct cfg_inst *cfg_inst;
409  struct req_lib_cfg_killnode req_lib_cfg_killnode;
410  struct res_lib_cfg_killnode res_lib_cfg_killnode;
411  cs_error_t error;
412  struct iovec iov;
413 
414  if (strlen(reason) >= CS_MAX_NAME_LENGTH)
415  return CS_ERR_NAME_TOO_LONG;
416 
417  error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, cfg_handle,
418  (void *)&cfg_inst));
419  if (error != CS_OK) {
420  return (error);
421  }
422 
423  req_lib_cfg_killnode.header.id = MESSAGE_REQ_CFG_KILLNODE;
424  req_lib_cfg_killnode.header.size = sizeof (struct req_lib_cfg_killnode);
425  req_lib_cfg_killnode.nodeid = nodeid;
426  strcpy((char *)req_lib_cfg_killnode.reason.value, reason);
427  req_lib_cfg_killnode.reason.length = strlen(reason)+1;
428 
429  iov.iov_base = (void *)&req_lib_cfg_killnode;
430  iov.iov_len = sizeof (struct req_lib_cfg_killnode);
431 
432  error = qb_to_cs_error (qb_ipcc_sendv_recv (cfg_inst->c,
433  &iov,
434  1,
435  &res_lib_cfg_killnode,
436  sizeof (struct res_lib_cfg_killnode), CS_IPC_TIMEOUT_MS));
437 
438  error = res_lib_cfg_killnode.header.error;
439 
440  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
441 
442  return (error == CS_OK ? res_lib_cfg_killnode.header.error : error);
443 }
444 
447  corosync_cfg_handle_t cfg_handle,
449 {
450  struct cfg_inst *cfg_inst;
451  struct req_lib_cfg_tryshutdown req_lib_cfg_tryshutdown;
452  struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
453  cs_error_t error;
454  struct iovec iov;
455 
456  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle,
457  (void *)&cfg_inst));
458  if (error != CS_OK) {
459  return (error);
460  }
461 
462  req_lib_cfg_tryshutdown.header.id = MESSAGE_REQ_CFG_TRYSHUTDOWN;
463  req_lib_cfg_tryshutdown.header.size = sizeof (struct req_lib_cfg_tryshutdown);
464  req_lib_cfg_tryshutdown.flags = flags;
465 
466  iov.iov_base = (void *)&req_lib_cfg_tryshutdown;
467  iov.iov_len = sizeof (req_lib_cfg_tryshutdown);
468 
469  error = qb_to_cs_error (qb_ipcc_sendv_recv (cfg_inst->c,
470  &iov,
471  1,
472  &res_lib_cfg_tryshutdown,
473  sizeof (struct res_lib_cfg_tryshutdown), CS_IPC_TIMEOUT_MS));
474 
475  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
476 
477  return (error == CS_OK ? res_lib_cfg_tryshutdown.header.error : error);
478 }
479 
482  corosync_cfg_handle_t cfg_handle,
484 {
485  struct cfg_inst *cfg_inst;
486  struct req_lib_cfg_replytoshutdown req_lib_cfg_replytoshutdown;
487  struct res_lib_cfg_replytoshutdown res_lib_cfg_replytoshutdown;
488  struct iovec iov;
489  cs_error_t error;
490 
491  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle,
492  (void *)&cfg_inst));
493  if (error != CS_OK) {
494  return (error);
495  }
496 
497  req_lib_cfg_replytoshutdown.header.id = MESSAGE_REQ_CFG_REPLYTOSHUTDOWN;
498  req_lib_cfg_replytoshutdown.header.size = sizeof (struct req_lib_cfg_replytoshutdown);
499  req_lib_cfg_replytoshutdown.response = response;
500 
501  iov.iov_base = (void *)&req_lib_cfg_replytoshutdown;
502  iov.iov_len = sizeof (struct req_lib_cfg_replytoshutdown);
503 
504  error = qb_to_cs_error (qb_ipcc_sendv_recv (cfg_inst->c,
505  &iov,
506  1,
507  &res_lib_cfg_replytoshutdown,
508  sizeof (struct res_lib_cfg_replytoshutdown), CS_IPC_TIMEOUT_MS));
509 
510  return (error);
511 }
512 
514  corosync_cfg_handle_t cfg_handle,
515  unsigned int nodeid,
516  size_t max_addrs,
517  int *num_addrs,
519 {
520  cs_error_t error;
521  struct req_lib_cfg_get_node_addrs req_lib_cfg_get_node_addrs;
523  struct cfg_inst *cfg_inst;
524  int addrlen = 0;
525  int i;
526  struct iovec iov;
527  const char *addr_buf;
528  char response_buf[IPC_RESPONSE_SIZE];
529 
530  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle,
531  (void *)&cfg_inst));
532  if (error != CS_OK) {
533  return (error);
534  }
535 
536  req_lib_cfg_get_node_addrs.header.size = sizeof (req_lib_cfg_get_node_addrs);
537  req_lib_cfg_get_node_addrs.header.id = MESSAGE_REQ_CFG_GET_NODE_ADDRS;
538  req_lib_cfg_get_node_addrs.nodeid = nodeid;
539 
540  iov.iov_base = (char *)&req_lib_cfg_get_node_addrs;
541  iov.iov_len = sizeof (req_lib_cfg_get_node_addrs);
542 
543  error = qb_to_cs_error (qb_ipcc_sendv_recv (
544  cfg_inst->c,
545  &iov, 1,
546  response_buf, IPC_RESPONSE_SIZE, CS_IPC_TIMEOUT_MS));
547  res_lib_cfg_get_node_addrs = (struct res_lib_cfg_get_node_addrs *)response_buf;
548 
549  if (error != CS_OK) {
550  goto error_put;
551  }
552 
553  if (res_lib_cfg_get_node_addrs->family == AF_INET)
554  addrlen = sizeof(struct sockaddr_in);
555  if (res_lib_cfg_get_node_addrs->family == AF_INET6)
556  addrlen = sizeof(struct sockaddr_in6);
557 
558  for (i = 0, addr_buf = (char *)res_lib_cfg_get_node_addrs->addrs;
559  i < max_addrs && i<res_lib_cfg_get_node_addrs->num_addrs;
560  i++, addr_buf += TOTEMIP_ADDRLEN) {
561  struct sockaddr_in *in;
562  struct sockaddr_in6 *in6;
563 
564  addrs[i].address_length = addrlen;
565 
566  if (res_lib_cfg_get_node_addrs->family == AF_INET) {
567  in = (struct sockaddr_in *)addrs[i].address;
568  in->sin_family = AF_INET;
569  memcpy(&in->sin_addr, addr_buf, sizeof(struct in_addr));
570  }
571  if (res_lib_cfg_get_node_addrs->family == AF_INET6) {
572  in6 = (struct sockaddr_in6 *)addrs[i].address;
573  in6->sin6_family = AF_INET6;
574  memcpy(&in6->sin6_addr, addr_buf, sizeof(struct in6_addr));
575  }
576  }
577  *num_addrs = res_lib_cfg_get_node_addrs->num_addrs;
578  errno = error = res_lib_cfg_get_node_addrs->header.error;
579 
580 error_put:
581  hdb_handle_put (&cfg_hdb, cfg_handle);
582 
583  return (error);
584 }
585 
587  corosync_cfg_handle_t handle,
588  unsigned int *local_nodeid)
589 {
590  cs_error_t error;
591  struct cfg_inst *cfg_inst;
592  struct iovec iov;
593  struct req_lib_cfg_local_get req_lib_cfg_local_get;
594  struct res_lib_cfg_local_get res_lib_cfg_local_get;
595 
596  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, handle, (void *)&cfg_inst));
597  if (error != CS_OK) {
598  return (error);
599  }
600 
601  req_lib_cfg_local_get.header.size = sizeof (struct qb_ipc_request_header);
602  req_lib_cfg_local_get.header.id = MESSAGE_REQ_CFG_LOCAL_GET;
603 
604  iov.iov_base = (void *)&req_lib_cfg_local_get;
605  iov.iov_len = sizeof (struct req_lib_cfg_local_get);
606 
607  error = qb_to_cs_error (qb_ipcc_sendv_recv (
608  cfg_inst->c,
609  &iov,
610  1,
611  &res_lib_cfg_local_get,
612  sizeof (struct res_lib_cfg_local_get), CS_IPC_TIMEOUT_MS));
613 
614  if (error != CS_OK) {
615  goto error_exit;
616  }
617 
618  error = res_lib_cfg_local_get.header.error;
619 
620  *local_nodeid = res_lib_cfg_local_get.local_nodeid;
621 
622 error_exit:
623  (void)hdb_handle_put (&cfg_hdb, handle);
624 
625  return (error);
626 }
627 
629  corosync_cfg_handle_t handle)
630 {
631  cs_error_t error;
632  struct cfg_inst *cfg_inst;
633  struct iovec iov;
634  struct req_lib_cfg_reload_config req_lib_cfg_reload_config;
635  struct res_lib_cfg_reload_config res_lib_cfg_reload_config;
636 
637  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, handle, (void *)&cfg_inst));
638  if (error != CS_OK) {
639  return (error);
640  }
641 
642  req_lib_cfg_reload_config.header.size = sizeof (struct qb_ipc_request_header);
643  req_lib_cfg_reload_config.header.id = MESSAGE_REQ_CFG_RELOAD_CONFIG;
644 
645  iov.iov_base = (void *)&req_lib_cfg_reload_config;
646  iov.iov_len = sizeof (struct req_lib_cfg_reload_config);
647 
648  error = qb_to_cs_error (qb_ipcc_sendv_recv (
649  cfg_inst->c,
650  &iov,
651  1,
652  &res_lib_cfg_reload_config,
653  sizeof (struct res_lib_cfg_reload_config), CS_IPC_TIMEOUT_MS));
654 
655  if (error != CS_OK) {
656  goto error_exit;
657  }
658 
659  error = res_lib_cfg_reload_config.header.error;
660 
661 error_exit:
662  (void)hdb_handle_put (&cfg_hdb, handle);
663 
664  return (error);
665 }
qb_ipcc_connection_t * c
Definition: lib/cfg.c:66
cs_error_t corosync_cfg_kill_node(corosync_cfg_handle_t cfg_handle, unsigned int nodeid, const char *reason)
corosync_cfg_kill_node
Definition: lib/cfg.c:403
cs_error_t hdb_error_to_cs(int res)
The res_lib_cfg_replytoshutdown struct.
Definition: ipc_cfg.h:160
cs_error_t corosync_cfg_local_get(corosync_cfg_handle_t handle, unsigned int *local_nodeid)
corosync_cfg_local_get
Definition: lib/cfg.c:586
struct corosync_cfg_shutdown_callback_t
Definition: cfg.h:81
The res_lib_cfg_testshutdown struct.
Definition: ipc_cfg.h:167
cs_error_t corosync_cfg_ring_status_get(corosync_cfg_handle_t cfg_handle, char ***interface_names, char ***status, unsigned int *interface_count)
corosync_cfg_ring_status_get
Definition: lib/cfg.c:283
The req_lib_cfg_ringreenable struct.
Definition: ipc_cfg.h:107
cs_name_t comp_name
Definition: lib/cfg.c:68
cs_error_t corosync_cfg_fd_get(corosync_cfg_handle_t cfg_handle, int32_t *selection_fd)
corosync_cfg_fd_get
Definition: lib/cfg.c:126
cs_error_t corosync_cfg_initialize(corosync_cfg_handle_t *cfg_handle, const corosync_cfg_callbacks_t *cfg_callbacks)
corosync_cfg_initialize
Definition: lib/cfg.c:85
The res_lib_cfg_get_node_addrs struct.
Definition: ipc_cfg.h:183
corosync_cfg_callbacks_t callbacks
Definition: lib/cfg.c:67
A node address.
Definition: cfg.h:95
The req_lib_cfg_get_node_addrs struct.
Definition: ipc_cfg.h:175
corosync_cfg_shutdown_flags_t
Shutdown types.
Definition: cfg.h:46
cs_error_t corosync_cfg_reload_config(corosync_cfg_handle_t handle)
corosync_cfg_reload_config
Definition: lib/cfg.c:628
uint64_t corosync_cfg_handle_t
Definition: cfg.h:41
The req_lib_cfg_reload_config struct.
Definition: ipc_cfg.h:209
#define IPC_RESPONSE_SIZE
Definition: lib/util.h:50
cs_error_t corosync_cfg_finalize(corosync_cfg_handle_t cfg_handle)
corosync_cfg_finalize
Definition: lib/cfg.c:254
#define IPC_DISPATCH_SIZE
Definition: lib/util.h:51
The res_lib_cfg_local_get struct.
Definition: ipc_cfg.h:201
The res_lib_cfg_killnode struct.
Definition: ipc_cfg.h:130
cs_error_t corosync_cfg_replyto_shutdown(corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_reply_flags_t response)
corosync_cfg_replyto_shutdown
Definition: lib/cfg.c:481
corosync_cfg_shutdown_callback_t corosync_cfg_shutdown_callback
Definition: cfg.h:82
unsigned int num_addrs
Definition: ipc_cfg.h:186
unsigned int flags
Definition: ipc_cfg.h:169
The req_lib_cfg_tryshutdown struct.
Definition: ipc_cfg.h:137
cs_error_t corosync_cfg_get_node_addrs(corosync_cfg_handle_t cfg_handle, unsigned int nodeid, size_t max_addrs, int *num_addrs, corosync_cfg_node_address_t *addrs)
corosync_cfg_get_node_addrs
Definition: lib/cfg.c:513
cs_error_t corosync_cfg_dispatch(corosync_cfg_handle_t cfg_handle, cs_dispatch_flags_t dispatch_flags)
corosync_cfg_dispatch
Definition: lib/cfg.c:145
The res_lib_cfg_ringreenable struct.
Definition: ipc_cfg.h:114
int finalize
Definition: lib/cfg.c:70
uint32_t flags
#define IPC_REQUEST_SIZE
Definition: lib/util.h:49
cs_error_t
The cs_error_t enum.
Definition: corotypes.h:94
cs_dispatch_flags_t
The cs_dispatch_flags_t enum.
Definition: corotypes.h:80
The req_lib_cfg_replytoshutdown struct.
Definition: ipc_cfg.h:152
The res_lib_cfg_tryshutdown struct.
Definition: ipc_cfg.h:145
DECLARE_HDB_DATABASE(cfg_hdb, cfg_inst_free)
#define TOTEMIP_ADDRLEN
Definition: coroapi.h:86
corosync_cfg_shutdown_reply_flags_t
enum corosync_cfg_shutdown_reply_flags_t
Definition: cfg.h:66
The req_lib_cfg_ringstatusget struct.
Definition: ipc_cfg.h:90
cs_error_t corosync_cfg_try_shutdown(corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags)
corosync_cfg_try_shutdown
Definition: lib/cfg.c:446
unsigned int flags
Definition: ipc_cfg.h:139
#define CS_MAX_NAME_LENGTH
Definition: corotypes.h:55
The res_lib_cfg_ringstatusget struct.
Definition: ipc_cfg.h:97
The res_lib_cfg_reload_config struct.
Definition: ipc_cfg.h:216
int comp_registered
Definition: lib/cfg.c:69
cs_error_t corosync_cfg_ring_reenable(corosync_cfg_handle_t cfg_handle)
corosync_cfg_ring_reenable
Definition: lib/cfg.c:371
unsigned int nodeid
Definition: coroapi.h:75
#define CS_IPC_TIMEOUT_MS
Definition: corotypes.h:127
cs_error_t qb_to_cs_error(int result)
qb_to_cs_error
The req_lib_cfg_killnode struct.
Definition: ipc_cfg.h:121
The cs_name_t struct.
Definition: corotypes.h:62
The req_lib_cfg_local_get struct.
Definition: ipc_cfg.h:194