#ifndef LIBPMEMOBJ_MEMOPS_H
#define LIBPMEMOBJ_MEMOPS_H 1
#include <stddef.h>
#include <stdint.h>
#include "pmemops.h"
#include "redo.h"
#include "lane.h"
enum operation_type {
OPERATION_SET,
OPERATION_AND,
OPERATION_OR,
MAX_OPERATION_TYPE
};
struct operation_entry {
uint64_t *ptr;
uint64_t value;
enum operation_type type;
};
#define MAX_MEMOPS_ENTRIES REDO_NUM_ENTRIES
enum operation_entry_type {
ENTRY_PERSISTENT,
ENTRY_TRANSIENT,
MAX_OPERATION_ENTRY_TYPE
};
struct operation_context {
const void *base;
const struct redo_ctx *redo_ctx;
struct redo_log *redo;
const struct pmem_ops *p_ops;
size_t nentries[MAX_OPERATION_ENTRY_TYPE];
struct operation_entry
entries[MAX_OPERATION_ENTRY_TYPE][MAX_MEMOPS_ENTRIES];
};
void operation_init(struct operation_context *ctx, const void *base,
const struct redo_ctx *redo_ctx, struct redo_log *redo);
void operation_add_entry(struct operation_context *ctx,
void *ptr, uint64_t value, enum operation_type type);
void operation_add_typed_entry(struct operation_context *ctx,
void *ptr, uint64_t value,
enum operation_type type, enum operation_entry_type en_type);
void operation_process(struct operation_context *ctx);
#endif