MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / parse_op_key

Function parse_op_key

lib/common/utils.c:705–774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

703}
704
705gboolean
706parse_op_key(const char *key, char **rsc_id, char **op_type, int *interval)
707{
708 char *notify = NULL;
709 char *mutable_key = NULL;
710 char *mutable_key_ptr = NULL;
711 int len = 0, offset = 0, ch = 0;
712
713 CRM_CHECK(key != NULL, return FALSE);
714
715 *interval = 0;
716 len = strlen(key);
717 offset = len - 1;
718
719 crm_trace("Source: %s", key);
720
721 while (offset > 0 && isdigit(key[offset])) {
722 int digits = len - offset;
723
724 ch = key[offset] - '0';
725 CRM_CHECK(ch < 10, return FALSE);
726 CRM_CHECK(ch >= 0, return FALSE);
727 while (digits > 1) {
728 digits--;
729 ch = ch * 10;
730 }
731 *interval += ch;
732 offset--;
733 }
734
735 crm_trace(" Interval: %d", *interval);
736 CRM_CHECK(key[offset] == '_', return FALSE);
737
738 mutable_key = strdup(key);
739 mutable_key_ptr = mutable_key_ptr;
740 mutable_key[offset] = 0;
741 offset--;
742
743 while (offset > 0 && key[offset] != '_') {
744 offset--;
745 }
746
747 CRM_CHECK(key[offset] == '_', free(mutable_key); return FALSE);
748
749 mutable_key_ptr = mutable_key + offset + 1;
750
751 crm_trace(" Action: %s", mutable_key_ptr);
752
753 *op_type = strdup(mutable_key_ptr);
754
755 mutable_key[offset] = 0;
756 offset--;
757
758 CRM_CHECK(mutable_key != mutable_key_ptr, free(mutable_key); return FALSE);
759
760 notify = strstr(mutable_key, "_post_notify");
761 if (notify && safe_str_eq(notify, "_post_notify")) {
762 notify[0] = 0;

Callers 6

handle_rsc_opFunction · 0.85
modify_configurationFunction · 0.85
find_actions_by_taskFunction · 0.85
rsc_order_firstFunction · 0.85
convert_non_atomic_uuidFunction · 0.85
update_failcountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected