Example #1
0
int fsif_update_factstore_entry(char         *name,
                                fsif_field_t *selist,
                                fsif_field_t *fldlist)
{
    OhmFact      *fact;
    fsif_field_t *fld;
    char          selb[256];
    char          valb[256];
    char         *selstr;
    char         *valstr;

    selstr = print_selector(selist, selb, sizeof(selb));

    if ((fact = find_entry(name, selist)) == NULL) {
        OHM_ERROR("resource: [%s] Failed to update '%s%s' entry: "
                  "no entry found", __FUNCTION__, name, selstr);
        return FALSE;
    }

    for (fld = fldlist;   fld->type != fldtype_invalid;   fld++) {
        set_field(fact, fld->type, fld->name, (void *)&fld->value);


        valstr = print_value(fld->type,(void *)&fld->value, valb,sizeof(valb));

        OHM_DEBUG(DBG_FS, "factstore entry update %s%s.%s = %s",
                  name, selstr, fld->name, valstr);
    }

    return TRUE;
}
Example #2
0
int fsif_delete_factstore_entry(char *name, fsif_field_t *selist)
{
    OhmFact *fact;
    char     selb[256];
    char    *selstr;
    int      success;

    selstr = print_selector(selist, selb, sizeof(selb));

    if ((fact = find_entry(name, selist)) == NULL) {
        OHM_ERROR("resource: [%s] Failed to delete '%s%s' entry: "
                  "no entry found", __FUNCTION__, name, selstr);
        success = FALSE;
    }
    else {
        ohm_fact_store_remove(fs, fact);

        g_object_unref(fact);

        OHM_DEBUG(DBG_FS, "factstore entry %s%s deleted", name, selstr);

        success = TRUE;
    }

    return success;
}
Example #3
0
File: u32.c Project: celebdor/libnl
static void u32_dump_details(struct rtnl_tc *tc, void *data,
			     struct nl_dump_params *p)
{
	struct rtnl_u32 *u = data;
	struct tc_u32_sel *s;

	if (!u)
		return;

	if (!(u->cu_mask & U32_ATTR_SELECTOR)) {
		nl_dump(p, "no-selector\n");
		return;
	}
	
	s = u->cu_selector->d_data;

	nl_dump(p, "nkeys %u ", s->nkeys);

	if (u->cu_mask & U32_ATTR_HASH)
		nl_dump(p, "ht key 0x%x hash 0x%u",
			TC_U32_USERHTID(u->cu_hash), TC_U32_HASH(u->cu_hash));

	if (u->cu_mask & U32_ATTR_LINK)
		nl_dump(p, "link %u ", u->cu_link);

	if (u->cu_mask & U32_ATTR_INDEV)
		nl_dump(p, "indev %s ", u->cu_indev);

	print_selector(p, s, u);
	nl_dump(p, "\n");
}
Example #4
0
static void u32_dump_details(struct rtnl_cls *cls, struct nl_dump_params *p)
{
	struct rtnl_u32 *u = rtnl_cls_data(cls);
	struct tc_u32_sel *s;

	if (!(u->cu_mask & U32_ATTR_SELECTOR)) {
		nl_dump(p, "no-selector\n");
		return;
	}
	
	s = u->cu_selector->d_data;

	nl_dump(p, "nkeys %u ", s->nkeys);

	if (u->cu_mask & U32_ATTR_HASH)
		nl_dump(p, "ht key 0x%x hash 0x%u",
			TC_U32_USERHTID(u->cu_hash), TC_U32_HASH(u->cu_hash));

	if (u->cu_mask & U32_ATTR_LINK)
		nl_dump(p, "link %u ", u->cu_link);

	if (u->cu_mask & U32_ATTR_INDEV)
		nl_dump(p, "indev %s ", u->cu_indev);

	print_selector(p, s, cls, u);
	nl_dump(p, "\n");

#if 0	
#define U32_ATTR_ACTION       0x040
#define U32_ATTR_POLICE       0x080

	struct nl_data   act;
	struct nl_data   police;
#endif
}
Example #5
0
void
print_selector(fz_css_selector *sel)
{
	if (sel->combine)
	{
putchar('(');
		print_selector(sel->left);
		if (sel->combine == ' ')
			printf(" ");
		else
			printf(" %c ", sel->combine);
		print_selector(sel->right);
putchar(')');
	}
	else if (sel->name)
		printf("%s", sel->name);
	else
		printf("*");
	if (sel->cond)
	{
		print_condition(sel->cond);
	}
}
Example #6
0
static void u32_dump_details(struct rtnl_tc *tc, void *data,
			     struct nl_dump_params *p)
{
	struct rtnl_u32 *u = data;
	struct tc_u32_sel *s = NULL;
	struct tc_u32_mark *m;

	if (!u)
		return;

	if (!(u->cu_mask & (U32_ATTR_SELECTOR & U32_ATTR_MARK))) {
		nl_dump(p, "no-selector no-mark\n");
		return;
	}

	if (!(u->cu_mask & U32_ATTR_SELECTOR)) {
		nl_dump(p, "no-selector");
	} else {
		s = u->cu_selector->d_data;
		nl_dump(p, "nkeys %u", s->nkeys);
	}

	if (!(u->cu_mask & U32_ATTR_MARK)) {
		nl_dump(p, " no-mark");
	} else {
		m = u->cu_mark->d_data;
		nl_dump(p, " mark 0x%u 0x%u", m->val, m->mask);
	}

	if (u->cu_mask & U32_ATTR_HASH)
		nl_dump(p, " ht key 0x%x hash 0x%u",
			TC_U32_USERHTID(u->cu_hash), TC_U32_HASH(u->cu_hash));

	if (u->cu_mask & U32_ATTR_LINK)
		nl_dump(p, " link %u", u->cu_link);

	if (u->cu_mask & U32_ATTR_INDEV)
		nl_dump(p, " indev %s", u->cu_indev);

	if (u->cu_mask & U32_ATTR_SELECTOR)
		print_selector(p, s, u);

	nl_dump(p, "\n");
}
Example #7
0
void
print_rule(fz_css_rule *rule)
{
	fz_css_selector *sel;
	fz_css_property *prop;

	for (sel = rule->selector; sel; sel = sel->next)
	{
		print_selector(sel);
		printf(" /* %d */", selector_specificity(sel, 0));
		if (sel->next)
			printf(", ");
	}

	printf("\n{\n");
	for (prop = rule->declaration; prop; prop = prop->next)
	{
		print_property(prop);
	}
	printf("}\n");
}