//
// Be aware: If you change those, adjust the trigger code in prolog as well!
-#define DIST_ON_SET (0x1) /*!< Trigger checked for set events. */
-#define DIST_ON_DEL (0x1 << 1) /*!< Trigger checked for del events. */
-#define DIST_ON_PUBLISH (0x1 << 5) /*!< Is Publish/Subscribe Event. */
-#define DIST_PERSIST (0x1 << 2) /*!< Trigger installed until it is removed. */
-#define DIST_ALWAYS_SET (0x1 << 3) /*!< Provided error is ignored (trigger
+#define OCT_ON_SET (0x1) /*!< Trigger checked for set events. */
+#define OCT_ON_DEL (0x1 << 1) /*!< Trigger checked for del events. */
+#define OCT_ON_PUBLISH (0x1 << 5) /*!< Is Publish/Subscribe Event. */
+#define OCT_PERSIST (0x1 << 2) /*!< Trigger installed until it is removed. */
+#define OCT_ALWAYS_SET (0x1 << 3) /*!< Provided error is ignored (trigger
is always installed). */
-#define DIST_REMOVED (0x1 << 4) /*!< Indicates that the trigger has been
+#define OCT_REMOVED (0x1 << 4) /*!< Indicates that the trigger has been
removed. Cleaning up any state for
this trigger is safe in case this
flag is set. */
octopus_trigger_id_t tid;
size_t current_barriers = 0;
octopus_trigger_t t = oct_mktrigger(OCT_ERR_NO_RECORD, octopus_BINDING_RPC,
- DIST_ON_SET, NULL, NULL);
+ OCT_ON_SET, NULL, NULL);
err = oct_set_get(SET_SEQUENTIAL, barrier_record,
"%s_ { barrier: '%s' }", name, name);
// Wait until barrier record is created
err = cl->recv.trigger(cl, &tid, &fn, &mode, &record, &state);
free(record);
- assert(mode & DIST_REMOVED);
+ assert(mode & OCT_REMOVED);
err = SYS_ERR_OK;
}
uint64_t fn = 0;
octopus_trigger_id_t tid;
octopus_trigger_t t = oct_mktrigger(SYS_ERR_OK, octopus_BINDING_RPC,
- DIST_ON_DEL, NULL, NULL);
+ OCT_ON_DEL, NULL, NULL);
//debug_printf("leaving: %s\n", barrier_record);
err = oct_read(barrier_record, "%s { barrier: %s }", &rec_name,
if (err_is_ok(err)) {
// Wait until everyone has left the barrier
err = cl->recv.trigger(cl, &tid, &fn, &mode, &record, &state);
- assert(mode & DIST_REMOVED);
+ assert(mode & OCT_REMOVED);
}
else if (err_no(err) == OCT_ERR_NO_RECORD) {
// barrier already deleted
// as expected right now
// TODO: Barrier/Lock code calls this a number of times because
// we currently use the existing getset API there
-#define DIST_LOCK_BINDING(cl) event_mutex_threaded_lock(&(cl)->b->mutex)
-#define DIST_UNLOCK_BINDING(cl) event_mutex_unlock(&(cl)->b->mutex)
+#define OCT_LOCK_BINDING(cl) event_mutex_threaded_lock(&(cl)->b->mutex)
+#define OCT_UNLOCK_BINDING(cl) event_mutex_unlock(&(cl)->b->mutex)
// Make sure args come right after query
uint64_t state = 0;
uint64_t fn = 0;
octopus_trigger_id_t tid;
- octopus_trigger_t t = oct_mktrigger(SYS_ERR_OK, DIST_ON_DEL,
+ octopus_trigger_t t = oct_mktrigger(SYS_ERR_OK, OCT_ON_DEL,
octopus_BINDING_RPC, NULL, NULL);
err = oct_set_get(SET_SEQUENTIAL, lock_record, "%s_ { lock: '%s' }",
err = cl->recv.trigger(cl, &tid, &fn, &mode, &record, &state);
assert(err_is_ok(err));
free(record);
- assert(mode & DIST_REMOVED);
+ assert(mode & OCT_REMOVED);
}
else if (err_no(exist_err) != OCT_ERR_NO_RECORD) {
err = exist_err;
return LIB_ERR_NAMESERVICE_NOT_BOUND;
}
- octopus_trigger_t t = oct_mktrigger(OCT_ERR_NO_RECORD, DIST_ON_SET, 0, 0);
+ octopus_trigger_t t = oct_mktrigger(OCT_ERR_NO_RECORD, OCT_ON_SET, 0, 0);
err = cl->call_seq.get(cl, iface, &record, t, &error_code);
if (err_is_ok(err)) {
err = error_code;
char* result = NULL;
octopus_trigger_id_t tid;
octopus_trigger_t t = oct_mktrigger(OCT_ERR_NO_RECORD,
- octopus_BINDING_RPC, DIST_ON_SET, NULL, NULL);
+ octopus_BINDING_RPC, OCT_ON_SET, NULL, NULL);
struct octopus_thc_client_binding_t* cl = oct_get_thc_client();
char query[100];
*
* In any case a valid watch id is specified this
* causes a trigger event to be sent with the
- * DIST_REMOVED flag set. After this event it's safe
+ * OCT_REMOVED flag set. After this event it's safe
* to clean up any memory associated with the event handler.
*
* \param trigger_id ID of trigger we want to remove
{
return trigger.m > 0 &&
(trigger.in_case == err_no(error) ||
- (trigger.m & DIST_ALWAYS_SET) != 0 );
+ (trigger.m & OCT_ALWAYS_SET) != 0 );
}
static inline uint64_t install_trigger(struct octopus_binding* binding,
if (err_no(err) == OCT_ERR_NO_RECORD) {
debug_printf("waiting for: %s\n", query);
uint64_t wid;
- set_watch_err = set_watch(b, ast, DIST_ON_SET, drs, &wid);
+ set_watch_err = set_watch(b, ast, OCT_ON_SET, drs, &wid);
}
}
subscriber->client_handler = client_handler;
subscriber->client_state = client_state;
subscriber->server_id = server_id;
- subscriber->mode = DIST_REMOVED;
+ subscriber->mode = OCT_REMOVED;
OCT_DEBUG("publish msg to: recipient:%lu id:%lu\n", binding, server_id);
subscriber->reply(subscriber->binding, subscriber);
strcpy(subscriber->query_state.stdout.buffer, record);
subscriber->client_state = client_state;
subscriber->server_id = server_id;
- subscriber->mode = DIST_ON_PUBLISH;
+ subscriber->mode = OCT_ON_PUBLISH;
OCT_DEBUG("publish msg to: recipient:%lu id:%lu\n", binding, server_id);
subscriber->reply(subscriber->binding, subscriber);
switch (err_no(err)) {
case SYS_ERR_OK:
- event_handler(DIST_ON_SET, record, state);
+ event_handler(OCT_ON_SET, record, state);
break;
case OCT_ERR_NO_RECORD:
#include "queue.h"
#include "debug.h"
-#define TRIGGER_ALWAYS (DIST_PERSIST | DIST_ON_SET | DIST_ON_DEL | DIST_ALWAYS_SET)
+#define TRIGGER_ALWAYS (OCT_PERSIST | OCT_ON_SET | OCT_ON_DEL | OCT_ALWAYS_SET)
#define BSP_CORE_ID 0
extern coreid_t my_core_id;
static void cpu_change_event(octopus_mode_t mode, char* record, void* state)
{
- if (mode & DIST_ON_SET) {
+ if (mode & OCT_ON_SET) {
KALUGA_DEBUG("CPU found: %s\n", record);
uint64_t cpu_id, arch_id, enabled = 0;
}
}
- if (mode & DIST_ON_DEL) {
+ if (mode & OCT_ON_DEL) {
KALUGA_DEBUG("CPU removed: %s\n", record);
assert(!"NYI");
}
out:
- assert(!(mode & DIST_REMOVED));
+ assert(!(mode & OCT_REMOVED));
free(record);
}
static void ioapic_change_event(octopus_mode_t mode, char* record, void* state)
{
- if (mode & DIST_ON_SET) {
+ if (mode & OCT_ON_SET) {
struct module_info* mi = find_module("ioapic");
if (mi != NULL) {
// Pass apic id as 1st argument
}
}
}
- else if (mode & DIST_ON_DEL) {
+ else if (mode & OCT_ON_DEL) {
KALUGA_DEBUG("Removed I/O APIC?");
assert(!"NYI");
}
static void spawnd_up_event(octopus_mode_t mode, char* spawnd_record, void* st)
{
- assert(mode & DIST_ON_SET);
+ assert(mode & OCT_ON_SET);
uint64_t iref;
errval_t err = oct_read(spawnd_record, "_ { iref: %d }", &iref);
if (err_is_fail(err)) {
// Pass the iref as state, this tells pci_change_event that we
// don't need to look again for the spawnd iref
- pci_change_event(DIST_ON_SET, st, (void*)iref);
+ pci_change_event(OCT_ON_SET, st, (void*)iref);
free(spawnd_record);
}
octopus_trigger_id_t tid;
errval_t error_code;
octopus_trigger_t t = oct_mktrigger(OCT_ERR_NO_RECORD,
- octopus_BINDING_EVENT, DIST_ON_SET, spawnd_up_event, state);
+ octopus_BINDING_EVENT, OCT_ON_SET, spawnd_up_event, state);
// Construct service name
static char* format = "spawn.%hhu { iref: _ }";
static void pci_change_event(octopus_mode_t mode, char* device_record, void* st)
{
errval_t err;
- if (mode & DIST_ON_SET) {
+ if (mode & OCT_ON_SET) {
uint64_t vendor_id, device_id;
err = oct_read(device_record, "_ { vendor: %d, device_id: %d }",
&vendor_id, &device_id);
static void bridge_change_event(octopus_mode_t mode, char* bridge_record, void* st)
{
- if (mode & DIST_ON_SET) {
+ if (mode & OCT_ON_SET) {
// No need to ask the SKB as we always start pci for
// in case we find a root bridge
struct module_info* mi = find_module("pci");
if (res != PSUCCEED) {
assert(ec_is_var(ec_arg(1)) == PSUCCEED);
// record will be null
- // can happen in case we send DIST_REMOVED
+ // can happen in case we send OCT_REMOVED
}
// Action that triggered the event
drs->error = SYS_ERR_OK;
- bool retract = !(watch_mode & DIST_PERSIST);
+ bool retract = !(watch_mode & OCT_PERSIST);
if (record != NULL) {
assert(strlen(record)+1 < MAX_QUERY_LENGTH);
strcpy(drs->query_state.stdout.buffer, record);
bitfield_off(trigger_ids, watch_id);
}
- drs->mode = (retract) ? (action | DIST_REMOVED) : action;
+ drs->mode = (retract) ? (action | OCT_REMOVED) : action;
if (drs->binding->st != NULL) {
oct_rpc_enqueue_reply(drs->binding, drs);
remove_watch(Binding, Id) :-
store_get(trigger, Id, subscription(_, _, subscriber(Binding, Id, ReplyState, Mode))),
delete_subscription(trigger, Id, Binding),
- trigger_watch(_, 16, 0, ReplyState, Id, _). % 16 is DIST_REMOVED
+ trigger_watch(_, 16, 0, ReplyState, Id, _). % 16 is OCT_REMOVED
%
% Output
{
size_t* received = (size_t*) st;
- if (mode & DIST_ON_PUBLISH) {
+ if (mode & OCT_ON_PUBLISH) {
static const char* receive_order[] =
{ "msg_2", "msg_4", "msg_5", "msg_5", "msg_6", "msg_7" };
char* name = NULL;
free(name);
free(record);
}
- else if (mode & DIST_REMOVED) {
- debug_printf("DIST_REMOVED set...\n");
+ else if (mode & OCT_REMOVED) {
+ debug_printf("OCT_REMOVED set...\n");
}
(*received)++;
*received = *received + 1;
debug_printf("trigger_handler got: %s\n", record);
- assert(m & DIST_ON_DEL);
- assert(m & DIST_REMOVED);
+ assert(m & OCT_ON_DEL);
+ assert(m & OCT_REMOVED);
free(record);
}
size_t* received = (size_t*) state;
*received = *received + 1;
- if (m & DIST_ON_SET) {
+ if (m & OCT_ON_SET) {
debug_printf("persistent_trigger ON SET: %s\n", record);
}
- if (m & DIST_ON_DEL) {
+ if (m & OCT_ON_DEL) {
debug_printf("persistent_trigger ON DEL: %s\n", record);
}
- if (m & DIST_REMOVED) {
+ if (m & OCT_REMOVED) {
debug_printf("persistent trigger CLEANUP: %s\n", record);
assert(record == NULL);
}
struct octopus_thc_client_binding_t* c = oct_get_thc_client();
octopus_trigger_t record_deleted = oct_mktrigger(SYS_ERR_OK,
- octopus_BINDING_EVENT, DIST_ON_DEL, trigger_handler, &received);
+ octopus_BINDING_EVENT, OCT_ON_DEL, trigger_handler, &received);
errval_t error_code = SYS_ERR_OK;
char* output = NULL;
received = 0;
tid = 0;
- octopus_mode_t m = DIST_ON_SET | DIST_ON_DEL | DIST_PERSIST;
+ octopus_mode_t m = OCT_ON_SET | OCT_ON_DEL | OCT_PERSIST;
octopus_trigger_t ptrigger = oct_mktrigger(SYS_ERR_OK,
octopus_BINDING_EVENT, m, persistent_trigger, &received);
output = NULL;