local-storage-model.h 1.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
/*
 * Copyright (C) 2013 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
 */

#ifndef __LS_MODEL__
#define __LS_MODEL__

#include <ross.h>

/*
 * lsm_event_t
 *   - events supported by the local storage model
 */
typedef enum lsm_event_e
{
    LSM_INIT = 0,
    LSM_WRITE_REQUEST = 1,
    LSM_READ_REQUEST = 2,
    LSM_WRITE_COMPLETION = 3,
    LSM_READ_COMPLETION = 4
} lsm_event_t;

/*
 * Prototypes
 */
void lsm_event_new_reverse(tw_lp *sender);

tw_lpid lsm_find_local_device(tw_lp *sender);

tw_event* lsm_event_new(const char* category,
                        tw_lpid  dest_gid,
                        uint64_t io_object,
                        int64_t  io_offset,
                        uint64_t io_size_bytes,
                        int      io_type,
                        size_t   message_bytes,
                        tw_lp   *sender,
                        tw_stime delay);

void* lsm_event_data(tw_event *event);

void lsm_init(void);

void lsm_send_init (tw_lpid gid, tw_lp *lp, char *name);

/*
 * Macros
 */
#define lsm_write_event_new(cat,gid,obj,off,sz,mb,s) \
  lsm_event_new((cat),(gid),(obj),(off),(sz),LSM_WRITE_REQUEST,(mb),(s),0.0)

#define lsm_read_event_new(cat,gid,obj,off,sz,mb,s) \
  lsm_event_new((cat),(gid),(obj),(off),(sz),LSM_READ_REQUEST,(mb),(s),0.0)

#define LSM_DEBUG 0

#endif

/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ft=c ts=8 sts=4 sw=4 expandtab
 */