Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c91c23d
Refactor: based: New based_messages.h
nrwahl2 Dec 22, 2025
bfc606c
Refactor: libcib: Return void from cib_read_config()
nrwahl2 Dec 22, 2025
b36d70b
Refactor: based: Best practices for cib_process_delete_absolute()
nrwahl2 Dec 22, 2025
61c4b11
Refactor: based: cib_server_process_diff -> based_process_apply_patch
nrwahl2 Dec 22, 2025
9ba8341
Refactor: based: Drop send_sync_request() argument
nrwahl2 Dec 22, 2025
095c0ca
Refactor: libcib: cib_process_diff -> cib__process_apply_patch
nrwahl2 Dec 22, 2025
1d653fd
Refactor: libcib: cib_process_bump() -> cib__process_bump()
nrwahl2 Dec 22, 2025
e480b19
Refactor: based: Rename cib_process_commit_transaction()
nrwahl2 Dec 22, 2025
53d38f4
Refactor: libcib: Stop using "cib_" prefix in static cib_file.c funcs
nrwahl2 Dec 22, 2025
0941b08
Refactor: libcib: Drop "cib_" from some internal cib_file.c symbols
nrwahl2 Dec 22, 2025
24d40bd
Refactor: libcib: Move commit_transact handler above functions table
nrwahl2 Dec 22, 2025
8cc43b4
Refactor: libcib: Don't use gboolean in cib_file.c
nrwahl2 Dec 22, 2025
619b017
Refactor: libcib: Move some static variable declarations to top of file
nrwahl2 Dec 22, 2025
f1890cd
Refactor: libcib: Drop CIB_SERIES_BZIP
nrwahl2 Dec 22, 2025
3a971fa
Refactor: libcib: cib_process_create() -> cib__process_create()
nrwahl2 Dec 22, 2025
448559d
Refactor: libcib: cib_process_delete() -> cib__process_delete()
nrwahl2 Dec 22, 2025
6e2d1b1
Refactor: libcib: Make cib_process_xpath() static
nrwahl2 Dec 22, 2025
0bf543e
Doc: various: Update a few copyright dates
nrwahl2 Dec 22, 2025
a2fc8d5
Refactor: libcib: cib_process_erase() -> cib__process_erase()
nrwahl2 Dec 22, 2025
65d66f5
Refactor: based: New based_process_is_primary()
nrwahl2 Dec 22, 2025
1117ed1
Refactor: libcib: cib_process_modify() -> cib__process_modify()
nrwahl2 Dec 22, 2025
b35965b
Refactor: based: cib_process_noop() -> based_process_noop()
nrwahl2 Dec 22, 2025
9bb0a91
Refactor: based: cib_process_ping() -> based_process_ping()
nrwahl2 Dec 22, 2025
e3f1fbb
Refactor: based: New based_process_primary()
nrwahl2 Dec 22, 2025
dc448f5
Refactor: libcib: cib_process_query() -> cib__process_query()
nrwahl2 Dec 22, 2025
1801167
Refactor: based: cib_process_replace_svr() -> based_process_replace()
nrwahl2 Dec 22, 2025
30e0a62
Refactor: based: cib_process_readwrite() -> based_process_secondary()
nrwahl2 Dec 22, 2025
0bbd2b5
Refactor: based: cib_process_shutdown_req() -> based_process_shutdown()
nrwahl2 Dec 22, 2025
15f0e4a
Refactor: libcib: cib__op_sync_{all,one} -> cib__op_sync_to_{all,one}
nrwahl2 Dec 22, 2025
0ea8461
Refactor: based: cib_process_sync() -> based_process_sync_to_all()
nrwahl2 Dec 22, 2025
13b023d
Refactor: based: cib_process_sync_one() -> based_process_sync_to_one()
nrwahl2 Dec 22, 2025
db3c0a7
Refactor: based: cib_process_upgrade_server() -> based_process_upgrade()
nrwahl2 Dec 22, 2025
30bea45
Refactor: based: cib_process_schemas() -> based_process_schemas()
nrwahl2 Dec 22, 2025
30457ad
Refactor: libcib: cib_process_replace() -> cib__process_replace()
nrwahl2 Dec 22, 2025
be9e788
Refactor: libcib: cib_process_upgrade() -> cib__process_upgrade()
nrwahl2 Dec 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions daemons/based/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ halibdir = $(CRM_DAEMON_DIR)
halib_PROGRAMS = pacemaker-based

noinst_HEADERS = based_io.h
noinst_HEADERS += based_messages.h
noinst_HEADERS += based_notify.h
noinst_HEADERS += based_operation.h
noinst_HEADERS += based_transaction.h
Expand Down
39 changes: 28 additions & 11 deletions daemons/based/based_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,34 @@ bool based_is_primary = false;

xmlNode *the_cib = NULL;

/*!
* \internal
* \brief Process a \c PCMK__CIB_REQUEST_ABS_DELETE
*
* \param[in] op Ignored
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up not getting around to Doxygen for others yet. Probably at some point.

* \param[in] options Ignored
* \param[in] section Ignored
* \param[in] req Ignored
* \param[in] input Ignored
* \param[in] existing_cib Ignored
* \param[in] result_cib Ignored
* \param[in] answer Ignored
*
* \return \c -EINVAL
*
* \note This is unimplemented and simply returns an error.
*/
int
based_process_abs_delete(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer)
{
/* @COMPAT Remove when PCMK__CIB_REQUEST_ABS_DELETE is removed. Note that
* external clients with Pacemaker versions < 3.0.0 can send it.
*/
return -EINVAL;
}

