1/** 2 * \file 3 * \brief 4 */ 5 6/* 7 * Copyright (c) 2008, 2009, 2010, ETH Zurich. 8 * All rights reserved. 9 * 10 * This file is distributed under the terms in the attached LICENSE file. 11 * If you do not find this file, copies can be found by writing to: 12 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15#ifndef LIBBARRELFISH_CORESET_H 16#define LIBBARRELFISH_CORESET_H 17 18#include <sys/cdefs.h> 19 20__BEGIN_DECLS 21 22typedef coreid_t coreset_token_t; 23 24#define CORESET_INIT_TOKEN 0 25 26struct coreset; 27 28/** 29 * \brief Function pointer used to call on every core in the coreset 30 * 31 * \param st User supplied state 32 * \param id The core id this is called for 33 * 34 * Refer to #coreset_iterate. 35 */ 36typedef errval_t (*coreset_iterator_fn)(void *st, coreid_t id); 37 38errval_t coreset_new(struct coreset **set); 39void coreset_destroy(struct coreset *set); 40errval_t coreset_add(struct coreset *set, coreid_t id); 41errval_t coreset_remove(struct coreset *set, coreid_t id); 42bool coreset_test(struct coreset *set, coreid_t id); 43errval_t coreset_get_next(struct coreset *set, coreset_token_t *token, 44 coreid_t *id); 45errval_t coreset_iterate(struct coreset *set, void *st, 46 coreset_iterator_fn func); 47 48errval_t coreset_to_coremask(struct coreset *set, coremask_t *mask); 49errval_t coreset_from_coremask(coremask_t mask, struct coreset **set); 50 51coreid_t coreset_count(struct coreset *set); 52 53__END_DECLS 54 55#endif 56