int
cib_process_shutdown_req(const char *op, int options, const char *section, xmlNode * req,
xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
Expand Down Expand Up @@ -351,17 +379,6 @@ cib_process_replace_svr(const char *op, int options, const char *section, xmlNod
return rc;
}

/* @COMPAT: Remove when PCMK__CIB_REQUEST_ABS_DELETE is removed
* (At least external client code <3.0.0 can send it)
*/
int
cib_process_delete_absolute(const char *op, int options, const char *section, xmlNode * req,
xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
xmlNode ** answer)
{
return -EINVAL;
}

static xmlNode *
cib_msg_copy(xmlNode *msg)
{
Expand Down
75 changes: 75 additions & 0 deletions daemons/based/based_messages.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright 2004-2025 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
* This source code is licensed under the GNU Lesser General Public License
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
*/

#ifndef BASED_MESSAGES__H
#define BASED_MESSAGES__H

#include <stdbool.h>

#include <libxml/tree.h> // xmlNode *

extern bool based_is_primary;
extern xmlNode *the_cib;

int based_process_abs_delete(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input,
xmlNode *existing_cib, xmlNode **result_cib,
xmlNode **answer);

int cib_process_shutdown_req(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input,
xmlNode *existing_cib, xmlNode **result_cib,
xmlNode **answer);

int cib_process_noop(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

int cib_process_ping(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

int cib_process_readwrite(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

int cib_process_replace_svr(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

int cib_server_process_diff(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

int cib_process_sync(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

int cib_process_sync_one(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

int cib_process_upgrade_server(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input,
xmlNode *existing_cib, xmlNode **result_cib,
xmlNode **answer);

int cib_process_commit_transaction(const char *op, int options,
const char *section, xmlNode *req,
xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

int cib_process_schemas(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

void send_sync_request(const char *host);
int sync_our_cib(xmlNode *request, bool all);

#endif // BASED_MESSAGES__H
2 changes: 1 addition & 1 deletion daemons/based/based_operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "pacemaker-based.h"

static const cib__op_fn_t op_functions[] = {
[cib__op_abs_delete] = cib_process_delete_absolute,
[cib__op_abs_delete] = based_process_abs_delete,
[cib__op_apply_patch] = cib_server_process_diff,
[cib__op_bump] = cib_process_bump,
[cib__op_commit_transact] = cib_process_commit_transaction,
Expand Down
47 changes: 1 addition & 46 deletions daemons/based/pacemaker-based.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <crm/common/internal.h> // pcmk__client_t

#include "based_io.h"
#include "based_messages.h"
#include "based_operation.h"
#include "based_notify.h"
#include "based_transaction.h"
Expand All @@ -36,9 +37,7 @@ enum cib_client_flags {
cib_notify_diff = (UINT64_C(1) << 4),
};

extern bool based_is_primary;
extern GHashTable *config_hash;
extern xmlNode *the_cib;

extern GMainLoop *mainloop;
extern pcmk_cluster_t *crm_cluster;
Expand All @@ -64,50 +63,6 @@ int cib_process_request(xmlNode *request, bool privileged,
void cib_shutdown(int nsig);
void terminate_cib(int exit_status);

int cib_process_shutdown_req(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input,
xmlNode *existing_cib, xmlNode **result_cib,
xmlNode **answer);
int cib_process_noop(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);
int cib_process_ping(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);
int cib_process_readwrite(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);
int cib_process_replace_svr(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);
int cib_server_process_diff(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);
int cib_process_sync(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);
int cib_process_sync_one(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);
int cib_process_delete_absolute(const char *op, int options,
const char *section, xmlNode *req,
xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);
int cib_process_upgrade_server(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input,
xmlNode *existing_cib, xmlNode **result_cib,
xmlNode **answer);
int cib_process_commit_transaction(const char *op, int options,
const char *section, xmlNode *req,
xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);
int cib_process_schemas(const char *op, int options, const char *section,
xmlNode *req, xmlNode *input, xmlNode *existing_cib,
xmlNode **result_cib, xmlNode **answer);

void send_sync_request(const char *host);
int sync_our_cib(xmlNode *request, bool all);

static inline const char *
cib_config_lookup(const char *opt)
{
Expand Down
2 changes: 1 addition & 1 deletion include/crm/cib/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ enum cib__op_type {
cib__op_schemas,
};

gboolean cib_read_config(GHashTable * options, xmlNode * current_cib);
void cib_read_config(GHashTable *options, xmlNode *current_cib);

typedef int (*cib__op_fn_t)(const char *, int, const char *, xmlNode *,
xmlNode *, xmlNode *, xmlNode **, xmlNode **);
Expand Down
6 changes: 2 additions & 4 deletions lib/cib/cib_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,14 +730,14 @@ cib_native_notify(gpointer data, gpointer user_data)
pcmk__trace("Callback invoked...");
}

gboolean
void
cib_read_config(GHashTable * options, xmlNode * current_cib)
{
xmlNode *config = NULL;
crm_time_t *now = NULL;

if (options == NULL || current_cib == NULL) {
return FALSE;
return;
}

now = crm_time_new(NULL);
Expand All @@ -758,8 +758,6 @@ cib_read_config(GHashTable * options, xmlNode * current_cib)
pcmk__validate_cluster_options(options);

crm_time_free(now);

return TRUE;
}

int
Expand Down